ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
G4FieldManagerToolBase Class Reference

#include "G4AtlasTools/G4FieldManagerToolBase.h"

Inheritance diagram for G4FieldManagerToolBase:
Collaboration diagram for G4FieldManagerToolBase:

Public Member Functions

 G4FieldManagerToolBase (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor. More...
 
virtual ~G4FieldManagerToolBase ()
 Destructor. More...
 
virtual StatusCode initialize () override
 Initialize method. More...
 

Protected Member Functions

G4MagIntegratorStepper * getStepper (const std::string &stepperType, G4MagneticField *field) const
 Common method to construct a stepper of requested type. More...
 
StatusCode setFieldParameters (G4FieldManager *fieldMgr) const
 Common method to apply configuredfield parameters. More...
 

Protected Attributes

ServiceHandle< IG4FieldSvcm_fieldSvc {this, "FieldSvc", "G4FieldSvc", "Service providing a G4MagneticField"}
 Handle to the G4 field service. More...
 
Gaudi::Property< bool > m_fieldOn {this, "FieldOn", true, "Toggles field on/off"}
 
Gaudi::Property< std::string > m_integratorStepper {this, "IntegratorStepper", "AtlasRK4", "Integrator stepper name"}
 The type of stepper to use. More...
 
ToolHandle< IEquationOfMotionToolm_equationOfMotion {this, "EquationOfMotion", "", ""}
 The type of equation of motion to use. More...
 

Detailed Description

Tool base class for implementation/retrieval of a G4FieldManager

Author
Andrea Dell'Acqua
Date
2015-11-17

Definition at line 33 of file G4FieldManagerToolBase.h.

Constructor & Destructor Documentation

◆ G4FieldManagerToolBase()

G4FieldManagerToolBase::G4FieldManagerToolBase ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Standard constructor.

Definition at line 49 of file G4FieldManagerToolBase.cxx.

52  : base_class(type, name, parent)
53 {
54 }

◆ ~G4FieldManagerToolBase()

virtual G4FieldManagerToolBase::~G4FieldManagerToolBase ( )
inlinevirtual

Destructor.

Definition at line 42 of file G4FieldManagerToolBase.h.

42 {}

Member Function Documentation

◆ getStepper()

G4MagIntegratorStepper * G4FieldManagerToolBase::getStepper ( const std::string &  stepperType,
G4MagneticField *  field 
) const
protected

Common method to construct a stepper of requested type.

Definition at line 187 of file G4FieldManagerToolBase.cxx.

188 {
189  ATH_MSG_DEBUG("getStepper");
190  G4Mag_EqRhs* eqRhs(nullptr);
191  if (!m_equationOfMotion.empty())
192  {
193  eqRhs = m_equationOfMotion->makeEquationOfMotion(field);
194  ATH_MSG_INFO("Configuring alternative equation of motion using " <<
195  m_equationOfMotion.name() );
196  }
197  else
198  {
199  ATH_MSG_VERBOSE("Using G4Mag_UsualEqRhs as the equation of motion.");
200  eqRhs = new G4Mag_UsualEqRhs(field);
201  }
202  // @TODO Add some way of confirming that the choices of Equation of
203  // motion and stepper are compatible.
204  // @TODO consider moving the stepper choice into a tool as well?
205  // Only worthwhile if we envisage adding more stepper choices in the
206  // future.
207  if (name=="HelixImplicitEuler") return new G4HelixImplicitEuler(eqRhs);
208  else if (name=="HelixSimpleRunge") return new G4HelixSimpleRunge(eqRhs);
209  else if (name=="HelixExplicitEuler") return new G4HelixExplicitEuler(eqRhs);
210  else if (name=="NystromRK4") return new G4NystromRK4(eqRhs);
211  else if (name=="ClassicalRK4") return new G4ClassicalRK4(eqRhs);
212  else if (name=="AtlasRK4") return new G4AtlasRK4(eqRhs);
213  else if (name=="BogackiShampine23") return new G4BogackiShampine23(eqRhs);
214  else if (name=="BogackiShampine45") return new G4BogackiShampine45(eqRhs);
215  else if (name=="CashKarpRKF45") return new G4CashKarpRKF45(eqRhs);
216  else if (name=="DoLoMcPriRK34") return new G4DoLoMcPriRK34(eqRhs);
217  else if (name=="DormandPrince745") return new G4DormandPrince745(eqRhs);
218  else if (name=="DormandPrinceRK56") return new G4DormandPrinceRK56(eqRhs);
219  else if (name=="DormandPrinceRK78") return new G4DormandPrinceRK78(eqRhs);
220  else if (name=="RK547FEq1") return new G4RK547FEq1(eqRhs);
221  else if (name=="RK547FEq2") return new G4RK547FEq2(eqRhs);
222  else if (name=="RK547FEq3") return new G4RK547FEq3(eqRhs);
223  else if (name=="RKG3_Stepper") return new G4RKG3_Stepper(eqRhs);
224  else if (name=="TsitourasRK45") return new G4TsitourasRK45(eqRhs);
225  else {
226  ATH_MSG_ERROR("Stepper " << name << " not available! returning NystromRK4!");
227  return new G4NystromRK4(eqRhs);
228  }
229 }

◆ initialize()

StatusCode G4FieldManagerToolBase::initialize ( )
overridevirtual

Initialize method.

Definition at line 59 of file G4FieldManagerToolBase.cxx.

60 {
61  ATH_MSG_DEBUG("G4FieldManagerToolBase::initialize()");
62 
63  // Skip field svc retrieval if field disabled.
64  if(m_fieldOn) {
65  ATH_CHECK( m_fieldSvc.retrieve() );
66  }
67  else {
68  ATH_MSG_DEBUG("Field disabled. Not retrieving G4 field svc.");
69  }
70  if (!m_equationOfMotion.empty())
71  {
72  ATH_CHECK(m_equationOfMotion.retrieve());
73  }
74  return StatusCode::SUCCESS;
75 }

◆ setFieldParameters()

StatusCode G4FieldManagerToolBase::setFieldParameters ( G4FieldManager *  fieldMgr) const
protected

Common method to apply configuredfield parameters.

Definition at line 235 of file G4FieldManagerToolBase.cxx.

237 {
238  ATH_MSG_DEBUG("setFieldParameters");
239  if (fieldMgr) {
240  if (m_deltaChord>0) fieldMgr->GetChordFinder()->SetDeltaChord(m_deltaChord);
241  if (m_deltaOneStep>0) fieldMgr->SetDeltaOneStep(m_deltaOneStep);
242  if (m_deltaIntersection>0) fieldMgr->SetDeltaIntersection(m_deltaIntersection);
243  if (m_minEps>0) fieldMgr->SetMinimumEpsilonStep(m_minEps);
244  if (m_maxEps>0) fieldMgr->SetMaximumEpsilonStep(m_maxEps);
245  }
246  else {
247  ATH_MSG_ERROR("setFieldParameters received NULL field mgr!");
248  return StatusCode::FAILURE;
249  }
250  return StatusCode::SUCCESS;
251 }

Member Data Documentation

◆ m_deltaChord

Gaudi::Property<double> G4FieldManagerToolBase::m_deltaChord {this, "DeltaChord", -1.0, "Missing distance for the chord finder"}
protected

Definition at line 81 of file G4FieldManagerToolBase.h.

◆ m_deltaIntersection

Gaudi::Property<double> G4FieldManagerToolBase::m_deltaIntersection {this, "DeltaIntersection", -1.0, "Accuracy for boundary intersection"}
protected

Definition at line 83 of file G4FieldManagerToolBase.h.

◆ m_deltaOneStep

Gaudi::Property<double> G4FieldManagerToolBase::m_deltaOneStep {this, "DeltaOneStep", -1.0, "Delta(one-step)"}
protected

Definition at line 82 of file G4FieldManagerToolBase.h.

◆ m_equationOfMotion

ToolHandle<IEquationOfMotionTool> G4FieldManagerToolBase::m_equationOfMotion {this, "EquationOfMotion", "", ""}
protected

The type of equation of motion to use.

Definition at line 74 of file G4FieldManagerToolBase.h.

◆ m_fieldOn

Gaudi::Property<bool> G4FieldManagerToolBase::m_fieldOn {this, "FieldOn", true, "Toggles field on/off"}
protected
Todo:
TODO why is this duplicated in the g4 field svc?

Definition at line 68 of file G4FieldManagerToolBase.h.

◆ m_fieldSvc

ServiceHandle<IG4FieldSvc> G4FieldManagerToolBase::m_fieldSvc {this, "FieldSvc", "G4FieldSvc", "Service providing a G4MagneticField"}
protected

Handle to the G4 field service.

Definition at line 65 of file G4FieldManagerToolBase.h.

◆ m_integratorStepper

Gaudi::Property<std::string> G4FieldManagerToolBase::m_integratorStepper {this, "IntegratorStepper", "AtlasRK4", "Integrator stepper name"}
protected

The type of stepper to use.

Definition at line 71 of file G4FieldManagerToolBase.h.

◆ m_maxEps

Gaudi::Property<double> G4FieldManagerToolBase::m_maxEps {this, "MaximumEpsilonStep", -1.0, "Maximum epsilon (see G4 documentation)"}
protected

Definition at line 80 of file G4FieldManagerToolBase.h.

◆ m_maxStep

Gaudi::Property<double> G4FieldManagerToolBase::m_maxStep {this, "MaximumStep", -1.0, "Maximum step length in field (see G4 documentation)"}
protected

Definition at line 84 of file G4FieldManagerToolBase.h.

◆ m_minEps

Gaudi::Property<double> G4FieldManagerToolBase::m_minEps {this, "MinimumEpsilonStep", -1.0, "Minimum epsilon (see G4 documentation)"}
protected

Definition at line 79 of file G4FieldManagerToolBase.h.

◆ m_minStep

Gaudi::Property<double> G4FieldManagerToolBase::m_minStep {this, "MinimumStep",1e-2, "Minimum step length in field (see G4 documentation)"}
protected

Definition at line 85 of file G4FieldManagerToolBase.h.


The documentation for this class was generated from the following files:
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
G4FieldManagerToolBase::m_equationOfMotion
ToolHandle< IEquationOfMotionTool > m_equationOfMotion
The type of equation of motion to use.
Definition: G4FieldManagerToolBase.h:74
G4FieldManagerToolBase::m_minEps
Gaudi::Property< double > m_minEps
Definition: G4FieldManagerToolBase.h:79
G4FieldManagerToolBase::m_fieldOn
Gaudi::Property< bool > m_fieldOn
Definition: G4FieldManagerToolBase.h:68
G4FieldManagerToolBase::m_fieldSvc
ServiceHandle< IG4FieldSvc > m_fieldSvc
Handle to the G4 field service.
Definition: G4FieldManagerToolBase.h:65
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
G4FieldManagerToolBase::m_deltaOneStep
Gaudi::Property< double > m_deltaOneStep
Definition: G4FieldManagerToolBase.h:82
G4FieldManagerToolBase::m_deltaChord
Gaudi::Property< double > m_deltaChord
Definition: G4FieldManagerToolBase.h:81
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
G4FieldManagerToolBase::m_deltaIntersection
Gaudi::Property< double > m_deltaIntersection
Definition: G4FieldManagerToolBase.h:83
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
G4FieldManagerToolBase::m_maxEps
Gaudi::Property< double > m_maxEps
Definition: G4FieldManagerToolBase.h:80