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

Tool which manages the G4TrackCounter action. More...

#include <G4TrackCounterTool.h>

Inheritance diagram for G4UA::G4TrackCounterTool:
Collaboration diagram for G4UA::G4TrackCounterTool:

Public Member Functions

 G4TrackCounterTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor.
virtual StatusCode initialize () override final
 Initialize tool.
virtual StatusCode finalize () override final
 Finalize and merge results from all threads.
virtual StatusCode fillUserAction (G4AtlasUserActions &actionLists) override final
 Fill the user action lists.
StatusCode BeginOfAthenaEvent (HitCollectionMap &) override
 Calls BeginOfAthenaEvent.
StatusCode EndOfAthenaEvent (HitCollectionMap &) override
 Calls EndOfAthenaEvent.

Protected Member Functions

virtual std::unique_ptr< G4TrackCountermakeAndFillAction (G4AtlasUserActions &) override final
 Create action for this thread.

Protected Attributes

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

Detailed Description

Tool which manages the G4TrackCounter action.

This tool creates the G4TrackCounter for each thread and merges the track counts from all threads in finalization.

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

Definition at line 24 of file G4TrackCounterTool.h.

Constructor & Destructor Documentation

◆ G4TrackCounterTool()

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

Standard constructor.

Definition at line 13 of file G4TrackCounterTool.cxx.

16 : UserActionToolBase<G4TrackCounter>(type, name, parent)
17 {
18 }
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< G4TrackCounter >::BeginOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls BeginOfAthenaEvent.

Definition at line 59 of file UserActionToolBase.h.

59{return StatusCode::SUCCESS;};
abstract template utility base-class for G4 user-action tools.

◆ EndOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< G4TrackCounter >::EndOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls EndOfAthenaEvent.

Definition at line 61 of file UserActionToolBase.h.

61{return StatusCode::SUCCESS;};

◆ fillUserAction()

virtual StatusCode G4UA::UserActionToolBase< G4TrackCounter >::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)
virtual std::unique_ptr< G4TrackCounter > makeAndFillAction(G4AtlasUserActions &actionLists)=0

◆ finalize()

StatusCode G4UA::G4TrackCounterTool::finalize ( )
finaloverridevirtual

Finalize and merge results from all threads.

Definition at line 32 of file G4TrackCounterTool.cxx.

33 {
34 ATH_MSG_DEBUG( "Finalizing " << name() );
35
36 // Accumulate the results across threads
37 G4TrackCounter::Report report;
38 m_actions.accumulate(report, &G4TrackCounter::getReport,
40
41 // Report the totals
42 ATH_MSG_INFO("nEvents " << report.nEvents);
43 ATH_MSG_INFO("nPrimaryTracks " << report.nPrimaryTracks);
44 ATH_MSG_INFO("nSecondaryTracks " << report.nSecondaryTracks);
45 ATH_MSG_INFO("n50MeVTracks " << report.n50MeVTracks);
46
47 return StatusCode::SUCCESS;
48 }
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
const Report & getReport() const
Retrieve my counts.
ThreadSpecificUserAction< G4TrackCounter > m_actions
list report
Definition checkTP.py:125
void merge(const Report &rep)

◆ initialize()

StatusCode G4UA::G4TrackCounterTool::initialize ( )
finaloverridevirtual

Initialize tool.

Definition at line 23 of file G4TrackCounterTool.cxx.

24 {
25 ATH_MSG_DEBUG( "Initializing " << name() );
26 return StatusCode::SUCCESS;
27 }

◆ makeAndFillAction()

std::unique_ptr< G4TrackCounter > G4UA::G4TrackCounterTool::makeAndFillAction ( G4AtlasUserActions & actionList)
finaloverrideprotectedvirtual

Create action for this thread.

Implements G4UA::UserActionToolBase< G4TrackCounter >.

Definition at line 54 of file G4TrackCounterTool.cxx.

55 {
56 ATH_MSG_DEBUG("Making a G4TrackCounter action");
57 auto action = std::make_unique<G4TrackCounter>();
58 actionList.eventActions.push_back( action.get() );
59 actionList.trackingActions.push_back( action.get() );
60 return action;
61 }

Member Data Documentation

◆ m_actions

Thread-specific storage of the user action.

Definition at line 70 of file UserActionToolBase.h.


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