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

Tool which manages the G4SimTimer action. More...

#include <G4SimTimerTool.h>

Inheritance diagram for G4UA::G4SimTimerTool:
Collaboration diagram for G4UA::G4SimTimerTool:

Public Member Functions

 G4SimTimerTool (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor.
virtual StatusCode initialize () override
 Initialize the tool.
virtual StatusCode finalize () override
 Finalize and merge results from all worker 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< G4SimTimermakeAndFillAction (G4AtlasUserActions &) override final
 Create aciton for this thread.

Protected Attributes

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

Detailed Description

Tool which manages the G4SimTimer action.

Create the G4SimTimer for each worker thread and merges timing results in finalization.

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

Definition at line 28 of file G4SimTimerTool.h.

Constructor & Destructor Documentation

◆ G4SimTimerTool()

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

Standard constructor.

Definition at line 13 of file G4SimTimerTool.cxx.

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

Member Function Documentation

◆ BeginOfAthenaEvent()

StatusCode G4UA::UserActionToolBase< G4SimTimer >::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< G4SimTimer >::EndOfAthenaEvent ( HitCollectionMap & )
inlineoverrideinherited

Calls EndOfAthenaEvent.

Definition at line 61 of file UserActionToolBase.h.

61{return StatusCode::SUCCESS;};

◆ fillUserAction()

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

◆ finalize()

StatusCode G4UA::G4SimTimerTool::finalize ( )
overridevirtual

Finalize and merge results from all worker threads.

Definition at line 32 of file G4SimTimerTool.cxx.

33 {
34 ATH_MSG_DEBUG( "Finalizing " << name() );
35
36 // Accumulate results across threads
37 G4SimTimer::Report report;
38 m_actions.accumulate(report, &G4SimTimer::getReport,
40
41 // Report the results
42 auto meanSigma = report.meanAndSigma();
43 ATH_MSG_INFO("Finalized timing results for " << report.nEvent <<
44 " events (not all events used)");
45 ATH_MSG_INFO("Average time per event was " <<
46 std::setprecision(4) << meanSigma.first << " +- " <<
47 std::setprecision(4) << meanSigma.second);
48 return StatusCode::SUCCESS;
49 }
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
const Report & getReport() const
Retrieve my timing results.
Definition G4SimTimer.h:77
ThreadSpecificUserAction< G4SimTimer > m_actions
list report
Definition checkTP.py:125
void merge(const Report &rep)
Definition G4SimTimer.h:60

◆ initialize()

StatusCode G4UA::G4SimTimerTool::initialize ( )
overridevirtual

Initialize the tool.

Definition at line 23 of file G4SimTimerTool.cxx.

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

◆ makeAndFillAction()

std::unique_ptr< G4SimTimer > G4UA::G4SimTimerTool::makeAndFillAction ( G4AtlasUserActions & actionList)
finaloverrideprotectedvirtual

Create aciton for this thread.

Implements G4UA::UserActionToolBase< G4SimTimer >.

Definition at line 55 of file G4SimTimerTool.cxx.

56 {
57 ATH_MSG_DEBUG("Making a G4SimTimer action");
58 auto action = std::make_unique<G4SimTimer>();
59 actionList.eventActions.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: