MpdEmcGeoUtils.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef MPDEMCDETGEOUTILS_H
  2. #define MPDEMCDETGEOUTILS_H
  3. #include "TObject.h"
  4. class MpdEmcGeoUtils : public TObject
  5. {
  6. public:
  7. /// Default constructor.
  8. /// It must be kept public for root persistency purposes,
  9. /// but should never be called by the outside world
  10. MpdEmcGeoUtils();
  11. ///
  12. /// Destructor.
  13. ///
  14. ~MpdEmcGeoUtils() {}
  15. ///
  16. /// \return the pointer of the _existing_ unique instance of the geometry
  17. /// It should have been set before with GetInstance(name) method
  18. ///
  19. static MpdEmcGeoUtils* GetInstance()
  20. {
  21. if (!sGeom) {
  22. sGeom = new MpdEmcGeoUtils();
  23. }
  24. return sGeom;
  25. }
  26. // Check if two towers have common side (for clustering)
  27. // \return -1: second from prev. sector, 0: no, 1: yes, 2: towers too far apart, no sense to continue searching for
  28. // neighboirs
  29. int AreNeighbours(int detId1, int detId2) const;
  30. // Check if two towers have common vertex (for unfolding)
  31. // \return -1: second from prev. sector, 0: no, 1: yes, 2: towers too far apart, no sense to continue searching for
  32. // neighboirs
  33. int AreNeighboursVertex(int detId1, int detId2) const;
  34. int GeantToDetId(int chamberH, int chamber, int sector, int crate,
  35. int module, int boxA, int boxB) const; // Convert Geant volume indexes to abs ID of a channel
  36. void DetIdToRelIndex(int detId, int& chamber, int& sector, int& iphi,
  37. int& iz) const; // Convert detId to iphi,iz indexes within one sector
  38. void DetIdToGlobalIphiIz(int detId, int& iphi, int& iz) const; // Convert detId to iphi=0...299,iz=0...127 indexes global
  39. int GetTotalNCells() const { return fNTowersPerChamber * fNChambers; }
  40. void DetIdToGlobalPosition(int detId, double& x, double& y,
  41. double& z) const; // calculates senter of front surfase of tower with index detId
  42. void GetECALTubeSize(double& rMin, double& rMax, double& zMax); // Radius and length of ECAL tube
  43. int MaxPhiSector(int sector) const; // number of crates (phi raws) in sector
  44. bool IsPreviousSector(int sector1, int sector2)const; // check if sector 2 goes before sector1
  45. double Rperp(double z) ; //Radius in xy plane of the surface where clusters are reconstructed
  46. private:
  47. static MpdEmcGeoUtils* sGeom; // Pointer to the unique instance of the singleton
  48. int fNTowsersPerModule; //Number of towers per module
  49. int fNTowersPerCrate; // Number of towsers per crate
  50. int fNTowersPerSector; // Number of towsers per sector
  51. int fNCratesPerSector; // Number of crates per sector
  52. int fNCratesPerSector2; // Number of crates per small sector
  53. int fNSectorsPerChamber; // Number of Sectors per Chamber
  54. int fNChambers; // Number of chambers
  55. int fNTowersPerChamber; // number of tower per chamber
  56. float fEcalRmin; // Minimal radius of ECAL
  57. float fEcalRmax; // Maximal radius of ECAL
  58. float fEcalZmax; // Maximal lenght of ECAL in z direction
  59. ClassDef(MpdEmcGeoUtils, 1)
  60. };
  61. #endif