CbmRoot
CbmMCTrack.h
Go to the documentation of this file.
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 #include <Rtypes.h> // for THashConsistencyHolder, ClassDef
22 #include <RtypesCore.h> // for Double_t, Int_t, Double32_t, UInt_t
23 #include <TLorentzVector.h> // for TLorentzVector
24 #include <TMath.h> // for Sqrt
25 #include <TObject.h> // for TObject
26 #include <TVector3.h> // for TVector3
27 
28 #include <string> // for string
29 
30 #include "CbmDefs.h" // for ECbmModuleId, ECbmModuleId::kMvd, ECbmModuleId::kPsd, ECbmModuleId::kSts
31 
32 class TParticle;
33 
34 class CbmMCTrack : public TObject {
35 
36 public:
38  CbmMCTrack();
39 
40 
42  CbmMCTrack(Int_t pdgCode,
43  Int_t motherID,
44  Double_t px,
45  Double_t py,
46  Double_t pz,
47  Double_t x,
48  Double_t y,
49  Double_t z,
50  Double_t t,
51  Int_t nPoints);
52 
54  CbmMCTrack(const CbmMCTrack& track);
55 
56 
58  CbmMCTrack(TParticle* particle);
59 
60 
62  virtual ~CbmMCTrack();
63 
64  Int_t AccMVD() const { return GetNPoints(ECbmModuleId::kMvd); }
65  Int_t AccSTS() const { return GetNPoints(ECbmModuleId::kSts); }
66  Int_t AccPSD() const { return GetNPoints(ECbmModuleId::kPsd); }
67 
69  UInt_t GetGeantProcessId() const { return fProcessId; }
70  Int_t GetPdgCode() const { return fPdgCode; }
71  Int_t GetMotherId() const { return fMotherId; }
72  Double_t GetPx() const { return fPx; }
73  Double_t GetPy() const { return fPy; }
74  Double_t GetPz() const { return fPz; }
75  Double_t GetStartX() const { return fStartX; }
76  Double_t GetStartY() const { return fStartY; }
77  Double_t GetStartZ() const { return fStartZ; }
78  Double_t GetStartT() const { return fStartT; }
79 
87  Double_t GetMass() const;
88 
96  Double_t GetCharge() const;
97 
98  Double_t GetEnergy() const;
99  Double_t GetPt() const { return TMath::Sqrt(fPx * fPx + fPy * fPy); }
100  Double_t GetP() const {
101  return TMath::Sqrt(fPx * fPx + fPy * fPy + fPz * fPz);
102  }
103  Double_t GetRapidity() const;
104  void GetMomentum(TVector3& momentum) const;
105  void Get4Momentum(TLorentzVector& momentum) const;
106  void GetStartVertex(TVector3& vertex) const;
107 
108 
110  Int_t GetNPoints(ECbmModuleId detId) const;
111 
112 
114  void SetMotherId(Int_t id) { fMotherId = id; }
115  void SetNPoints(ECbmModuleId iDet, Int_t np);
116 
117 
119  std::string ToString() const;
120 
121 
122 private:
124  UInt_t fProcessId;
125 
127  Int_t fPdgCode;
128 
130  Int_t fMotherId;
131 
133  Double32_t fPx, fPy, fPz;
134 
136  Double32_t fE;
137 
140 
156  Int_t fNPoints;
157 
158 
159  ClassDef(CbmMCTrack, 3)
160 };
161 
162 
163 // ========== Inline functions ========================================
164 
165 inline Double_t CbmMCTrack::GetEnergy() const {
166  if (fE > 0.) return fE;
167  Double_t mass = GetMass();
168  return TMath::Sqrt(mass * mass + fPx * fPx + fPy * fPy + fPz * fPz);
169 }
170 
171 
172 inline void CbmMCTrack::GetMomentum(TVector3& momentum) const {
173  momentum.SetXYZ(fPx, fPy, fPz);
174 }
175 
176 
177 inline void CbmMCTrack::Get4Momentum(TLorentzVector& momentum) const {
178  momentum.SetXYZT(fPx, fPy, fPz, GetEnergy());
179 }
180 
181 
182 inline void CbmMCTrack::GetStartVertex(TVector3& vertex) const {
183  vertex.SetXYZ(fStartX, fStartY, fStartZ);
184 }
185 
186 
187 #endif
CbmMCTrack::GetMotherId
Int_t GetMotherId() const
Definition: CbmMCTrack.h:71
CbmMCTrack::GetMomentum
void GetMomentum(TVector3 &momentum) const
Definition: CbmMCTrack.h:172
CbmMCTrack::GetMass
Double_t GetMass() const
Mass of the associated particle.
Definition: CbmMCTrack.cxx:114
CbmMCTrack::GetStartX
Double_t GetStartX() const
Definition: CbmMCTrack.h:75
CbmMCTrack::fStartT
Double32_t fStartT
Definition: CbmMCTrack.h:139
CbmMCTrack::ToString
std::string ToString() const
Definition: CbmMCTrack.cxx:295
CbmMCTrack::CbmMCTrack
CbmMCTrack()
Definition: CbmMCTrack.cxx:23
CbmMCTrack::GetPdgCode
Int_t GetPdgCode() const
Definition: CbmMCTrack.h:70
ECbmModuleId::kMvd
@ kMvd
Micro-Vertex Detector.
ECbmModuleId
ECbmModuleId
Definition: CbmDefs.h:33
CbmMCTrack::GetPx
Double_t GetPx() const
Definition: CbmMCTrack.h:72
CbmMCTrack::GetPy
Double_t GetPy() const
Definition: CbmMCTrack.h:73
CbmMCTrack::AccSTS
Int_t AccSTS() const
Definition: CbmMCTrack.h:65
CbmMCTrack::~CbmMCTrack
virtual ~CbmMCTrack()
Definition: CbmMCTrack.cxx:109
CbmMCTrack::fPy
Double32_t fPy
Definition: CbmMCTrack.h:133
CbmMCTrack::SetNPoints
void SetNPoints(ECbmModuleId iDet, Int_t np)
Definition: CbmMCTrack.cxx:214
CbmMCTrack::GetCharge
Double_t GetCharge() const
Charge of the associated particle.
Definition: CbmMCTrack.cxx:146
CbmMCTrack::AccMVD
Int_t AccMVD() const
Definition: CbmMCTrack.h:64
CbmMCTrack::GetStartZ
Double_t GetStartZ() const
Definition: CbmMCTrack.h:77
CbmMCTrack::fPz
Double32_t fPz
Definition: CbmMCTrack.h:133
CbmMCTrack::fPdgCode
Int_t fPdgCode
Definition: CbmMCTrack.h:127
CbmMCTrack::fProcessId
UInt_t fProcessId
Definition: CbmMCTrack.h:124
CbmMCTrack::GetNPoints
Int_t GetNPoints(ECbmModuleId detId) const
Definition: CbmMCTrack.cxx:186
CbmMCTrack::fMotherId
Int_t fMotherId
Definition: CbmMCTrack.h:130
CbmMCTrack::fE
Double32_t fE
Definition: CbmMCTrack.h:136
CbmMCTrack::SetMotherId
void SetMotherId(Int_t id)
Definition: CbmMCTrack.h:114
CbmMCTrack::GetGeantProcessId
UInt_t GetGeantProcessId() const
Definition: CbmMCTrack.h:69
CbmMCTrack::GetStartVertex
void GetStartVertex(TVector3 &vertex) const
Definition: CbmMCTrack.h:182
CbmMCTrack::GetPt
Double_t GetPt() const
Definition: CbmMCTrack.h:99
CbmMCTrack::GetRapidity
Double_t GetRapidity() const
Definition: CbmMCTrack.cxx:177
CbmMCTrack::GetStartY
Double_t GetStartY() const
Definition: CbmMCTrack.h:76
CbmMCTrack::fStartZ
Double32_t fStartZ
Definition: CbmMCTrack.h:139
CbmMCTrack::fStartY
Double32_t fStartY
Definition: CbmMCTrack.h:139
CbmMCTrack
Definition: CbmMCTrack.h:34
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmMCTrack::fStartX
Double32_t fStartX
Definition: CbmMCTrack.h:139
CbmMCTrack::AccPSD
Int_t AccPSD() const
Definition: CbmMCTrack.h:66
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
ECbmModuleId::kPsd
@ kPsd
Projectile spectator detector.
CbmMCTrack::Get4Momentum
void Get4Momentum(TLorentzVector &momentum) const
Definition: CbmMCTrack.h:177
CbmMCTrack::GetEnergy
Double_t GetEnergy() const
Definition: CbmMCTrack.h:165
CbmMCTrack::fNPoints
Int_t fNPoints
Definition: CbmMCTrack.h:156
CbmMCTrack::fPx
Double32_t fPx
Definition: CbmMCTrack.h:133
ECbmModuleId::kSts
@ kSts
Silicon Tracking System.
CbmMCTrack::GetP
Double_t GetP() const
Definition: CbmMCTrack.h:100
CbmMCTrack::GetPz
Double_t GetPz() const
Definition: CbmMCTrack.h:74
CbmMCTrack::GetStartT
Double_t GetStartT() const
Definition: CbmMCTrack.h:78
CbmDefs.h