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

Gaudi::Property< MCTruthSteppingAction::VolumeCollectionMap_tm_volumeCollectionMap
 Map of volume name to output collection name.
Gaudi::Property< int > m_secondarySavingLevel
 The saving level for secondaries.
Gaudi::Property< int > m_subDetVolLevel
 The level in the G4 volume hierarchy at which we find the sub-detector.
ServiceHandle< ISF::ITruthSvcm_truthRecordSvc
 Central Truth Service.
ServiceHandle< ISF::IGeoIDSvcm_geoIDSvc
 Geo ID Service.

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 31 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 {}
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 49 of file MCTruthSteppingActionTool.cxx.

50 {
51 for(const auto& volCollPair : m_volumeCollectionMap.value()) {
52 hitCollections.Emplace<TrackRecordCollection>(volCollPair.second, volCollPair.second);
53 }
54 return StatusCode::SUCCESS;
55 }
AtlasHitsVector< TrackRecord > TrackRecordCollection
Gaudi::Property< MCTruthSteppingAction::VolumeCollectionMap_t > m_volumeCollectionMap
Map of volume name to output collection name.
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 57 of file MCTruthSteppingActionTool.cxx.

58 {
59 for(const auto& volCollPair : m_volumeCollectionMap.value()) {
60 CHECK(hitCollections.Record<TrackRecordCollection>(volCollPair.second));
61 }
62 return StatusCode::SUCCESS;
63 }
#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 23 of file MCTruthSteppingActionTool.cxx.

24 {
25 ATH_MSG_DEBUG( "Initializing " << name() );
26 ATH_CHECK(m_truthRecordSvc.retrieve());
27 ATH_CHECK(m_geoIDSvc.retrieve());
28 return StatusCode::SUCCESS;
29 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
ServiceHandle< ISF::IGeoIDSvc > m_geoIDSvc
Geo ID Service.
ServiceHandle< ISF::ITruthSvc > m_truthRecordSvc
Central Truth Service.

◆ 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 35 of file MCTruthSteppingActionTool.cxx.

36 {
37 ATH_MSG_DEBUG("Constructing an MCTruthSteppingAction");
38 auto action = std::make_unique<MCTruthSteppingAction> (
40 m_subDetVolLevel.value(),
42 msgSvc(), msg().level() );
43 actionLists.eventActions.push_back( action.get() );
44 actionLists.steppingActions.push_back( action.get() );
45 return action;
46 }
Gaudi::Property< int > m_subDetVolLevel
The level in the G4 volume hierarchy at which we find the sub-detector.
Gaudi::Property< int > m_secondarySavingLevel
The saving level for secondaries.
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_geoIDSvc

ServiceHandle<ISF::IGeoIDSvc> G4UA::MCTruthSteppingActionTool::m_geoIDSvc
private
Initial value:
{
this, "GeoIDSvc", "ISF_GeoIDSvc", "ISF GeoID Service"}

Geo ID Service.

Definition at line 76 of file MCTruthSteppingActionTool.h.

76 {
77 this, "GeoIDSvc", "ISF_GeoIDSvc", "ISF GeoID Service"};

◆ m_secondarySavingLevel

Gaudi::Property<int> G4UA::MCTruthSteppingActionTool::m_secondarySavingLevel
private
Initial value:
{
this, "SecondarySavingLevel", 2,
"Three valid options: 1 - Primaries; 2 - StoredSecondaries(default); 3 - All"}

The saving level for secondaries.

Definition at line 62 of file MCTruthSteppingActionTool.h.

62 {
63 this, "SecondarySavingLevel", 2,
64 "Three valid options: 1 - Primaries; 2 - StoredSecondaries(default); 3 - All"};

◆ m_subDetVolLevel

Gaudi::Property<int> G4UA::MCTruthSteppingActionTool::m_subDetVolLevel
private
Initial value:
{
this, "SubDetVolumeLevel", 1,
"The level in the G4 volume hierarchy at which we find the sub-detector name"}

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

Definition at line 67 of file MCTruthSteppingActionTool.h.

67 {
68 this, "SubDetVolumeLevel", 1,
69 "The level in the G4 volume hierarchy at which we find the sub-detector name"};

◆ m_truthRecordSvc

ServiceHandle<ISF::ITruthSvc> G4UA::MCTruthSteppingActionTool::m_truthRecordSvc
private
Initial value:
{
this, "TruthRecordSvc", "ISF_TruthRecordSvc", "ISF Particle Truth Service"}

Central Truth Service.

Definition at line 72 of file MCTruthSteppingActionTool.h.

72 {
73 this, "TruthRecordSvc", "ISF_TruthRecordSvc", "ISF Particle Truth Service"};

◆ m_volumeCollectionMap

Gaudi::Property<MCTruthSteppingAction::VolumeCollectionMap_t> G4UA::MCTruthSteppingActionTool::m_volumeCollectionMap
private
Initial value:
{this, "VolumeCollectionMap", {},
"Map of volume name to output collection name"}

Map of volume name to output collection name.

Definition at line 58 of file MCTruthSteppingActionTool.h.

58 {this, "VolumeCollectionMap", {},
59 "Map of volume name to output collection name"};

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