ATLAS Offline Software
Loading...
Searching...
No Matches
G4UA::EnergyLossRecorderTool Class Reference

A class to manage EnergyLossRecorder actions. More...

#include <EnergyLossRecorderTool.h>

Inheritance diagram for G4UA::EnergyLossRecorderTool:
Collaboration diagram for G4UA::EnergyLossRecorderTool:

Public Member Functions

 EnergyLossRecorderTool (const std::string &type, const std::string &name, const IInterface *parent)
 standard tool ctor
virtual StatusCode initialize () override final
 Athena initialize method.
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists.
StatusCode BeginOfAthenaEvent (HitCollectionMap &) override
 Calls BeginOfAthenaEvent.
StatusCode EndOfAthenaEvent (HitCollectionMap &) override
 Calls EndOfAthenaEvent.

Protected Member Functions

virtual std::unique_ptr< EnergyLossRecordermakeAndFillAction (G4AtlasUserActions &) override final
 creates the instance for this thread

Protected Attributes

ThreadSpecificUserAction< EnergyLossRecorderm_actions
 Thread-specific storage of the user action.

Private Attributes

EnergyLossRecorder::Config m_config
 stores the config obtained from the python side
ToolHandle< Trk::IPositionMomentumWriterm_pmWriter

Detailed Description

A class to manage EnergyLossRecorder actions.

creates one instance of the action per thread

Author
Andrea Di Simone

Definition at line 29 of file EnergyLossRecorderTool.h.

Constructor & Destructor Documentation

◆ EnergyLossRecorderTool()

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

standard tool ctor

Definition at line 11 of file EnergyLossRecorderTool.cxx.

14 : UserActionToolBase<EnergyLossRecorder>(type, name, parent),
15 m_pmWriter("")
16 {
17 declareProperty("PositionMomentumWriter", m_pmWriter, "");
18 }
ToolHandle< Trk::IPositionMomentumWriter > m_pmWriter
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< EnergyLossRecorder >::BeginOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls BeginOfAthenaEvent.

Definition at line 59 of file UserActionToolBase.h.

59{return StatusCode::SUCCESS;};
abstract template utility base-class for G4 user-action tools.

◆ EndOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< EnergyLossRecorder >::EndOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls EndOfAthenaEvent.

Definition at line 61 of file UserActionToolBase.h.

61{return StatusCode::SUCCESS;};

◆ fillUserAction()

virtual StatusCode G4UA::UserActionToolBase< EnergyLossRecorder >::fillUserAction ( G4AtlasUserActions & actionLists)
inlinefinaloverridevirtualinherited

Fill the user action lists.

Definition at line 47 of file UserActionToolBase.h.

48 {
50 if(myAction == nullptr) {
51 ATH_MSG_ERROR( "Failed to construct user action in " << name() );
53 }
56 }
#define ATH_MSG_ERROR(x)
virtual std::unique_ptr< EnergyLossRecorder > makeAndFillAction(G4AtlasUserActions &actionLists)=0

◆ initialize()

StatusCode G4UA::EnergyLossRecorderTool::initialize ( )
finaloverridevirtual

Athena initialize method.

Definition at line 20 of file EnergyLossRecorderTool.cxx.

21 {
22 if(!m_pmWriter.empty()) {
23 ATH_CHECK(m_pmWriter.retrieve());
24 // FIXME: thread-unsafe usage of a component in a thread-local action?
25 // See ATLASSIM-3562.
26 m_config.pmWriter = &(*m_pmWriter);
27 }
28 return StatusCode::SUCCESS;
29 }
#define ATH_CHECK
Evaluate an expression and check for errors.
EnergyLossRecorder::Config m_config
stores the config obtained from the python side

◆ makeAndFillAction()

std::unique_ptr< EnergyLossRecorder > G4UA::EnergyLossRecorderTool::makeAndFillAction ( G4AtlasUserActions & actionList)
finaloverrideprotectedvirtual

creates the instance for this thread

Implements G4UA::UserActionToolBase< EnergyLossRecorder >.

Definition at line 32 of file EnergyLossRecorderTool.cxx.

33 {
34 ATH_MSG_DEBUG("Constructing an EnergyLossRecorder action");
35 auto action = std::make_unique<EnergyLossRecorder>(m_config);
36 actionList.runActions.push_back( action.get() );
37 actionList.eventActions.push_back( action.get() );
38 actionList.steppingActions.push_back( action.get() );
39 return action;
40 }
#define ATH_MSG_DEBUG(x)

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 70 of file UserActionToolBase.h.

◆ m_config

EnergyLossRecorder::Config G4UA::EnergyLossRecorderTool::m_config
private

stores the config obtained from the python side

Definition at line 44 of file EnergyLossRecorderTool.h.

◆ m_pmWriter

ToolHandle<Trk::IPositionMomentumWriter> G4UA::EnergyLossRecorderTool::m_pmWriter
private

Definition at line 45 of file EnergyLossRecorderTool.h.


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