#ifndef __DRCOPTDEV_H__ #define __DRCOPTDEV_H__ /*! \brief Class for optical device representation. An device can be a optical volume, a mirror, or eg. a measuring plane. */ class DrcSurfAbs; class DrcOptMatAbs; class DrcOptDev { protected: //! Copy number for "copies". int m_copyNumber; //! Name of volume. string m_name; //! Verbosity from 0 to 5. int m_verbosity; //! Flag for photon tracing. mutable bool m_photonTrace; //! Stream for photon tracing. mutable fstream* m_photonTraceStream; //! List of surface pointers. list m_listSurf; private: /*! \brief Auxiliary function for assignment operator and copy constructor.. \param d The object to copy. */ void copy(const DrcOptDev& d); public: //! Constructor DrcOptDev(); //! Destructor. virtual ~DrcOptDev(); /*! \brief Virtual copy constructor. \return Pointer to new allocated memory. */ virtual DrcOptDev* clone() const=0; /*! \brief Copy constructor. \param d The object to copy. */ DrcOptDev(const DrcOptDev& d); /*! \brief Assignment operator. \param d The object to assign. */ DrcOptDev& operator=(const DrcOptDev& d); //! Print out all surface names and pointers. void print(); /*! \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); /*! \brief Copy number for this object. \return The copy number. \sa setCopyNumber */ int copyNumber() const {return m_copyNumber;}; /*! \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;}; /*! \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 Add surface. For mirrors do not use this class. Mirrors have a frontside and a backside and need other functions to distinguish between both. \sa DrcOptMirror::setFrontSurface \sa DrcOptMirror::setBackSurface \param surf The surface. */ virtual void addSurface(const DrcSurfAbs& surf); /*! \brief List of surfaces the device is composed of. \return List. */ list& surfaceList(){return m_listSurf;}; /*! \brief Propagate one photon. \param ph The photon. */ virtual void propagate(DrcPhoton& ph) = 0; /*! \brief Write volume coordinates to stream in root syntax. \param stream The stream. */ virtual void print(fstream& stream) const; /*! \brief Optical material. \return Pointer to material. */ virtual DrcOptMatAbs& optMaterial() const; /*! \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. \param trans The transformation. */ virtual void addTransform(const Transform3D& trans); /*! \brief Flag if object is radiator. \return The flag. */ virtual bool radiator() const = 0; /*! \brief Set print color for root objects. All subobjects of this object will get the chosen color for printing with root. \param col The chosen color. \sa DrcSurfAbs::setPrintColor() */ void setPrintColor(int col); }; #endif