#ifndef __DRCPHOTON_H__ #define __DRCPHOTON_H__ //! A namespace for encapsulation. namespace Drc { /*! \enum Drc::PhotonFate An enum holding the fate of a photon. */ enum PhotonFate { //! Photon is still propagating PhotFlying, //! Photon has hit measuring device. PhotMeasured, //! Photon got lost outside. PhotLost, //! Photon got lost inside. PhotAbsorbed }; } class DrcOptDev; /*! \brief Representation of a photon. */ class DrcPhoton { private: //! Wavelength in nm. double m_lambda; //! Actual position of photon. XYZPoint m_position; //! Old position of photon. XYZPoint m_positionOld; //! Normalized direction of photon. XYZVector m_direction; //! The fate of the photon. Drc::PhotonFate m_fate; //! Number of suffered reflections. int m_reflections; //! Verbosity level 0-5. int m_verbosity; //! Pointer to device where photon is. DrcOptDev* m_dev; //! Time of flight. double m_time; public: //! Empty constructor. DrcPhoton(); //! Destructor. virtual ~DrcPhoton(){}; /*! \brief Verbosity Set the verbosity. Range is 0 to 5. \verbatim 0=quiet, 1=constructors,destructors, 2=member functions, 3=functionality 4=photons 5=everything \endverbatim \param level The verbosity level */ void setVerbosity(int level){m_verbosity=level;}; /*! \brief Verbosity. \return Verbosity \sa setVerbosity() */ const int verbosity() const {return m_verbosity;}; /*! \brief Set fate of photon \param fate The fate \sa Drc::PhotonFate */ void setFate(Drc::PhotonFate fate) {m_fate=fate;}; /*! \brief Fate of photon \return The fate \sa Drc::PhotonFate */ const Drc::PhotonFate fate() const {return m_fate;}; /*! \brief Reflections \return Reflections. */ int reflections() const {return m_reflections;}; /*! \brief Position \return Position. */ XYZPoint position() const {return m_position;}; /*! \brief Set position \param pos Position. */ void setPosition(const XYZPoint& pos); /*! \brief Direction \return Normalized direction. */ XYZVector direction() const {return m_direction;}; /*! \brief Set normalized direction \param dir Direction. */ void setDirection(const XYZVector& dir) {m_direction=dir.Unit();}; /*! \brief Wavelength \return Wavelength in nm. */ double wavelength() const {return m_lambda;}; /*! \brief Set wavelength \param lambda Wavelength in nm. */ void setWavelength(double lambda){m_lambda=lambda;}; /*! \brief Device where photon is \return Device. */ DrcOptDev* device() const {return m_dev;}; /*! \brief Set device where photon is \param dev The device. */ void setDevice(DrcOptDev* dev){m_dev=dev;}; /*! \brief Time of flight for photon \return Time of flight in [ns]. */ double time() const {return m_time;}; /*! \brief Set time of photon \param tim The time. */ void setTime(double tim){m_time=tim;}; /*! \brief Reflect the photon \param normal The normal vector of the surface. */ void reflect(const XYZVector& normal); /*! \brief Write photon coordinates to stream in root syntax. \param stream The stream. */ void print(fstream& stream) const; //! Write photon properties to cout. void print() const; /*! \brief Color number for usage in root \param lambda The wavelength in nm. \return Color number. */ int colorNumber(double lambda) const; }; #endif