TpcLheTrack.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /////////////////////////////////////////////////////////////////////////////////
  2. // //
  3. // TpcLheTrack class - implementation of TPC track for LHE tracking //
  4. // //
  5. /////////////////////////////////////////////////////////////////////////////////
  6. #ifndef PND_TPC_LHE_TRACK_H
  7. #define PND_TPC_LHE_TRACK_H
  8. #include "TObject.h"
  9. #include "TVector3.h"
  10. #include "TClonesArray.h"
  11. #include "TLorentzVector.h"
  12. #include "TpcLhePoint.h"
  13. #include "TpcLheHit.h"
  14. //#include "lhe.h"
  15. #include "Riostream.h"
  16. class TpcLheTrack: public TObject {
  17. // using namespace std;
  18. protected:
  19. TObjArray *fRealHits; // Array of indices of hits
  20. Int_t fQ; // track charge
  21. Int_t fTrackNumber; // track number in
  22. Bool_t fFromMainVertex; // true for primary tracks
  23. // Double_t fRadius; // Radius of the helix (projected to a circle)
  24. Double_t fMoment; // momentum estimation
  25. Bool_t fGood; //
  26. Double_t fDipChi2;
  27. Double_t fTanDipAngle;
  28. Double_t fTanDipAngleErr;
  29. Double_t fZ0;
  30. Double_t fZ0Err;
  31. TpcLhePoint fVertex; // track vertex
  32. TpcLhePoint fLastHit; // last track hit
  33. TpcLhePoint fCircle; // circle x,y,R
  34. // --- the code below is needed only for testing with Geant
  35. Int_t fPid; // GEANT particle id
  36. TVector3 fP; // track momentum
  37. // -----------
  38. public:
  39. TpcLheTrack (); // constructor
  40. TpcLheTrack (Int_t tracknumber); // constructor with tracknumber
  41. virtual ~TpcLheTrack (); //
  42. void SetDefaults(); // performs the default setup for the track
  43. void AddHit(TpcLheHit *point); // adds a hit to the track
  44. // getters
  45. TObjArray *GetRHits() const { return fRealHits; }
  46. Int_t GetTrackNumber() const { return fTrackNumber; }
  47. Bool_t IsGood() const { return fGood; }
  48. Int_t GetPid() const { return fPid; }
  49. Int_t GetNumberOfHits() const { return fRealHits->GetEntries(); }
  50. Bool_t ComesFromMainVertex() const { return fFromMainVertex; }
  51. TVector3 GetMomentum() const { return fP; }
  52. Double_t GetMoment () { return fMoment; }
  53. Double_t GetTheta ();
  54. Double_t GetTanAlpha ();
  55. Double_t GetTanDipAngle() const { return fTanDipAngle; }
  56. Double_t GetZ0() const { return fZ0; }
  57. Double_t GetPx() const { return fP.X(); }
  58. Double_t GetPy() const { return fP.Y(); }
  59. Double_t GetPz() const { return fP.Z(); }
  60. Double_t GetPt() const;
  61. Double_t GetP() const;
  62. Double_t GetPseudoRapidity() const;
  63. TpcLhePoint GetVertex() const { return fVertex; }
  64. TpcLhePoint GetCircle() const { return fCircle; }
  65. Int_t GetCharge() const { return fQ; }
  66. // setters
  67. Double_t GetRadius() const { return fCircle.GetZ(); }
  68. void SetRadius(Double_t f) { fCircle.SetZ(f); }
  69. void SetTrackNumber(Int_t num);
  70. void SetPx(Double_t f) {fP.SetX(f); }
  71. void SetPy(Double_t f) {fP.SetY(f); }
  72. void SetPz(Double_t f) {fP.SetZ(f); }
  73. void SetMoment(Double_t f);
  74. void SetTanDipAngle(Double_t f) {fTanDipAngle = f;}
  75. void SetTanDipAngleErr(Double_t f) {fTanDipAngleErr = f;}
  76. void SetDipChi2(Double_t f) {fDipChi2 = f;}
  77. void SetZ0(Double_t f) {fZ0 = f;}
  78. void SetZ0Err(Double_t f) {fZ0Err = f;}
  79. void SetGood(Bool_t f) { fGood = f; }
  80. void SetVertex(Double_t vx, Double_t vy, Double_t vz);
  81. void SetCircle(Double_t vx, Double_t vy, Double_t vz);
  82. void SetCharge(Int_t f) {fQ = f; }
  83. void SetPid(Int_t f) {fPid = f; }
  84. void ComesFromMainVertex(Bool_t f) { fFromMainVertex = f; }
  85. virtual void Print(); //
  86. void PrintHits();
  87. ClassDef(TpcLheTrack , 1) // STS track class
  88. };
  89. //________________________________________________________________
  90. inline void TpcLheTrack::SetMoment (Double_t f) {
  91. //
  92. fMoment = f* 1.e-3;
  93. #if 0
  94. // beta --- angle between Z and projection on XZ plane
  95. SetPz(fMoment*TMath::Cos(fBeta) /
  96. TMath::Sqrt(1. + fTanAlpha*fTanAlpha));
  97. SetPx(fMoment*TMath::Sin(fBeta) /
  98. TMath::Sqrt(1. + fTanAlpha*fTanAlpha));
  99. SetPy(fMoment*fTanAlpha /
  100. TMath::Sqrt(1. + fTanAlpha*fTanAlpha) );
  101. #endif
  102. }
  103. //________________________________________________________________
  104. inline Double_t TpcLheTrack::GetTheta () {
  105. return TMath::ATan2 (fP.X(), fP.Z());
  106. }
  107. //________________________________________________________________
  108. inline Double_t TpcLheTrack::GetTanAlpha () {
  109. return fP.Y()/TMath::Sqrt(fP.X()*fP.X() + fP.Z()*fP.Z());
  110. }
  111. //________________________________________________________________
  112. inline Double_t TpcLheTrack::GetP() const {
  113. // Returns total momentum.
  114. return fP.Mag();
  115. }
  116. //________________________________________________________________
  117. inline Double_t TpcLheTrack::GetPt() const {
  118. // Returns transverse momentum.
  119. return fP.Pt();
  120. }
  121. //________________________________________________________________
  122. inline Double_t TpcLheTrack::GetPseudoRapidity() const {
  123. // Returns the pseudorapidity of the particle.
  124. return 0.5 * TMath::Log((fP.Mag() + fP.Z()) / (fP.Mag() - fP.Z()));
  125. }
  126. ///:~
  127. #endif