#include #include #include using namespace CLHEP; using namespace RAT; TrackKiller::TrackKiller( const G4String& processName, G4ProcessType aType ) : G4VDiscreteProcess(processName, aType) { fMaxGlobalTime = 50.0 * ns; } G4double TrackKiller::PostStepGetPhysicalInteractionLength( const G4Track& aTrack, G4double, G4ForceCondition* condition) { // condition is set to "Not Forced" *condition = NotForced; G4double limit = DBL_MAX; if( aTrack.GetGlobalTime() > fMaxGlobalTime ) limit = 0.0; // Force this to be the interaction that happens return limit; } G4VParticleChange* TrackKiller::PostStepDoIt( const G4Track& aTrack, const G4Step& ) { warn << "TrackKiller::PostStepDoIt: Track time = " << aTrack.GetGlobalTime() << " exceeds max global time = " << fMaxGlobalTime << " step_no=" << aTrack.GetCurrentStepNumber() << " type=" << aTrack.GetDefinition()->GetParticleName() << newline; pParticleChange->Initialize( aTrack ); pParticleChange->ProposeTrackStatus( fStopAndKill ); return pParticleChange; }