ATLAS Offline Software
Loading...
Searching...
No Matches
G4SimTimer.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef G4USERACTIONS_G4UA_G4SIMTIMER_H
6#define G4USERACTIONS_G4UA_G4SIMTIMER_H
7
8// Infrastructure includes
10
11// Geant4 includes
12#include "G4Timer.hh"
13#include "G4UserEventAction.hh"
14
15// Forward declarations
16class G4Event;
17class G4Run;
18
19namespace G4UA
20{
21
40 class G4SimTimer : public G4UserEventAction, public AthMessaging
41 {
42
43 public:
44
46 struct Report
47 {
49 Report();
52 unsigned int nEvent;
54 double eventTime;
58 std::pair<double, double> meanAndSigma();
59
60 void merge(const Report& rep){
61 nEvent += rep.nEvent;
62 eventTime += rep.eventTime;
63 eventTimeSquared += rep.eventTimeSquared;
64 }
65 };
66
68 G4SimTimer();
69
71 virtual void BeginOfEventAction(const G4Event* event) override final;
72
74 virtual void EndOfEventAction(const G4Event* event) override final;
75
77 const Report& getReport() const
78 { return m_results; }
79
80 private:
81
83 G4Timer m_eventTimer;
84
87
90
91 }; // class G4SimTimer
92
93} // namespace G4UA
94
95#endif // G4USERACTIONS_G4UA_G4SIMTIMER_H
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
G4Timer m_eventTimer
My private instance of an event timer.
Definition G4SimTimer.h:83
const Report & getReport() const
Retrieve my timing results.
Definition G4SimTimer.h:77
virtual void EndOfEventAction(const G4Event *event) override final
Finish timing this Geant4 event.
Report m_results
My timing results.
Definition G4SimTimer.h:86
G4SimTimer()
Constructor.
virtual void BeginOfEventAction(const G4Event *event) override final
Start timing this Geant4 event.
bool m_firstEvent
Used to skip the first event.
Definition G4SimTimer.h:89
Simple struct which holds timing results for an action instance.
Definition G4SimTimer.h:47
std::pair< double, double > meanAndSigma()
Calculate the mean and sample std dev.
double eventTime
Accumulated event time.
Definition G4SimTimer.h:54
Report()
Initializes the variables.
unsigned int nEvent
Number of timed G4 events (we skip the first).
Definition G4SimTimer.h:52
double eventTimeSquared
Accumulated squared event time.
Definition G4SimTimer.h:56
void merge(const Report &rep)
Definition G4SimTimer.h:60