MpdStrawECTHit.cxx 2.8 KB

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