ATLAS Offline Software
Public Member Functions | Protected Member Functions | List of all members
G4MagFieldSvcBase Class Referenceabstract

#include "G4AtlasServices/G4MagFieldSvcBase.h"

Inheritance diagram for G4MagFieldSvcBase:
Collaboration diagram for G4MagFieldSvcBase:

Public Member Functions

 G4MagFieldSvcBase (const std::string &name, ISvcLocator *pSvcLocator)
 Standard constructor. More...
 
virtual ~G4MagFieldSvcBase ()
 Empty destructor. More...
 
G4MagneticField * getField () override final
 Retrieve a G4 magnetic field object. More...
 

Protected Member Functions

virtual G4MagneticField * makeField ()=0
 This method must be overridden by concrete tools to create a new field. More...
 

Detailed Description

Base class for services that create/manage G4 magnetic fields.

Author
Andrea Dell'Acqua
Date
2015-11-17

Definition at line 28 of file G4MagFieldSvcBase.h.

Constructor & Destructor Documentation

◆ G4MagFieldSvcBase()

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

Standard constructor.

Definition at line 22 of file G4MagFieldSvcBase.cxx.

24  : base_class(name, pSvcLocator)
25 {
26 }

◆ ~G4MagFieldSvcBase()

virtual G4MagFieldSvcBase::~G4MagFieldSvcBase ( )
inlinevirtual

Empty destructor.

Definition at line 35 of file G4MagFieldSvcBase.h.

35 {};

Member Function Documentation

◆ getField()

G4MagneticField * G4MagFieldSvcBase::getField ( )
finaloverride

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 }

◆ makeField()

virtual G4MagneticField* G4MagFieldSvcBase::makeField ( )
protectedpure virtual

This method must be overridden by concrete tools to create a new field.

Implemented in StandardFieldSvc, and ConstantFieldSvc.


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_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240