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/ISimG4MagneticFieldTool.h"
9#include "k4Interface/IGeoSvc.h"
10
11// Geant4
12#include "G4SystemOfUnits.hh"
13#include "G4MagneticField.hh"
14
15// Forward declarations:
16// Geant4 classes
17class G4MagIntegratorStepper;
18
19
30class SimG4MagneticFieldTool : public AlgTool, virtual public ISimG4MagneticFieldTool {
31public:
33 SimG4MagneticFieldTool(const std::string& type,
34 const std::string& name,
35 const IInterface* parent);
36
39
41 virtual StatusCode initialize() final;
42
44 virtual StatusCode finalize() final;
45
48 virtual const G4MagneticField* field() const final;
49
52 G4MagIntegratorStepper* stepper(const std::string&, G4MagneticField*) const;
53
54private:
56 ServiceHandle<IGeoSvc> m_geoSvc;
57
59 G4MagneticField* m_field = nullptr;
60
62 Gaudi::Property<bool> m_fieldOn{this, "FieldOn", false, "Switch to turn field off"};
63
66 Gaudi::Property<double> m_minEps{this, "MinimumEpsilon", 0, "Minimum epsilon (see G4 documentation)"};
67
70 Gaudi::Property<double> m_maxEps{this, "MaximumEpsilon", 0, "Maximum epsilon (see G4 documentation)"};
71
73 Gaudi::Property<double> m_deltaChord{this, "DeltaChord", 0, "Missing distance for the chord finder"};
74
77 Gaudi::Property<double> m_deltaOneStep{this, "DeltaOneStep", 0, "Delta(one-step)"};
78
80 Gaudi::Property<double> m_maxStep{this, "MaximumStep", 1. * m, "Maximum step length in field (see G4 documentation)"};
81
83 Gaudi::Property<double> m_minStep{this, "MinimumStep", 0.01 * mm, "Minimum step length in field (see G4 documentation)"};
84
86 Gaudi::Property<std::string> m_integratorStepper{this, "IntegratorStepper", "NystromRK4", "Integrator stepper name"};
87};
88
89#endif /* SIMG4COMPONENTS_G4MAGNETICFIELDTOOL_H */
Abstract interface to Geant4 field classes.
Definition ISimG4MagneticFieldTool.h:20
SimG4MagneticFieldTool.h.
Definition SimG4MagneticFieldTool.h:30
Gaudi::Property< double > m_deltaChord
This parameter governs accuracy of volume intersection, see G4 doc for more details....
Definition SimG4MagneticFieldTool.h:73
virtual StatusCode finalize() final
Finalize method.
Definition SimG4MagneticFieldTool.cpp:90
Gaudi::Property< double > m_minStep
Lower limit of the step size, see G4 doc for more details. Set with property MinimumStep.
Definition SimG4MagneticFieldTool.h:83
virtual ~SimG4MagneticFieldTool()
Destructor.
Definition SimG4MagneticFieldTool.cpp:37
Gaudi::Property< bool > m_fieldOn
Switch to turn field on or off (default is off). Set with property FieldOn.
Definition SimG4MagneticFieldTool.h:62
virtual StatusCode initialize() final
Initialize method.
Definition SimG4MagneticFieldTool.cpp:39
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:80
virtual const G4MagneticField * field() const final
Get the magnetic field.
Definition SimG4MagneticFieldTool.cpp:97
ServiceHandle< IGeoSvc > m_geoSvc
Pointer to the geometry service.
Definition SimG4MagneticFieldTool.h:56
Gaudi::Property< double > m_minEps
Minimum epsilon (relative error of position / momentum, see G4 doc for more details).
Definition SimG4MagneticFieldTool.h:66
Gaudi::Property< double > m_deltaOneStep
This parameter is roughly the position error which is acceptable in an integration step,...
Definition SimG4MagneticFieldTool.h:77
Gaudi::Property< std::string > m_integratorStepper
Name of the integration stepper, defaults to NystromRK4.
Definition SimG4MagneticFieldTool.h:86
G4MagIntegratorStepper * stepper(const std::string &, G4MagneticField *) const
Get the stepper.
Definition SimG4MagneticFieldTool.cpp:102
G4MagneticField * m_field
Pointer to the actual Geant4 magnetic field.
Definition SimG4MagneticFieldTool.h:59
Gaudi::Property< double > m_maxEps
Maximum epsilon (relative error of position / momentum, see G4 doc for more details).
Definition SimG4MagneticFieldTool.h:70