#ifndef __PNDDRCOPTDEVSYS_H__ #define __PNDDRCOPTDEVSYS_H__ /*! \brief Class for representation of a system of optical devices. Optical devices can be combined (coupled) to a system. This system, then can be also multiplicated by the copy constructor. A copy number helps to distingish between all generated systems. Since on can add one system to another and also combine the surfaces of two different systems, which were added to s system, one should make sure, that every single system gets a different copy number when the names are the same. \anchor originating The notion "originating system" refers to the system in which the device was added. After adding of two system into one, this allows to distinguish between two devices. */ class PndDrcOptDevSys { 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 devices. list m_listDev; //! List of originating systems for couplings. list m_listSysOri1Coupling; //! List of originating systems for couplings. list m_listSysOri2Coupling; //! List of originating system copies for couplings. list m_listSysOri1CopyCoupling; //! List of originating system copies for couplings. list m_listSysOri2CopyCoupling; //! List of devices for couplings. list m_listDev1Coupling; //! List of devices for couplings. list m_listDev2Coupling; //! List of devices for couplings. list m_listDev1CopyCoupling; //! List of devices for couplings. list m_listDev2CopyCoupling; //! List of surfaces for couplings. list m_listSurf1Coupling; //! List of surfaces for couplings. list m_listSurf2Coupling; //! List of surfaces for couplings. list m_listSurf1CopyCoupling; //! List of surfaces for couplings. list m_listSurf2CopyCoupling; //! List of system origin for devices. list m_listSysOri; //! List of copy number of system origin for devices. list m_listSysOriCopy; private: /*! \brief Auxiliary function for assignment operator and copy constructor.. \param d The object to copy. */ void copy(const PndDrcOptDevSys& d); public: //! Constructor PndDrcOptDevSys(); //! Destructor. virtual ~PndDrcOptDevSys(); /*! \brief Copy constructor. \param d The object to copy. */ PndDrcOptDevSys(const PndDrcOptDevSys& d); /*! \brief Assignment operator. \param d The object to assign. */ PndDrcOptDevSys& operator=(const PndDrcOptDevSys& d); /*! \brief Virtual copy constructor. \return Pointer to new allocated memory. */ virtual PndDrcOptDevSys* clone() const; /*! \brief List accessor \return List of devices */ list& deviceList() {return m_listDev;}; /*! \brief List accessor \return List of originating system*/ list listSysOri() const {return m_listSysOri;}; /*! \brief List accessor \return List of originating system copy*/ list listSysOriCopy() const {return m_listSysOriCopy;}; /*! \brief List accessor \return List of originating system */ list listSysOri1Coupling() const {return m_listSysOri1Coupling;}; /*! \brief List accessor \return List of originating system2 for coupling */ list listSysOri2Coupling() const {return m_listSysOri2Coupling;}; /*! \brief List accessor \return List of device 1 for coupling */ list listDev1Coupling() const {return m_listDev1Coupling;}; /*! \brief List accessor \return List of device 2 for coupling */ list listDev2Coupling() const {return m_listDev2Coupling;}; /*! \brief List accessor \return List of device 1 for coupling */ list listDev1CopyCoupling() const {return m_listDev1CopyCoupling;}; /*! \brief List accessor \return List of device 2 for coupling */ list listDev2CopyCoupling() const {return m_listDev2CopyCoupling;}; /*! \brief List accessor \return List of surface 1 for coupling */ list listSurf1Coupling() const {return m_listSurf1Coupling;}; /*! \brief List accessor \return List of surface 2 for coupling */ list listSurf2Coupling() const {return m_listSurf2Coupling;}; /*! \brief List accessor \return List of surface 1 for coupling */ list listSurf1CopyCoupling() const {return m_listSurf1CopyCoupling;}; /*! \brief List accessor \return List of surface 2 for coupling */ list listSurf2CopyCoupling() const {return m_listSurf2CopyCoupling;}; /*! \brief List accessor \return List of originating system copy 1 for coupling */ list listSysOri1CopyCoupling() const {return m_listSysOri1CopyCoupling;}; /*! \brief List accessor \return List of originating system copy 2 for coupling */ list listSysOri2CopyCoupling() const {return m_listSysOri2CopyCoupling;}; /*! \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); /*! \brief The name of the volume. \return The name. */ string name() const {return m_name;}; /*! \brief Set the name and copy number of the volume. \param name1 The name. \param icopy The copy number. */ void setNameCopyNumber(string name1, int icopy); /*! \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;}; private: /*! \brief Add device to the system. This private member assigns to that device also the orinating system name and a copy number. \param dev The device. \param sys_ori The system name where the device si originating from \param sys_ori_copy The system copy number where the device is orinating from. */ void addDevice(const PndDrcOptDev& dev, string sys_ori, int sys_ori_copy); public: /*! \brief Add device. \param dev The device. */ void addDevice(const PndDrcOptDev& dev); /*! \brief Embed device. An embedded device is a device completely part of another device. This function creates the necessary surfaces of the mother and couples those to the surfaces of the daughter. If the volume to embed contains internal surfaces, make sure that those are marked as internal. \sa PndDrcSurfAbs::setInternal() \param dev_daughter The daughter device to embed . \param dev_mother The mother device to embed in. */ void embedDevice(PndDrcOptDev& dev_daughter, PndDrcOptDev& dev_mother); /*! \brief Add whole device system \param sys The device system. */ void addDeviceSystem(const PndDrcOptDevSys& sys); /*! \brief Couple two devices such that photons can propagate from one to the other. \param dev1 The first optical device to couple. \param dev2 The second optical device to couple. \param surf1 The surface of dev1 to couple. \param surf2 The surface of dev2 to couple. \param dev_copy1 The copy number of the dev1 to couple. \param dev_copy2 The copy number of the dev2 to couple. \param surf_copy1 The copy number of the surf1 to couple. \param surf_copy2 The copy number of the surf2 to couple. */ void coupleDevice(string dev1, string dev2, string surf1, string surf2, int dev_copy1=0, int dev_copy2=0, int surf_copy1=0, int surf_copy2=0); /*! \brief Couple two devices such that photons can propagate from one to the other. \param dev1 The first optical device to couple. \param dev2 The second optical device to couple. \param surf1 The surface of dev1 to couple. \param surf2 The surface of dev2 to couple. \param sys1 The optical system for dev1 to couple. \param sys2 The optical system for dev2 to couple. \param dev_copy1 The copy number of the dev1 to couple. \param dev_copy2 The copy number of the dev2 to couple. \param surf_copy1 The copy number of the surf1 to couple. \param surf_copy2 The copy number of the surf2 to couple. \param sys_copy1 The copy number of the device system #1 to couple. \param sys_copy2 The copy number of the device system #2 to couple. */ void coupleDevice1(string dev1, string dev2, string surf1, string surf2, string sys1="none", string sys2="none", int dev_copy1=0, int dev_copy2=0, int surf_copy1=0, int surf_copy2=0, int sys_copy1=0, int sys_copy2=0); public: /*! \brief Write volume coordinates to stream in root syntax. \param stream The stream. */ void print(fstream& stream) const; //! Print out pointers and names of volumes, surfaces... void print() const; /*! \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 PndDrcSurfAbs::setPrintColor() */ void setPrintColor(int col); /*! \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); }; #endif