00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // 00028 // 00029 00030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 00031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... 00032 00033 #ifndef MyGlobalField_h 00034 #define MyGlobalField_h 1 00035 00036 #include <vector> 00037 00038 #include "G4FieldManager.hh" 00039 #include "G4PropagatorInField.hh" 00040 #include "G4MagIntegratorStepper.hh" 00041 #include "G4ChordFinder.hh" 00042 00043 #include "G4MagneticField.hh" 00044 #include "G4ElectroMagneticField.hh" 00045 00046 #include "G4Mag_EqRhs.hh" 00047 #include "G4Mag_SpinEqRhs.hh" 00048 00049 #include "G4EqMagElectricField.hh" 00050 #include "G4EqEMFieldWithSpin.hh" 00051 00052 #include "MyGlobalFieldMessenger.hh" 00053 #include "MyElementField.hh" 00054 00055 // MyGlobalField - handles the global ElectroMagnetic field 00056 // 00057 // There is a single G04GlobalField object. 00058 // 00059 // The field from each individual beamline element is given by a 00060 // ElementField object. Any number of overlapping ElementField 00061 // objects can be added to the global field. Any element that 00062 // represents an element with an EM field must add the appropriate 00063 // ElementField to the global GlobalField object. 00064 00065 typedef std::vector<MyElementField*> FieldList; 00066 00067 class MyGlobalField : public G4ElectroMagneticField { 00068 //class MyGlobalField : public G4MagneticField { 00069 00070 private: 00071 00072 MyGlobalField(); 00073 MyGlobalField(const MyGlobalField&); 00074 00075 ~MyGlobalField(); 00076 00077 MyGlobalField& operator=(const MyGlobalField&); 00078 00079 void setupArray(); 00080 00081 public: 00082 00085 static MyGlobalField* getObject(); 00086 00090 void GetFieldValue(const G4double* point, G4double* field) const; 00091 00093 G4bool DoesFieldChangeEnergy() const { return true; } 00094 00097 void addElementField(MyElementField* f) { if (fields) fields->push_back(f); } 00098 00102 void clear(); 00103 00105 void updateField(); 00106 00108 void SetStepperType( G4int i ) { fStepperType = i; } 00109 00111 void SetStepper(); 00112 00114 void SetMinStep(G4double s) { minStep = s; } 00115 00117 void SetDeltaChord(G4double s) { deltaChord = s; } 00118 00120 void SetDeltaOneStep(G4double s) { deltaOneStep = s; } 00121 00123 void SetDeltaIntersection(G4double s) { deltaIntersection = s; } 00124 00126 void SetEpsMin(G4double s) { epsMin = s; } 00127 00129 void SetEpsMax(G4double s) { epsMax = s; } 00130 00132 FieldList* getFields() { return fields; } 00133 00134 protected: 00135 00137 G4FieldManager* GetGlobalFieldManager(); 00138 00139 private: 00140 00141 static MyGlobalField* object; 00142 00143 G4int nfp; 00144 G4bool first; 00145 00146 FieldList* fields; 00147 00148 const MyElementField **fp; 00149 00150 private: 00151 00152 G4int fStepperType; 00153 00154 G4double minStep; 00155 G4double deltaChord; 00156 G4double deltaOneStep; 00157 G4double deltaIntersection; 00158 G4double epsMin; 00159 G4double epsMax; 00160 00161 // G4Mag_EqRhs* fEquation; 00162 // G4Mag_SpinEqRhs* fEquation; 00163 00164 // G4EqMagElectricField* fEquation; 00165 G4EqEMFieldWithSpin* fEquation; 00166 00167 G4FieldManager* fFieldManager; 00168 G4PropagatorInField* fFieldPropagator; 00169 G4MagIntegratorStepper* fStepper; 00170 G4ChordFinder* fChordFinder; 00171 00172 MyGlobalFieldMessenger* fGlobalFieldMessenger; 00173 00174 }; 00175 #endif