ATLAS Offline Software
Loading...
Searching...
No Matches
ConstantFieldSvc Class Referencefinal

#include <ConstantFieldSvc.h>

Inheritance diagram for ConstantFieldSvc:
Collaboration diagram for ConstantFieldSvc:

Public Member Functions

 ConstantFieldSvc (const std::string &name, ISvcLocator *pSvcLocator)
 Basic constructor and destructor.
 ~ConstantFieldSvc ()=default
StatusCode initialize () override final
 Athena method.
G4MagneticField * getField () override final
 Retrieve a G4 magnetic field object.

Protected Member Functions

G4MagneticField * makeField () override final
 Create the field object.

Private Attributes

Field vector components - What are the units??
Gaudi::Property< double > m_fieldX {this, "FieldX", 0., "Field X component"}
Gaudi::Property< double > m_fieldY {this, "FieldY", 0., "Field Y component"}
Gaudi::Property< double > m_fieldZ {this, "FieldZ", 0., "Field Z component"}

Detailed Description

Todo
Needs documentation

Definition at line 19 of file ConstantFieldSvc.h.

Constructor & Destructor Documentation

◆ ConstantFieldSvc()

ConstantFieldSvc::ConstantFieldSvc ( const std::string & name,
ISvcLocator * pSvcLocator )

Basic constructor and destructor.

Definition at line 10 of file ConstantFieldSvc.cxx.

11 : G4MagFieldSvcBase(name, pSvcLocator)
12{
13}
G4MagFieldSvcBase(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.

◆ ~ConstantFieldSvc()

ConstantFieldSvc::~ConstantFieldSvc ( )
default

Member Function Documentation

◆ getField()

G4MagneticField * G4MagFieldSvcBase::getField ( )
finaloverrideinherited

Retrieve a G4 magnetic field object.

If one doesn't yet exist in the current thread, it will be created.

Definition at line 31 of file G4MagFieldSvcBase.cxx.

32{
33 ATH_MSG_DEBUG("G4MagFieldSvcBase::getField");
34
35 // create a thread-local magnetic field instance
36 static thread_local std::unique_ptr<G4MagneticField> field{makeField()};
37
38 return field.get();
39}
#define ATH_MSG_DEBUG(x)
virtual G4MagneticField * makeField()=0
This method must be overridden by concrete tools to create a new field.

◆ initialize()

StatusCode ConstantFieldSvc::initialize ( )
finaloverride

Athena method.

called at initialization time, being customized here

Definition at line 15 of file ConstantFieldSvc.cxx.

16{
17 ATH_MSG_DEBUG( "Initializing " << name() );
18 return StatusCode::SUCCESS;
19}

◆ makeField()

G4MagneticField * ConstantFieldSvc::makeField ( )
finaloverrideprotectedvirtual

Create the field object.

Implements G4MagFieldSvcBase.

Definition at line 21 of file ConstantFieldSvc.cxx.

22{
23 ATH_MSG_VERBOSE( "ConstantFieldSvc::makeField" );
24 const G4ThreeVector fieldVec(m_fieldX, m_fieldY, m_fieldZ);
25 return new G4UniformMagField(fieldVec);
26}
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< double > m_fieldX
Gaudi::Property< double > m_fieldZ
Gaudi::Property< double > m_fieldY

Member Data Documentation

◆ m_fieldX

Gaudi::Property<double> ConstantFieldSvc::m_fieldX {this, "FieldX", 0., "Field X component"}
private

Definition at line 39 of file ConstantFieldSvc.h.

39{this, "FieldX", 0., "Field X component"};

◆ m_fieldY

Gaudi::Property<double> ConstantFieldSvc::m_fieldY {this, "FieldY", 0., "Field Y component"}
private

Definition at line 40 of file ConstantFieldSvc.h.

40{this, "FieldY", 0., "Field Y component"};

◆ m_fieldZ

Gaudi::Property<double> ConstantFieldSvc::m_fieldZ {this, "FieldZ", 0., "Field Z component"}
private

Definition at line 41 of file ConstantFieldSvc.h.

41{this, "FieldZ", 0., "Field Z component"};

The documentation for this class was generated from the following files: