ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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. More...
 
 ~ConstantFieldSvc ()=default
 
StatusCode initialize () override final
 Athena method. More...
 
G4MagneticField * getField () override final
 Retrieve a G4 magnetic field object. More...
 

Protected Member Functions

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

Protected Attributes

thread_utils::ThreadLocalOwner< G4MagneticField > m_fieldHolder
 Thread-local field object. More...
 

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 }

◆ ~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 29 of file G4MagFieldSvcBase.cxx.

30 {
31  ATH_MSG_DEBUG("G4MagFieldSvcBase::getField");
32 
33  // Check if we already have a field setup for current thread
34  auto field = m_fieldHolder.get();
35  // If not, we create one
36  if(!field) {
37  field = makeField();
39  }
40 
41  return field;
42 }

◆ 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 }

Member Data Documentation

◆ m_fieldHolder

thread_utils::ThreadLocalOwner<G4MagneticField> G4MagFieldSvcBase::m_fieldHolder
protectedinherited

Thread-local field object.

Definition at line 48 of file G4MagFieldSvcBase.h.

◆ m_fieldX

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

Definition at line 39 of file ConstantFieldSvc.h.

◆ m_fieldY

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

Definition at line 40 of file ConstantFieldSvc.h.

◆ m_fieldZ

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

Definition at line 41 of file ConstantFieldSvc.h.


The documentation for this class was generated from the following files:
G4MagFieldSvcBase::makeField
virtual G4MagneticField * makeField()=0
This method must be overridden by concrete tools to create a new field.
ReadOfcFromCool.field
field
Definition: ReadOfcFromCool.py:48
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
thread_utils::ThreadLocalHolder::set
void set(T *obj)
Assign the object of the current thread.
Definition: ThreadLocalHolder.h:67
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ConstantFieldSvc::m_fieldY
Gaudi::Property< double > m_fieldY
Definition: ConstantFieldSvc.h:40
thread_utils::ThreadLocalHolder::get
T * get()
Get the object of the current thread.
Definition: ThreadLocalHolder.h:60
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
G4MagFieldSvcBase::G4MagFieldSvcBase
G4MagFieldSvcBase(const std::string &name, ISvcLocator *pSvcLocator)
Standard constructor.
Definition: G4MagFieldSvcBase.cxx:20
ConstantFieldSvc::m_fieldZ
Gaudi::Property< double > m_fieldZ
Definition: ConstantFieldSvc.h:41
ConstantFieldSvc::m_fieldX
Gaudi::Property< double > m_fieldX
Definition: ConstantFieldSvc.h:39
G4MagFieldSvcBase::m_fieldHolder
thread_utils::ThreadLocalOwner< G4MagneticField > m_fieldHolder
Thread-local field object.
Definition: G4MagFieldSvcBase.h:48