Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4FieldParameters.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// G4FieldParameters
27//
28// Class description:
29//
30// The class defines the type of equation of motion of a particle
31// in a field and the integration method, as well as other accuracy
32// parameters.
33//
34// The default values correspond to the defaults set in Geant4.
35
36// Author: Ivana Hrivnacova (IJCLab, Orsay), 2024.
37// -------------------------------------------------------------------
38#ifndef G4FIELDPARAMETERS_HH
39#define G4FIELDPARAMETERS_HH
40
41#include "globals.hh"
42
44
48
49/**
50 * @brief G4FieldType defines the available fields in Geant4.
51 */
52
54{
55 kMagnetic, ///< magnetic field
56 kElectroMagnetic, ///< electromagnetic field
57 kGravity, ///< gravity field
58 kUserFieldType ///< User defined field type
59};
60
61/**
62 * @brief G4EquationType defines the types of equations of motion of a
63 * particle in a field in Geant4.
64 */
65
67{
68 kEqMagnetic, ///< G4Mag_UsualEqRhs: the standard right-hand side for
69 ///< equation of motion.
70 kEqMagneticWithSpin,///< G4Mag_SpinEqRhs: the equation of motion for a particle
71 ///< with spin
72 ///< in a pure magnetic field
73 kEqElectroMagnetic, ///< G4EqMagElectricField: Equation of motion in a combined
74 ///< electric and magnetic field
75 kEqEMfieldWithSpin, ///< G4EqEMFieldWithSpin: Equation of motion for a
76 ///< particle with spin
77 ///< in a combined electric and magnetic field
78 kEqEMfieldWithEDM, ///< G4EqEMFieldWithEDM: Equation of motion in a combined
79 ///< electric and magnetic field, with spin tracking for
80 ///< both MDM and EDM terms
81 kEqGravity, ///< G4EqGravityField: equation of motion in a gravity field
82 /// (not build by G4FieldBuilder)
83 kEqMonopole, ///< G4MonopoleEq: the right-hand side of equation of motion for monopole
84 /// in a combined electric and magnetic field
85 /// (not build by G4FieldBuilder)
86 kEqReplate, ///< G4RepleteEofM: equation of motion in a combined field, including:
87 /// magnetic, electric, gravity, and gradient B field, as well as spin tracking
88 /// (not build by G4FieldBuilder)
89 kUserEquation ///< User defined equation of motion
90};
91
92/**
93 * @brief G4StepperType defines the available integrator of particle's
94 * equation of motion in Geant4.
95 */
96
98{
99 // steppers with equation of motion of generic type (G4EquationOfMotion)
100 kCashKarpRKF45, ///< G4CashKarpRKF45
101 kClassicalRK4, ///< G4ClassicalRK4
102 kBogackiShampine23, ///< G4BogackiShampine23
103 kBogackiShampine45, ///< G4BogackiShampine45
104 kDoLoMcPriRK34, ///< G4DoLoMcPriRK34
105 kDormandPrince745, ///< G4DormandPrince745
106 kDormandPrinceRK56, ///< G4DormandPrinceRK56
107 kDormandPrinceRK78, ///< G4DormandPrinceRK78
108 kExplicitEuler, ///< G4ExplicitEuler
109 kImplicitEuler, ///< G4ImplicitEuler
110 kSimpleHeum, ///< G4SimpleHeum
111 kSimpleRunge, ///< G4SimpleRunge
112 kTsitourasRK45, ///< G4TsitourasRK45
113
114 // steppers with equation of motion of G4Mag_UsualEqRhs type
115 kConstRK4, ///< G4ConstRK4
116 kExactHelixStepper, ///< G4ExactHelixStepper
117 kHelixExplicitEuler, ///< G4HelixExplicitEuler
118 kHelixHeum, ///< G4HelixHeum
119 kHelixImplicitEuler, ///< G4HelixImplicitEuler
120 kHelixMixedStepper, ///< G4HelixMixedStepper
121 kHelixSimpleRunge, ///< G4HelixSimpleRunge
122 kNystromRK4, ///< G4NystromRK4
123 kRKG3Stepper, ///< G4RKG3_Stepper
124 kUserStepper, ///< User defined stepper
125
126 // FSAL steppers
127 kRK547FEq1, ///< G4RK547FEq1
128 kRK547FEq2, ///< G4RK547FEq2
129 kRK547FEq3, ///< G4RK547FEq3
130
131 // Templated steppers (not build by G4FieldBuilder)
132 kTCashKarpRKF45, ///< G4TCashKarpRKF45
133 kTDormandPrince45, ///< G4TDormandPrince45
134 kTMagErrorStepper, ///< G4TMagErrorStepper
135 kQSStepper ///< G4QSStepper
136};
137
138/**
139 * @brief G4FieldDefaults defines the magnetic field parameters defaults.
140 * The namespace defines the default values of the field paraments as constexpr
141 * so that they can be used also as the default values in the magnetic field
142 * classes constructors and other member functions.
143 */
144
146{
147 /// Default minimum step in G4ChordFinder
148 constexpr G4double kMinimumStep = 0.01 * CLHEP::mm;
149 /// Default delta chord in G4ChordFinder
150 constexpr G4double kDeltaChord = 0.25 * CLHEP::mm;
151 /// Default delta one step in global field manager
152 constexpr G4double kDeltaOneStep = 0.01 * CLHEP::mm;
153 /// Delta intersection in global field manager
154 constexpr G4double kDeltaIntersection = 0.001 * CLHEP::mm;
155 /// Default minimum epsilon step in global field manager
156 constexpr G4double kMinimumEpsilonStep = 5.0e-5; // Expected: 5.0e-5 to 1.0e-10 ...
157 /// Default maximum epsilon step in global field manager
158 constexpr G4double kMaximumEpsilonStep = 0.001; // Expected: 1.0e-3 to 1.0e-8 ...
159}
160
161/**
162 * @brief G4FieldParameters defines the type of equation of motion of a
163 * particle in a field and the integration method, as well as other accuracy
164 * parameters. The default values correspond to the defaults set in Geant4.
165 */
166
168{
169 public:
170
171 /**
172 * Constructor for G4FieldParameters.
173 * @param[in] volumeName The volume name where field is applied.
174 */
175 G4FieldParameters(const G4String& volumeName = "");
176
177 /**
178 * Destructor.
179 */
181
182 /**
183 * Copy constructor and assignment operator not allowed.
184 */
185 G4FieldParameters(const G4FieldParameters& right) = delete;
187
188 /**
189 * Returns the field type as a string.
190 */
191 static G4String FieldTypeName(G4FieldType field);
192
193 /**
194 * Returns the equation type as a string.
195 */
197
198 /**
199 * Returns the stepper type as a string.
200 */
201 static G4String StepperTypeName(G4StepperType stepper);
202
203 /**
204 * Returns the field type for given field type name.
205 */
206 static G4FieldType GetFieldType(const G4String& name);
207
208 /**
209 * Returns the equation type for given equation type name.
210 */
211 static G4EquationType GetEquationType(const G4String& name);
212
213 /**
214 * Returns the stepper type for given stepper type name.
215 */
216 static G4StepperType GetStepperType(const G4String& name);
217
218 /**
219 * Prints all customisable accuracy parameters.
220 */
221 void PrintParameters() const;
222
223 // Set methods ------------------------------------------------------------
224
225 /**
226 * Sets the type of field.
227 */
229
230 /**
231 * Sets the type of equation of motion of a particle in a field.
232 */
234
235 /**
236 * Sets the type of integrator of particle's equation of motion.
237 */
239
240 /**
241 * Sets the user defined equation of motion.
242 */
244
245 /**
246 * Sets the user defined integrator of particle's equation of motion.
247 */
249
250 /**
251 * Sets the minimum step in G4ChordFinder.
252 */
254
255 /**
256 * Sets the delta chord in G4ChordFinder.
257 */
259
260 /**
261 * Sets the delta one step in global field manager.
262 */
264
265 /**
266 * Sets the delta intersection in global field manager.
267 */
269
270 /**
271 * Sets the minimum epsilon step in global field manager.
272 */
274
275 /**
276 * Sets the maximum epsilon step in global field manager.
277 */
279
280 /**
281 * Sets the distance within which the field is considered constant.
282 */
284
285 // Get methods ------------------------------------------------------------
286
287 /**
288 * Gets the name of associated volume, if local field.
289 */
290 const G4String& GetVolumeName() const;
291
292 /**
293 * Gets the type of field.
294 */
295 const G4FieldType& GetFieldType() const;
296
297 /**
298 * Gets the type of equation of motion of a particle in a field.
299 */
301
302 /**
303 * Gets the type of integrator of particle's equation of motion.
304 */
306
307 /**
308 * Gets the user defined equation of motion.
309 */
311
312 /**
313 * Gets the user defined integrator of particle's equation of motion.
314 */
316
317 /**
318 * Gets the minimum step in G4ChordFinder.
319 */
321
322 /**
323 * Gets the delta chord in G4ChordFinder.
324 */
326
327 /**
328 * Gets the delta one step in global field manager.
329 */
331
332 /**
333 * Gets the delta intersection in global field manager.
334 */
336
337 /**
338 * Gets the minimum epsilon step in global field manager.
339 */
341
342 /**
343 * Gets the maximum epsilon step in global field manager.
344 */
346
347 /**
348 * Gets the distance within which the field is considered constant.
349 */
351
352 private:
353
354 /** Default constant distance. */
355 inline static const G4double fgkDefaultConstDistance = 0.;
356
357 /** Messenger for this class. */
358 G4FieldParametersMessenger* fMessenger = nullptr;
359
360 /** The name of the associated volume, if local field. */
361 G4String fVolumeName;
362
363 /** The minimum step in G4ChordFinder. */
365
366 /** The delta chord in G4ChordFinder. */
368
369 /** The delta one step in global field manager. */
371
372 /** The delta intersection in global field manager. */
374
375 /** The minimum epsilon step in global field manager. */
377
378 /** The maximum epsilon step in global field manager. */
380
381 /** The type of field. */
382 G4FieldType fField = kMagnetic;
383
384 /** Type of equation of motion of a particle in a field. */
385 G4EquationType fEquation = kEqMagnetic;
386
387 /** Type of integrator of particle's equation of motion. */
389
390 /** User defined equation of motion. */
391 G4EquationOfMotion* fUserEquation = nullptr;
392
393 /// User defined integrator of particle's equation of motion. */
394 G4MagIntegratorStepper* fUserStepper = nullptr;
395
396 /** The distance within which the field is considered constant. */
397 G4double fConstDistance = fgkDefaultConstDistance;
398};
399
400// Inline functions
401
402#include "G4FieldParameters.icc"
403
404#endif
G4EquationType
G4EquationType defines the types of equations of motion of a particle in a field in Geant4.
@ kEqMagneticWithSpin
@ kUserEquation
User defined equation of motion.
@ kEqEMfieldWithSpin
@ kEqMagnetic
@ kEqGravity
@ kEqReplate
@ kEqMonopole
@ kEqElectroMagnetic
@ kEqEMfieldWithEDM
G4FieldType
G4FieldType defines the available fields in Geant4.
@ kElectroMagnetic
electromagnetic field
@ kUserFieldType
User defined field type.
@ kGravity
gravity field
@ kMagnetic
magnetic field
G4StepperType
G4StepperType defines the available integrator of particle's equation of motion in Geant4.
@ kRKG3Stepper
G4RKG3_Stepper.
@ kRK547FEq2
G4RK547FEq2.
@ kHelixSimpleRunge
G4HelixSimpleRunge.
@ kNystromRK4
G4NystromRK4.
@ kDormandPrince745
G4DormandPrince745.
@ kCashKarpRKF45
G4CashKarpRKF45.
@ kDormandPrinceRK78
G4DormandPrinceRK78.
@ kQSStepper
G4QSStepper.
@ kSimpleRunge
G4SimpleRunge.
@ kHelixImplicitEuler
G4HelixImplicitEuler.
@ kConstRK4
G4ConstRK4.
@ kUserStepper
User defined stepper.
@ kDoLoMcPriRK34
G4DoLoMcPriRK34.
@ kSimpleHeum
G4SimpleHeum.
@ kHelixHeum
G4HelixHeum.
@ kHelixExplicitEuler
G4HelixExplicitEuler.
@ kDormandPrinceRK56
G4DormandPrinceRK56.
@ kTDormandPrince45
G4TDormandPrince45.
@ kTsitourasRK45
G4TsitourasRK45.
@ kImplicitEuler
G4ImplicitEuler.
@ kExactHelixStepper
G4ExactHelixStepper.
@ kHelixMixedStepper
G4HelixMixedStepper.
@ kBogackiShampine45
G4BogackiShampine45.
@ kExplicitEuler
G4ExplicitEuler.
@ kTCashKarpRKF45
G4TCashKarpRKF45.
@ kRK547FEq1
G4RK547FEq1.
@ kRK547FEq3
G4RK547FEq3.
@ kBogackiShampine23
G4BogackiShampine23.
@ kClassicalRK4
G4ClassicalRK4.
@ kTMagErrorStepper
G4TMagErrorStepper.
double G4double
Definition G4Types.hh:83
G4EquationOfMotion is the abstract base class for the right hand size of the equation of motion of a ...
G4FieldParametersMessenger is a messenger class that defines commands for field configuration....
const G4EquationType & GetEquationType() const
void SetEquationType(G4EquationType equation)
G4double GetDeltaIntersection() const
void SetFieldType(G4FieldType field)
void SetUserStepper(G4MagIntegratorStepper *stepper)
G4double GetMinimumEpsilonStep() const
G4double GetDeltaChord() const
G4MagIntegratorStepper * GetUserStepper() const
void SetUserEquationOfMotion(G4EquationOfMotion *equation)
void SetConstDistance(G4double value)
G4double GetMinimumStep() const
const G4String & GetVolumeName() const
void SetMinimumStep(G4double value)
const G4StepperType & GetStepperType() const
void SetStepperType(G4StepperType stepper)
G4FieldParameters & operator=(const G4FieldParameters &right)=delete
G4FieldParameters(const G4FieldParameters &right)=delete
void SetMinimumEpsilonStep(G4double value)
G4double GetConstDistance() const
static G4String EquationTypeName(G4EquationType equation)
void PrintParameters() const
G4EquationOfMotion * GetUserEquationOfMotion() const
G4FieldParameters(const G4String &volumeName="")
G4double GetDeltaOneStep() const
void SetDeltaOneStep(G4double value)
void SetDeltaIntersection(G4double value)
G4double GetMaximumEpsilonStep() const
const G4FieldType & GetFieldType() const
static G4String StepperTypeName(G4StepperType stepper)
void SetDeltaChord(G4double value)
static G4String FieldTypeName(G4FieldType field)
void SetMaximumEpsilonStep(G4double value)
G4MagIntegratorStepper is an abstract base class for integrator of particle's equation of motion,...
G4FieldDefaults defines the magnetic field parameters defaults. The namespace defines the default val...
constexpr G4double kDeltaOneStep
Default delta one step in global field manager.
constexpr G4double kMaximumEpsilonStep
Default maximum epsilon step in global field manager.
constexpr G4double kDeltaIntersection
Delta intersection in global field manager.
constexpr G4double kDeltaChord
Default delta chord in G4ChordFinder.
constexpr G4double kMinimumEpsilonStep
Default minimum epsilon step in global field manager.
constexpr G4double kMinimumStep
Default minimum step in G4ChordFinder.