#ifndef __PNDDRCSURFABS_H__ #define __PNDDRCSURFABS_H__ /*! \brief Class for surface representation. The surface is defined by a position dependent normal vector and boundaries. It might be coupled to a surface of another volume. There are internal and external surfaces. Internal surfaces should be marked a such by \sa setInternal() to prevent the coupling to a mother volume surface, when the device containing this surface is embedded as daughter into the mother device. This refers in particular to mirrors and pad planes. */ class PndDrcOptDev; class PndDrcSurfAbs { protected: //! Copy number for "copies". int m_copyNumber; //! Coupling flag. bool m_coupledFlag; //! Coupled surface. list m_coupledSurfaceList; //! Coupled device. list m_coupledDeviceList; //! Name of surface. string m_name; //! Verbosity from 0 to 5. int m_verbosity; //! Print color for root. int m_printColor; //! Pointer to reflectivity. PndDrcOptReflAbs* m_reflectivity; /*! \brief Flag if surface measures photon, sets its \sa PhotonFate() to PhotMeasured.*/ bool m_pixel; //! Flag for internal surfaces. bool m_internal; private: /*! \brief Auxiliary function for assignment operator and copy constructor.. \param s The object to copy. */ void copy(const PndDrcSurfAbs& s); public: //! Empty constructor. PndDrcSurfAbs(); /*! \brief Copy constructor. \param s The object to copy. */ PndDrcSurfAbs(const PndDrcSurfAbs& s); /*! \brief Assignment operator. \param s The object to assign. */ PndDrcSurfAbs& operator=(const PndDrcSurfAbs& s); //! Destructor. virtual ~PndDrcSurfAbs(); /*! \brief Virtual copy constructor. \return Pointer to new allocated memory. */ virtual PndDrcSurfAbs* clone() const=0; /*! \brief Set the copy number for this object. This serves for the purpos to distinguisch between several objects generated with a copy constructor. \param i The copy number. */ void setCopyNumber(int i){m_copyNumber=i;}; /*! \brief Copy number for this object. \return The copy number. \sa setCopyNumber */ int copyNumber() const {return m_copyNumber;}; /*! \brief Set surface as internal surface to prevent coupling to other surfaces when daughter volume with this surface is embedded in a mother volume in \sa PndDrcOptDevSys::embedDevice(). \param flag The flag */ void setInternal(bool flag=true) {m_internal=flag;} /*! \brief Flag if surface is an internal surface \sa setInternal() \return The flag */ bool internal() const {return m_internal;} /*! \brief Flag for coupling with other devices. \return Flag */ bool coupled() const {return m_coupledFlag;}; /*! \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 Coupling to different surface. Tell the surface to which device and surface it is optical coupled. Photons can then propagate through this surface to different optical volume. \param dev The coupled device. \param surf The coupled surface. */ void setCoupled(PndDrcOptDev* dev, PndDrcSurfAbs* surf); /*! \brief The coupled device list. \return The device. \sa setCoupled() \sa coupledSurfaceList() */ const list& coupledDeviceList() const {return m_coupledDeviceList;}; /*! \brief The coupled surface list. \return The Surface. \sa setCoupled() \sa coupledDeviceList() */ const list& coupledSurfaceList() const {return m_coupledSurfaceList;}; /*! \brief Set the name of the volume. \param name The name. */ void setName(string name){m_name=name;}; /*! \brief The name of the volume. \return The name. */ string name() const {return m_name;}; /*! Set reflectivity \param refl the reflectivity. */ void setReflectivity(const PndDrcOptReflAbs& refl); /*! \brief Set the PhotoFate to PhotMeasured after successfully running the surfaceHit function. \param flag The flag. */ void setPixel(bool flag=true){m_pixel=flag;}; /*! Reflectivity \return Reflectivity. */ PndDrcOptReflAbs& reflectivity() { return *m_reflectivity; }; /*! \brief Normal vector The normal vector of the surface points outside. \param point The point where the normal vector is taken; \return Normal vector. */ virtual XYZVector normal(const XYZPoint& point) const = 0; /*! \brief Intersection vector The intersection of a photon with the surface. If the photon has hit the area, pos_new is the position on the area, the direction is unchanged. The path from the current position to the hit position is returned by path_length. If the surface is a screen, the photons fate is set to PhotMeasured. \sa PhotonFate() setScreen(). \param ph The photon. \param pos_new Hit position on surface (return value). \param path_length Distance from photon position to hit position (return value). \return If the photon has hit the area. */ virtual bool surfaceHit(PndDrcPhoton& ph, XYZPoint& pos_new, double& path_length) const = 0; /*! \brief Write surface coordinates to stream in root syntax. \param stream The stream. \return The stream. */ virtual void print(fstream& stream) const = 0; /*! \brief Set print color for root objects. \param col The color \verbatim 17 grey 50 dark red 2 red 42 orange 5 yellow 3 green 7 cyan 4 blue 9 indigo 39 violet \endverbatim */ void setPrintColor(int col){m_printColor=col;}; /* \brief The print color for root. \return The color number \sa setPrintColor */ //int printColor() const {return m_printColor;}; /*! \brief Add transformation The tranform from the root framework is a rotation followed by a shift and is represented by a 4x4 matrix, rotation + shift vector. Consecutive transforms are multiplied from the left. \param trans The transformation. */ virtual void addTransform(const Transform3D& trans) = 0; /*! \brief Flag if surface is flat. \return Flag. */ virtual bool isFlat()=0; }; #endif