CbmRoot
Loading...
Searching...
No Matches
CaMcPoint.h
Go to the documentation of this file.
1/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Sergei Zharko [committer] */
4
9
10#ifndef CaMcPoint_h
11#define CaMcPoint_h 1
12
13#include "CaDefs.h"
14#include "CaMcLinkKey.h"
15#include "CaVector.h"
16//#include "CbmDefs.h"
17
18#include <string>
19
20using namespace cbm::algo::ca; //TODO: remove
21
22namespace cbm::algo::ca
23{
24 enum class EDetectorID;
25}
26
27namespace cbm::algo::ca
28{
29 namespace ca = cbm::algo::ca;
30
33 class McPoint {
34 public:
36 McPoint() = default;
37
39 ~McPoint() = default;
40
42 McPoint(const McPoint&) = default;
43
45 McPoint(McPoint&&) = default;
46
48 McPoint& operator=(const McPoint&) = default;
49
51 McPoint& operator=(McPoint&&) = default;
52
53
56 void AddHitID(int iH) { fvHitIndexes.push_back_no_warning(iH); }
57
58
59 // *********************
60 // ** Getters **
61 // *********************
62
64 double GetCharge() const { return fCharge; }
65
68
70 int GetActiveStationId() const { return fActiveStationId; }
71
73 int GetLocalStationId() const { return fLocalStationId; }
74
76 int GetEventId() const { return fLinkKey.fEvent; }
77
81 int GetExternalId() const { return fLinkKey.fIndex; }
82
84 int GetFileId() const { return fLinkKey.fFile; }
85
87 int GetId() const { return fId; }
88
90 int GetInvSpeed() const
91 {
92 return std::sqrt(1. + GetMass() * GetMass() / GetP() / GetP()) * constants::phys::SpeedOfLightInv;
93 }
94
96 int GetInvSpeedIn() const
97 {
98 return std::sqrt(1. + GetMass() * GetMass() / GetPIn() / GetPIn()) * constants::phys::SpeedOfLightInv;
99 }
100
102 int GetInvSpeedOut() const
103 {
104 return std::sqrt(1. + GetMass() * GetMass() / GetPOut() / GetPOut()) * constants::phys::SpeedOfLightInv;
105 }
106
108 const auto& GetHitIndexes() const { return fvHitIndexes; }
109
111 McLinkKey GetLinkKey() const { return fLinkKey; }
112
114 double GetMass() const { return fMass; }
115
117 int GetMotherId() const { return fMotherId; }
118
120 double GetP() const { return std::sqrt(fMom[0] * fMom[0] + fMom[1] * fMom[1] + fMom[2] * fMom[2]); }
121
123 int GetPdgCode() const { return fPdgCode; }
124
126 double GetPhi() const { return std::atan2(-fMom[1], fMom[0]); }
127
129 double GetPhiIn() const { return std::atan2(-fMomIn[1], fMomIn[0]); }
130
132 double GetPhiOut() const { return std::atan2(-fMomOut[1], fMomOut[0]); }
133
135 double GetPIn() const { return std::sqrt(fMomIn[0] * fMomIn[0] + fMomIn[1] * fMomIn[1] + fMomIn[2] * fMomIn[2]); }
136
138 double GetPOut() const
139 {
140 return std::sqrt(fMomOut[0] * fMomOut[0] + fMomOut[1] * fMomOut[1] + fMomOut[2] * fMomOut[2]);
141 }
142
144 double GetPt() const { return sqrt(fMom[0] * fMom[0] + fMom[1] * fMom[1]); }
145
147 double GetPtIn() const
148 {
149 return sqrt(fMomIn[0] * fMomIn[0] + fMomIn[1] * fMomIn[1]);
150 ;
151 }
152
154 double GetPtOut() const
155 {
156 return sqrt(fMomOut[0] * fMomOut[0] + fMomOut[1] * fMomOut[1]);
157 ;
158 }
159
160
162 double GetPx() const { return fMom[0]; }
163
165 double GetPxIn() const { return fMomIn[0]; }
166
168 double GetPxOut() const { return fMomOut[0]; }
169
171 double GetPy() const { return fMom[1]; }
172
174 double GetPyIn() const { return fMomIn[1]; }
175
177 double GetPyOut() const { return fMomOut[1]; }
178
180 double GetPz() const { return fMom[2]; }
181
183 double GetPzIn() const { return fMomIn[2]; }
184
186 double GetPzOut() const { return fMomOut[2]; }
187
189 double GetQp() const { return fCharge / GetP(); }
190
192 double GetQpIn() const { return fCharge / GetPIn(); }
193
195 double GetQpOut() const { return fCharge / GetPOut(); }
196
198 double GetTheta() const { return std::acos(GetPz() / GetP()); }
199
201 double GetThetaIn() const { return std::acos(GetPzIn() / GetPIn()); }
202
204 double GetThetaOut() const { return std::acos(GetPzOut() / GetPOut()); }
205
207 double GetTime() const { return fTime; }
208
210 int GetTrackId() const { return fTrackId; }
211
213 double GetTx() const { return fMom[0] / fMom[2]; }
214
216 double GetTxIn() const { return fMomIn[0] / fMomIn[2]; }
217
219 double GetTxOut() const { return fMomOut[0] / fMomOut[2]; }
220
222 double GetTy() const { return fMom[1] / fMom[2]; }
223
225 double GetTyIn() const { return fMomIn[1] / fMomIn[2]; }
226
228 double GetTyOut() const { return fMomOut[1] / fMomOut[2]; }
229
231 double GetX() const { return fPos[0]; }
232
234 double GetXIn() const { return fPosIn[0]; }
235
237 double GetXOut() const { return fPosOut[0]; }
238
240 double GetY() const { return fPos[1]; }
241
243 double GetYIn() const { return fPosIn[1]; }
244
246 double GetYOut() const { return fPosOut[1]; }
247
249 double GetZ() const { return fPos[2]; }
250
252 double GetZIn() const { return fPosIn[2]; }
253
255 double GetZOut() const { return fPosOut[2]; }
256
257 // *********************
258 // ** Setters **
259 // *********************
260
262 void SetCharge(double charge) { fCharge = charge; }
263
266
268 void SetActiveStationId(int stationId) { fActiveStationId = stationId; }
269
271 void SetLocalStationId(int localStationId) { fLocalStationId = localStationId; }
272
274 void SetEventId(int eventId) { fLinkKey.fEvent = eventId; }
275
277 void SetExternalId(int id) { fLinkKey.fIndex = id; }
278
280 void SetFileId(int fileId) { fLinkKey.fFile = fileId; }
281
283 void SetId(int id) { fId = id; }
284
286 void SetMass(double mass) { fMass = mass; }
287
289 void SetMotherId(int motherId) { fMotherId = motherId; }
290
292 void SetPdgCode(int pdg) { fPdgCode = pdg; }
293
295 void SetPx(double px) { fMom[0] = px; }
296
298 void SetPxIn(double px) { fMomIn[0] = px; }
299
301 void SetPxOut(double px) { fMomOut[0] = px; }
302
304 void SetPy(double py) { fMom[1] = py; }
305
307 void SetPyIn(double py) { fMomIn[1] = py; }
308
310 void SetPyOut(double py) { fMomOut[1] = py; }
311
313 void SetPz(double pz) { fMom[2] = pz; }
314
316 void SetPzIn(double pz) { fMomIn[2] = pz; }
317
319 void SetPzOut(double pz) { fMomOut[2] = pz; }
320
322 void SetTime(double time) { fTime = time; }
323
325 void SetTrackId(int trackId) { fTrackId = trackId; }
326
328 void SetX(double x) { fPos[0] = x; }
329
331 void SetXIn(double x) { fPosIn[0] = x; }
332
334 void SetXOut(double x) { fPosOut[0] = x; }
335
337 void SetY(double y) { fPos[1] = y; }
338
340 void SetYIn(double y) { fPosIn[1] = y; }
341
343 void SetYOut(double y) { fPosOut[1] = y; }
344
346 void SetZ(double z) { fPos[2] = z; }
347
349 void SetZIn(double z) { fPosIn[2] = z; }
350
352 void SetZOut(double z) { fPosOut[2] = z; }
353
360 std::string ToString(int verbose, bool printHeader = false) const;
361
362 // ****************************
363 // ** Data variables **
364 // ****************************
365
366 private:
379
383
385
391
393
397
398 // TODO: SZh 17.05.2023: Check, if there are more then one index can be added
399 ca::Vector<int> fvHitIndexes{"ca::tools::McPoint::fvHitIndexes"};
400 };
401} // namespace cbm::algo::ca
402
403
404#endif // CaMcPoint_h
Compile-time constants definition for the CA tracking algorithm.
Data structure to represent a MC link in CA tracking MC module.
friend fvec sqrt(const fvec &a)
void SetCharge(double charge)
Sets particle charge [e].
Definition CaMcPoint.h:262
double GetTyIn() const
Gets slope along x-axis at entrance to station.
Definition CaMcPoint.h:225
double GetPt() const
Gets track transverse momentum at reference z of station [GeV/c].
Definition CaMcPoint.h:144
int GetInvSpeed() const
Gets inverse speed at reference z of station [ns/cm].
Definition CaMcPoint.h:90
double fMass
Particle mass [GeV/c2].
Definition CaMcPoint.h:380
double GetTxIn() const
Gets slope along x-axis at entrance to station.
Definition CaMcPoint.h:216
double fCharge
Particle charge [e].
Definition CaMcPoint.h:381
void SetPdgCode(int pdg)
Sets PDG code.
Definition CaMcPoint.h:292
void SetPy(double py)
Sets track momentum y component at reference z of station [GeV/c].
Definition CaMcPoint.h:304
double GetPxOut() const
Gets track momentum x component at exit of station [GeV/c].
Definition CaMcPoint.h:168
ca::EDetectorID GetDetectorId() const
Gets detector ID.
Definition CaMcPoint.h:67
double GetTxOut() const
Gets slope along x-axis at exit of station.
Definition CaMcPoint.h:219
void SetYIn(double y)
Sets y coordinate at entrance to station [cm].
Definition CaMcPoint.h:340
double GetThetaIn() const
Gets polar angle at entrance to station [rad].
Definition CaMcPoint.h:201
~McPoint()=default
Destructor.
std::array< double, 3 > fPosOut
Position at exit of station [cm].
Definition CaMcPoint.h:372
void SetDetectorId(ca::EDetectorID detId)
Sets detector ID.
Definition CaMcPoint.h:265
void SetZ(double z)
Sets z coordinate at reference z of station [cm].
Definition CaMcPoint.h:346
void SetPx(double px)
Sets track momentum x component at reference z of station [GeV/c].
Definition CaMcPoint.h:295
double GetPhi() const
Gets track azimuthal angle at reference z of station [rad].
Definition CaMcPoint.h:126
double GetPIn() const
Gets track momentum absolute value at entrance to station [GeV/c].
Definition CaMcPoint.h:135
void SetYOut(double y)
Sets x coordinate at exit of station [cm].
Definition CaMcPoint.h:343
int GetFileId() const
Gets MC file ID.
Definition CaMcPoint.h:84
int fId
Index of MC point in the external MC point container.
Definition CaMcPoint.h:387
double GetPz() const
Gets track momentum z component at reference z of station [GeV/c].
Definition CaMcPoint.h:180
int fMotherId
Index of mother track in CA internal data structures (within event/TS)
Definition CaMcPoint.h:390
double GetQpIn() const
Gets track momentum absolute value at entrance to station [ec/GeV].
Definition CaMcPoint.h:192
int GetLocalStationId() const
Gets local index of tracking station in the detector subsystem.
Definition CaMcPoint.h:73
double GetTime() const
Gets time [ns].
Definition CaMcPoint.h:207
void SetMass(double mass)
Sets particle mass [GeV/c2].
Definition CaMcPoint.h:286
void SetActiveStationId(int stationId)
Sets global index of active station.
Definition CaMcPoint.h:268
double GetPOut() const
Gets track momentum absolute value at exit of station [GeV/c].
Definition CaMcPoint.h:138
double GetPhiOut() const
Gets track azimuthal angle at exit of station [rad].
Definition CaMcPoint.h:132
double GetP() const
Gets track momentum absolute value at reference z of station [GeV/c].
Definition CaMcPoint.h:120
McLinkKey fLinkKey
Link key of point.
Definition CaMcPoint.h:384
double GetZIn() const
Gets z coordinate at entrance to station [cm].
Definition CaMcPoint.h:252
int fPdgCode
Particle PDG code.
Definition CaMcPoint.h:386
double GetMass() const
Gets mass of the particle [GeV/c2].
Definition CaMcPoint.h:114
double GetQpOut() const
Gets track momentum absolute value at exit of station [ec/GeV].
Definition CaMcPoint.h:195
double fTime
Point time [ns].
Definition CaMcPoint.h:382
std::array< double, 3 > fMomIn
Momentum at entrance to station [GeV/c].
Definition CaMcPoint.h:376
double GetPx() const
Gets track momentum x component at reference z of station [GeV/c].
Definition CaMcPoint.h:162
double GetYOut() const
Gets y coordinate at exit of station [cm].
Definition CaMcPoint.h:246
int GetInvSpeedIn() const
Gets inverse speed at entrance to station [ns/cm].
Definition CaMcPoint.h:96
std::array< double, 3 > fMom
Momentum at reference z of station [GeV/c].
Definition CaMcPoint.h:374
std::array< double, 3 > fPosIn
Position at entrance to station [cm].
Definition CaMcPoint.h:370
void SetXOut(double x)
Sets x coordinate at exit of station [cm].
Definition CaMcPoint.h:334
McPoint & operator=(const McPoint &)=default
Copy assignment operator.
double GetY() const
Gets y coordinate at reference z of station [cm].
Definition CaMcPoint.h:240
double GetPzOut() const
Gets track momentum z component at exit of station [GeV/c].
Definition CaMcPoint.h:186
void SetPxIn(double px)
Sets track momentum x component at entrance to station [GeV/c].
Definition CaMcPoint.h:298
int GetExternalId() const
Gets MC external ID.
Definition CaMcPoint.h:81
std::array< double, 3 > fMomOut
Momentum at exit of station [cm].
Definition CaMcPoint.h:378
int GetActiveStationId() const
Gets global ID of the active tracking station.
Definition CaMcPoint.h:70
McPoint(McPoint &&)=default
Move constructor.
void SetPyIn(double py)
Sets track momentum y component at entrance to station [GeV/c].
Definition CaMcPoint.h:307
int fActiveStationId
Global index of active tracking station.
Definition CaMcPoint.h:394
double GetXOut() const
Gets x coordinate at exit of station [cm].
Definition CaMcPoint.h:237
int fTrackId
Index of associated MC track in CA internal track container within TS/event.
Definition CaMcPoint.h:388
double GetQp() const
Gets track charge over momentum at reference z of station [ec/GeV].
Definition CaMcPoint.h:189
std::string ToString(int verbose, bool printHeader=false) const
Prints content for a given verbosity level.
Definition CaMcPoint.cxx:20
void SetFileId(int fileId)
Sets index of MC file containing this point.
Definition CaMcPoint.h:280
double GetPhiIn() const
Gets track azimuthal angle at entrance to station [rad].
Definition CaMcPoint.h:129
void SetTrackId(int trackId)
Sets track ID in the CA internal track container (within event/TS)
Definition CaMcPoint.h:325
double GetCharge() const
Gets charge of the particle [e].
Definition CaMcPoint.h:64
int GetTrackId() const
Gets ID of track from the internal CA MC track container (within event/TS)
Definition CaMcPoint.h:210
double GetPyOut() const
Gets track momentum y component at exit of station [GeV/c].
Definition CaMcPoint.h:177
void SetTime(double time)
Sets time [ns].
Definition CaMcPoint.h:322
int GetPdgCode() const
Gets PDG code of the particle.
Definition CaMcPoint.h:123
void SetZIn(double z)
Sets z coordinate at entrance to station [cm].
Definition CaMcPoint.h:349
void SetPzIn(double pz)
Sets track momentum z component at entrance to station [GeV/c].
Definition CaMcPoint.h:316
void SetPyOut(double py)
Sets track momentum y component at exit of station [GeV/c].
Definition CaMcPoint.h:310
void SetEventId(int eventId)
Sets index of MC event containing this point.
Definition CaMcPoint.h:274
McPoint(const McPoint &)=default
Copy constructor.
McPoint & operator=(McPoint &&)=default
Move assignment operator.
ca::EDetectorID fDetectorId
Detector ID of MC point.
Definition CaMcPoint.h:392
int GetEventId() const
Gets MC event ID.
Definition CaMcPoint.h:76
double GetTyOut() const
Gets slope along x-axis at exit of station.
Definition CaMcPoint.h:228
double GetPxIn() const
Gets track momentum x component at entrance to station [GeV/c].
Definition CaMcPoint.h:165
const auto & GetHitIndexes() const
Gets container of matched hit indexes.
Definition CaMcPoint.h:108
double GetX() const
Gets x coordinate at reference z of station [cm].
Definition CaMcPoint.h:231
double GetYIn() const
Gets y coordinate at entrance to station [cm].
Definition CaMcPoint.h:243
int GetId() const
Gets index of this point in internal CA container.
Definition CaMcPoint.h:87
int GetInvSpeedOut() const
Gets inverse speed at exit of station [ns/cm].
Definition CaMcPoint.h:102
void SetPzOut(double pz)
Sets track momentum z component at exit of station [GeV/c].
Definition CaMcPoint.h:319
double GetZOut() const
Gets z coordinate at exit of station [cm].
Definition CaMcPoint.h:255
int GetMotherId() const
Gets mother ID of the track.
Definition CaMcPoint.h:117
double GetTx() const
Gets slope along x-axis at reference z of station.
Definition CaMcPoint.h:213
ca::Vector< int > fvHitIndexes
Indexes of hits, assigned to this point.
Definition CaMcPoint.h:399
void SetX(double x)
Sets x coordinate at reference z of station [cm].
Definition CaMcPoint.h:328
double GetThetaOut() const
Gets polar angle at exit of station [rad].
Definition CaMcPoint.h:204
double GetPtIn() const
Gets track transverse momentum at entrance to station [GeV/c].
Definition CaMcPoint.h:147
McLinkKey GetLinkKey() const
Gets link key.
Definition CaMcPoint.h:111
double GetPy() const
Gets track momentum y component at reference z of station [GeV/c].
Definition CaMcPoint.h:171
double GetPtOut() const
Gets track transverse momentum at exit of station [GeV/c].
Definition CaMcPoint.h:154
void SetY(double y)
Sets y coordinate at reference z of station [cm].
Definition CaMcPoint.h:337
double GetXIn() const
Gets x coordinate at entrance to station [cm].
Definition CaMcPoint.h:234
double GetTheta() const
Gets polar angle at reference z of station [rad].
Definition CaMcPoint.h:198
void SetPxOut(double px)
Sets track momentum x component at exit of station [GeV/c].
Definition CaMcPoint.h:301
double GetZ() const
Gets z coordinate at reference z of station [cm].
Definition CaMcPoint.h:249
void SetXIn(double x)
Sets x coordinate at entrance to station [cm].
Definition CaMcPoint.h:331
void SetLocalStationId(int localStationId)
Sets local index of tracking station in the detector subsystem.
Definition CaMcPoint.h:271
void SetExternalId(int id)
Sets index of this point in external data structures.
Definition CaMcPoint.h:277
std::array< double, 3 > fPos
Position at reference z of station [cm].
Definition CaMcPoint.h:368
double GetPzIn() const
Gets track momentum z component at entrance to station [GeV/c].
Definition CaMcPoint.h:183
void SetMotherId(int motherId)
Sets index of mother track in the internal CA data structures.
Definition CaMcPoint.h:289
double GetPyIn() const
Gets track momentum y component at entrance to station [GeV/c].
Definition CaMcPoint.h:174
void AddHitID(int iH)
Adds index of hits from the container of hits of event/TS.
Definition CaMcPoint.h:56
void SetId(int id)
Sets index of this point in the CA internal structure.
Definition CaMcPoint.h:283
McPoint()=default
Default constructor.
double GetTy() const
Gets slope along x-axis at reference z of station.
Definition CaMcPoint.h:222
void SetPz(double pz)
Sets track momentum z component at reference z of station [GeV/c].
Definition CaMcPoint.h:313
void SetZOut(double z)
Sets z coordinate at exit of station [cm].
Definition CaMcPoint.h:352
constexpr fscal SpeedOfLightInv
Inverse speed of light [ns/cm].
Definition CaDefs.h:96
constexpr T2 Undef
Undefined values.
Definition CaDefs.h:117
TODO: SZh 8.11.2022: add selection of parameterisation.
Definition CaBranch.h:14
EDetectorID
Enumeration for the tracking detector subsystems in CBM-CA.
Definition CbmDefs.h:216