Belle II Software development
StepTiming.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <simulation/kernel/StepTiming.h>
10#include <framework/utilities/Utils.h>
11#include <G4SteppingManager.hh>
12
13namespace Belle2 {
18 namespace Simulation {
20 {
21 //Start timing the step
23 }
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 }
34
35 }
37} //Belle2 namespace
double m_startTime
start time of the step
Definition: StepTiming.h:72
virtual void NewStep()
Start timing a new step.
Definition: StepTiming.cc:19
virtual void StepInfo()
Step finished, call callback function.
Definition: StepTiming.cc:24
callbackType m_callback
callback function to call
Definition: StepTiming.h:70
double getClock()
Return current value of the real-time clock.
Definition: Utils.cc:66
Abstract base class for different kinds of events.