#ifndef TGeomInfo_hxx_seen #define TGeomInfo_hxx_seen #include //#include #include #include #include #include #include /// Namespace surrounding all COMET code. namespace COMET { class IGeomInfo; class ICDCGeom; class ICTHGeom; 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 CDC geometry information. static const ICDCGeom& CDC(); /// Get a reference to the singleton instance of CTH geometry information. static const ICTHGeom& CTH(); /// Get a reference to the singleton instance of Detector Solenoid geometry information. static IDetectorSolenoidGeom& DetectorSolenoid(); /// Get a reference to the singleton instance of StrawTrk geometry information. static IStrawTrkGeom& StrawTrk(); /// Get a reference to the singleton instance of ECAL geometry information. static IECALGeom& ECAL(); /// 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); /// Optioned Get radiation length ... /// Methods: /// - 0: use (corrected) root version /// - 1: use PDG method /// - 2: use simplified PDG method double X0(TGeoMaterial * mat, int method = 0); /// 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 CDC. ICDCGeom* fCDCGeom; /// Get Geometry description of CTH. ICTHGeom* fCTHGeom; /// Get Geometry description of DetectorSolenoid. IDetectorSolenoidGeom* fDetectorSolenoidGeom; /// Get Geometry description of StrawTrk. IStrawTrkGeom* fStrawTrkGeom; /// Get Geometry description of ECAL. IECALGeom* fECALGeom; }; #endif