ATLAS Offline Software
Loading...
Searching...
No Matches
EnergyLossRecorderTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace G4UA
9{
10
12 const std::string& name,
13 const IInterface* parent)
15 m_pmWriter("")
16 {
17 declareProperty("PositionMomentumWriter", m_pmWriter, "");
18 }
19
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 }
30
31 std::unique_ptr<EnergyLossRecorder>
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 }
41
42} // namespace G4UA
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
EnergyLossRecorder::Config m_config
stores the config obtained from the python side
virtual StatusCode initialize() override final
Athena initialize method.
virtual std::unique_ptr< EnergyLossRecorder > makeAndFillAction(G4AtlasUserActions &) override final
creates the instance for this thread
ToolHandle< Trk::IPositionMomentumWriter > m_pmWriter
EnergyLossRecorderTool(const std::string &type, const std::string &name, const IInterface *parent)
standard tool ctor
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Struct for passing around user actions.
std::vector< G4UserSteppingAction * > steppingActions
std::vector< G4UserEventAction * > eventActions
std::vector< G4UserRunAction * > runActions