/////////////////////////////////////////////////////////////////////// // // Stores track history as a RAT::DS::MCTrack object. This class is // attached to a G4Track if track storing is on, see TrackingAction. It // stores the history of the track as a RAT::DS::MCTrack. If created // with a condensed flag it will return a RAT::DS::MCTrack step with // only the first and last steps. // // This extends the G4Trajectory class and is extended by the // PhotonTrajectory class. This class is used for all particles bar // photons. // // Author: P G Jones // Author: S Langrock -- contact person // // REVISION HISTORY: // 28/07/2010 : P. Jones - Added ability to add steps as a MCTrackStep // object. // 2014-05-2014: P. Jones - major refactor. // 09/02/2015: J.R.Wilson - fixed bug in optical flags logic - was never // assigning media-based scattering flags due to order of else-ifs // 14/03/2016: J.Dunger - set re-emission summary flag after reem on any // compontent // /////////////////////////////////////////////////////////////////////// #ifndef __RAT_Trajectory__ #define __RAT_Trajectory__ #include #include namespace RAT { class Trajectory : public G4Trajectory { public: // Construct a trajectory for a track // // track: track to collate the trajectory of // condensed: true if the trajectory should be condensed Trajectory( const G4Track* track, const bool condensed ); // Destruct the trajectory virtual ~Trajectory(); // Overloaded new operator // // Returns a a newed Trajectory class inline void* operator new( size_t ); // Overloaded delete operator // // object: the object to delete inline void operator delete( void* object ); // Called by Geant4 to append a step to this trajectory // // aStep: step to append virtual void AppendStep( const G4Step* aStep ); // Merge another trajectory with this, used by Geant4 // // trajectory: trajectory to merge in virtual void MergeTrajectory( G4VTrajectory* trajectory ); // Get the MCTrack information // // Returns a the MCTrack const DS::MCTrack& GetMCTrack(); protected: // Append a G4StepPoint to the MCTrack // // point: point to append // step: step information // initial: intial step? true if so void AppendG4StepPoint( const G4StepPoint* point, const G4Step* step, const bool initial ); DS::MCTrack fMCTrack; // The MCTrack information (stored track details) bool fCondensed; // Return condensed tracks if true }; // GEANT4 uses a custom allocator on subclass, so we need to override it here. #if defined G4TRACKING_ALLOC_EXPORT extern G4DLLEXPORT G4Allocator aTrajectoryAllocator; #else extern G4DLLIMPORT G4Allocator aTrajectoryAllocator; #endif inline void* Trajectory::operator new( size_t ) { void* aTrajectory; aTrajectory = (void*)aTrajectoryAllocator.MallocSingle(); return aTrajectory; } inline void Trajectory::operator delete( void* aTrajectory ) { aTrajectoryAllocator.FreeSingle( (Trajectory*)aTrajectory ); } } // namespace RAT #endif