Loading...
Searching...
No Matches
F04GlobalField.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27/// \file field/field04/include/F04GlobalField.hh
28/// \brief Definition of the F04GlobalField class
29//
30
31#ifndef F04GlobalField_h
32#define F04GlobalField_h 1
33
34#include <vector>
35
36#include "G4FieldManager.hh"
37#include "G4PropagatorInField.hh"
38#include "G4MagIntegratorStepper.hh"
39#include "G4ChordFinder.hh"
40
41#include "G4MagneticField.hh"
42#include "G4ElectroMagneticField.hh"
43
44#include "G4Mag_EqRhs.hh"
45#include "G4Mag_SpinEqRhs.hh"
46
47#include "G4EqMagElectricField.hh"
48#include "G4EqEMFieldWithSpin.hh"
49
50#include "F04FieldMessenger.hh"
51#include "F04ElementField.hh"
52
54
55// F04GlobalField - handles the global ElectroMagnetic field
56//
57// There is a single G04GlobalField object.
58//
59// The field from each individual beamline element is given by a
60// ElementField object. Any number of overlapping ElementField
61// objects can be added to the global field. Any element that
62// represents an element with an EM field must add the appropriate
63// ElementField to the global GlobalField object.
64
65using FieldList = std::vector<F04ElementField *>;
66
68//class F04GlobalField : public G4MagneticField {
69
70private:
71
74
76
77 void SetupArray();
78
79public:
80
81 ~F04GlobalField() override;
82
83 /// GetObject() returns the single F04GlobalField object.
84 /// It is constructed, if necessary.
86 static F04GlobalField* GetObject();
87
88 /// GetFieldValue() returns the field value at a given point[].
89 /// field is really field[6]: Bx,By,Bz,Ex,Ey,Ez.
90 /// point[] is in global coordinates: x,y,z,t.
91 void GetFieldValue(const G4double* point, G4double* field) const override;
92
93 /// DoesFieldChangeEnergy() returns true.
94 G4bool DoesFieldChangeEnergy() const override { return true; }
95
96 /// AddElementField() adds the ElementField object for a single
97 /// element to the global field.
99 {
100 if (fFields) fFields->push_back(f);
101 }
102
103 /// Clear() removes all ElementField-s from the global object,
104 /// and destroys them. Used before the geometry is completely
105 /// re-created.
106 void Clear();
107
108 /// constructs all field tracking objects
109 void ConstructField();
110
111 /// Set the Stepper types
112 void SetStepperType( G4int i ) { fStepperType = i; }
113
114 /// Set the Stepper
115 void SetStepper();
116
117 /// Set the minimum step length
118 void SetMinStep(G4double stp) { fMinStep = stp; }
119
120 /// Set the delta chord length
121 void SetDeltaChord(G4double dcr) { fDeltaChord = dcr; }
122
123 /// Set the delta one step length
124 void SetDeltaOneStep(G4double stp) { fDeltaOneStep = stp; }
125
126 /// Set the delta intersection length
127 void SetDeltaIntersection(G4double its) { fDeltaIntersection = its; }
128
129 /// Set the minimum eps length
130 void SetEpsMin(G4double eps) { fEpsMin = eps; }
131
132 /// Set the maximum eps length
133 void SetEpsMax(G4double eps) { fEpsMax = eps; }
134
135 /// Return the list of Element Fields
137
138protected:
139
140 /// Get the global field manager
142
143private:
144
145 static G4ThreadLocal F04GlobalField* fObject;
146
147 G4int fNfp = 0;
148 G4bool fFirst = true;
149
150 FieldList* fFields = nullptr;
151
152 const F04ElementField **fFp = nullptr;
153
154private:
155
156 // A. INVARIANTS:
157 // --------------
158 // INVARIANT: an integer to indicate the type of RK integration method ('stepper') used
159 G4int fStepperType = 4; // ClassicalRK4 is default stepper;
160
161 // INVARIANTS: Accuracy parameters of field propagation (and the integration it uses.)
162 // 1. These values are lengths - initialised in src
163 G4double fMinStep = 0.01 * CLHEP::mm;
164 G4double fDeltaChord = 3.0 * CLHEP::mm;
165 G4double fDeltaOneStep = 0.01 * CLHEP::mm;
166 G4double fDeltaIntersection = 0.1 * CLHEP::mm;
167 // 2. Dimensionless numbers - can initialise here
168 G4double fEpsMin = 2.5e-7; // Relative accuracy of integration (minimum)
169 G4double fEpsMax = 0.001; // Relative accuracy of integration (maximum)
170
171 // B. STATE: objects which carry out the propagation and are modified during tracking
172 // --------
173// G4Mag_EqRhs* fEquation;
174// G4Mag_SpinEqRhs* fEquation;
175
176// G4EqMagElectricField* fEquation;
178
183
184 // INVARIANTS during tracking: Auxiliary class & information - used for setup
187};
188
189#endif
Definition of the F04DetectorConstruction class.
Definition of the F04ElementField class.
Definition of the F04FieldMessenger class.
std::vector< F04ElementField * > FieldList
static G4ThreadLocal F04GlobalField * fObject
void SetMinStep(G4double stp)
Set the minimum step length.
void SetEpsMin(G4double eps)
Set the minimum eps length.
void ConstructField()
constructs all field tracking objects
F04GlobalField & operator=(const F04GlobalField &)
~F04GlobalField() override
F04DetectorConstruction * fDetectorConstruction
G4FieldManager * fFieldManager
F04GlobalField(const F04GlobalField &)
void SetDeltaChord(G4double dcr)
Set the delta chord length.
void SetDeltaIntersection(G4double its)
Set the delta intersection length.
const F04ElementField ** fFp
G4ChordFinder * fChordFinder
void SetDeltaOneStep(G4double stp)
Set the delta one step length.
G4PropagatorInField * fFieldPropagator
G4bool DoesFieldChangeEnergy() const override
DoesFieldChangeEnergy() returns true.
F04FieldMessenger * fFieldMessenger
void Clear()
Clear() removes all ElementField-s from the global object, and destroys them.
void GetFieldValue(const G4double *point, G4double *field) const override
GetFieldValue() returns the field value at a given point[].
G4EqEMFieldWithSpin * fEquation
FieldList * fFields
void SetEpsMax(G4double eps)
Set the maximum eps length.
void SetStepperType(G4int i)
Set the Stepper types.
void SetStepper()
Set the Stepper.
FieldList * GetFields()
Return the list of Element Fields.
static F04GlobalField * GetObject()
G4double fDeltaIntersection
void AddElementField(F04ElementField *f)
AddElementField() adds the ElementField object for a single element to the global field.
G4FieldManager * GetGlobalFieldManager()
Get the global field manager.
G4MagIntegratorStepper * fStepper

Applications | User Support | Publications | Collaboration