Belle II Software development
StepTiming Class Reference

Class to perform more detailed timing studies of the Geant4 simulation. More...

#include <StepTiming.h>

Inheritance diagram for StepTiming:

Public Types

typedef std::function< void(G4Track *, G4LogicalVolume *, double)> callbackType
 Signature of the callback function.
 

Public Member Functions

 StepTiming (const callbackType &callback)
 Constructor: create an instance with a given callback function.
 
virtual void NewStep ()
 Start timing a new step.
 
virtual void StepInfo ()
 Step finished, call callback function.
 
virtual void AtRestDoItInvoked ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void AlongStepDoItAllDone ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void PostStepDoItAllDone ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void AlongStepDoItOneByOne ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void PostStepDoItOneByOne ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void TrackingStarted ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void DPSLStarted ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void DPSLUserLimit ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void DPSLPostStep ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void DPSLAlongStep ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void VerboseTrack ()
 ignored, empty stub only implemented because it's pure virtual in base class

 
virtual void VerboseParticleChange ()
 ignored, empty stub only implemented because it's pure virtual in base class

 

Private Attributes

callbackType m_callback
 callback function to call
 
double m_startTime {0}
 start time of the step
 

Detailed Description

Class to perform more detailed timing studies of the Geant4 simulation.

This class overrides the default G4SteppingVerbose implementation which is used by Geant4 to display stepping information. It measures the time for each step and calls a given callback function with a pointer to the track, the volume in which the step occured and the time needed for that step.

Measuring the time in each step causes a overhead of 10%-20% so this should not be used in production

Definition at line 34 of file StepTiming.h.

Member Typedef Documentation

◆ callbackType

typedef std::function<void (G4Track*, G4LogicalVolume*, double)> callbackType

Signature of the callback function.

Definition at line 37 of file StepTiming.h.

Constructor & Destructor Documentation

◆ StepTiming()

StepTiming ( const callbackType callback)
inlineexplicit

Constructor: create an instance with a given callback function.

Definition at line 39 of file StepTiming.h.

39: G4VSteppingVerbose(), m_callback(callback) {}
callbackType m_callback
callback function to call
Definition: StepTiming.h:70

Member Function Documentation

◆ AlongStepDoItAllDone()

virtual void AlongStepDoItAllDone ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 47 of file StepTiming.h.

47{};

◆ AlongStepDoItOneByOne()

virtual void AlongStepDoItOneByOne ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 51 of file StepTiming.h.

51{};

◆ AtRestDoItInvoked()

virtual void AtRestDoItInvoked ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 45 of file StepTiming.h.

45{};

◆ DPSLAlongStep()

virtual void DPSLAlongStep ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 63 of file StepTiming.h.

63{};

◆ DPSLPostStep()

virtual void DPSLPostStep ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 61 of file StepTiming.h.

61{};

◆ DPSLStarted()

virtual void DPSLStarted ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 57 of file StepTiming.h.

57{};

◆ DPSLUserLimit()

virtual void DPSLUserLimit ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 59 of file StepTiming.h.

59{};

◆ NewStep()

void NewStep ( )
virtual

Start timing a new step.

Definition at line 19 of file StepTiming.cc.

20 {
21 //Start timing the step
23 }
double m_startTime
start time of the step
Definition: StepTiming.h:72
double getClock()
Return current value of the real-time clock.
Definition: Utils.cc:66

◆ PostStepDoItAllDone()

virtual void PostStepDoItAllDone ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 49 of file StepTiming.h.

49{};

◆ PostStepDoItOneByOne()

virtual void PostStepDoItOneByOne ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 53 of file StepTiming.h.

53{};

◆ StepInfo()

void StepInfo ( )
virtual

Step finished, call callback function.

Definition at line 24 of file StepTiming.cc.

25 {
26 //Step is done, get track and volume
27 fTrack = fManager->GetfTrack();
28 G4LogicalVolume* volume = fTrack->GetStep()->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
29 //calculate elapsed time
30 const double time = Utils::getClock() - m_startTime;
31 //call callback function
32 m_callback(fTrack, volume, time);
33 }

◆ TrackingStarted()

virtual void TrackingStarted ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 55 of file StepTiming.h.

55{};

◆ VerboseParticleChange()

virtual void VerboseParticleChange ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 67 of file StepTiming.h.

67{};

◆ VerboseTrack()

virtual void VerboseTrack ( )
inlinevirtual

ignored, empty stub only implemented because it's pure virtual in base class

Definition at line 65 of file StepTiming.h.

65{};

Member Data Documentation

◆ m_callback

callbackType m_callback
private

callback function to call

Definition at line 70 of file StepTiming.h.

◆ m_startTime

double m_startTime {0}
private

start time of the step

Definition at line 72 of file StepTiming.h.


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