k4SimGeant4
Loading...
Searching...
No Matches
SimG4MagneticFieldTool.h
Go to the documentation of this file.
1#ifndef SIMG4COMPONENTS_G4MAGNETICFIELDTOOL_H
2#define SIMG4COMPONENTS_G4MAGNETICFIELDTOOL_H
3
4// Gaudi
5#include "GaudiKernel/AlgTool.h"
6
7// k4FWCore
8#include "k4Interface/IGeoSvc.h"
9#include "k4Interface/ISimG4MagneticFieldTool.h"
10
11// Geant4
12#include "G4MagneticField.hh"
13#include "G4SystemOfUnits.hh"
14
15// Forward declarations:
16// Geant4 classes
17class G4MagIntegratorStepper;
18
29class SimG4MagneticFieldTool : public AlgTool, virtual public ISimG4MagneticFieldTool {
30public:
32 SimG4MagneticFieldTool(const std::string& type, const std::string& name, const IInterface* parent);
33
36
38 virtual StatusCode initialize() final;
39
41 virtual StatusCode finalize() final;
42
45 virtual const G4MagneticField* field() const final;
46
49 G4MagIntegratorStepper* stepper(const std::string&, G4MagneticField*) const;
50
51private:
53 ServiceHandle<IGeoSvc> m_geoSvc;
54
56 G4MagneticField* m_field = nullptr;
57
59 Gaudi::Property<bool> m_fieldOn{this, "FieldOn", false, "Switch to turn field off"};
60
63 Gaudi::Property<double> m_minEps{this, "MinimumEpsilon", 0, "Minimum epsilon (see G4 documentation)"};
64
67 Gaudi::Property<double> m_maxEps{this, "MaximumEpsilon", 0, "Maximum epsilon (see G4 documentation)"};
68
70 Gaudi::Property<double> m_deltaChord{this, "DeltaChord", 0, "Missing distance for the chord finder"};
71
74 Gaudi::Property<double> m_deltaOneStep{this, "DeltaOneStep", 0, "Delta(one-step)"};
75
77 Gaudi::Property<double> m_maxStep{this, "MaximumStep", 1. * m, "Maximum step length in field (see G4 documentation)"};
78
80 Gaudi::Property<double> m_minStep{this, "MinimumStep", 0.01 * mm,
81 "Minimum step length in field (see G4 documentation)"};
82
84 Gaudi::Property<std::string> m_integratorStepper{this, "IntegratorStepper", "NystromRK4", "Integrator stepper name"};
85};
86
87#endif /* SIMG4COMPONENTS_G4MAGNETICFIELDTOOL_H */
Abstract interface to Geant4 field classes.
Definition ISimG4MagneticFieldTool.h:20
SimG4MagneticFieldTool.h.
Definition SimG4MagneticFieldTool.h:29
Gaudi::Property< double > m_deltaChord
This parameter governs accuracy of volume intersection, see G4 doc for more details....
Definition SimG4MagneticFieldTool.h:70
virtual StatusCode finalize() final
Finalize method.
Definition SimG4MagneticFieldTool.cpp:88
Gaudi::Property< double > m_minStep
Lower limit of the step size, see G4 doc for more details. Set with property MinimumStep.
Definition SimG4MagneticFieldTool.h:80
virtual ~SimG4MagneticFieldTool()
Destructor.
Definition SimG4MagneticFieldTool.cpp:36
Gaudi::Property< bool > m_fieldOn
Switch to turn field on or off (default is off). Set with property FieldOn.
Definition SimG4MagneticFieldTool.h:59
virtual StatusCode initialize() final
Initialize method.
Definition SimG4MagneticFieldTool.cpp:38
SimG4MagneticFieldTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition SimG4MagneticFieldTool.cpp:30
Gaudi::Property< double > m_maxStep
Upper limit of the step size, see G4 doc for more details. Set with property MaximumStep.
Definition SimG4MagneticFieldTool.h:77
virtual const G4MagneticField * field() const final
Get the magnetic field.
Definition SimG4MagneticFieldTool.cpp:94
ServiceHandle< IGeoSvc > m_geoSvc
Pointer to the geometry service.
Definition SimG4MagneticFieldTool.h:53
Gaudi::Property< double > m_minEps
Minimum epsilon (relative error of position / momentum, see G4 doc for more details).
Definition SimG4MagneticFieldTool.h:63
Gaudi::Property< double > m_deltaOneStep
This parameter is roughly the position error which is acceptable in an integration step,...
Definition SimG4MagneticFieldTool.h:74
Gaudi::Property< std::string > m_integratorStepper
Name of the integration stepper, defaults to NystromRK4.
Definition SimG4MagneticFieldTool.h:84
G4MagIntegratorStepper * stepper(const std::string &, G4MagneticField *) const
Get the stepper.
Definition SimG4MagneticFieldTool.cpp:96
G4MagneticField * m_field
Pointer to the actual Geant4 magnetic field.
Definition SimG4MagneticFieldTool.h:56
Gaudi::Property< double > m_maxEps
Maximum epsilon (relative error of position / momentum, see G4 doc for more details).
Definition SimG4MagneticFieldTool.h:67