Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 26 /// \file G4FieldSetup.h 27 /// \brief Definition of the G4FieldSetup clas 28 /// 29 /// This code was initially developed in Geant 30 /// (https://github.com/vmc-project) 31 /// and adapted to Geant4. 32 /// 33 /// \author I. Hrivnacova; IJCLab, Orsay 34 35 #ifndef G4FIELDSETUP_HH 36 #define G4FIELDSETUP_HH 37 38 #include "G4FieldParameters.hh" 39 #include "globals.hh" 40 41 class G4Field; 42 class G4FieldParameters; 43 class G4FieldSetupMessenger; 44 45 class G4ChordFinder; 46 class G4EquationOfMotion; 47 class G4FieldManager; 48 class G4MagIntegratorStepper; 49 class G4LogicalVolume; 50 class G4VIntegrationDriver; 51 52 class TVirtualMagField; 53 54 /// \ingroup geometry 55 /// \brief The class for constructing magnetic 56 /// fields which strength is defined via G4Fie 57 /// 58 /// The equation of motion of a particle in a 59 /// integration method is set according to the 60 /// G4FieldParameters, as well as other accura 61 /// The default values in G4FieldParameters co 62 /// set in Geant4 (taken from Geant4 9.3 relea 63 /// As Geant4 classes to not provide access me 64 /// the defaults have to be checked with each 65 /// TO DO: unify defaults in G4 classes and G4 66 /// 67 /// \author I. Hrivnacova; IJClab, Orsay 68 69 class G4FieldSetup 70 { 71 public: 72 /// Standard constructor 73 G4FieldSetup(const G4FieldParameters& parame 74 G4LogicalVolume* lv = nullptr); 75 /// Destructor 76 ~G4FieldSetup(); 77 78 // Methods 79 80 /// Clear previously created setup 81 void Clear(); 82 /// Update field setup with new field parame 83 void Update(); 84 /// Print information 85 void PrintInfo(G4int verboseLevel, const G4S 86 87 // Set methods 88 89 /// Set G4 field 90 void SetG4Field(G4Field* field); 91 92 // Access to field setting 93 94 /// Return the instantiated field 95 G4Field* GetG4Field() const; 96 /// Return the logical vol;ume 97 G4LogicalVolume* GetLogicalVolume() const; 98 /// Return the equation of motion 99 G4EquationOfMotion* GetEquation() const; 100 /// Return the magnetic integrator stepper 101 G4MagIntegratorStepper* GetStepper() const; 102 /// Return the magnetic integrator driver 103 G4VIntegrationDriver* GetIntegrationDriver() 104 105 private: 106 /// Not implemented 107 G4FieldSetup() = delete; 108 /// Not implemented 109 G4FieldSetup(const G4FieldSetup& right) = de 110 /// Not implemented 111 G4FieldSetup& operator=(const G4FieldSetup& 112 113 // Methods 114 115 // Create cached magnetic field if const dis 116 // and field is of G4MagneticField. 117 // Return the input field otherwise. 118 G4Field* CreateCachedField( 119 const G4FieldParameters& parameters, G4Fie 120 121 /// Set the equation of motion of a particle 122 G4EquationOfMotion* CreateEquation(G4Equatio 123 124 /// Set the integrator of particle's equatio 125 G4MagIntegratorStepper* CreateStepper( 126 G4EquationOfMotion* equation, G4StepperTyp 127 128 /// Set the FSAL integrator of particle's eq 129 G4VIntegrationDriver* CreateFSALStepperAndDr 130 G4EquationOfMotion* equation, G4StepperTyp 131 132 // methods to update field setup step by ste 133 /// Create cached field (if ConstDistance is 134 void CreateCachedField(); 135 /// Create cached field (if ConstDistance is 136 void CreateStepper(); 137 /// Create chord finder 138 void CreateChordFinder(); 139 /// Update field manager 140 void UpdateFieldManager(); 141 142 // Data members 143 144 /// Messenger for this class 145 G4FieldSetupMessenger* fMessenger = nullptr; 146 /// Parameters 147 const G4FieldParameters& fParameters; 148 /// Geant4 field manager 149 G4FieldManager* fFieldManager = nullptr; 150 /// Geant4 field 151 G4Field* fG4Field = nullptr; 152 /// The associated ROOT volume (if local fie 153 G4LogicalVolume* fLogicalVolume = nullptr; 154 /// The equation of motion 155 G4EquationOfMotion* fEquation = nullptr; 156 /// The magnetic integrator stepper 157 G4MagIntegratorStepper* fStepper = nullptr; 158 /// The magnetic integrator driver 159 G4VIntegrationDriver* fDriver = nullptr; 160 /// Chord finder 161 G4ChordFinder* fChordFinder = nullptr; 162 }; 163 164 // inline functions 165 166 inline void G4FieldSetup::SetG4Field(G4Field* 167 { 168 // Set G4 field 169 fG4Field = field; 170 } 171 172 inline G4Field* G4FieldSetup::GetG4Field() con 173 { 174 // Return the instantiated field 175 return fG4Field; 176 } 177 178 inline G4LogicalVolume* G4FieldSetup::GetLogic 179 { 180 // Return the logical vol;ume 181 return fLogicalVolume; 182 } 183 184 inline G4EquationOfMotion* G4FieldSetup::GetEq 185 { 186 // Return the equation of motion 187 return fEquation; 188 } 189 190 inline G4MagIntegratorStepper* G4FieldSetup::G 191 { 192 // Return the magnetic integrator stepper 193 return fStepper; 194 } 195 196 #endif // G4FIELDSETUP_HH 197