MpdTofMatchingData.cxx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. //------------------------------------------------------------------------------------------------------------------------
  2. /// \class MpdTofMatching
  3. ///
  4. /// \brief
  5. /// \author Sergei Lobastov (LHE, JINR, Dubna)
  6. //------------------------------------------------------------------------------------------------------------------------
  7. #include <iostream>
  8. #include <bitset>
  9. #include <cmath>
  10. #include <TMath.h>
  11. #include "MpdTofHit.h"
  12. #include "MpdTofMatching.h"
  13. #include "MpdTofMatchingData.h"
  14. using namespace std;
  15. ClassImp(MpdTofMatchingData)
  16. //------------------------------------------------------------------------------------------------------------------------
  17. MpdTofMatchingData::MpdTofMatchingData()
  18. {
  19. fTime = fBeta = fMass2 = fLength = NAN;
  20. }
  21. //------------------------------------------------------------------------------------------------------------------------
  22. MpdTofMatchingData::MpdTofMatchingData(Int_t kfTrackId, Int_t tofHitId, Double_t weight, const MpdTofHit* pHit, Double_t length, Int_t nTrHits, const TVector3& P, const TVector3& point)
  23. : fKFTrackIndex(kfTrackId), fTofHitIndex(tofHitId), fWeight(weight), fLength(length), fNmbTrHits(nTrHits)
  24. {
  25. fFlag = pHit->GetFlag();
  26. fTime = pHit->GetTime();
  27. fMomentum = P;
  28. pHit->Position(fHitPosition);
  29. fEstPoint = point;
  30. fdPhi = TMath::Sqrt(fEstPoint.X()*fEstPoint.X() + fEstPoint.Y()*fEstPoint.Y()) * (TMath::ATan2(fEstPoint.Y(),fEstPoint.X()) - TMath::ATan2(fHitPosition.Y(),fHitPosition.X()));
  31. //fdPhi = TMath::Sqrt( (fEstPoint.X()-fHitPosition.X())*(fEstPoint.X()-fHitPosition.X()) + (fEstPoint.Y()-fHitPosition.Y())*(fEstPoint.Y()-fHitPosition.Y()) );
  32. fdZed = fEstPoint.Z() - fHitPosition.Z();
  33. const static Double_t c_vel = TMath::C();
  34. fBeta = fLength / (fTime * 1.e-7) / c_vel;// [cm/nc] -> m/c
  35. Double_t beta2 = fBeta*fBeta;
  36. Double_t gamma2 = 1. / (1. - beta2);
  37. fMass2 = fMomentum.Mag2() / ( gamma2 * beta2 );
  38. }
  39. //------------------------------------------------------------------------------------------------------------------------
  40. void MpdTofMatchingData::Print(const char* comment, ostream& os) const
  41. {
  42. if(comment != nullptr) os<<comment;
  43. os<<"[MpdTofMatchingData] pair<"<<fKFTrackIndex<<", "<<fTofHitIndex<<">, weight="<<fWeight<<", norm. weight="<<fNormWeight<<", dev.="<<GetDelta()
  44. <<", flag="<<std::bitset<sizeof(Int_t)>(fFlag)<<", Momentum("<<fMomentum.X()<<","<<fMomentum.Y()<<","<<fMomentum.Z()
  45. <<"), hit position("<<fHitPosition.X()<<","<<fHitPosition.Y()<<","<<fHitPosition.Z()<<"), length="<<fLength;
  46. }
  47. //------------------------------------------------------------------------------------------------------------------------