CbmRoot
Loading...
Searching...
No Matches
CbmMCTrack.h
Go to the documentation of this file.
1/* Copyright (C) 2006-2025 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
20
21
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 <cmath>
34#include <cstdint>
35#include <string> // for string
36
37class TParticle;
38
39class CbmMCTrack : public TObject {
40
41 public:
43 CbmMCTrack();
44
45
47 CbmMCTrack(int32_t pdgCode, int32_t motherID, double px, double py, double pz, double x, double y, double z, double t,
48 int32_t nPoints);
49
51 CbmMCTrack(const CbmMCTrack& track);
52
53
55 CbmMCTrack(TParticle* particle);
56
57
59 virtual ~CbmMCTrack();
60
61 int32_t AccMVD() const { return GetNPoints(ECbmModuleId::kMvd); }
62 int32_t AccSTS() const { return GetNPoints(ECbmModuleId::kSts); }
63 int32_t AccPSD() const { return GetNPoints(ECbmModuleId::kPsd); }
64
66 uint32_t GetGeantProcessId() const { return fProcessId; }
67 int32_t GetPdgCode() const { return fPdgCode; }
68 int32_t GetMotherId() const { return fMotherId; }
69 double GetPx() const { return fPx; }
70 double GetPy() const { return fPy; }
71 double GetPz() const { return fPz; }
72 double GetStartX() const { return fStartX; }
73 double GetStartY() const { return fStartY; }
74 double GetStartZ() const { return fStartZ; }
75 double GetStartT() const { return fStartT; }
76
84 double GetMass() const;
85
93 double GetCharge() const;
94
95 double GetEnergy() const;
96 double GetPt() const { return sqrt(fPx * fPx + fPy * fPy); }
97 double GetP() const { return sqrt(fPx * fPx + fPy * fPy + fPz * fPz); }
98 double GetRapidity() const;
99 void GetMomentum(TVector3& momentum) const;
100 void Get4Momentum(TLorentzVector& momentum) const;
101 void GetStartVertex(TVector3& vertex) const;
102
103
105 int32_t GetNPoints(ECbmModuleId detId) const;
106
107
109 void SetMotherId(int32_t id) { fMotherId = id; }
110 void SetNPoints(ECbmModuleId iDet, int32_t np);
111
112
114 std::string ToString() const;
115
116
117 private:
119 uint32_t fProcessId;
120
122 int32_t fPdgCode;
123
125 int32_t fMotherId;
126
128 Double32_t fPx, fPy, fPz;
129
131 Double32_t fE;
132
135
152 int32_t fNPoints;
153
154
155 ClassDef(CbmMCTrack, 4)
156};
157
158
159// ========== Inline functions ========================================
160
161inline double CbmMCTrack::GetEnergy() const
162{
163 if (fE > 0.) return fE;
164 double mass = GetMass();
165 return sqrt(mass * mass + fPx * fPx + fPy * fPy + fPz * fPz);
166}
167
168
169inline void CbmMCTrack::GetMomentum(TVector3& momentum) const { momentum.SetXYZ(fPx, fPy, fPz); }
170
171
172inline void CbmMCTrack::Get4Momentum(TLorentzVector& momentum) const { momentum.SetXYZT(fPx, fPy, fPz, GetEnergy()); }
173
174
175inline void CbmMCTrack::GetStartVertex(TVector3& vertex) const { vertex.SetXYZ(fStartX, fStartY, fStartZ); }
176
177
178#endif
ECbmModuleId
Enumerator for module Identifiers.
Definition CbmDefs.h:45
@ kMvd
Micro-Vertex Detector.
Definition CbmDefs.h:47
@ kPsd
Projectile spectator detector.
Definition CbmDefs.h:54
@ kSts
Silicon Tracking System.
Definition CbmDefs.h:48
friend fvec sqrt(const fvec &a)
double GetPz() const
Definition CbmMCTrack.h:71
double GetStartT() const
Definition CbmMCTrack.h:75
std::string ToString() const
Double32_t fPx
Definition CbmMCTrack.h:128
double GetCharge() const
Charge of the associated particle.
int32_t AccSTS() const
Definition CbmMCTrack.h:62
Double32_t fPy
Definition CbmMCTrack.h:128
int32_t AccPSD() const
Definition CbmMCTrack.h:63
double GetPt() const
Definition CbmMCTrack.h:96
void SetNPoints(ECbmModuleId iDet, int32_t np)
int32_t fMotherId
Definition CbmMCTrack.h:125
Double32_t fStartZ
Definition CbmMCTrack.h:134
Double32_t fStartT
Definition CbmMCTrack.h:134
double GetP() const
Definition CbmMCTrack.h:97
double GetPx() const
Definition CbmMCTrack.h:69
int32_t AccMVD() const
Definition CbmMCTrack.h:61
uint32_t GetGeantProcessId() const
Definition CbmMCTrack.h:66
uint32_t fProcessId
Definition CbmMCTrack.h:119
Double32_t fE
Definition CbmMCTrack.h:131
virtual ~CbmMCTrack()
void GetMomentum(TVector3 &momentum) const
Definition CbmMCTrack.h:169
Double32_t fStartY
Definition CbmMCTrack.h:134
int32_t fNPoints
Definition CbmMCTrack.h:152
double GetStartZ() const
Definition CbmMCTrack.h:74
int32_t GetMotherId() const
Definition CbmMCTrack.h:68
double GetMass() const
Mass of the associated particle.
double GetStartX() const
Definition CbmMCTrack.h:72
Double32_t fPz
Definition CbmMCTrack.h:128
int32_t GetPdgCode() const
Definition CbmMCTrack.h:67
void Get4Momentum(TLorentzVector &momentum) const
Definition CbmMCTrack.h:172
double GetStartY() const
Definition CbmMCTrack.h:73
void SetMotherId(int32_t id)
Definition CbmMCTrack.h:109
double GetPy() const
Definition CbmMCTrack.h:70
Double32_t fStartX
Definition CbmMCTrack.h:134
double GetRapidity() const
void GetStartVertex(TVector3 &vertex) const
Definition CbmMCTrack.h:175
int32_t GetNPoints(ECbmModuleId detId) const
double GetEnergy() const
Definition CbmMCTrack.h:161
int32_t fPdgCode
Definition CbmMCTrack.h:122