MpdMCTrack.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. // -------------------------------------------------------------------------
  2. // ----- FairMCTrack header file -----
  3. // ----- Created 03/08/04 by V. Friese -----
  4. // ----- adopted for NICA/MPD 29/03/10 (litvin) -----
  5. // ----- adopted for NICA/MPD 20/12/19 (ABychkov) -----
  6. // -------------------------------------------------------------------------
  7. /** FairMCTrack.h
  8. *@author V.Friese <v.friese@gsi.de>
  9. **
  10. ** Data class for storing Monte Carlo tracks processed by the MpdStack (FairStack).
  11. ** A MCTrack can be a primary track put into the simulation or a
  12. ** secondary one produced by the transport through decay or interaction.
  13. **
  14. ** Redesign 13/06/07 by V. Friese
  15. **/
  16. #ifndef MPDMCTRACK_H
  17. #define MPDMCTRACK_H 1
  18. #include "MpdDetectorList.h"
  19. #include "TLorentzVector.h"
  20. #include "TObject.h"
  21. #include "TParticle.h"
  22. #include "TVector3.h"
  23. #ifndef ROOT_TParticlePDG
  24. #include "TParticlePDG.h"
  25. #endif
  26. #ifndef ROOT_TDatabasePDG
  27. #include "TDatabasePDG.h"
  28. #endif
  29. class MpdMCTrack : public TObject
  30. {
  31. public:
  32. /** Default constructor **/
  33. MpdMCTrack();
  34. /** Standard constructor **/
  35. MpdMCTrack(Int_t pdgCode, Int_t motherID, Double_t px, Double_t py,
  36. Double_t pz, Double_t x, Double_t y, Double_t z,
  37. Double_t t, Int_t nPoints);
  38. /** Copy constructor **/
  39. MpdMCTrack(const MpdMCTrack& track);
  40. /** Constructor from TParticle **/
  41. MpdMCTrack(TParticle* particle);
  42. /** Destructor **/
  43. virtual ~MpdMCTrack();
  44. /** Output to screen **/
  45. void Print(Int_t iTrack=0) const;
  46. /** Accessors **/
  47. Int_t GetPdgCode() const { return fPdgCode; }
  48. Int_t GetMotherId() const { return fMotherId; }
  49. Double_t GetPx() const { return fPx; }
  50. Double_t GetPy() const { return fPy; }
  51. Double_t GetPz() const { return fPz; }
  52. Double_t GetStartX() const { return fStartX; }
  53. Double_t GetStartY() const { return fStartY; }
  54. Double_t GetStartZ() const { return fStartZ; }
  55. Double_t GetStartT() const { return fStartT; }
  56. Double_t GetMass() const;
  57. Double_t GetEnergy() const;
  58. Double_t GetPt() const { return TMath::Sqrt(fPx*fPx+fPy*fPy); }
  59. Double_t GetP() const { return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz); }
  60. Double_t GetRapidity() const;
  61. void GetMomentum(TVector3& momentum);
  62. void Get4Momentum(TLorentzVector& momentum);
  63. void GetStartVertex(TVector3& vertex);
  64. Double_t GetPolar(Int_t indx) { return fPolar[indx]; }
  65. Double_t GetWeight() { return fWeight; }
  66. /** Accessors to the number of MCPoints in the detectors **/
  67. Int_t GetNPoints(DetectorIdMPD detId) const;
  68. /** Modifiers **/
  69. void SetMotherId(Int_t id) { fMotherId = id; }
  70. void SetNPoints(Int_t iDet, Int_t np);
  71. void SetPolar(Int_t indx, Double_t polar) { fPolar[indx] = polar; }
  72. void SetWeight(Double_t weight) { fWeight = weight; }
  73. private:
  74. /** PDG particle code **/
  75. Int_t fPdgCode;
  76. /** Index of mother track. -1 for primary particles. **/
  77. Int_t fMotherId;
  78. /** Momentum components at start vertex [GeV] **/
  79. Double32_t fPx, fPy, fPz;
  80. /** Coordinates of start vertex [cm, ns] **/
  81. Double32_t fStartX, fStartY, fStartZ, fStartT;
  82. /** Bitvector representing the number of MCPoints for this track in
  83. ** each subdetector. The detectors are represented by
  84. ** kSTS: Bit 0 (1 bit, max. value 1)
  85. ** kTPC: Bit 1
  86. ** kTOF: Bit 2
  87. ** kETOF: Bit 3
  88. ** kFD: Bit 4
  89. ** kECT: Bit 5
  90. ** kECAL: Bit 6
  91. ** kNDET: Bit 7
  92. ** kCPC: Bit 8
  93. ** kBBC: Bit 9
  94. ** kZDC: Bit 10
  95. ** kFSA: Bit 11
  96. ** The respective point numbers can be accessed and modified
  97. ** with the inline functions.
  98. ** Bits 12-31 are spare for potential additional detectors.
  99. **/
  100. Int_t fNPoints;
  101. /**AZ Polarization **/
  102. Double32_t fPolar[3];
  103. /** Accounts for the length of the polarization vector **/
  104. Double32_t fWeight;
  105. ClassDef(MpdMCTrack,5);
  106. };
  107. // ========== Inline functions ========================================
  108. inline Double_t MpdMCTrack::GetEnergy() const {
  109. Double_t mass = GetMass();
  110. return TMath::Sqrt(mass*mass + fPx*fPx + fPy*fPy + fPz*fPz );
  111. }
  112. inline void MpdMCTrack::GetMomentum(TVector3& momentum) {
  113. momentum.SetXYZ(fPx,fPy,fPz);
  114. }
  115. inline void MpdMCTrack::Get4Momentum(TLorentzVector& momentum) {
  116. momentum.SetXYZT(fPx,fPy,fPz,GetEnergy());
  117. }
  118. inline void MpdMCTrack::GetStartVertex(TVector3& vertex) {
  119. vertex.SetXYZ(fStartX,fStartY,fStartZ);
  120. }
  121. #endif