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.
int m_secondarySavingLevel
 The saving level for secondaries.
int m_subDetVolLevel
 The level in the G4 volume hierarchy at which we find the sub-detector.

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.

20 {
21 declareProperty("VolumeCollectionMap", m_volumeCollectionMap,
22 "Map of volume name to output collection name");
23 declareProperty("SecondarySavingLevel", m_secondarySavingLevel,
24 "Three valid options: 1 - Primaries; "
25 "2 - StoredSecondaries(default); 3 - All");
26 declareProperty("SubDetVolumeLevel", m_subDetVolLevel,
27 "The level in the G4 volume hierarchy at which can we find "
28 "the sub-detector name");
29 }
int m_secondarySavingLevel
The saving level for secondaries.
int m_subDetVolLevel
The level in the G4 volume hierarchy at which we find the sub-detector.
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 56 of file MCTruthSteppingActionTool.cxx.

57 {
58 for(const auto& volCollPair : m_volumeCollectionMap) {
59 hitCollections.Emplace<TrackRecordCollection>(volCollPair.second, volCollPair.second);
60 }
61 return StatusCode::SUCCESS;
62 }
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 64 of file MCTruthSteppingActionTool.cxx.

65 {
66 for(const auto& volCollPair : m_volumeCollectionMap) {
67 CHECK(hitCollections.Record<TrackRecordCollection>(volCollPair.second));
68 }
69 return StatusCode::SUCCESS;
70 }
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode 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 34 of file MCTruthSteppingActionTool.cxx.

35 {
36 ATH_MSG_DEBUG( "Initializing " << name() );
37 return StatusCode::SUCCESS;
38 }
#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 44 of file MCTruthSteppingActionTool.cxx.

45 {
46 ATH_MSG_DEBUG("Constructing an MCTruthSteppingAction");
47 auto action = std::make_unique<MCTruthSteppingAction> (
49 msgSvc(), msg().level() );
50 actionLists.eventActions.push_back( action.get() );
51 actionLists.steppingActions.push_back( action.get() );
52 return action;
53 }
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_secondarySavingLevel

int G4UA::MCTruthSteppingActionTool::m_secondarySavingLevel
private

The saving level for secondaries.

Definition at line 55 of file MCTruthSteppingActionTool.h.

◆ m_subDetVolLevel

int G4UA::MCTruthSteppingActionTool::m_subDetVolLevel
private

The level in the G4 volume hierarchy at which we find the sub-detector.

Definition at line 58 of file MCTruthSteppingActionTool.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: