ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
G4UA::TestActionVPTimer Class Reference

#include <TestActionVPTimer.h>

Inheritance diagram for G4UA::TestActionVPTimer:
Collaboration diagram for G4UA::TestActionVPTimer:

Classes

struct  Config
 
struct  Report
 
struct  volumeData
 

Public Types

typedef std::map< VolTree, TestActionVPTimer::volumeDataVolMap
 
typedef VolMap::const_iterator VolIt
 

Public Member Functions

 TestActionVPTimer (const Config &config)
 
 TestActionVPTimer (const TestActionVPTimer &)=delete
 
TestActionVPTimeroperator= (const TestActionVPTimer &)=delete
 
const ReportgetReport () const
 
virtual void BeginOfEventAction (const G4Event *) override
 
virtual void EndOfEventAction (const G4Event *) override
 
virtual void BeginOfRunAction (const G4Run *) override
 
virtual void EndOfRunAction (const G4Run *) override
 
virtual void UserSteppingAction (const G4Step *) override
 

Private Member Functions

double TimerSum (G4Timer *timer) const
 Gets the time from the timer for summation. More...
 

Private Attributes

Config m_config
 
Report m_report
 
G4Timer * m_runTimer
 Timer for the entire run. More...
 
G4Timer * m_eventTimer
 Timer for this event. More...
 
G4Timer * v_timer
 Timer activated for each volume. More...
 
double m_eventTime
 Double for storing this event time. More...
 
VolTree v_history
 Vector of the current volume history, used to assign times to each element. More...
 

Detailed Description

Definition at line 51 of file TestActionVPTimer.h.

Member Typedef Documentation

◆ VolIt

typedef VolMap::const_iterator G4UA::TestActionVPTimer::VolIt

Definition at line 100 of file TestActionVPTimer.h.

◆ VolMap

Definition at line 99 of file TestActionVPTimer.h.

Constructor & Destructor Documentation

◆ TestActionVPTimer() [1/2]

G4UA::TestActionVPTimer::TestActionVPTimer ( const Config config)

Definition at line 48 of file TestActionVPTimer.cxx.

50  {
51  // create event & run timers
52  m_runTimer = new G4Timer();
53  m_runTimer->Start();
54  m_runTimer->Stop();
55  m_eventTimer = new G4Timer();
56  m_eventTimer->Start();
57  m_eventTimer->Stop();
58 
59  // create step timer
60  v_timer = new G4Timer();
61  v_timer->Start();
62  v_timer->Stop();
63  }

◆ TestActionVPTimer() [2/2]

G4UA::TestActionVPTimer::TestActionVPTimer ( const TestActionVPTimer )
delete

Member Function Documentation

◆ BeginOfEventAction()

void G4UA::TestActionVPTimer::BeginOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 65 of file TestActionVPTimer.cxx.

66  {
67  m_report.nev++;
68  m_eventTimer->Start();
69  }

◆ BeginOfRunAction()

void G4UA::TestActionVPTimer::BeginOfRunAction ( const G4Run *  )
overridevirtual

Definition at line 77 of file TestActionVPTimer.cxx.

78  {
79  m_runTimer->Start();
80  }

◆ EndOfEventAction()

void G4UA::TestActionVPTimer::EndOfEventAction ( const G4Event *  )
overridevirtual

Definition at line 71 of file TestActionVPTimer.cxx.

72  {
73  // this function also stops the timer. it will be restarted at BoE
75  }

◆ EndOfRunAction()

void G4UA::TestActionVPTimer::EndOfRunAction ( const G4Run *  )
overridevirtual

Definition at line 82 of file TestActionVPTimer.cxx.

83  {
84  // this also stops the timer
86  }

◆ getReport()

const Report& G4UA::TestActionVPTimer::getReport ( ) const
inline

Definition at line 141 of file TestActionVPTimer.h.

142  { return m_report; }

◆ operator=()

TestActionVPTimer& G4UA::TestActionVPTimer::operator= ( const TestActionVPTimer )
delete

◆ TimerSum()

double G4UA::TestActionVPTimer::TimerSum ( G4Timer *  timer) const
inlineprivate

Gets the time from the timer for summation.

Stops a timer and return the elapsed time.

Definition at line 166 of file TestActionVPTimer.h.

167  {
168  if (timer == 0) return -999.;
169  timer->Stop();
170  return (timer->GetUserElapsed() + timer->GetSystemElapsed());
171  }

◆ UserSteppingAction()

void G4UA::TestActionVPTimer::UserSteppingAction ( const G4Step *  aStep)
overridevirtual

Definition at line 88 of file TestActionVPTimer.cxx.

