k4SimGeant4
Loading...
Searching...
No Matches
SimG4MagneticFieldFromMapTool.h
Go to the documentation of this file.
1#ifndef SIMG4COMPONENTS_G4MAGNETICFIELDFROMMAPTOOL_H
2#define SIMG4COMPONENTS_G4MAGNETICFIELDFROMMAPTOOL_H
3
4// Gaudi
5#include "GaudiKernel/AlgTool.h"
6
7// FCCSW
9
10// Geant4
11#include "G4SystemOfUnits.hh"
12#include "G4MagneticField.hh"
13
14// Forward declarations:
15// Geant 4 classes
16class G4MagIntegratorStepper;
17
18// FCCSW
19/*
20namespace sim {
21 class MapField;
22}
23*/
24
34class SimG4MagneticFieldFromMapTool : public AlgTool, virtual public ISimG4MagneticFieldTool {
35public:
37 SimG4MagneticFieldFromMapTool(const std::string& type, const std::string& name, const IInterface* parent);
38
41
43 virtual StatusCode initialize() final;
44
46 virtual StatusCode finalize() final;
47
50 virtual const G4MagneticField* field() const final;
51
54 G4MagIntegratorStepper* stepper(const std::string&, G4MagneticField*) const;
55
56private:
58 G4MagneticField* m_field = nullptr;
60 Gaudi::Property<bool> m_fieldOn{this, "FieldOn", false, "Switch to turn field off"};
63 Gaudi::Property<double> m_minEps{this, "MinimumEpsilon", 0, "Minimum epsilon (see G4 documentation)"};
66 Gaudi::Property<double> m_maxEps{this, "MaximumEpsilon", 0, "Maximum epsilon (see G4 documentation)"};
68 Gaudi::Property<double> m_deltaChord{this, "DeltaChord", 0, "Missing distance for the chord finder"};
71 Gaudi::Property<double> m_deltaOneStep{this, "DeltaOneStep", 0, "Delta(one-step)"};
73 Gaudi::Property<double> m_maxStep{this, "MaximumStep", 1. * m, "Maximum step length in field (see G4 documentation)"};
75 Gaudi::Property<double> m_minStep{this, "MinimumStep", 0.01 * mm, "Minimum step length in field (see G4 documentation)"};
77 Gaudi::Property<std::string> m_integratorStepper{this, "IntegratorStepper", "NystromRK4", "Integrator stepper name"};
79 Gaudi::Property<std::string> m_mapFilePath{this, "MapFile", "", "Path to file containing fieldmap"};
81 Gaudi::Property<double> m_addFieldBz{this, "AddFieldBz", 0., "Additional constant field, z component (default: 0.)"};
83 Gaudi::Property<double> m_addFieldMaxR{this, "AddFieldMaxR", -1., "Maximum radius of additional constant field (default: no limit)"};
85 Gaudi::Property<double> m_addFieldMaxZ{this, "AddFieldMaxZ", -1., "Maximum z coordinate of additional constant field (default: no limit)"};
87 Gaudi::Property<double> m_fieldMaxR{this, "FieldMaxR", -1., "Field maximum radius (default: no limit)"};
89 Gaudi::Property<double> m_fieldMaxZ{this, "FieldMaxZ", -1., "Field maximum z coordinate (default: no limit)"};
90
92 StatusCode loadRootMap();
94 StatusCode loadComsolMap();
95};
96
97#endif
Abstract interface to Geant4 field classes.
Definition ISimG4MagneticFieldTool.h:20
SimG4MagneticFieldFromMapTool.h.
Definition SimG4MagneticFieldFromMapTool.h:34
Gaudi::Property< double > m_maxStep
Upper limit of the step size, see G4 doc for more details. Set with property MaximumStep.
Definition SimG4MagneticFieldFromMapTool.h:73
Gaudi::Property< double > m_maxEps
Maximum epsilon (relative error of position / momentum, see G4 doc for more details).
Definition SimG4MagneticFieldFromMapTool.h:66
Gaudi::Property< double > m_fieldMaxZ
Maximum field z coordinate (default: no limit)
Definition SimG4MagneticFieldFromMapTool.h:89
virtual ~SimG4MagneticFieldFromMapTool()
Destructor.
Definition SimG4MagneticFieldFromMapTool.cpp:44
Gaudi::Property< bool > m_fieldOn
Switch to turn field on or off (default is off). Set with property FieldOn.
Definition SimG4MagneticFieldFromMapTool.h:60
virtual StatusCode initialize() final
Initialize method.
Definition SimG4MagneticFieldFromMapTool.cpp:46
StatusCode loadComsolMap()
Load map from the COMSOL export file.
Definition SimG4MagneticFieldFromMapTool.cpp:254
Gaudi::Property< std::string > m_integratorStepper
Name of the integration stepper, defaults to NystromRK4.
Definition SimG4MagneticFieldFromMapTool.h:77
Gaudi::Property< std::string > m_mapFilePath
Path to the input file containing fieldmap.
Definition SimG4MagneticFieldFromMapTool.h:79
Gaudi::Property< double > m_minStep
Lower limit of the step size, see G4 doc for more details. Set with property MinimumStep.
Definition SimG4MagneticFieldFromMapTool.h:75
SimG4MagneticFieldFromMapTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition SimG4MagneticFieldFromMapTool.cpp:38
G4MagneticField * m_field
Pointer to the actual Geant4 magnetic field.
Definition SimG4MagneticFieldFromMapTool.h:58
Gaudi::Property< double > m_addFieldMaxZ
Maximum z coordinate of the additional constant field (default: no limit)
Definition SimG4MagneticFieldFromMapTool.h:85
StatusCode loadRootMap()
Load map from the ROOT file.
Definition SimG4MagneticFieldFromMapTool.cpp:160
Gaudi::Property< double > m_addFieldBz
Additional constant field, z component (spans whole z range of the map)
Definition SimG4MagneticFieldFromMapTool.h:81
Gaudi::Property< double > m_addFieldMaxR
Maximum radius of the additional constant field (default: no limit)
Definition SimG4MagneticFieldFromMapTool.h:83
G4MagIntegratorStepper * stepper(const std::string &, G4MagneticField *) const
Get the stepper.
Definition SimG4MagneticFieldFromMapTool.cpp:139
Gaudi::Property< double > m_deltaOneStep
This parameter is roughly the position error which is acceptable in an integration step,...
Definition SimG4MagneticFieldFromMapTool.h:71
virtual StatusCode finalize() final
Finalize method.
Definition SimG4MagneticFieldFromMapTool.cpp:127
virtual const G4MagneticField * field() const final
Get the magnetic field.
Definition SimG4MagneticFieldFromMapTool.cpp:134
Gaudi::Property< double > m_fieldMaxR
Maximum field radius (default: no limit)
Definition SimG4MagneticFieldFromMapTool.h:87
Gaudi::Property< double > m_deltaChord
This parameter governs accuracy of volume intersection, see G4 doc for more details....
Definition SimG4MagneticFieldFromMapTool.h:68
Gaudi::Property< double > m_minEps
Minimum epsilon (relative error of position / momentum, see G4 doc for more details).
Definition SimG4MagneticFieldFromMapTool.h:63