//////////////////////////////////////////////////////////////////////// /// \class RAT::DS::MCPhoton /// /// \brief This class represents a single photon that entered the PMT bucket. /// /// \author Stan Seibert \n /// Phil G Jones /// /// REVISION HISTORY:\n /// 2013-10-16: P G Jones - Updates for MCPhoton & MCPhotoelectron \n /// 2016-02-18: W Heintzelman - update header comments to be consistent /// with the user manual /// 2016-10-24: N Barros - pmtID is now stored with the MCPhoton. /// Since MC with tracking on is a debug mode, the additional /// storage is an acceptable overhead. /// /// \details An instance is created for every photon entering the PMT /// bucket, regardless of whether an MCPE was generated. //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// /// \class RAT::DS::MCPhoton::NoValueError /// /// \brief An exception that is thrown when a user atempts to retrieve /// exit values if the photon doesn't exit. /// /// \author Phil G Jones /// /// REVISION HISTORY:\n /// 2013-10-17 : P G Jones - Updates for MCPhoton & MCPhotoelectron \n /// /// \details As brief /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_DS_MCPhoton__ #define __RAT_DS_MCPhoton__ #include #include #include #include #include namespace RAT { namespace DS { class MCPhoton : public TObject { public: /// The possible photon fates enum EPhotonFate{ eAbsorbed, eReflected, ePhotoelectron, eUnknown }; class NoValueError : public DataNotFound { public: /// Sets up a DataNotFound error /// /// @param[in] className of class the variable is a member of /// @param[in] fieldName of the variable /// @param[in] detail regarding the error NoValueError( const std::string className, const std::string fieldName, const std::string detail) : DataNotFound(className, fieldName, detail) { } }; /// Construct a MCPhoton, calls the TObject constructor MCPhoton() : TObject(), inTime(0), outTime(0), energy(0), weight(0), photonTrackID(0), fate(eUnknown), pmtID(667125376) { } /// Set the entry position /// /// @param[in] pos is the local coordinate position void SetInPosition( const TVector3& pos ) { inPosition = ROOT::Math::XYZVectorF(pos.X(), pos.Y(), pos.Z()); } /// Get the entry position /// /// @return the local coordinate position TVector3 GetInPosition() const { return TVector3(inPosition.X(), inPosition.Y(), inPosition.Z()); } /// Set the entry direction /// /// @param[in] dir is the local coordinate direction void SetInDirection( const TVector3& dir ) { inDirection = ROOT::Math::XYZVectorF(dir.X(), dir.Y(), dir.Z()); } /// Get the entry direction /// /// @return the local coordinate direction TVector3 GetInDirection() const { return TVector3(inDirection.X(), inDirection.Y(), inDirection.Z()); } /// Set the entry polarisation /// /// @param[in] pol is the local coordinate polarisation void SetInPolarisation( const TVector3& pol ) { inPolarisation = ROOT::Math::XYZVectorF(pol.X(), pol.Y(), pol.Z()); } /// Get the entry polarisation /// /// @return the local coordinate polarisation TVector3 GetInPolarisation() const { return TVector3(inPolarisation.X(), inPolarisation.Y(), inPolarisation.Z()); } /// Set the entry time /// /// @param[in] time is the global time in ns void SetInTime( const Double_t time ) { inTime = time; } /// Get the entry time /// /// @return the global time in ns Double_t GetInTime() const { return inTime; } /// Set the exit position /// /// @param[in] pos is the local coordinate position void SetOutPosition( const TVector3& pos ) { outPosition = ROOT::Math::XYZVectorF(pos.X(), pos.Y(), pos.Z()); } /// Get the exit position /// /// @return the local coordinate position /// @throws NoValueError if photon doesn't exit TVector3 GetOutPosition() const { if( fate != eReflected ) throw NoValueError( "MCPhoton", "outPosition", "Photon didn't exit." ); return TVector3(outPosition.X(), outPosition.Y(), outPosition.Z()); } /// Set the exit direction /// /// @param[in] dir is the local coordinate direction void SetOutDirection( const TVector3& dir ) { outDirection = ROOT::Math::XYZVectorF(dir.X(), dir.Y(), dir.Z()); } /// Get the exit direction /// /// @return the local coordinate direction /// @throws NoValueError if photon doesn't exit TVector3 GetOutDirection() const { if( fate != eReflected ) throw NoValueError( "MCPhoton", "outDirection", "Photon didn't exit." ); return TVector3(outDirection.X(), outDirection.Y(), outDirection.Z()); } /// Set the exit polarisation /// /// @param[in] pol is the local coordinate polarisation void SetOutPolarisation( const TVector3& pol ) { outPolarisation = ROOT::Math::XYZVectorF(pol.X(), pol.Y(), pol.Z()); } /// Get the entry polarisation /// /// @return the local coordinate polarisation /// @throws NoValueError if photon doesn't exit TVector3 GetOutPolarisation() const { if( fate != eReflected ) throw NoValueError( "MCPhoton", "outPolarisation", "Photon didn't exit." ); return TVector3(outPolarisation.X(), outPolarisation.Y(), outPolarisation.Z()); } /// Set the exit time /// /// @param[in] time is the global time in ns void SetOutTime( const Double_t time ) { outTime = time; } /// Get the entry time /// /// @return the global time in ns /// @throws NoValueError if photon doesn't exit Double_t GetOutTime() const { if( fate != eReflected ) throw NoValueError( "MCPhoton", "outTime", "Photon didn't exit." ); return outTime; } /// Set the photon energy /// /// @param[in] energy_ in MeV void SetEnergy( const Double_t energy_ ) { energy = energy_; } /// Get the photon energy /// /// @return the energy in MeV Double_t GetEnergy() const { return energy; } /// Set the relative weight of the photon /// /// @param[in] weight_ is the relative weight void SetWeight( const Double_t weight_ ) { weight = weight_; } /// Get the relative weight /// /// @return the relative weight Double_t GetWeight() const { return weight; } /// Set the track ID of the photon /// /// @param[in] id is the track id void SetPhotonTrackID( const Int_t id ) { photonTrackID = id; } /// Get the track ID of the photon /// /// @return the track id Int_t GetPhotonTrackID() const { return photonTrackID; } /// Set the id of the pmt the photon has entered /// /// @param[in] id of the pmt void SetPMTID( const Int_t id ) { pmtID = id; } /// Get the id of the pmt the photon has entered /// /// @return the pmt id Int_t GetPMTID() const { return pmtID; } /// Set the fate of the photon /// /// @param[in] fate_ is an EPhotonFate void SetFate( EPhotonFate fate_ ) { fate = fate_; } /// Get the photon fate /// /// @return an EPhotonFate EPhotonFate GetFate() const { return fate; } // 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( MCPhoton, 5 ); protected: ROOT::Math::XYZVectorF inPosition; ///< Local coordinate position of the photon on entry to the bucket/pmt ROOT::Math::XYZVectorF inDirection; ///< Local coordinate direction of the photon on entry ROOT::Math::XYZVectorF inPolarisation; ///< Local coordinate polarisation of the photon on entry ROOT::Math::XYZVectorF outPosition; ///< Local coordinate position of the photon on exit ROOT::Math::XYZVectorF outDirection; ///< Local coordinate direction of the photon on exit ROOT::Math::XYZVectorF outPolarisation; ///< Local coordinate polarisation of the photon on exit Double32_t inTime; ///< Global mc time on entry Double32_t outTime; ///< Global mc time on exit Double32_t energy; ///< Energy of the photon in MeV Double32_t weight; ///< Relative weight assigned to this photon UInt_t photonTrackID; ///< The photon track ID for this photon EPhotonFate fate; ///< The fate of the photon UInt_t pmtID; ///< The ID of the PMT this photon entered }; } // namespace DS } // namespace RAT #endif