89  {
90  // HERE IS WHERE WE BEGIN OUR CLOCKING -- ONLY IF
91  // TIMERS ARE NOT VALID
92 
93  if (!v_timer->IsValid()) {
94 
95  // Collect the total time before processing anything else
96  // this stops the timer
97  double vtime = TimerSum(v_timer);
98 
99  // CHECKIN' OUT THA NAVIGATA
100  VolumeTreeNavigator currentTree( aStep );
101 
102  // Set depth cuts here
103  currentTree.SetDepthCutSimple(m_config.dCALO, m_config.dBeam, m_config.dIDET, m_config.dMUON);
104  if ( !m_config.dDetail.empty() ) {
105  currentTree.SetDepthCutDetail( m_config.dDetail.c_str() );
106  }
107 
108  // Store time generated in current volume, remove deepest entry in v_history, then
109  // repeat for the resulting VolTree (one level higher)
110  G4ParticleDefinition* PDef = currentTree.GetTrack()->GetDefinition();
111  while ( true ) {
112  VolTree VHistory = currentTree.Extract();
113  m_report.time_index[VHistory].tTotal += vtime;
114  //std::cout<<"filling "<<m_report.time_index[VHistory].tTotal<<std::endl;
115  if (PDef->GetParticleName() == "neutron") { m_report.time_index[VHistory].tNeutron += vtime; }
116  else if (PDef->GetParticleSubType() == "e") { m_report.time_index[VHistory].tElectron += vtime; }
117  else if (PDef->GetParticleSubType() == "pi") { m_report.time_index[VHistory].tPion += vtime; }
118  else if (PDef->GetParticleType() == "gamma") { m_report.time_index[VHistory].tPhoton += vtime; }
119  else if (PDef->GetParticleType() == "baryon") { m_report.time_index[VHistory].tBaryon += vtime; }
120  else if (PDef->GetParticleType() == "lepton") { m_report.time_index[VHistory].tLepton += vtime; }
121  else if (PDef->GetParticleType() == "meson") { m_report.time_index[VHistory].tMeson += vtime; }
122  else { m_report.time_index[VHistory].tOther += vtime; }
123  //ATH_MSG_DEBUG("Time stored in "<<VHistory.back().first->GetName());
124  if ( !currentTree.Ascend() ) break;
125  }
126  }
127 
128  // Restart timer
129  v_timer->Start();
130  }

Member Data Documentation

◆ m_config

Config G4UA::TestActionVPTimer::m_config
private

Definition at line 151 of file TestActionVPTimer.h.

◆ m_eventTime

double G4UA::TestActionVPTimer::m_eventTime
private

Double for storing this event time.

Definition at line 157 of file TestActionVPTimer.h.

◆ m_eventTimer

G4Timer* G4UA::TestActionVPTimer::m_eventTimer
private

Timer for this event.

Definition at line 155 of file TestActionVPTimer.h.

◆ m_report

Report G4UA::TestActionVPTimer::m_report
private

Definition at line 152 of file TestActionVPTimer.h.

◆ m_runTimer

G4Timer* G4UA::TestActionVPTimer::m_runTimer
private

Timer for the entire run.

Definition at line 154 of file TestActionVPTimer.h.

◆ v_history

VolTree G4UA::TestActionVPTimer::v_history
private

Vector of the current volume history, used to assign times to each element.

Definition at line 159 of file TestActionVPTimer.h.

◆ v_timer

G4Timer* G4UA::TestActionVPTimer::v_timer
private

Timer activated for each volume.

Definition at line 156 of file TestActionVPTimer.h.


The documentation for this class was generated from the following files:
G4UA::TestActionVPTimer::Config::dBeam
int dBeam
Definition: TestActionVPTimer.h:60
G4UA::TestActionVPTimer::m_eventTimer
G4Timer * m_eventTimer
Timer for this event.
Definition: TestActionVPTimer.h:155
G4UA::TestActionVPTimer::m_report
Report m_report
Definition: TestActionVPTimer.h:152
G4UA::TestActionVPTimer::v_timer
G4Timer * v_timer
Timer activated for each volume.
Definition: TestActionVPTimer.h:156
VolumeTreeNavigator
Definition: VolumeTreeNavigator.h:39
G4UA::TestActionVPTimer::Config::dIDET
int dIDET
Definition: TestActionVPTimer.h:61
G4UA::TestActionVPTimer::Config::dMUON
int dMUON
Used for setting depths in jobOptions file.
Definition: TestActionVPTimer.h:62
G4UA::TestActionVPTimer::m_config
Config m_config
Definition: TestActionVPTimer.h:151
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
python.utils.AtlRunQueryTimer.timer
def timer(name, disabled=False)
Definition: AtlRunQueryTimer.py:86
G4UA::TestActionVPTimer::Config::dCALO
int dCALO
Definition: TestActionVPTimer.h:59
G4UA::TestActionVPTimer::m_eventTime
double m_eventTime
Double for storing this event time.
Definition: TestActionVPTimer.h:157
G4UA::TestActionVPTimer::Report::time_index
VolMap time_index
Definition: TestActionVPTimer.h:107
G4UA::TestActionVPTimer::Report::nev
int nev
number of processed events
Definition: TestActionVPTimer.h:108
G4UA::TestActionVPTimer::m_runTimer
G4Timer * m_runTimer
Timer for the entire run.
Definition: TestActionVPTimer.h:154
VolTree
std::vector< VolID > VolTree
Definition: VolumeTreeNavigator.h:36
G4UA::TestActionVPTimer::TimerSum
double TimerSum(G4Timer *timer) const
Gets the time from the timer for summation.
Definition: TestActionVPTimer.h:166
G4UA::TestActionVPTimer::Config::dDetail
std::string dDetail
Path to set detailed depth in jobOptions file.
Definition: TestActionVPTimer.h:63
G4UA::TestActionVPTimer::Report::runTime
double runTime
Double for storing this run time.
Definition: TestActionVPTimer.h:109