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

A tool for managing the MCTruthSteppingAction. More...

#include <MCTruthSteppingActionTool.h>

Inheritance diagram for G4UA::MCTruthSteppingActionTool:
Collaboration diagram for G4UA::MCTruthSteppingActionTool:

Public Member Functions

 MCTruthSteppingActionTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor.
virtual StatusCode initialize () override final
 Initialize the tool.
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists.

Protected Member Functions

virtual std::unique_ptr< MCTruthSteppingActionmakeAndFillAction (G4AtlasUserActions &) override final
 Setup the user action for current thread.
StatusCode BeginOfAthenaEvent (HitCollectionMap &) override
 Calls BeginOfAthenaEvent.
StatusCode EndOfAthenaEvent (HitCollectionMap &) override
 Calls EndOfAthenaEvent.

Protected Attributes

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

Private Attributes

std::map< std::string, std::string > m_volumeCollectionMap
 Map of volume name to output collection name.

Detailed Description

A tool for managing the MCTruthSteppingAction.

Author
Steve Farrell Steve.nosp@m.n.Fa.nosp@m.rrell.nosp@m.@cer.nosp@m.n.ch

Definition at line 26 of file MCTruthSteppingActionTool.h.

Constructor & Destructor Documentation

◆ MCTruthSteppingActionTool()

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

Standard constructor.

Definition at line 14 of file MCTruthSteppingActionTool.cxx.

18 {
19 declareProperty("VolumeCollectionMap", m_volumeCollectionMap,
20 "Map of volume name to output collection name");
21 }
std::map< std::string, std::string > m_volumeCollectionMap
Map of volume name to output collection name.
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode G4UA::MCTruthSteppingActionTool::BeginOfAthenaEvent ( HitCollectionMap & hitCollections)
overrideprotected

Calls BeginOfAthenaEvent.

Definition at line 47 of file MCTruthSteppingActionTool.cxx.

48 {
49 for(const auto& volCollPair : m_volumeCollectionMap) {
50 hitCollections.Emplace<TrackRecordCollection>(volCollPair.second, volCollPair.second);
51 }
52 return StatusCode::SUCCESS;
53 }
AtlasHitsVector< TrackRecord > TrackRecordCollection
std::pair< StorageIterator, bool > Emplace(std::string const &hitCollectionName, CollectionArgs &&... args)
Insert a container in the map with in-place construction.

◆ EndOfAthenaEvent()

StatusCode G4UA::MCTruthSteppingActionTool::EndOfAthenaEvent ( HitCollectionMap & hitCollections)
overrideprotected

Calls EndOfAthenaEvent.

Definition at line 55 of file MCTruthSteppingActionTool.cxx.

56 {
57 for(const auto& volCollPair : m_volumeCollectionMap) {
58 hitCollections.Record<TrackRecordCollection>(volCollPair.second);
59 }
60 return StatusCode::SUCCESS;
61 }
void Record(std::string const &sgKey, std::string const &hitCollectionName, EventContext const &ctx)
Record the hit collection hitCollectionName to the StoreGate sgKey.

◆ fillUserAction()

virtual StatusCode G4UA::UserActionToolBase< MCTruthSteppingAction >::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)
abstract template utility base-class for G4 user-action tools.
virtual std::unique_ptr< MCTruthSteppingAction > makeAndFillAction(G4AtlasUserActions &actionLists)=0

◆ initialize()

StatusCode G4UA::MCTruthSteppingActionTool::initialize ( )
finaloverridevirtual

Initialize the tool.

Definition at line 26 of file MCTruthSteppingActionTool.cxx.

27 {
28 ATH_MSG_DEBUG( "Initializing " << name() );
29 return StatusCode::SUCCESS;
30 }
#define ATH_MSG_DEBUG(x)

◆ makeAndFillAction()

std::unique_ptr< MCTruthSteppingAction > G4UA::MCTruthSteppingActionTool::makeAndFillAction ( G4AtlasUserActions & actionLists)
finaloverrideprotectedvirtual

Setup the user action for current thread.

Implements G4UA::UserActionToolBase< MCTruthSteppingAction >.

Definition at line 36 of file MCTruthSteppingActionTool.cxx.

37 {
38 ATH_MSG_DEBUG("Constructing an MCTruthSteppingAction");
39 auto action = std::make_unique<MCTruthSteppingAction> (
41 actionLists.eventActions.push_back( action.get() );
42 actionLists.steppingActions.push_back( action.get() );
43 return action;
44 }
msgSvc
Provide convenience handles for various services.
Definition StdJOSetup.py:36
MsgStream & msg
Definition testRead.cxx:32

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 70 of file UserActionToolBase.h.

◆ m_volumeCollectionMap

std::map<std::string, std::string> G4UA::MCTruthSteppingActionTool::m_volumeCollectionMap
private

Map of volume name to output collection name.

Definition at line 52 of file MCTruthSteppingActionTool.h.


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