#ifndef TGeomInfo_hxx_seen #define TGeomInfo_hxx_seen #include #include #include #include #include "IScintDetGeom.hxx" //#include "IECALGeom.hxx" #include "IP0DGeom.hxx" /* #include "IFGDGeom.hxx" #include "ITPCGeom.hxx" */ #include "ISMRDGeom.hxx" #include "IIngridGeom.hxx" #include "ICDCGeom.hxx" /// Namespace surrounding all COMET code. namespace COMET { class IGeomInfo; class IHit; }; /// A singleton class that creates, and provides access too, instances of /// separate, 'singleton like' classes containing utility functions specific /// to each sub-detector. class COMET::IGeomInfo { public: virtual ~IGeomInfo(); /// Get a reference to the singleton instance of geometry information. static IGeomInfo& Get(void); /// Get a reference to the singleton instance of P0D geometry information. static IP0DGeom& P0D(); /* /// Get a reference to the singleton instance of FGD geometry information. static IFGDGeom& FGD(); /// Get a reference to the singleton instance of ECAL geometry information. static IECALGeom& ECAL(); */ /// Get a reference to the singleton instance of SMRD geometry information. static ISMRDGeom& SMRD(); /* /// Get a reference to the singleton instance of TPC geometry information. static ITPCGeom& TPC(); */ /// Get a reference to the singleton instance of ingrid geometry /// information. static IIngridGeom& Ingrid(); /// Get a reference to the singleton instat of the scintillator detectors /// geometry information static IScintDetGeom& ScintDet(); /// Get a reference to the singleton instance of CDC geometry information. static ICDCGeom& CDC(); /// Translate an xyz position into a global node id. This takes a /// position in the global coordinate system and returns the associated /// geometry identifier. If the position is not associated with an /// identifier, then this returns an empty identifier. Code using the /// method should ensure that the returned identifier is a real volume. /// For instance: /// /// \code /// IGeometryId id = COMET::IGeomInfo::Get().GeomId(x,y,z); /// if (id == COMET::IGeometryId()) { /// std::cout << "x,y,z is not in a detector volume" /// << std::endl; /// } /// \endcode COMET::IGeometryId GeomId(double x, double y, double z); /// {@ Translate a node ID into an extent in the master coordinate system. /// The node extent is defined as the "half-length" of the dimension. For /// instance, a box which is 2cmx2cmx10cm will have an extend of (1cm, /// 1cm, 5cm). This is how far the object extends from its reference /// point. TVector3 NodeExtent(COMET::IGeometryId geomId); TVector3 NodeExtent(const COMET::IHit& hit); // @} /// Fine the bounding box for the node in the local coordinate system. /// The bounding box is defined as the "half-length" of the dimension. /// For instance a box which is 2cmx2cmx10cm will have an extend of (1cm, /// 1cm, 5cm). This is how far the object extends from its center. TVector3 NodeSize(COMET::IGeometryId geomId); /// Translate a node id into a geometry path name. std::string NodeName(COMET::IGeometryId geomId); /// Translate a node id into a position in the master coordinate system. /// If the input geometry identifier does not correspond to a volume, this /// returns an unspecified position. TVector3 NodePosition(COMET::IGeometryId geomId); /// Translate a position in the master coordinate system to a position in /// the local coordinate system of the geometry id. TVector3 MasterToLocal(COMET::IGeometryId geomId, double x, double y, double z); /// Translate a vector in the master coordinate system to a vector in /// the local coordinate system of the geometry id. TVector3 MasterToLocalVect(COMET::IGeometryId geomId, double x, double y, double z); /// Translate a position in the local coordinate system of a geometry id /// into a position in the master coordinate system. TVector3 LocalToMaster(COMET::IGeometryId geomId, double x, double y, double z); /// Translate a vector in the local coordinate system of a geometry id /// into a vector in the master coordinate system. TVector3 LocalToMasterVect(COMET::IGeometryId geomId, double x, double y, double z); /// Return the scintillator bar info corresponding to the TGeoNodeId /// provided. The GetScintBar method looks in all scintillator based /// detector and will throw an COMET::EVolumeNotFound exception if the /// node does not correspond to a scintillator. const IScintBarGeom& GetScintBar(COMET::IGeometryId geomId) const; /// Optioned Get radiation length ... /// Root is out by a factor 1000 for our units /// Methods: /// - 0: use (corrected) root version /// - 1: use PDG method /// - 2: use simplified PDG method double X0(TGeoMaterial * mat, int method = 0); /// Default Get Radiation Length method... /// Returns the radiation length calculated with option 2 of the above /// function, which in most cases provides sufficient accuracy. If in any /// doubt whether this is accurate enough for your use please check the /// other methods. double X0(TGeoMaterial * mat); /// An internal COMET::IGeomInfo class used to update tables when the /// geometry gets changed. class IGeometryChange : public COMET::IOADatabase::IGeometryChange { public: /// The callback to build the internal tables. void Callback(const COMET::ICOMETEvent* const event); }; friend class COMET::IGeomInfo::IGeometryChange; private: IGeomInfo(); /// Private copy c'tor, no imp. IGeomInfo(const IGeomInfo& src); /// Private copy asg't operator, no imp. IGeomInfo& operator=(const IGeomInfo& rhs); /// Fill the internal tables. void FillInformation(void); /// Clear the internal tables. void Clear(void); /// The static pointer to the singleton instance. static IGeomInfo* fGeomInfo; /// The geometry manager that is currently described in this class. This /// should not be used in regular code. Use gGeoManager instead. TGeoManager* fGeoManager; /// Get Geometry description of the P0D. IP0DGeom* fP0DGeom; /* /// Get Geometry description of the FGD. IFGDGeom* fFGDGeom; /// Get Geometry description of the ECAL. IECALGeom* fECALGeom; */ /// Get Geometry description of the SMRD. ISMRDGeom* fSMRDGeom; /* /// Get Geometry description of the SMRD. ITPCGeom* fTPCGeom; */ /// Get Geometry description of ingrid. IIngridGeom* fIngridGeom; /// Get Geometry description of the Scintillator detectors IScintDetGeom* fScintDetGeom; /// Get Geometry description of CDC. ICDCGeom* fCDCGeom; }; #endif