///////////////////////////////////////////////////////////////////////
//
// Stores photon track history as a RAT::DS::MCPhoton object.
//
// Author: P G Jones
// Author: C Jackson -- contact person
// Author: S Langrock -- contact person
//
// REVISION HISTORY:
// 2014-05-2014 : P. Jones - new file.
// 2018-12-22 : W. Heintzelman - corrected logic in AppendStep( G4Step* )
// 2021-10-08 : L. Lebanowski - added logic for Grey Disc PMT
//
// This class is attached to a G4Track if track storing is on,
// see TrackingAction. It enhances it's parent Trajectory class by
// storing photon track details in a RAT::DS::MCPhoton object.
//
// As a photon track can reflect out of a PMT envelope and a MCPhoton
// should exist for each envelope entry, a current MCPhoton is stored
// until it's fate is known.
//
///////////////////////////////////////////////////////////////////////
#ifndef __RAT_PhotonTrajectory__
#define __RAT_PhotonTrajectory__
#include
#include
#include
#include
class G4VPhysicalVolume;
class G4AffineTransform;
namespace RAT
{
class PhotonTrajectory : public Trajectory
{
public:
// Construct a trajectory for a track
//
// track: track to collate the trajectory of
// condensed: true if the trajectory should be condensed
PhotonTrajectory( const G4Track* track, const bool condensed );
// Destruct the trajectory
virtual ~PhotonTrajectory();
// Overloaded new operator
//
// Returns a a newed PhotonTrajectory class
inline void* operator new( size_t );
// Overloaded delete operator
//
// object: 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 );
// Called by the PMT optical models to append a step
//
// step: step to append
void AppendStep( const DS::MCTrackStep& step );
// Called by the PMT optical models to append a photoelectron creation step
//
// pmtID: ID of the PMT the photoelectron is created within
void AppendPhotoelectron( const int pmtID );
// Merge another trajectory with this, used by Geant4
//
// trajectory: trajectory to merge in
virtual void MergeTrajectory( G4VTrajectory* trajectory );
// Get the MCPhoton information
//
// Returns a the MCPhoton
std::vector GetMCPhotons();
protected:
// Convert a global position into a local position using a affline transform
//
// global: the global position
// globalToLocal: affline transform
TVector3 ConvertToLocalCoords( const TVector3 global, const G4AffineTransform& globalToLocal );
// Convert a global direction into a local direction using a affline transform
//
// global: the global direction
// globalToLocal: affline transform
TVector3 ConvertToLocalAxis( const TVector3 global, const G4AffineTransform& globalToLocal );
std::vector fMCPhotons; // The MCPhotons information (stored track details)
};
// GEANT4 uses a custom allocator on subclass, so we need to override it here.
#if defined G4TRACKING_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator aPhotonTrajectoryAllocator;
#else
extern G4DLLIMPORT G4Allocator aPhotonTrajectoryAllocator;
#endif
inline void*
PhotonTrajectory::operator new( size_t )
{
void* aTrajectory;
aTrajectory = (void*)aPhotonTrajectoryAllocator.MallocSingle();
return aTrajectory;
}
inline void
PhotonTrajectory::operator delete( void* object )
{
aPhotonTrajectoryAllocator.FreeSingle( (PhotonTrajectory*)object );
}
} // namespace RAT
#endif