/** * PndGeoHandling.h * @author: t.stockmanns * * @brief Class to access the naming information of the MVD * * To save memory not anylonger the full path of a volume is stored * in each hit but an encrypted form of it (f.e. /1_1/34_2/101_1/). * The first number is the volumeID comming from the GeoManager and * the second number is the copy number. * This class helps you converting the encrypted ID into the path * information and vice versa. * It needs the informations of the GeoManager. Therefore one has to * ensure that either an initialized TGeoManager pointer is given in the * constructor with the correct goemetry or a filename with the correct geoemetry ("FAIRGeom") * */ #ifndef PNDGEOHANDLING_H #define PNDGEOHANDLING_H #include "TGeoManager.h" #include "TGeoMatrix.h" #include "TString.h" #include "TVector3.h" #include #include #include class PndGeoHandling{ public: PndGeoHandling(); //PndGeoHandling(TString fileName); PndGeoHandling(TGeoManager* aGeoMan) { if (aGeoMan == 0) std::cout << "-E- PndGeoHandling: Not a valid GeoManager" << std::endl; fGeoMan = aGeoMan;}; ~PndGeoHandling(){}; TString GetCurrentID(); ///< returns the ID of the current node TString GetID(TString path); ///< for a given TGeoManager-path the ID is returned TString GetPath(TString id); ///< for a given ID the path is returned TString GetVolumeID(TString name); ///< returns the volume ID for a given volume name std::vector GetNamesLevel(Int_t level, TString startPath = "", bool fullPath = false); void GetOUVPath(TString path, TVector3& o, TVector3& u, TVector3& v); ///< for a volume given by its path the o, u, v vectors for the plane are returned void GetOUVId(TString id, TVector3& o, TVector3& u, TVector3& v); ///< for a volume given by its ID the o, u, v vectors for the plane are returned TGeoHMatrix* GetMatrixPath(TString path); TGeoHMatrix* GetMatrixId(TString id); TVector3 GetSensorDimensionsId(TString id); TVector3 GetSensorDimensionsPath(TString path); TVector3 MasterToLocalId(const TVector3& master, const TString& id); TVector3 MasterToLocalPath(const TVector3& master, const TString& id); TVector3 LocalToMasterId(const TVector3& local, const TString& id); TVector3 LocalToMasterPath(const TVector3& local, const TString& id); // TODO: Recheck the error calculation for 3-vectors TVector3 MasterToLocalErrorsId(const TVector3& master, const TString& id); TVector3 MasterToLocalErrorsPath(const TVector3& master, const TString& id); TVector3 LocalToMasterErrorsId(const TVector3& local, const TString& id); TVector3 LocalToMasterErrorsPath(const TVector3& local, const TString& id); void SetVerbose(Int_t v) { fVerbose = v; } void SetGeoManager(TGeoManager* geo){fGeoMan = geo;}; Bool_t cd(TString id); ///< as the cd command of TGeoManager just with the ID void FillLevelNames(); ///< fills vector fLevelNames with the names (or the paths) of the volumes down to the level given by fLevel TString FindNodePath(TGeoNode* node); void DiveDownToNode(TGeoNode* node); void cd(TGeoNode* node); /// fLevelNames; Int_t fLevel; bool fFullPath; Int_t fVerbose; ClassDef(PndGeoHandling,3); }; #endif