//////////////////////////////////////////////////////////////////// /// \class RAT::DS::MCTrackStep /// /// \brief This class represents a step of a simulated Monte Carlo track. /// /// \author Stan Seibert \n /// Phil G Jones /// /// REVISION HISTORY:\n /// 2013-1-21 : P. Jones - Refactor as part of ds review.\n /// 2016-3-14 : J. Dunger - Extend reemission to 4 components /// /// \details This class holds one step along the trajectory of a particle. /// The initial point in a track is represented with a MCTrackStep /// of length zero. All other steps are defined "looking backwards", /// with the information in this class corresponding to the endpoint /// of the segment. /// /// Particle transport is performed in GEANT4 so that a single step /// cannot cross a volume boundary, so each step is fully contained /// within a particular volume in the detector geometry. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_DS_MCTrackStep__ #define __RAT_DS_MCTrackStep__ #include #include #include #include namespace RAT { namespace DS { class MCTrackStep : public TObject { public: /// Possible step status values enum EStatus { WorldBoundary = 0, GeomBoundary, AtRestDoItProc, AlongStepDoItProc, PostStepDoItProc, UserDefinedLimit, ExclusivelyForcedProc, Unknown }; /// IDs for the processes in rat, add new values to the end of this list /// to keep the existing enum values unchanged enum EProcess { Transportation = 0, G4FastSimulationManagerProcess, msc, ionIoni, nuclearStopping, eIoni, eBrem, annihil, phot, compt, conv, Rayl, muMsc, muIoni, muBrems, muPairProd, CoulombScat, hIoni, hBrems, hPairProd, HadronElastic, ProtonInelastic, NeutronInelastic, nCapture, nFission, NeutronCaptureAtRest, DeuteronInelastic, TritonInelastic, PositronNuclear, ElectroNuclear, PhotonInelastic, muNuclear, Decay, RadioactiveDecay, Absorption, OpBoundary, Cerenkov, Undefined, start, PMTOptMod, ConcOptMod, Reem_compt0, Reem_compt1, Mie, Scint, Reem_compt2, Reem_compt3 }; /// Construct the track step MCTrackStep() : TObject(), length(0), globalTime(0), localTime(0), properTime(0), kineticEnergy(0), depositedEnergy(0), status(Unknown), process(Undefined) { } /// Set the position of the step /// /// @param[in] pos of the step void SetPosition( const TVector3& pos ) { position = ROOT::Math::XYZVectorF(pos.X(), pos.Y(), pos.Z()); } /// Get the position of the step /// /// @return position of the step TVector3 GetPosition() const { return TVector3(position.X(), position.Y(), position.Z()); } /// Set the polarisation of the step /// /// @param[in] pol of the step void SetPolarisation( const TVector3& pol ) { polarisation = ROOT::Math::XYZVectorF(pol.X(), pol.Y(), pol.Z()); } /// Get the polarisation of the step /// /// @return polarisation of the step TVector3 GetPolarisation() const { return TVector3(polarisation.X(), polarisation.Y(), polarisation.Z()); } /// Set the momentum of the step /// /// @param[in] mom of the step void SetMomentum( const TVector3& mom ) { momentum = ROOT::Math::XYZVectorF(mom.X(), mom.Y(), mom.Z()); } /// Get the momentum of the step /// /// @return momentum of the step TVector3 GetMomentum() const { return TVector3(momentum.X(), momentum.Y(), momentum.Z()); } /// Set the start volume's name /// /// @param[in] name of the start volume void SetStartVolume( const std::string& name ) { startVolume = name; } /// Get the start volume's name /// /// @return the name of the start volume std::string GetStartVolume() const { return startVolume; } /// Set the end volume's name /// /// @param[in] name of the end volume void SetEndVolume( const std::string& name ) { endVolume = name; } /// Get the end volume's name /// /// @return the name of the end volume std::string GetEndVolume() const { return endVolume; } /// Set the length of the step /// /// @param[in] len (length) of the step void SetLength( const Double_t len ) { length = len; } /// Get the length of the step /// /// @return length of the step Double_t GetLength() const { return length; } /// Set the global time of the step /// /// @param[in] time (global) of the step void SetGlobalTime( const Double_t time ) { globalTime = time; } /// Get the global time of the step /// /// @return global time of the step Double_t GetGlobalTime() const { return globalTime; } /// Set the local time of the step /// /// @param[in] time (local) of the step void SetLocalTime( const Double_t time ) { localTime = time; } /// Get the local time of the step /// /// @return local time of the step Double_t GetLocalTime() const { return localTime; } /// Set the proper time of the step /// /// @param[in] time (proper) of the step void SetProperTime( const Double_t time ) { properTime = time; } /// Get the proper time of the step /// /// @return proper time of the step Double_t GetProperTime() const { return properTime; } /// Set the kinetic energy of the step /// /// @param[in] energy (kinetic) of the step void SetKineticEnergy( const Double_t energy ) { kineticEnergy = energy; } /// Get the kinetic energy of the step /// /// @return kinetic energy of the step Double_t GetKineticEnergy() const { return kineticEnergy; } /// Set the deposited energy of the step /// /// @param[in] energy (deposited) of the step void SetDepositedEnergy( const Double_t energy ) { depositedEnergy = energy; } /// Get the deposited energy of the step /// /// @return deposited energy of the step Double_t GetDepositedEnergy() const { return depositedEnergy; } /// Set the step status /// /// This is saved as an enum to save storage space /// /// @param[in] status_ inline void SetStatus( const EStatus status_ ) { status = status_; } /// Get the step status /// /// This is saved as an enum to save storage space /// /// @return status name inline std::string GetStatus() const; /// Set the step process /// /// This is saved as an enum to save storage space /// /// @param[in] name process name inline void SetProcess( const std::string& name ); /// Get the step process /// /// This is saved as an enum to save storage space /// /// @return process name inline std::string GetProcess() const; /// Get the step process ENum /// /// @return process enum EProcess GetProcessEnum() const { return process; } // This ROOT macro adds dictionary methods to this class. // The number should be incremented whenever this class's members are changed. // It assumes this class has no virtual methods, use ClassDef if change this. ClassDefNV( MCTrackStep, 4 ); protected: ROOT::Math::XYZVectorF position; ///< Position at the end of the step ROOT::Math::XYZVectorF polarisation; ///< Polarisation at the end of the step ROOT::Math::XYZVectorF momentum; ///< Momentum at the end of the step std::string startVolume; ///< Name of the volume at the start of this step std::string endVolume; ///< Name of the volume at the end of this step Double32_t length; ///< Length of this step Double32_t globalTime; ///< Global time, since start of event, at the end of the step Double32_t localTime; ///< Local time, since start of track, at the end of the step Double32_t properTime; ///< Proper time at the end of the step Double32_t kineticEnergy; ///< Kinetic energy at the end of the step Double32_t depositedEnergy; ///< Energy deposited over the step EStatus status; ///< The step status EProcess process; ///< The process that has caused the step }; inline std::string MCTrackStep::GetStatus() const { switch( status ) { case WorldBoundary: return "WorldBoundary"; case GeomBoundary: return "GeomBoundary"; case AtRestDoItProc: return "AtRestDoItProc"; case AlongStepDoItProc: return "AlongStepDoItProc"; case PostStepDoItProc: return "PostStepDoItProc"; case UserDefinedLimit: return "UserDefinedLimit"; case ExclusivelyForcedProc: return "ExclusivelyForcedProc"; case Unknown: return "Unknown"; default: return "Unknown"; } } inline void MCTrackStep::SetProcess( const std::string& name ) { if( name == std::string( "Transportation" ) ) process = Transportation; else if( name == std::string( "G4FastSimulationManagerProcess" ) ) process = G4FastSimulationManagerProcess; else if( name == std::string( "msc" ) ) process = msc; else if( name == std::string( "ionIoni" ) ) process = ionIoni; else if( name == std::string( "nuclearStopping" ) ) process = nuclearStopping; else if( name == std::string( "eIoni" ) ) process = eIoni; else if( name == std::string( "eBrem" ) ) process = eBrem; else if( name == std::string( "annihilation" ) ) process = annihil; else if( name == std::string( "phot" ) ) process = phot; else if( name == std::string( "compt" ) ) process = compt; else if( name == std::string( "conv" ) ) process = conv; else if( name == std::string( "OpRayleigh" ) ) process = Rayl; else if( name == std::string( "muMsc" ) ) process = muMsc; else if( name == std::string( "muIoni" ) ) process = muIoni; else if( name == std::string( "muBrems" ) ) process = muBrems; else if( name == std::string( "muPairProduction" ) ) process = muPairProd; else if( name == std::string( "CoulombScattering" ) ) process = CoulombScat; else if( name == std::string( "hIoni" ) ) process = hIoni; else if( name == std::string( "hBrems" ) ) process = hBrems; else if( name == std::string( "hPairProduction" ) ) process = hPairProd; else if( name == std::string( "HadronElastic" ) ) process = HadronElastic; else if( name == std::string( "ProtonInelastic" ) ) process = ProtonInelastic; else if( name == std::string( "NeutronInelastic" ) ) process = NeutronInelastic; else if( name == std::string( "nCapture" ) ) process = nCapture; else if( name == std::string( "nFission" ) ) process = nFission; else if( name == std::string( "NeutronCaptureAtRest" ) ) process = NeutronCaptureAtRest; else if( name == std::string( "DeuteronInelastic" ) ) process = DeuteronInelastic; else if( name == std::string( "TritonInelastic" ) ) process = TritonInelastic; else if( name == std::string( "PositronNuclear" ) ) process = PositronNuclear; else if( name == std::string( "ElectronNuclear" ) ) process = ElectroNuclear; else if( name == std::string( "PhotonInelastic" ) ) process = PhotonInelastic; else if( name == std::string( "muNuclear" ) ) process = muNuclear; else if( name == std::string( "Decay" ) ) process = Decay; else if( name == std::string( "RadioactiveDecay" ) ) process = RadioactiveDecay; else if( name == std::string( "OpAbsorption" ) ) process = Absorption; else if( name == std::string( "OpBoundary" ) ) process = OpBoundary; else if( name == std::string( "Cerenkov" ) ) process = Cerenkov; else if( name == std::string( "start" ) ) process = start; else if( name == std::string( "PMTOpticalModel" ) ) process = PMTOptMod; else if( name == std::string( "ConcentratorOpticalModel" ) ) process = ConcOptMod; else if( name == std::string( "Reemission_from_comp0" ) ) process = Reem_compt0; else if( name == std::string( "Reemission_from_comp1" ) ) process = Reem_compt1; else if( name == std::string( "Reemission_from_comp2" ) ) process = Reem_compt2; else if( name == std::string( "Reemission_from_comp3" ) ) process = Reem_compt3; else if( name == std::string( "OpMie" ) ) process = Mie; else if( name == std::string( "Scintillation" ) ) process = Scint; else process = Undefined; } inline std::string MCTrackStep::GetProcess() const { switch( process ) { case Transportation: return "Transportation"; case G4FastSimulationManagerProcess: return "G4FastSimulationManagerProcess"; case msc: return "msc"; case ionIoni: return "ionIoni"; case nuclearStopping: return "nuclearStopping"; case eIoni: return "eIoni"; case eBrem: return "eBrem"; case annihil: return "annihil"; case phot: return "phot"; case compt: return "compt"; case conv: return "conv"; case Rayl: return "OpRayleigh"; case muMsc: return "muMsc"; case muIoni: return "muIoni"; case muBrems: return "muBrems"; case muPairProd: return "muPairProd"; case CoulombScat: return "CoulombScat"; case hIoni: return "hIoni"; case hBrems: return "hBrems"; case hPairProd: return "hPairProd"; case HadronElastic: return "HadronElastic"; case ProtonInelastic: return "ProtonInelastic"; case NeutronInelastic: return "NeutronInelastic"; case nCapture: return "nCapture"; case nFission: return "nFission"; case NeutronCaptureAtRest: return "NeutronCaptureAtRest"; case DeuteronInelastic: return "DeuteronInelastic"; case TritonInelastic: return "TritonInelastic"; case PositronNuclear: return "PositronNuclear"; case ElectroNuclear: return "ElectroNuclear"; case PhotonInelastic: return "PhotonInelastic"; case muNuclear: return "muNuclear"; case Decay: return "Decay"; case RadioactiveDecay: return "RadioactiveDecay"; case Absorption: return "OpAbsorption"; case OpBoundary: return "OpBoundary"; case Cerenkov: return "Cerenkov"; case start: return "start"; case PMTOptMod: return "PMTOpticalModel"; case ConcOptMod: return "ConcentratorOpticalModel"; case Reem_compt0: return "Reemission_from_comp0"; case Reem_compt1: return "Reemission_from_comp1"; case Reem_compt2: return "Reemission_from_comp2"; case Reem_compt3: return "Reemission_from_comp3"; case Mie: return "OpMie"; case Scint: return "Scintillation"; case Undefined: return "Unknown"; default: return "Unknown"; } } } // namespace DS } // namespace RAT #endif