EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CbmMCTrack.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CbmMCTrack.h
1 // -------------------------------------------------------------------------
2 // ----- CbmMCTrack header file -----
3 // ----- Created 03/08/04 by V. Friese -----
4 // -------------------------------------------------------------------------
5 
6 
18 #ifndef CBMMCTRACK_H
19 #define CBMMCTRACK_H 1
20 
21 
22 #include "CbmDetectorList.h"
23 
24 #include "TObject.h"
25 #include "TMath.h"
26 #include "TVector3.h"
27 #include "TLorentzVector.h"
28 
29 class TParticle;
30 
31 class CbmMCTrack : public TObject
32 {
33 
34  public:
35 
36 
38  CbmMCTrack();
39 
40 
42  CbmMCTrack(Int_t pdgCode, Int_t motherID, Double_t px, Double_t py,
43  Double_t pz, Double_t x, Double_t y, Double_t z,
44  Double_t t, Int_t nPoints);
45 
47  CbmMCTrack(const CbmMCTrack& track);
48 
49 
51  CbmMCTrack(TParticle* particle);
52 
53 
55  virtual ~CbmMCTrack();
56 
57 
59  void Print(Int_t iTrack=0) const;
60 
61 
63  Int_t GetPdgCode() const { return fPdgCode; }
64  Int_t GetMotherId() const { return fMotherId; }
65  Double_t GetPx() const { return fPx; }
66  Double_t GetPy() const { return fPy; }
67  Double_t GetPz() const { return fPz; }
68  Double_t GetStartX() const { return fStartX; }
69  Double_t GetStartY() const { return fStartY; }
70  Double_t GetStartZ() const { return fStartZ; }
71  Double_t GetStartT() const { return fStartT; }
72  Double_t GetMass() const;
73  Double_t GetEnergy() const;
74  Double_t GetPt() const { return TMath::Sqrt(fPx*fPx+fPy*fPy); }
75  Double_t GetP() const { return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz); }
76  Double_t GetRapidity() const;
77  void GetMomentum(TVector3& momentum) const;
78  void Get4Momentum(TLorentzVector& momentum) const;
79  void GetStartVertex(TVector3& vertex) const;
80 
81 
83  Int_t GetNPoints(DetectorId detId) const;
84 
85 
87  void SetMotherId(Int_t id) { fMotherId = id; }
88  void SetNPoints(Int_t iDet, Int_t np);
89 
90 
91 
92 private:
93 
95  Int_t fPdgCode;
96 
98  Int_t fMotherId;
99 
101  Double32_t fPx, fPy, fPz;
102 
105 
121  Int_t fNPoints;
122 
123 
124  ClassDef(CbmMCTrack,2);
125 
126 };
127 
128 
129 
130 // ========== Inline functions ========================================
131 
132 inline Double_t CbmMCTrack::GetEnergy() const {
133  Double_t mass = GetMass();
134  return TMath::Sqrt(mass*mass + fPx*fPx + fPy*fPy + fPz*fPz );
135 }
136 
137 
138 inline void CbmMCTrack::GetMomentum(TVector3& momentum) const {
139  momentum.SetXYZ(fPx,fPy,fPz);
140 }
141 
142 
143 inline void CbmMCTrack::Get4Momentum(TLorentzVector& momentum) const {
144  momentum.SetXYZT(fPx,fPy,fPz,GetEnergy());
145 }
146 
147 
148 inline void CbmMCTrack::GetStartVertex(TVector3& vertex) const {
149  vertex.SetXYZ(fStartX,fStartY,fStartZ);
150 }
151 
152 
153 
154 
155 
156 #endif