MpdTgemHit.cxx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. //--------------------------------------------------------------------------
  2. //----- MpdTgemHit -----
  3. //----- Created 8/12/09 by A. Zinchenko -----
  4. //--------------------------------------------------------------------------
  5. /** MpdTgemHit.cxx
  6. *@author A.Zinchenko <Alexander.Zinchenko@jinr.ru>
  7. **
  8. ** MPD End-Cap Tracker (ECT) hit
  9. **/
  10. // modified by A. Kuznetsov for Tgem
  11. #include <iostream>
  12. using namespace std;
  13. #include "MpdTgemHit.h"
  14. // ----- Default constructor -------------------------------------------
  15. MpdTgemHit::MpdTgemHit()
  16. : FairHit(),
  17. fFlag(0),
  18. fNofDim(1),
  19. fPhi(0.)
  20. {
  21. fMeas[1] = fError[1] = 0.;
  22. }
  23. // ----- Standard constructor ------------------------------------------
  24. MpdTgemHit::MpdTgemHit(Int_t detID, TVector3 pos, TVector3 dpos, Int_t index, Int_t flag)
  25. : FairHit(detID, pos, dpos, index),
  26. fFlag(flag),
  27. fNofDim(1),
  28. fPhi(0.)
  29. {
  30. fMeas[1] = fError[1] = 0.;
  31. }
  32. // ----- Constructor without flag ------------------------------------------
  33. MpdTgemHit::MpdTgemHit(Int_t detID, TVector3 pos, TVector3 dpos, Int_t index)
  34. : FairHit(detID, pos, dpos, index),
  35. fFlag(0),
  36. fNofDim(1),
  37. fPhi(0.)
  38. {
  39. fMeas[1] = fError[1] = 0.;
  40. }
  41. // ----- Destructor ----------------------------------------------------
  42. MpdTgemHit::~MpdTgemHit() { }
  43. // ----- Print -----------------------------------------------------------
  44. void MpdTgemHit::Print(const Option_t* opt) const
  45. {
  46. cout << "-I- MpdTgemHit" << endl;
  47. cout << " DetectorID: " << fDetectorID << endl;
  48. cout << " Position: (" << fX
  49. << ", " << fY
  50. << ", " << fZ << ") cm"
  51. << endl;
  52. cout << " Position error: (" << fDx
  53. << ", " << fDy
  54. << ", " << fDz << ") cm"
  55. << endl;
  56. cout << " Flag: " << fFlag
  57. << endl;
  58. }
  59. // -------------------------------------------------------------------------
  60. //__________________________________________________________________________
  61. void MpdTgemHit::SetIndex(Int_t indx)
  62. {
  63. /// Add point index
  64. Int_t size = fIndex.GetSize();
  65. fIndex.Set (size + 1);
  66. fIndex[size] = indx;
  67. }
  68. // -------------------------------------------------------------------------
  69. //________________________________________________________________
  70. Int_t MpdTgemHit::Compare(const TObject* hit) const
  71. {
  72. /// "Compare" function to sort in ascending order in abs(Z)
  73. MpdTgemHit *kHit = (MpdTgemHit*) hit;
  74. if (GetLayer() < kHit->GetLayer()) return -1;
  75. else if (GetLayer() > kHit->GetLayer()) return 1;
  76. else {
  77. if (TMath::Abs(fZ) < TMath::Abs(kHit->GetZ())) return -1;
  78. else if (TMath::Abs(fZ) > TMath::Abs(kHit->GetZ())) return 1;
  79. else return 0;
  80. }
  81. }
  82. // -------------------------------------------------------------------------
  83. ClassImp(MpdTgemHit)