MpdTpcFoundHit.cxx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #include "MpdTpcFoundHit.h"
  2. ClassImp(MpdTpcFoundHit)
  3. MpdTpcFoundHit::MpdTpcFoundHit() :
  4. fNumHits(1), fHitType(kUnknown), fPadRow(0), fPadCol(0),
  5. fTimeBkt(0), fQFit(0.), fSigQFit(0.), fQADC(0.), fCluster(0)
  6. {}
  7. //......................................................................
  8. MpdTpcFoundHit::MpdTpcFoundHit(const MpdTpc2dCluster* clus) :
  9. fNumHits(1), fHitType(kUnknown), fPadRow(0), fPadCol(0), fTimeBkt(0),
  10. fQFit(0.), fSigQFit(0.), fQADC(0.), fCluster(0)
  11. {
  12. this->AttachCluster(clus);
  13. }
  14. //......................................................................
  15. MpdTpcFoundHit::MpdTpcFoundHit(Float_t x, Float_t dx, Float_t y, Float_t dy, Float_t z, Float_t dz)
  16. {
  17. fNumHits = 1;
  18. fHitType = kUnknown;
  19. fQFit = 0.;
  20. fSigQFit = 0.;
  21. fQADC = 0.;
  22. fTimeBkt = 0.;
  23. Float_t pos[3] = {x, y, z};
  24. Float_t err[3] = {dx, dy, dz};
  25. this->SetPos(pos, err);
  26. }
  27. //......................................................................
  28. MpdTpcFoundHit::MpdTpcFoundHit(Float_t p[3], Float_t dp[3])
  29. {
  30. fNumHits = 1;
  31. fHitType = kUnknown;
  32. fQFit = 0.;
  33. fSigQFit = 0.;
  34. fQADC = 0.;
  35. fTimeBkt = 0.;
  36. this->SetPos(p, dp);
  37. }
  38. //......................................................................
  39. MpdTpcFoundHit::MpdTpcFoundHit(const MpdTpcFoundHit& hit) :
  40. TObject((const TObject&) hit)
  41. {
  42. this->AttachCluster(hit.Cluster());
  43. fTimeBkt = hit.fTimeBkt;
  44. fNumHits = hit.fNumHits;
  45. fHitType = hit.fHitType;
  46. fQFit = hit.fQFit;
  47. fSigQFit = hit.fSigQFit;
  48. fQADC = hit.fQADC;
  49. fPadCol = hit.fPadCol;
  50. }
  51. //......................................................................
  52. MpdTpcFoundHit::~MpdTpcFoundHit()
  53. { }
  54. const void MpdTpcFoundHit::Print() const
  55. {
  56. std::cout.precision(4);
  57. std::cout << "("
  58. << this->GetLocalX() << " +/- " << this->errX() << ","
  59. << this->GetLocalY() << " +/- " << this->errY() << ","
  60. << this->GetLocalZ() << " +/- " << this->errZ() << ")";
  61. }
  62. //......................................................................
  63. void MpdTpcFoundHit::AttachCluster(const MpdTpc2dCluster* currclus)
  64. {
  65. //fCluster = TRef((MpdTpc2dCluster*)currclus);
  66. fCluster = currclus;
  67. fPadRow = currclus->Row();
  68. }
  69. //......................................................................
  70. ostream& operator << (ostream& ostr, const MpdTpcFoundHit& h1)
  71. {
  72. ostr.precision(4);
  73. ostr << "(" << h1.GetLocalX() << "," << h1.GetLocalY() << "," << h1.GetLocalZ() << ")";
  74. return ostr;
  75. }
  76. void MpdTpcFoundHit::SetPos(Float_t *p, Float_t *dp)
  77. {
  78. _xl=p[0];_yl=p[1];_zl=p[2];
  79. _dx=dp[0];_dy=dp[1];_dz=dp[2];
  80. }
  81. void MpdTpcFoundHit::AddOrigin(Int_t Origin){
  82. // for(Int_t i = 0; i < Origins.GetEntriesFast(); ++i){
  83. // Bool_t OriginExist = 0;
  84. // for(Int_t j = 0; j < fOrigins.GetEntriesFast(); ++j)
  85. // if(fOrigins.At(j) == Origins.At(i)) {
  86. // OriginExist = 1;
  87. // continue;
  88. // }
  89. // if(!OriginExist)
  90. // fOrigins.Add(Origins[i]);
  91. // }
  92. fOrigin = Origin;
  93. }
  94. ////////////////////////////////////////////////////////////////////////