MpdDchHit.cxx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //------------------------------------------------------------------------------------------------------------------------
  2. #include <iostream>
  3. using namespace std;
  4. #include "MpdDchHit.h"
  5. //------------------------------------------------------------------------------------------------------------------------
  6. MpdDchHit::MpdDchHit()
  7. : FairHit(),
  8. fFlag(0),
  9. fNofDim(1),
  10. fPhi(0.)
  11. {
  12. fMeas[1] = fError[1] = 0.;
  13. }
  14. //------------------------------------------------------------------------------------------------------------------------
  15. MpdDchHit::MpdDchHit(Int_t detID, TVector3 pos, TVector3 dpos, Int_t index, Int_t flag)
  16. : FairHit(detID, pos, dpos, index),
  17. fFlag(flag),
  18. fNofDim(1),
  19. fPhi(0.)
  20. {
  21. fMeas[1] = fError[1] = 0.;
  22. }
  23. //------------------------------------------------------------------------------------------------------------------------
  24. MpdDchHit::MpdDchHit(Int_t detID, TVector3 pos, TVector3 dpos, Int_t index)
  25. : FairHit(detID, pos, dpos, index),
  26. fFlag(0),
  27. fNofDim(1),
  28. fPhi(0.)
  29. {
  30. fMeas[1] = fError[1] = 0.;
  31. }
  32. //------------------------------------------------------------------------------------------------------------------------
  33. MpdDchHit::~MpdDchHit() { }
  34. //------------------------------------------------------------------------------------------------------------------------
  35. void MpdDchHit::Print(const Option_t* opt) const
  36. {
  37. cout<<"-I- MpdDchHit"<<endl;
  38. cout<<" DetectorID: " << fDetectorID << endl;
  39. cout<<" Position: (" <<fX<<", "<<fY<<", "<<fZ<< ") cm"<< endl;
  40. cout<<" Position error: ("<<fDx<< ", "<<fDy<< ", "<<fDz<< ") cm"<< endl;
  41. cout<<" Flag: "<<fFlag<< endl;
  42. }
  43. //------------------------------------------------------------------------------------------------------------------------
  44. void MpdDchHit::SetIndex(Int_t indx)
  45. {
  46. /// Add point index
  47. Int_t size = fIndex.GetSize();
  48. fIndex.Set (size + 1);
  49. fIndex[size] = indx;
  50. }
  51. //------------------------------------------------------------------------------------------------------------------------
  52. Int_t MpdDchHit::Compare(const TObject* hit) const
  53. {
  54. /// "Compare" function to sort in ascending order in abs(Z)
  55. MpdDchHit *kHit = (MpdDchHit*) hit;
  56. if (GetLayer() < kHit->GetLayer()) return -1;
  57. else if (GetLayer() > kHit->GetLayer()) return 1;
  58. else
  59. {
  60. if (TMath::Abs(fZ) < TMath::Abs(kHit->GetZ())) return -1;
  61. else if (TMath::Abs(fZ) > TMath::Abs(kHit->GetZ())) return 1;
  62. else return 0;
  63. }
  64. }
  65. //------------------------------------------------------------------------------------------------------------------------
  66. ClassImp(MpdDchHit)