23#include <TVirtualMCApplication.h>
24#include <TVirtualMagField.h>
26#include <G4SystemOfUnits.hh>
28#include <G4BogackiShampine23.hh>
29#include <G4BogackiShampine45.hh>
30#include <G4CashKarpRKF45.hh>
31#include <G4ChordFinder.hh>
32#include <G4ClassicalRK4.hh>
33#include <G4ConstRK4.hh>
34#include <G4DormandPrince745.hh>
35#include <G4DormandPrinceRK56.hh>
36#include <G4DormandPrinceRK78.hh>
37#include <G4EqEMFieldWithEDM.hh>
38#include <G4EqEMFieldWithSpin.hh>
39#include <G4EqMagElectricField.hh>
40#include <G4ExactHelixStepper.hh>
41#include <G4ExplicitEuler.hh>
42#include <G4FSALIntegrationDriver.hh>
43#include <G4FieldManager.hh>
44#include <G4HelixExplicitEuler.hh>
45#include <G4HelixHeum.hh>
46#include <G4HelixImplicitEuler.hh>
47#include <G4HelixMixedStepper.hh>
48#include <G4HelixSimpleRunge.hh>
49#include <G4ImplicitEuler.hh>
50#include <G4MagErrorStepper.hh>
51#include <G4MagHelicalStepper.hh>
52#include <G4MagIntegratorDriver.hh>
53#include <G4Mag_EqRhs.hh>
54#include <G4Mag_SpinEqRhs.hh>
55#include <G4Mag_UsualEqRhs.hh>
56#include <G4NystromRK4.hh>
57#include <G4RK547FEq1.hh>
58#include <G4RK547FEq2.hh>
59#include <G4RK547FEq3.hh>
60#include <G4RKG3_Stepper.hh>
61#include <G4SimpleHeum.hh>
62#include <G4SimpleRunge.hh>
63#include <G4TransportationManager.hh>
64#include <G4TsitourasRK45.hh>
65#include <G4VIntegrationDriver.hh>
69 TVirtualMagField* magField, G4LogicalVolume* lv)
70 : fVirtualMagField(magField),
82 "TG4Field",
"TG4Field:",
"No TVirtualMagField is defined.");
141 G4ElectroMagneticField* elMagField = 0;
143 elMagField =
dynamic_cast<G4ElectroMagneticField*
>(
fG4Field);
153 return new G4Mag_UsualEqRhs(magField);
157 return new G4Mag_SpinEqRhs(magField);
161 return new G4EqMagElectricField(elMagField);
165 return new G4EqEMFieldWithSpin(elMagField);
169 return new G4EqEMFieldWithEDM(elMagField);
178 "TG4Field",
"CreateEquation:",
"Unknown equation type.");
189 G4Mag_EqRhs* eqRhs =
dynamic_cast<G4Mag_EqRhs*
>(equation);
192 "The stepper type requires equation of motion of G4Mag_EqRhs type.");
198 return new G4BogackiShampine23(equation);
202 return new G4BogackiShampine45(equation);
206 return new G4CashKarpRKF45(equation);
210 return new G4ClassicalRK4(equation);
214 return new G4DormandPrince745(equation);
218 return new G4DormandPrinceRK56(equation);
222 return new G4DormandPrinceRK78(equation);
226 return new G4ExplicitEuler(equation);
230 return new G4ImplicitEuler(equation);
234 return new G4SimpleHeum(equation);
238 return new G4SimpleRunge(equation);
242 return new G4TsitourasRK45(equation);
246 return new G4ConstRK4(eqRhs);
250 return new G4ExactHelixStepper(eqRhs);
254 return new G4HelixExplicitEuler(eqRhs);
258 return new G4HelixHeum(eqRhs);
262 return new G4HelixImplicitEuler(eqRhs);
266 return new G4HelixMixedStepper(eqRhs);
270 return new G4HelixSimpleRunge(eqRhs);
274 return new G4NystromRK4(eqRhs);
278 return new G4RKG3_Stepper(eqRhs);
286 "TG4Field",
"CreateStepper:",
"Incorrect stepper type.");
297 switch (stepperType) {
299 return new G4FSALIntegrationDriver<G4RK547FEq1>(
300 minStep,
new G4RK547FEq1(equation));
303 return new G4FSALIntegrationDriver<G4RK547FEq2>(
304 minStep,
new G4RK547FEq2(equation));
307 return new G4FSALIntegrationDriver<G4RK547FEq3>(
308 minStep,
new G4RK547FEq3(equation));
312 "TG4Field",
"CreateFSALStepperAndDriver",
"Incorrect stepper type.");
329 G4FieldManager* fieldManager = 0;
334 G4TransportationManager::GetTransportationManager()->GetFieldManager();
338 fieldManager =
new G4FieldManager();
339 G4bool forceToAllDaughters =
true;
340 fLogicalVolume->SetFieldManager(fieldManager, forceToAllDaughters);
342 fieldManager->SetDetectorField(
fG4Field);
393 G4MagInt_Driver* intDriver =
new G4MagInt_Driver(
Definition of the TG4CachedMagneticField class.
@ kRKG3Stepper
G4RKG3_Stepper.
@ kHelixSimpleRunge
G4HelixSimpleRunge.
@ kNystromRK4
G4NystromRK4.
@ kDormandPrince745
G4DormandPrince745.
@ kCashKarpRKF45
G4CashKarpRKF45.
@ kDormandPrinceRK78
G4DormandPrinceRK78.
@ kSimpleRunge
G4SimpleRunge.
@ kHelixImplicitEuler
G4HelixImplicitEuler.
@ kUserStepper
User defined stepper.
@ kSimpleHeum
G4SimpleHeum.
@ kHelixExplicitEuler
G4HelixExplicitEuler.
@ kDormandPrinceRK56
G4DormandPrinceRK56.
@ kTsitourasRK45
G4TsitourasRK45.
@ kImplicitEuler
G4ImplicitEuler.
@ kExactHelixStepper
G4ExactHelixStepper.
@ kHelixMixedStepper
G4HelixMixedStepper.
@ kBogackiShampine45
G4BogackiShampine45.
@ kExplicitEuler
G4ExplicitEuler.
@ kBogackiShampine23
G4BogackiShampine23.
@ kClassicalRK4
G4ClassicalRK4.
@ kUserEquation
User defined equation of motion.
@ kElectroMagnetic
electromagnetic field
@ kMagnetic
magnetic field
Definition of the TG4Field class.
Definition of the TG4G3Units class.
Definition of the TG4Globals class and basic container types.
Definition of the TG4MagneticField class.
The cached magnetic field defined by the TVirtualMCApplication field map.
The magnetic field parameters.
G4double GetMaximumEpsilonStep() const
Return maximum epsilon step in global field manager.
G4EquationOfMotion * GetUserEquationOfMotion() const
Return the user defined equation of motion.
G4double GetMinimumEpsilonStep() const
Return minimum epsilon step in global field manager.
G4double GetDeltaOneStep() const
Return delta one step in global field manager.
static EquationType GetEquationType(const G4String &name)
G4double GetDeltaIntersection() const
Return delta intersection in global field manager.
static FieldType GetFieldType(const G4String &name)
G4double GetStepMinimum() const
Return minimum step in G4ChordFinder.
G4double GetDeltaChord() const
Return delta chord in G4ChordFinder.
G4double GetConstDistance() const
Return the distance within which the field is considered constant.
static StepperType GetStepperType(const G4String &name)
G4MagIntegratorStepper * GetUserStepper() const
Return the user defined integrator of particle's equation of motion.
G4EquationOfMotion * fEquation
The equation of motion.
G4ChordFinder * fChordFinder
Chord finder.
G4VIntegrationDriver * CreateFSALStepperAndDriver(G4EquationOfMotion *equation, StepperType stepper, G4double minStep)
G4Field * CreateG4Field(const TG4FieldParameters ¶meters, TVirtualMagField *magField)
G4LogicalVolume * fLogicalVolume
The associated volume (if local field)
TVirtualMagField * fVirtualMagField
The associated TGeo magnetic field.
TG4Field(const TG4FieldParameters ¶meters, TVirtualMagField *magField, G4LogicalVolume *lv=0)
G4MagIntegratorStepper * fStepper
The magnetic integrator stepper.
G4EquationOfMotion * CreateEquation(EquationType equation)
G4MagIntegratorStepper * CreateStepper(G4EquationOfMotion *equation, StepperType stepper)
G4VIntegrationDriver * fDriver
The magnetic integrator driver.
void Update(const TG4FieldParameters ¶meters)
G4Field * fG4Field
Geant4 field.
static void Exception(const TString &className, const TString &methodName, const TString &text)
The magnetic field defined via TVirtualMagField.