CbmRoot
Loading...
Searching...
No Matches
CbmMCTrack.h
Go to the documentation of this file.
1/* Copyright (C) 2006-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Denis Bertini [committer], Volker Friese, Florian Uhlig */
4
5// -------------------------------------------------------------------------
6// ----- CbmMCTrack header file -----
7// ----- Created 03/08/04 by V. Friese -----
8// -------------------------------------------------------------------------
9
10
22#ifndef CBMMCTRACK_H
23#define CBMMCTRACK_H 1
24
25#include "CbmDefs.h" // for ECbmModuleId, ECbmModuleId::kMvd, ECbmModuleId::kPsd, ECbmModuleId::kSts
26
27#include <Rtypes.h> // for THashConsistencyHolder, ClassDef
28#include <RtypesCore.h> // for Double32_t
29#include <TLorentzVector.h> // for TLorentzVector
30#include <TObject.h> // for TObject
31#include <TVector3.h> // for TVector3
32
33#include <cstdint>
34#include <string> // for string
35
36#include <cmath>
37
38class TParticle;
39
40class CbmMCTrack : public TObject {
41
42public:
44 CbmMCTrack();
45
46
48 CbmMCTrack(int32_t pdgCode, int32_t motherID, double px, double py, double pz, double x, double y, double z, double t,
49 int32_t nPoints);
50
52 CbmMCTrack(const CbmMCTrack& track);
53
54
56 CbmMCTrack(TParticle* particle);
57
58
60 virtual ~CbmMCTrack();
61
62 int32_t AccMVD() const { return GetNPoints(ECbmModuleId::kMvd); }
63 int32_t AccSTS() const { return GetNPoints(ECbmModuleId::kSts); }
64 int32_t AccPSD() const { return GetNPoints(ECbmModuleId::kPsd); }
65
67 uint32_t GetGeantProcessId() const { return fProcessId; }
68 int32_t GetPdgCode() const { return fPdgCode; }
69 int32_t GetMotherId() const { return fMotherId; }
70 double GetPx() const { return fPx; }
71 double GetPy() const { return fPy; }
72 double GetPz() const { return fPz; }
73 double GetStartX() const { return fStartX; }
74 double GetStartY() const { return fStartY; }
75 double GetStartZ() const { return fStartZ; }
76 double GetStartT() const { return fStartT; }
77
85 double GetMass() const;
86
94 double GetCharge() const;
95
96 double GetEnergy() const;
97 double GetPt() const { return sqrt(fPx * fPx + fPy * fPy); }
98 double GetP() const { return sqrt(fPx * fPx + fPy * fPy + fPz * fPz); }
99 double GetRapidity() const;
100 void GetMomentum(TVector3& momentum) const;
101 void Get4Momentum(TLorentzVector& momentum) const;
102 void GetStartVertex(TVector3& vertex) const;
103
104
106 int32_t GetNPoints(ECbmModuleId detId) const;
107
108
110 void SetMotherId(int32_t id) { fMotherId = id; }
111 void SetNPoints(ECbmModuleId iDet, int32_t np);
112
113
115 std::string ToString() const;
116
117
118private:
120 uint32_t fProcessId;
121
123 int32_t fPdgCode;
124
126 int32_t fMotherId;
127
129 Double32_t fPx, fPy, fPz;
130
132 Double32_t fE;
133
136
153 int32_t fNPoints;
154
155
156 ClassDef(CbmMCTrack, 3)
157};
158
159
160// ========== Inline functions ========================================
161
162inline double CbmMCTrack::GetEnergy() const
163{
164 if (fE > 0.) return fE;
165 double mass = GetMass();
166 return sqrt(mass * mass + fPx * fPx + fPy * fPy + fPz * fPz);
167}
168
169
170inline void CbmMCTrack::GetMomentum(TVector3& momentum) const { momentum.SetXYZ(fPx, fPy, fPz); }
171
172
173inline void CbmMCTrack::Get4Momentum(TLorentzVector& momentum) const { momentum.SetXYZT(fPx, fPy, fPz, GetEnergy()); }
174
175
176inline void CbmMCTrack::GetStartVertex(TVector3& vertex) const { vertex.SetXYZ(fStartX, fStartY, fStartZ); }
177
178
179#endif
ECbmModuleId
Definition CbmDefs.h:39
@ kMvd
Micro-Vertex Detector.
@ kPsd
Projectile spectator detector.
@ kSts
Silicon Tracking System.
friend fvec sqrt(const fvec &a)
double GetPz() const
Definition CbmMCTrack.h:72
double GetStartT() const
Definition CbmMCTrack.h:76
std::string ToString() const
Double32_t fPx
Definition CbmMCTrack.h:129
double GetCharge() const
Charge of the associated particle.
int32_t AccSTS() const
Definition CbmMCTrack.h:63
Double32_t fPy
Definition CbmMCTrack.h:129
int32_t AccPSD() const
Definition CbmMCTrack.h:64
double GetPt() const
Definition CbmMCTrack.h:97
void SetNPoints(ECbmModuleId iDet, int32_t np)
int32_t fMotherId
Definition CbmMCTrack.h:126
Double32_t fStartZ
Definition CbmMCTrack.h:135
Double32_t fStartT
Definition CbmMCTrack.h:135
double GetP() const
Definition CbmMCTrack.h:98
double GetPx() const
Definition CbmMCTrack.h:70
int32_t AccMVD() const
Definition CbmMCTrack.h:62
uint32_t GetGeantProcessId() const
Definition CbmMCTrack.h:67
uint32_t fProcessId
Definition CbmMCTrack.h:120
Double32_t fE
Definition CbmMCTrack.h:132
virtual ~CbmMCTrack()
void GetMomentum(TVector3 &momentum) const
Definition CbmMCTrack.h:170
Double32_t fStartY
Definition CbmMCTrack.h:135
int32_t fNPoints
Definition CbmMCTrack.h:153
double GetStartZ() const
Definition CbmMCTrack.h:75
int32_t GetMotherId() const
Definition CbmMCTrack.h:69
double GetMass() const
Mass of the associated particle.
double GetStartX() const
Definition CbmMCTrack.h:73
Double32_t fPz
Definition CbmMCTrack.h:129
int32_t GetPdgCode() const
Definition CbmMCTrack.h:68
void Get4Momentum(TLorentzVector &momentum) const
Definition CbmMCTrack.h:173
double GetStartY() const
Definition CbmMCTrack.h:74
void SetMotherId(int32_t id)
Definition CbmMCTrack.h:110
double GetPy() const
Definition CbmMCTrack.h:71
Double32_t fStartX
Definition CbmMCTrack.h:135
double GetRapidity() const
void GetStartVertex(TVector3 &vertex) const
Definition CbmMCTrack.h:176
int32_t GetNPoints(ECbmModuleId detId) const
double GetEnergy() const
Definition CbmMCTrack.h:162
int32_t fPdgCode
Definition CbmMCTrack.h:123