ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
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 More...
 
virtual StatusCode initialize () override final
 Athena initialize method. More...
 
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists. More...
 

Protected Member Functions

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

Protected Attributes

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

Private Attributes

EnergyLossRecorder::Config m_config
 stores the config obtained from the python side More...
 
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  }

Member Function Documentation

◆ fillUserAction()

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

Fill the user action lists.

Definition at line 45 of file UserActionToolBase.h.

46  {
47  auto myAction = makeAndFillAction(actionLists);
48  if(myAction == nullptr) {
49  ATH_MSG_ERROR( "Failed to construct user action in " << name() );
50  return StatusCode::FAILURE;
51  }
52  m_actions.set( std::move(myAction) );
53  return StatusCode::SUCCESS;
54  }

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

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

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 63 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:
G4UA::ThreadSpecificUserAction::set
void set(std::unique_ptr< ActionType > action)
Assign the object of the current thread.
Definition: ThreadSpecificUserAction.h:61
G4UA::EnergyLossRecorderTool::m_config
EnergyLossRecorder::Config m_config
stores the config obtained from the python side
Definition: EnergyLossRecorderTool.h:44
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
G4UA::UserActionToolBase< EnergyLossRecorder >::m_actions
ThreadSpecificUserAction< EnergyLossRecorder > m_actions
Thread-specific storage of the user action.
Definition: UserActionToolBase.h:63
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
G4UA::EnergyLossRecorder::Config::pmWriter
Trk::IPositionMomentumWriter * pmWriter
Definition: EnergyLossRecorder.h:46
G4UA::UserActionToolBase< EnergyLossRecorder >::makeAndFillAction
virtual std::unique_ptr< EnergyLossRecorder > makeAndFillAction(G4AtlasUserActions &actionLists)=0
Make the action and push onto the lists.
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
G4UA::EnergyLossRecorderTool::m_pmWriter
ToolHandle< Trk::IPositionMomentumWriter > m_pmWriter
Definition: EnergyLossRecorderTool.h:45
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15