MpdTpcSectorGeo.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #ifndef MPDTPCSECTORGEO_H
  2. #define MPDTPCSECTORGEO_H
  3. /// \ingroup rec
  4. /// \class MpdTpcSectorGeo
  5. /// \brief Geometry configuration of MPD TPC sector
  6. ///
  7. /// \author Alexander Zinchenko, LHEP JINR Dubna
  8. #include <TObject.h>
  9. #include <TVector3.h>
  10. class TpcGas;
  11. class MpdTpcSectorGeo : public TObject
  12. {
  13. public:
  14. enum Shifts {kSectorS = 0, kPadrowS = 5, kPadS = 13, kPadSignS = 30};
  15. enum Masks {kSectorM = 31, kPadrowM = 255, kPadM = 255, kPadSignM = 1};
  16. public:
  17. static MpdTpcSectorGeo* Instance(); ///< get singleton instance
  18. Int_t Global2Local(const Double_t *xyzGlob, Double_t *xyzLoc, Int_t iSec = -1); ///< transform global coordinates to local (sector) - returns padID
  19. Int_t Global2Local(const TVector3 &xyzGlob, TVector3 &xyzLoc, Int_t iSec = -1); ///< transform global coordinates to local (sector) - returns padID
  20. void Local2Global(Int_t iSec, const Double_t *xyzLoc, Double_t *xyzGlob); ///< transform local coordinates of sector iSec to global
  21. void Local2Global(Int_t iSec, const TVector3 &xyzLoc, TVector3 &xyzGlob); ///< transform local coordinates of sector iSec to global
  22. Int_t PadRow(Int_t padID) { return (padID >> kPadrowS) & kPadrowM; } ///< pad rows from padID
  23. Int_t Sector(Int_t padID) { return (padID >> kSectorS) & kSectorM; } ///< sector No. from padID
  24. Int_t PadID(Int_t sec, Int_t row) { return sec |= (row << kPadrowS); } ///< padID from sector and padrow numbers
  25. void PadID(Float_t xloc, Float_t yloc, UInt_t &row, UInt_t &pad, Float_t &yNext); ///< get row, pad and distance to nearest row
  26. TVector2 LocalPadPosition(Int_t padID); ///< get local pad position for padID
  27. Int_t NofSectors() { return fgkNsect; } ///< get number of TPC r/out sectors
  28. //Int_t NofRows() { return fgkNrows; } ///< get number of pad rows
  29. Int_t NofRows() { return fNrows[0] + fNrows[1]; } ///< get number of pad rows
  30. Int_t NofRowsReg(Int_t ireg) { return fNrows[ireg]; } ///< get number of pad rows in ROC region ireg
  31. Double_t Dphi() { return fDphi; } ///< get sector angle
  32. Double_t GetMinY() { return fYsec[0]; } ///< get minimum sector Y
  33. Double_t GetMaxY() { return fYsec[2]; } ///< get maximum sector Y
  34. Double_t GetRocY(Int_t i) { return fYsec[i]; } ///< get ROC region Y-coordinates
  35. Double_t PadHeight(Int_t ireg = 0) { return fPadH[ireg]; } ///< get pad height in ROC region ireg
  36. Double_t PadWidth(Int_t ireg = 0) { return fPadW[ireg]; } ///< get pad width in ROC region ireg
  37. Double_t SectorAngle(Int_t iSec) { return fPhi0 + (iSec + 0.5) * fDphi; } ///< get azimuthal angle of sector axis
  38. Int_t GetNTimeBins () { return fNTimeBins; } ///< number of time bins
  39. Int_t GetZmin () { return fZmin; } ///< sensitive volume Zmin
  40. Int_t GetZmax () { return fZmax; } ///< sensitive volume Zmax
  41. const Int_t* NPadsInRows() const { return fNPadsInRows; } ///< numbers of pads in rows
  42. Double_t Z2TimeBin(Double_t z); ///< Z-to-Time bin conversion
  43. Double_t T2TimeBin(Double_t time); ///< time-to-Time bin conversion
  44. Double_t TimeBin2Z(Double_t timeBin); ///< Time bin-to-Z conversion
  45. Double_t Pad2Xloc(Double_t pad, Int_t row); ///< Pad number-to-Xlocal conversion
  46. Double_t TimeMax() const { return fTimeMax; } ///< max drift time
  47. Double_t TimeBin() const { return fTimeBin; } ///< time bin length
  48. void SetNofRows(Int_t nRows, Int_t ireg = 0) { fNrows[ireg] = nRows; }
  49. void SetPadHeight(Double_t height, Int_t ireg = 0) { fPadH[ireg] = height; }
  50. void SetMinY(Double_t rmin) { fYsec[0] = rmin; }
  51. protected:
  52. //virtual void Finish();
  53. MpdTpcSectorGeo() { Init(); } ///< Default ctor
  54. virtual ~MpdTpcSectorGeo() {;} ///< Destructor
  55. private:
  56. void Init();
  57. // Automatic deletion when application exits
  58. static void DestroyInstance () { if (fgTpcSec) delete fgTpcSec; }
  59. static MpdTpcSectorGeo* fgTpcSec; //! pointer to Singleton instance
  60. static const Int_t fgkNsect = 12; // number of TPC sectors
  61. //static const Int_t fgkNrows = 50; // number of padrows
  62. Int_t fNrows[2]; // number of padrows 2 ROC regions
  63. Double_t fPhi0; // phi0 of the first sector
  64. Double_t fDphi; // sector angle
  65. Double_t fYsec[3]; // coordinates of ROC regions (height direction): minimum, boundary, maximum
  66. Double_t fPadH[2]; // pad heights for 2 ROC regions
  67. Double_t fPadW[2]; // pad widths for 2 ROC regions
  68. Double_t fZmin; // sensitive volume Zmin
  69. Double_t fZmax; // sensitive volume Zmax
  70. Double_t fNTimeBins; // number of time bins
  71. Int_t* fNPadsInRows; // numbers of pads in rows
  72. Double_t fZ2TimeBin; // Z-to-Time bin conversion coefficient
  73. TpcGas* fGas; // pointer to gas system
  74. Double_t fTimeMax; // max drift time
  75. Double_t fTimeBin; // time bin length
  76. //Int_t fTimeBinMax; // max time bin
  77. Double_t fTimeBinMax; // max time bin
  78. ClassDef(MpdTpcSectorGeo,1);
  79. };
  80. //__________________________________________________________________________
  81. inline Double_t MpdTpcSectorGeo::Z2TimeBin(Double_t z)
  82. {
  83. // Z-to-Time bin conversion
  84. return (fZmax - TMath::Abs(z)) * fZ2TimeBin;
  85. }
  86. //__________________________________________________________________________
  87. inline Double_t MpdTpcSectorGeo::T2TimeBin(Double_t time)
  88. {
  89. // Time-to-Time bin conversion
  90. return time / fTimeBin;
  91. }
  92. //__________________________________________________________________________
  93. inline Double_t MpdTpcSectorGeo::TimeBin2Z(Double_t timeBin)
  94. {
  95. // Time bin-to-Z conversion
  96. //return (fTimeBinMax - timeBin - 0.5) / fZ2TimeBin;
  97. return (fTimeBinMax - timeBin - 0.5 + 0.037) / fZ2TimeBin; // extra correction
  98. }
  99. //__________________________________________________________________________
  100. inline Double_t MpdTpcSectorGeo::Pad2Xloc(Double_t pad, Int_t row)
  101. {
  102. // Pad number-to-Xlocal conversion
  103. Double_t padW = (row < NofRowsReg(0)) ? fPadW[0] : fPadW[1];
  104. return padW * (pad - fNPadsInRows[row] + 0.5);
  105. }
  106. //__________________________________________________________________________
  107. #endif