ATLAS Offline Software
Loading...
Searching...
No Matches
G4MagFieldSvcBase Class Referenceabstract

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

#include "G4AtlasServices/G4MagFieldSvcBase.h"

Inheritance diagram for G4MagFieldSvcBase:
Collaboration diagram for G4MagFieldSvcBase:

Public Member Functions

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

Protected Member Functions

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

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}
#define ATH_MSG_DEBUG(x)
virtual G4MagneticField * makeField()=0
This method must be overridden by concrete tools to create a new field.

◆ makeField()

virtual G4MagneticField * G4MagFieldSvcBase::makeField ( )
protectedpure virtual

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

Implemented in ConstantFieldSvc, and StandardFieldSvc.


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