![]() |
|
|||
File indexing completed on 2025-02-23 09:21:17
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 // 0027 /// \file field/field04/include/F04GlobalField.hh 0028 /// \brief Definition of the F04GlobalField class 0029 // 0030 0031 #ifndef F04GlobalField_h 0032 #define F04GlobalField_h 1 0033 0034 #include "F04DetectorConstruction.hh" 0035 #include "F04ElementField.hh" 0036 #include "F04FieldMessenger.hh" 0037 0038 #include "G4ChordFinder.hh" 0039 #include "G4ElectroMagneticField.hh" 0040 #include "G4EqEMFieldWithSpin.hh" 0041 #include "G4EqMagElectricField.hh" 0042 #include "G4FieldManager.hh" 0043 #include "G4MagIntegratorStepper.hh" 0044 #include "G4Mag_EqRhs.hh" 0045 #include "G4Mag_SpinEqRhs.hh" 0046 #include "G4MagneticField.hh" 0047 #include "G4PropagatorInField.hh" 0048 0049 #include <vector> 0050 0051 // F04GlobalField - handles the global ElectroMagnetic field 0052 // 0053 // There is a single G04GlobalField object. 0054 // 0055 // The field from each individual beamline element is given by a 0056 // ElementField object. Any number of overlapping ElementField 0057 // objects can be added to the global field. Any element that 0058 // represents an element with an EM field must add the appropriate 0059 // ElementField to the global GlobalField object. 0060 0061 using FieldList = std::vector<F04ElementField*>; 0062 0063 class F04GlobalField : public G4ElectroMagneticField 0064 { 0065 // class F04GlobalField : public G4MagneticField { 0066 0067 private: 0068 F04GlobalField(F04DetectorConstruction* const); 0069 F04GlobalField(const F04GlobalField&); 0070 0071 F04GlobalField& operator=(const F04GlobalField&); 0072 0073 void SetupArray(); 0074 0075 public: 0076 ~F04GlobalField() override; 0077 0078 /// GetObject() returns the single F04GlobalField object. 0079 /// It is constructed, if necessary. 0080 static F04GlobalField* GetObject(F04DetectorConstruction* const); 0081 static F04GlobalField* GetObject(); 0082 0083 /// GetFieldValue() returns the field value at a given point[]. 0084 /// field is really field[6]: Bx,By,Bz,Ex,Ey,Ez. 0085 /// point[] is in global coordinates: x,y,z,t. 0086 void GetFieldValue(const G4double* point, G4double* field) const override; 0087 0088 /// DoesFieldChangeEnergy() returns true. 0089 G4bool DoesFieldChangeEnergy() const override { return true; } 0090 0091 /// AddElementField() adds the ElementField object for a single 0092 /// element to the global field. 0093 void AddElementField(F04ElementField* f) 0094 { 0095 if (fFields) fFields->push_back(f); 0096 } 0097 0098 /// Clear() removes all ElementField-s from the global object, 0099 /// and destroys them. Used before the geometry is completely 0100 /// re-created. 0101 void Clear(); 0102 0103 /// constructs all field tracking objects 0104 void ConstructField(); 0105 0106 /// Set the Stepper types 0107 void SetStepperType(G4int i) { fStepperType = i; } 0108 0109 /// Set the Stepper 0110 void SetStepper(); 0111 0112 /// Set the minimum step length 0113 void SetMinStep(G4double stp) { fMinStep = stp; } 0114 0115 /// Set the delta chord length 0116 void SetDeltaChord(G4double dcr) { fDeltaChord = dcr; } 0117 0118 /// Set the delta one step length 0119 void SetDeltaOneStep(G4double stp) { fDeltaOneStep = stp; } 0120 0121 /// Set the delta intersection length 0122 void SetDeltaIntersection(G4double its) { fDeltaIntersection = its; } 0123 0124 /// Set the minimum eps length 0125 void SetEpsMin(G4double eps) { fEpsMin = eps; } 0126 0127 /// Set the maximum eps length 0128 void SetEpsMax(G4double eps) { fEpsMax = eps; } 0129 0130 /// Return the list of Element Fields 0131 FieldList* GetFields() { return fFields; } 0132 0133 protected: 0134 /// Get the global field manager 0135 G4FieldManager* GetGlobalFieldManager(); 0136 0137 private: 0138 static G4ThreadLocal F04GlobalField* fObject; 0139 0140 G4int fNfp = 0; 0141 G4bool fFirst = true; 0142 0143 FieldList* fFields = nullptr; 0144 0145 const F04ElementField** fFp = nullptr; 0146 0147 private: 0148 // A. INVARIANTS: 0149 // -------------- 0150 // INVARIANT: an integer to indicate the type of RK integration method ('stepper') used 0151 G4int fStepperType = 4; // ClassicalRK4 is default stepper; 0152 0153 // INVARIANTS: Accuracy parameters of field propagation (and the integration it uses.) 0154 // 1. These values are lengths - initialised in src 0155 G4double fMinStep = 0.01 * CLHEP::mm; 0156 G4double fDeltaChord = 3.0 * CLHEP::mm; 0157 G4double fDeltaOneStep = 0.01 * CLHEP::mm; 0158 G4double fDeltaIntersection = 0.1 * CLHEP::mm; 0159 // 2. Dimensionless numbers - can initialise here 0160 G4double fEpsMin = 2.5e-7; // Relative accuracy of integration (minimum) 0161 G4double fEpsMax = 0.001; // Relative accuracy of integration (maximum) 0162 0163 // B. STATE: objects which carry out the propagation and are modified during tracking 0164 // -------- 0165 // G4Mag_EqRhs* fEquation; 0166 // G4Mag_SpinEqRhs* fEquation; 0167 0168 // G4EqMagElectricField* fEquation; 0169 G4EqEMFieldWithSpin* fEquation = nullptr; 0170 0171 G4FieldManager* fFieldManager = nullptr; 0172 G4PropagatorInField* fFieldPropagator = nullptr; 0173 G4MagIntegratorStepper* fStepper = nullptr; 0174 G4ChordFinder* fChordFinder = nullptr; 0175 0176 // INVARIANTS during tracking: Auxiliary class & information - used for setup 0177 F04FieldMessenger* fFieldMessenger; 0178 F04DetectorConstruction* fDetectorConstruction = nullptr; 0179 }; 0180 0181 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |