18 #include <G4RunManager.hh>
20 #include <G4StepPoint.hh>
22 #include <G4UnitsTable.hh>
23 #include <G4VPhysicalVolume.hh>
33 G4Track* track = step->GetTrack();
35 const auto pos = convertLength * track->GetPosition();
36 const auto time = convertTime * track->GetGlobalTime();
37 const bool isSecondary =
38 track->GetDynamicParticle()->GetPrimaryParticle() ==
nullptr;
40 const bool outOfVolume =
43 const bool outOfTime =
time >
m_cfg.maxTime;
44 const bool invalidSecondary =
m_cfg.secondaries && isSecondary;
46 if (outOfVolume or outOfTime or invalidSecondary) {
47 ACTS_DEBUG(
"Kill track with internal track ID "
48 << track->GetTrackID() <<
" at " <<
pos <<
" and global time "
51 track->SetTrackStatus(G4TrackStatus::fStopAndKill);