TpcLheHit.cxx 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #include "Riostream.h"
  2. #include <iomanip>
  3. #include "TpcLheHit.h"
  4. using namespace std;
  5. ClassImp(TpcLheHit)
  6. //________________________________________________________________
  7. TpcLheHit::TpcLheHit() : TObject() {
  8. //---
  9. SetUsage(kFALSE);
  10. SetHitNumber(-1);
  11. SetTrackID(-1);
  12. SetX(0);
  13. SetY(0);
  14. SetZ(0);
  15. SetXerr(0);
  16. SetYerr(0);
  17. SetZerr(0);
  18. SetFlag(1);
  19. SetEdep(0);
  20. SetStep(0);
  21. }
  22. //________________________________________________________________
  23. TpcLheHit::TpcLheHit(TpcPoint *point) : TObject() {
  24. SetUsage(kFALSE);
  25. SetHitNumber(-1);
  26. SetTrackID(-1);
  27. Float_t error = 0.0;
  28. SetXerr(error);
  29. SetYerr(error);
  30. SetZerr(error);
  31. SetFlag(1);
  32. SetEdep(0);
  33. SetStep(0);
  34. }
  35. //________________________________________________________________
  36. TpcLheHit::TpcLheHit(Double_t *x, Int_t stn) : TObject() {
  37. // Constructor which takes the coodrinates and the station number.
  38. SetUsage(kFALSE);
  39. SetHitNumber(-1);
  40. SetTrackID(-1);
  41. SetX(x[0]);
  42. SetY(x[1]);
  43. SetZ(x[2]);
  44. SetXerr(0.);
  45. SetYerr(0.);
  46. SetZerr(0.);
  47. SetFlag(1);
  48. SetEdep(0);
  49. SetStep(0);
  50. }
  51. //________________________________________________________________
  52. TpcLheHit::~TpcLheHit() {
  53. // ---
  54. }
  55. //________________________________________________________________
  56. void TpcLheHit::Print() {
  57. cout << flush;
  58. cout << " " << fTrackID ;
  59. cout << " " << fHitNumber;
  60. cout << " " << Int_t(fUsed) ;
  61. cout.setf(ios::right, ios::floatfield);
  62. cout.precision(3);
  63. cout << " " << setw(7) << fCoord.X();
  64. cout << " " << setw(7) << fCoord.Y();
  65. cout << " " << setw(5) << fCoord.Z();
  66. cout.setf(ios::scientific);
  67. cout.precision(5);
  68. cout << " " << setw(10) << fError.X();
  69. cout << " " << setw(10) << fError.Y();
  70. cout << " " << setw(10) << fError.Z();
  71. cout << endl;
  72. cout.setf(ios::right, ios::floatfield);
  73. }
  74. //________________________________________________________________
  75. Int_t TpcLheHit::Compare(const TObject* hit) const
  76. {
  77. /// "Compare" function to sort in descending order in radius
  78. TpcLheHit *tpcHit = (TpcLheHit*) hit;
  79. if (fLayer < tpcHit->GetLayer()) return 1;
  80. else if (fLayer > tpcHit->GetLayer()) return -1;
  81. else {
  82. if (fR < tpcHit->GetR()) return 1;
  83. else if (fR > tpcHit->GetR()) return -1;
  84. else return 0;
  85. }
  86. }