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#include <G4LogicalVolume.hh>
13#include <G4Track.hh>
14
15namespace Belle2 {
20 namespace Simulation {
22 {
23 //Start timing the step
25 }
27 {
28 //Step is done, get track and volume
29 fTrack = fManager->GetfTrack();
30 G4LogicalVolume* volume = fTrack->GetStep()->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume();
31 //calculate elapsed time
32 const double time = Utils::getClock() - m_startTime;
33 //call callback function
34 m_callback(fTrack, volume, time);
35 }
36
37 }
39} //Belle2 namespace
double m_startTime
start time of the step
Definition StepTiming.h:71
virtual void NewStep()
Start timing a new step.
Definition StepTiming.cc:21
virtual void StepInfo()
Step finished, call callback function.
Definition StepTiming.cc:26
callbackType m_callback
callback function to call
Definition StepTiming.h:69
double getClock()
Return current value of the real-time clock.
Definition Utils.cc:70
Abstract base class for different kinds of events.