19#include "BDSSteppingAction.hh"
20#include "BDSUtilities.hh"
24#include "G4EventManager.hh"
25#include "G4LogicalVolume.hh"
26#include "G4ThreeVector.hh"
28#include "G4VPhysicalVolume.hh"
29#include "G4VProcess.hh"
32BDSSteppingAction::BDSSteppingAction():
34 verboseEventStart(false),
35 verboseEventStop(false)
38BDSSteppingAction::BDSSteppingAction(G4bool verboseStepIn,
39 G4int verboseEventStartIn,
40 G4int verboseEventStopIn):
41 verboseStep(verboseStepIn),
42 verboseEventStart(verboseEventStartIn),
43 verboseEventStop(verboseEventStopIn)
46BDSSteppingAction::~BDSSteppingAction()
53 G4int eventID = G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID();
61 G4Track* track = step->GetTrack();
62 int trackID = track->GetTrackID();
63 G4VPhysicalVolume* pv = track->GetVolume();
64 G4LogicalVolume* lv = pv->GetLogicalVolume();
65 G4ThreeVector pos = track->GetPosition();
66 G4ThreeVector mom = track->GetMomentum() / CLHEP::GeV;
67 G4String materialName = track->GetMaterial()->GetName();
69 int G4precision = G4cout.precision();
71 G4cout <<
"pv: " << pv->GetName() <<
" lv: " << lv->GetName() << G4endl;
72 G4cout <<
"trackID: " << trackID
73 <<
" pdgID: " << track->GetDefinition()->GetParticleName()
74 <<
" Energy: " << track->GetTotalEnergy()/CLHEP::GeV
75 <<
" position: " << pos <<
"mm "
76 <<
" momentum: " << mom
77 <<
" material: " << materialName
80 auto preProcess = step->GetPreStepPoint()->GetProcessDefinedStep();
81 auto postProcess = step->GetPostStepPoint()->GetProcessDefinedStep();
84 {G4cout <<
"Pre-step process: " << preProcess->GetProcessName() << G4endl;}
86 {G4cout <<
"Post-step process: " << postProcess->GetProcessName() << G4endl;}
89 G4cout.precision(G4precision);
void VerboseSteppingAction(const G4Step *step)
The implementation of the print out.
virtual void UserSteppingAction(const G4Step *step)
G4bool VerboseThisEvent(G4int eventIndex, G4int eventStart, G4int eventStop)
Logic of whether this event should be verbose or not. Code here so it's not duplicated.