![]() |
|
|||
File indexing completed on 2025-08-02 08:28:37
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 0026 /// \file G4FieldSetup.h 0027 /// \brief Definition of the G4FieldSetup class 0028 /// 0029 /// This code was initially developed in Geant4 VMC package 0030 /// (https://github.com/vmc-project) 0031 /// and adapted to Geant4. 0032 /// 0033 /// \author I. Hrivnacova; IJCLab, Orsay 0034 0035 #ifndef G4FIELDSETUP_HH 0036 #define G4FIELDSETUP_HH 0037 0038 #include "G4FieldParameters.hh" 0039 #include "globals.hh" 0040 0041 class G4Field; 0042 class G4FieldParameters; 0043 class G4FieldSetupMessenger; 0044 0045 class G4ChordFinder; 0046 class G4EquationOfMotion; 0047 class G4FieldManager; 0048 class G4MagIntegratorStepper; 0049 class G4LogicalVolume; 0050 class G4VIntegrationDriver; 0051 0052 class TVirtualMagField; 0053 0054 /// \ingroup geometry 0055 /// \brief The class for constructing magnetic, electromagnetic and gravity 0056 /// fields which strength is defined via G4Field. 0057 /// 0058 /// The equation of motion of a particle in a field and the 0059 /// integration method is set according to the selection in 0060 /// G4FieldParameters, as well as other accuracy parameters. 0061 /// The default values in G4FieldParameters correspond to defaults 0062 /// set in Geant4 (taken from Geant4 9.3 release.) 0063 /// As Geant4 classes to not provide access methods for these defaults, 0064 /// the defaults have to be checked with each new Geant4 release. 0065 /// TO DO: unify defaults in G4 classes and G4 parameters 0066 /// 0067 /// \author I. Hrivnacova; IJClab, Orsay 0068 0069 class G4FieldSetup 0070 { 0071 public: 0072 /// Standard constructor 0073 G4FieldSetup(const G4FieldParameters& parameters, G4Field* field, 0074 G4LogicalVolume* lv = nullptr); 0075 /// Destructor 0076 ~G4FieldSetup(); 0077 0078 // Methods 0079 0080 /// Clear previously created setup 0081 void Clear(); 0082 /// Update field setup with new field parameters 0083 void Update(); 0084 /// Print information 0085 void PrintInfo(G4int verboseLevel, const G4String about = "created"); 0086 0087 // Set methods 0088 0089 /// Set G4 field 0090 void SetG4Field(G4Field* field); 0091 0092 // Access to field setting 0093 0094 /// Return the instantiated field 0095 G4Field* GetG4Field() const; 0096 /// Return the logical vol;ume 0097 G4LogicalVolume* GetLogicalVolume() const; 0098 /// Return the equation of motion 0099 G4EquationOfMotion* GetEquation() const; 0100 /// Return the magnetic integrator stepper 0101 G4MagIntegratorStepper* GetStepper() const; 0102 /// Return the magnetic integrator driver 0103 G4VIntegrationDriver* GetIntegrationDriver() const; 0104 0105 private: 0106 /// Not implemented 0107 G4FieldSetup() = delete; 0108 /// Not implemented 0109 G4FieldSetup(const G4FieldSetup& right) = delete; 0110 /// Not implemented 0111 G4FieldSetup& operator=(const G4FieldSetup& right) = delete; 0112 0113 // Methods 0114 0115 // Create cached magnetic field if const distance is set > 0. 0116 // and field is of G4MagneticField. 0117 // Return the input field otherwise. 0118 G4Field* CreateCachedField( 0119 const G4FieldParameters& parameters, G4Field* field); 0120 0121 /// Set the equation of motion of a particle in a field 0122 G4EquationOfMotion* CreateEquation(G4EquationType equation); 0123 0124 /// Set the integrator of particle's equation of motion 0125 G4MagIntegratorStepper* CreateStepper( 0126 G4EquationOfMotion* equation, G4StepperType stepper); 0127 0128 /// Set the FSAL integrator of particle's equation of motion 0129 G4VIntegrationDriver* CreateFSALStepperAndDriver( 0130 G4EquationOfMotion* equation, G4StepperType stepper, G4double minStep); 0131 0132 // methods to update field setup step by step 0133 /// Create cached field (if ConstDistance is set) 0134 void CreateCachedField(); 0135 /// Create cached field (if ConstDistance is set) 0136 void CreateStepper(); 0137 /// Create chord finder 0138 void CreateChordFinder(); 0139 /// Update field manager 0140 void UpdateFieldManager(); 0141 0142 // Data members 0143 0144 /// Messenger for this class 0145 G4FieldSetupMessenger* fMessenger = nullptr; 0146 /// Parameters 0147 const G4FieldParameters& fParameters; 0148 /// Geant4 field manager 0149 G4FieldManager* fFieldManager = nullptr; 0150 /// Geant4 field 0151 G4Field* fG4Field = nullptr; 0152 /// The associated ROOT volume (if local field) 0153 G4LogicalVolume* fLogicalVolume = nullptr; 0154 /// The equation of motion 0155 G4EquationOfMotion* fEquation = nullptr; 0156 /// The magnetic integrator stepper 0157 G4MagIntegratorStepper* fStepper = nullptr; 0158 /// The magnetic integrator driver 0159 G4VIntegrationDriver* fDriver = nullptr; 0160 /// Chord finder 0161 G4ChordFinder* fChordFinder = nullptr; 0162 }; 0163 0164 // inline functions 0165 0166 inline void G4FieldSetup::SetG4Field(G4Field* field) 0167 { 0168 // Set G4 field 0169 fG4Field = field; 0170 } 0171 0172 inline G4Field* G4FieldSetup::GetG4Field() const 0173 { 0174 // Return the instantiated field 0175 return fG4Field; 0176 } 0177 0178 inline G4LogicalVolume* G4FieldSetup::GetLogicalVolume() const 0179 { 0180 // Return the logical vol;ume 0181 return fLogicalVolume; 0182 } 0183 0184 inline G4EquationOfMotion* G4FieldSetup::GetEquation() const 0185 { 0186 // Return the equation of motion 0187 return fEquation; 0188 } 0189 0190 inline G4MagIntegratorStepper* G4FieldSetup::GetStepper() const 0191 { 0192 // Return the magnetic integrator stepper 0193 return fStepper; 0194 } 0195 0196 #endif // G4FIELDSETUP_HH
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |