MpdTpcHit.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef _MPDTPCHIT_H_
  2. #define _MPDTPCHIT_H_
  3. /// \ingroup tpc
  4. /// \class MpdTpcHit
  5. /// \brief Hit in MPD TPC
  6. ///
  7. /// \author Alexander Zinchenko, LHEP JINR Dubna - extension of TpcHit
  8. #include <FairHit.h>
  9. #include <TObject.h>
  10. #include <vector>
  11. class MpdTpc2dCluster;
  12. class MpdTpcHit : public FairHit
  13. {
  14. public:
  15. enum k_LinkType { PointIndex = 1, MCTrackIndex = 2 };
  16. public:
  17. MpdTpcHit() : FairHit(),
  18. fiPad(-1), fiBin(-1), fLayer(-1), fNdigits(0), fFlag(0), fQ(0), fStep(0), fLength(0), fLocalX(0), fLocalY(0), fLocalZ(0)
  19. { }
  20. MpdTpcHit(Int_t iPad, Int_t iBin) : FairHit(),
  21. fiPad(iPad), fiBin(iBin), fLayer(-1), fNdigits(0), fFlag(0), fQ(0), fStep(0), fLength(0), fLocalX(0), fLocalY(0), fLocalZ(0)
  22. { }
  23. MpdTpcHit(Int_t detUID, TVector3 posHit, TVector3 posHitErr, Int_t pointIndx);
  24. // TpcHit(const TpcHit &hit) : FairHit((const FairHit &)hit) {
  25. // fiBin = hit.fiBin;
  26. // fiPad = hit.fiPad;
  27. // fQ = hit.fQ;
  28. // fLocalX = hit.fLocalX;
  29. // fLocalY = hit.fLocalY;
  30. // fLocalZ = hit.fLocalZ;
  31. // }
  32. virtual ~MpdTpcHit() {}
  33. /** Accessors **/
  34. Int_t GetModular() const { return GetUniqueID(); }
  35. Int_t GetPad() const { return fiPad; }
  36. Int_t GetBin() const { return fiBin; }
  37. Int_t GetLayer() const { return fLayer; }
  38. Int_t GetFlag() const { return fFlag; }
  39. Double_t GetQ() const { return fQ; }
  40. Double_t GetStep() const { return fStep; } // step during MC transport
  41. Double_t GetLength() const { return fLength; } // track length
  42. // For backward compatibility
  43. //Int_t GetTrackID() const { return GetLinksWithType(Int_t type).GetLink(Int_t pos); }
  44. //Int_t GetTrackID() const { return GetLinksWithType(MpdTpcHit::MCTrackIndex).GetLink(0).GetIndex(); }
  45. Int_t GetTrackID() const;
  46. Double_t GetR() const { return fLocalY; }
  47. Double_t GetRphi() const { return fLocalX; }
  48. Double_t GetEnergyLoss() const { return fQ; }
  49. Double_t GetLocalX() const { return fLocalX; }
  50. Double_t GetLocalY() const { return fLocalY; }
  51. Double_t GetLocalZ() const { return fLocalZ; }
  52. void LocalPosition(TVector3 & pos) const { pos.SetXYZ(fLocalX, fLocalY, fLocalZ); }
  53. Double_t GetRMS(Int_t ixz = 0) const { return fXZrms[ixz]; }
  54. Int_t GetNdigits() const { return fNdigits; }
  55. Int_t GetNtracks() const { return fIDs.size(); }
  56. std::vector<Int_t>& GetIDs() { return fIDs; }
  57. /** Modifiers **/
  58. void SetModular(Int_t imod) { SetUniqueID(imod); }
  59. void SetPad(Int_t ipad) { fiPad = ipad; }
  60. void SetBin(Int_t ibin) { fiBin = ibin; }
  61. void SetLayer(Int_t lay) { fLayer = lay; }
  62. void SetQ(Double_t q) { fQ = q; }
  63. void SetStep(Double_t step) { fStep = step; }
  64. void SetLength(Double_t length) { fLength = length; }
  65. void SetFlag(Int_t flag) { fFlag = flag; }
  66. // For backward compatibility
  67. void SetR(Double_t r) { fLocalY = r; }
  68. void SetRphi(Double_t rphi) { fLocalX = rphi; }
  69. void SetEnergyLoss(Double_t edep) { fQ = edep; }
  70. void SetLocalX(Double_t x) { fLocalX = x; }
  71. void SetLocalY(Double_t y) { fLocalY = y; }
  72. void SetLocalZ(Double_t z) { fLocalZ = z; }
  73. void SetLocalXYZ(Double_t x, Double_t y, Double_t z) { fLocalX = x; fLocalY = y; fLocalZ = z; }
  74. void SetLocalPosition(const TVector3& pos) {
  75. fLocalX = pos.X(); fLocalY = pos.Y(); fLocalZ = pos.Z();
  76. }
  77. void SetRMS(Double_t rms, Int_t ixz = 0) { fXZrms[ixz] = rms; }
  78. void SetNdigits(Int_t ndigs) { fNdigits = ndigs; }
  79. void AddID(Int_t id) { fIDs.push_back(id); }
  80. void SetFlags(const MpdTpc2dCluster *clus);
  81. Bool_t IsSortable() const { return kTRUE; }
  82. Int_t Compare(const TObject* hit) const; // "Compare" function for sorting
  83. private:
  84. Int_t fiPad;
  85. Int_t fiBin;
  86. Int_t fLayer;
  87. Int_t fNdigits; // number of digits in the hit
  88. Int_t fFlag;
  89. std::vector<Int_t> fIDs; // track IDs with the highest charge contribution
  90. Double32_t fQ;
  91. Double32_t fStep;
  92. Double32_t fLength;
  93. // Sector coordinate system
  94. Double32_t fLocalX;
  95. Double32_t fLocalY;
  96. Double32_t fLocalZ;
  97. Double32_t fXZrms[2]; // RMS of the hit (group of digits) along pad and drift directions
  98. ClassDef(MpdTpcHit, 3)
  99. };
  100. #endif // _MPDTPCHIT_H_