////////////////////////////////////////////////////////////////////
//
// Optional process to kill tracks based on cuts. This code will kill
// any tracks that exist at times that are considered too long.
//
// Author: P G Jones
//
// REVISION HISTORY:\n
// 2013-12-15 : P G Jones - new file, code partially from GLG4SteppingAction
//
////////////////////////////////////////////////////////////////////
#ifndef __RAT_TrackKiller_hh__
#define __RAT_TrackKiller_hh__
#include
namespace RAT
{
class TrackKiller : public G4VDiscreteProcess
{
public:
// Initialise the default fMaxGlobalTime and inform geant4 what type of process this is
TrackKiller( const G4String& processName = "trackKiller",
G4ProcessType aType = fGeneral );
// Deconstruct... empty
virtual ~TrackKiller() { }
// This process should kill all track types, therefore it is applicable to all
G4bool IsApplicable( const G4ParticleDefinition& ) { return true; }
// Returns the mean free path calculation, which is DBL_MAX always
G4double GetMeanFreePath( const G4Track&,
G4double,
G4ForceCondition* ) { return DBL_MAX; }
// Return the proposed interaction length
//
// previousStepSize is unused
// condition is set to NotForced
// returns 0.0 if the track time exceeds fMaxGlobalTime
G4double PostStepGetPhysicalInteractionLength( const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition );
// Invoked to change the track, if invoked the track will be killed
//
// returns a killed track change
G4VParticleChange* PostStepDoIt( const G4Track& aTrack,
const G4Step& aStep );
private:
double fMaxGlobalTime; // The maximum global time a track can have before being killed
};
} //::RAT
#endif