Project
Loading...
Searching...
No Matches
TrackMCStudyTypes.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12#ifndef O2_TRACKING_STUDY_TYPES_H
13#define O2_TRACKING_STUDY_TYPES_H
23#include <array>
24#include <vector>
25
26namespace o2::trackstudy
27{
29
31 inline bool hasITSHitOnLr(int i) const { return (pattITSCl & ((0x1 << i) & 0x7f)) != 0; }
32 int getNITSClusCont() const;
33 int getNITSClusForAB() const;
34 int getLowestITSLayer() const;
35 int getHighestITSLayer() const;
36 std::vector<float> occTPCV{};
37 std::vector<o2::track::TrackPar> trackRefsTPC{};
40 float occTPC = -1.f;
41 int occITS = -1.f;
42 int bcInTF = -1;
43 int pdg = 0;
44 int pdgParent = 0;
45 int parentEntry = -1;
46 int16_t nTPCCl = 0;
47 int16_t nTPCClShared = 0;
48 int8_t parentDecID = -1;
49 uint8_t minTPCRow = -1;
50 uint8_t maxTPCRow = 0;
51 uint8_t nUsedPadRows = 0;
52 uint8_t maxTPCRowInner = 0; // highest row in the sector containing the lowest one
53 uint8_t minTPCRowSect = -1;
54 uint8_t maxTPCRowSect = -1;
55 int8_t nITSCl = 0;
56 int8_t pattITSCl = 0;
57 uint8_t flags = 0;
58
59 enum Flags : uint32_t { Primary = 0,
61 BitMask = 0xff };
62
63 bool isPrimary() const { return isBitSet(Primary); }
64 bool isAddedAtRecStage() const { return isBitSet(AddedAtRecStage); }
67
68 uint8_t getBits() const { return flags; }
69 bool isBitSet(int bit) const { return flags & (0xff & (0x1 << bit)); }
70 void setBits(std::uint8_t b) { flags = b; }
71 void setBit(int bit) { flags |= BitMask & (0x1 << bit); }
72 void resetBit(int bit) { flags &= ~(BitMask & (0x1 << bit)); }
73
74 o2::track::TrackPar getTrackParTPC(float b, float x = 90) const;
75 float getTrackParTPCPar(int i, float b, float x = 90) const;
76 float getTrackParTPCPhiSec(float b, float x = 90) const;
77
79};
80
81struct RecTrack {
82 enum FakeFlag {
83 FakeITS = 0x1 << 0,
84 FakeTPC = 0x1 << 1,
85 FakeTRD = 0x1 << 2,
86 FakeTOF = 0x1 << 3,
87 FakeITSTPC = 0x1 << 4,
88 FakeITSTPCTRD = 0x1 << 5,
89 HASACSides = 0x1 << 6,
90 FakeGLO = 0x1 << 7
91 };
96 short pvID = -1;
97 uint8_t nClTPCShared = 0;
98 uint8_t flags = 0;
99 uint8_t nClITS = 0;
100 uint8_t nClTPC = 0;
101 uint8_t pattITS = 0;
102 int8_t lowestPadRow = -1;
103 int8_t padFromEdge = -1;
104 uint8_t rowMaxTPC = 0;
105 uint8_t rowCountTPC = 0;
106
107 bool isFakeGLO() const { return flags & FakeGLO; }
108 bool isFakeITS() const { return flags & FakeITS; }
109 bool isFakeTPC() const { return flags & FakeTPC; }
110 bool isFakeTRD() const { return flags & FakeTRD; }
111 bool isFakeTOF() const { return flags & FakeTOF; }
112 bool isFakeITSTPC() const { return flags & FakeITSTPC; }
113 bool hasACSides() const { return flags & HASACSides; }
114
116};
117
121 uint8_t nshTPC = 0;
122 uint8_t nshTPCRow = 0;
123
124 int getComb() const { return tr0.track.getSign() != tr1.track.getSign() ? 0 : (tr0.track.getSign() > 0 ? 1 : 2); }
125 float getDPhi() const
126 {
127 float dphi = tr0.track.getPhi() - tr1.track.getPhi();
128 if (dphi < -o2::constants::math::PI) {
130 } else if (dphi > o2::constants::math::PI) {
132 }
133 return dphi;
134 }
135 float getDTgl() const { return tr0.track.getTgl() - tr1.track.getTgl(); }
136
137 ClassDefNV(TrackPairInfo, 1)
138};
139
140struct TrackFamily { // set of tracks related to the same MC label
142 std::vector<RecTrack> recTracks{};
145 int8_t entITS = -1;
146 int8_t entTPC = -1;
147 int8_t entITSTPC = -1;
148 int8_t entITSFound = -1; // ITS track for this MC track, regardless if it was matched to TPC of another track
149 int8_t flags = 0;
150 float tpcT0 = -999.;
151
153 {
154 for (const auto& tr : recTracks) {
155 if (ref == tr.gid) {
156 return true;
157 }
158 }
159 return false;
160 }
161 const RecTrack& getTrackWithITS() const { return entITS < 0 ? dummyRecTrack : recTracks[entITS]; }
162 const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
166 {
168 return n < 0 ? dummyRecTrack : recTracks[n];
169 }
170 int getLongestTPCTrackEntry() const;
171 int getNTPCClones() const;
173
175};
176
178 // contributor to TPC Cluster
179 std::array<float, 3> xyz{};
180 std::array<float, 3> below{};
181 std::array<float, 3> above{};
182 float snp = 0.;
183 float tgl = 0.;
184 float q2pt = 0.;
185 bool corrAttach = false;
186
187 int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
188
189 float getClX() const { return xyz[0]; }
190 float getClY() const { return xyz[1]; }
191 float getClZ() const { return xyz[2]; }
192
193 float getDY() const { return xyz[1] - getYRef(); }
194 float getDZ() const { return xyz[2] - getZRef(); }
195
196 float getYRef() const
197 {
198 float y = 0;
199 int n = 0;
200 if (below[0] > 1.) {
201 y += below[1];
202 n++;
203 }
204 if (above[0] > 1.) {
205 y += above[1];
206 n++;
207 }
208 return n == 1 ? y : 0.5 * y;
209 }
210
211 float getZRef() const
212 {
213 float z = 0;
214 int n = 0;
215 if (below[0] > 1.) {
216 z += below[2];
217 n++;
218 }
219 if (above[0] > 1.) {
220 z += above[2];
221 n++;
222 }
223 return n == 1 ? z : 0.5 * z;
224 }
225
226 float getDXMin() const
227 {
228 float adxA = 1e9, adxB = 1e9;
229 if (above[0] > 1.) {
230 adxA = xyz[0] - above[0];
231 }
232 if (below[0] > 1.) {
233 adxB = xyz[1] - below[0];
234 }
235 return std::abs(adxA) < std::abs(adxB) ? adxA : adxB;
236 }
237
238 float getDXMax() const
239 {
240 float adxA = 0, adxB = 0;
241 if (above[0] > 1.) {
242 adxA = xyz[0] - above[0];
243 }
244 if (below[0] > 1.) {
245 adxB = xyz[0] - below[0];
246 }
247 return std::abs(adxA) > std::abs(adxB) ? adxA : adxB;
248 }
249
250 float getEY() const { return getNExt() > 1 ? below[1] - above[1] : -999; }
251 float getEZ() const { return getNExt() > 1 ? below[2] - above[2] : -999; }
252
254};
255
256struct ClResTPC {
257 uint8_t sect = 0;
258 uint8_t row = 0;
259 uint8_t ncont = 0;
260 uint8_t flags = 0;
263 float qmax = 0;
264 float qtot = 0;
265 float occ = 0;
266 float occBin = 0;
267 float getSigmaPad() const { return float(sigmaPadPacked) * (1.f / 32); }
268 float getSigmaTime() const { return float(sigmaTimePacked) * (1.f / 32); }
269
270 std::vector<ClResTPCCont> contTracks;
271 int getNCont() const { return contTracks.size(); }
272
273 float getDY(int i) const { return i < getNCont() ? contTracks[i].getDY() : -999.; }
274 float getDZ(int i) const { return i < getNCont() ? contTracks[i].getDZ() : -999.; }
275 float getYRef(int i) const { return i < getNCont() ? contTracks[i].getYRef() : -999.; }
276 float getZRef(int i) const { return i < getNCont() ? contTracks[i].getZRef() : -999.; }
277 float getDXMin(int i) const { return i < getNCont() ? contTracks[i].getDXMin() : -999.; }
278 float getDXMax(int i) const { return i < getNCont() ? contTracks[i].getDXMax() : -999.; }
279 float getEY(int i) const { return i < getNCont() ? contTracks[i].getEY() : -999.; }
280 float getEZ(int i) const { return i < getNCont() ? contTracks[i].getEZ() : -999.; }
281
282 void sortCont()
283 {
284 std::sort(contTracks.begin(), contTracks.end(), [](const ClResTPCCont& a, const ClResTPCCont& b) {
285 float dya = a.getDY(), dyb = b.getDY(), dza = a.getDZ(), dzb = b.getDZ();
286 return dya * dya + dza * dza < dyb * dyb + dzb * dzb;
287 });
288 }
289
291};
292
296 float trefXT = 0; // track ref tracking frame coordinates
297 float trefYT = 0;
298 float chipX = 0;
299 float chipAlpha = 0;
301};
302
308
309struct MCVertex {
310 float getX() const { return pos[0]; }
311 float getY() const { return pos[1]; }
312 float getZ() const { return pos[2]; }
313
314 std::array<float, 3> pos{0., 0., -1999.f};
315 float ts = 0;
316 int nTrackSel = 0; // number of selected MC charged tracks
317 int ID = -1;
318 std::vector<RecPV> recVtx{};
319 std::vector<float> occTPCV{};
321};
322
323} // namespace o2::trackstudy
324#endif
Base track model for the Barrel, params only, w/o covariance.
int32_t i
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Header to collect LHC related constants.
Extention of GlobalTrackID by flags relevant for verter-track association.
GLdouble n
Definition glcorearb.h:1982
GLint GLenum GLint x
Definition glcorearb.h:403
GLboolean GLboolean GLboolean b
Definition glcorearb.h:1233
GLint y
Definition glcorearb.h:270
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
GLbitfield flags
Definition glcorearb.h:1570
GLboolean GLboolean GLboolean GLboolean a
Definition glcorearb.h:1233
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
constexpr double LHCBunchSpacingMUS
constexpr float TwoPI
constexpr float PI
TrackParCovF TrackParCov
Definition Track.h:33
std::array< float, 3 > above
std::array< float, 3 > below
ClassDefNV(ClResTPCCont, 1)
float getDXMax(int i) const
std::vector< ClResTPCCont > contTracks
float getDXMin(int i) const
o2::BaseCluster< float > clus
ClassDefNV(MCTrackInfo, 8)
std::vector< o2::track::TrackPar > trackRefsTPC
std::vector< float > occTPCV
o2::track::TrackPar getTrackParTPC(float b, float x=90) const
void setBits(std::uint8_t b)
float getTrackParTPCPar(int i, float b, float x=90) const
float getTrackParTPCPhiSec(float b, float x=90) const
std::array< float, 3 > pos
std::vector< float > occTPCV
std::vector< RecPV > recVtx
o2::dataformats::PrimaryVertex pv
o2::dataformats::VtxTrackIndex gid
o2::track::TrackParCov track
o2::dataformats::TimeStampWithError< float, float > ts
const RecTrack & getTrackWithITSTPC() const
o2::track::TrackParCov trackTPCProp
o2::track::TrackParCov trackITSProp
const RecTrack & getTrackWithTPC() const
const RecTrack & getTrackWithITSFound() const
const RecTrack & getLongestTPCTrack() const
std::vector< RecTrack > recTracks
bool contains(const o2::dataformats::VtxTrackIndex &ref) const
const RecTrack & getTrackWithITS() const
ClassDefNV(TrackFamily, 1)