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
22#include <array>
23#include <vector>
24
25namespace o2::trackstudy
26{
28
30 inline bool hasITSHitOnLr(int i) const { return (pattITSCl & ((0x1 << i) & 0x7f)) != 0; }
31 int getNITSClusCont() const;
32 int getNITSClusForAB() const;
33 int getLowestITSLayer() const;
34 int getHighestITSLayer() const;
35 std::vector<float> occTPCV{};
38 float occTPC = -1.f;
39 int occITS = -1.f;
40 int bcInTF = -1;
41 int pdg = 0;
42 int pdgParent = 0;
43 int parentEntry = -1;
44 int16_t nTPCCl = 0;
45 int16_t nTPCClShared = 0;
46 int8_t parentDecID = -1;
47 uint8_t minTPCRow = -1;
48 uint8_t maxTPCRow = 0;
49 uint8_t nUsedPadRows = 0;
50 uint8_t maxTPCRowInner = 0; // highest row in the sector containing the lowest one
51 uint8_t minTPCRowSect = -1;
52 uint8_t maxTPCRowSect = -1;
53 int8_t nITSCl = 0;
54 int8_t pattITSCl = 0;
55 uint8_t flags = 0;
56
57 enum Flags : uint32_t { Primary = 0,
59 BitMask = 0xff };
60
61 bool isPrimary() const { return isBitSet(Primary); }
62 bool isAddedAtRecStage() const { return isBitSet(AddedAtRecStage); }
65
66 uint8_t getBits() const { return flags; }
67 bool isBitSet(int bit) const { return flags & (0xff & (0x1 << bit)); }
68 void setBits(std::uint8_t b) { flags = b; }
69 void setBit(int bit) { flags |= BitMask & (0x1 << bit); }
70 void resetBit(int bit) { flags &= ~(BitMask & (0x1 << bit)); }
71
73};
74
75struct RecTrack {
76 enum FakeFlag {
77 FakeITS = 0x1 << 0,
78 FakeTPC = 0x1 << 1,
79 FakeTRD = 0x1 << 2,
80 FakeTOF = 0x1 << 3,
81 FakeITSTPC = 0x1 << 4,
82 FakeITSTPCTRD = 0x1 << 5,
83 FakeGLO = 0x1 << 7
84 };
89 short pvID = -1;
90 uint8_t flags = 0;
91 uint8_t nClITS = 0;
92 uint8_t nClTPC = 0;
93 uint8_t pattITS = 0;
94 int8_t lowestPadRow = -1;
95 int8_t padFromEdge = -1;
96
97 bool isFakeGLO() const { return flags & FakeGLO; }
98 bool isFakeITS() const { return flags & FakeITS; }
99 bool isFakeTPC() const { return flags & FakeTPC; }
100 bool isFakeTRD() const { return flags & FakeTRD; }
101 bool isFakeTOF() const { return flags & FakeTOF; }
102 bool isFakeITSTPC() const { return flags & FakeITSTPC; }
103
105};
106
110 uint8_t nshTPC = 0;
111 uint8_t nshTPCRow = 0;
112
113 int getComb() const { return tr0.track.getSign() != tr1.track.getSign() ? 0 : (tr0.track.getSign() > 0 ? 1 : 2); }
114 float getDPhi() const
115 {
116 float dphi = tr0.track.getPhi() - tr1.track.getPhi();
117 if (dphi < -o2::constants::math::PI) {
119 } else if (dphi > o2::constants::math::PI) {
121 }
122 return dphi;
123 }
124 float getDTgl() const { return tr0.track.getTgl() - tr1.track.getTgl(); }
125
126 ClassDefNV(TrackPairInfo, 1)
127};
128
129struct TrackFamily { // set of tracks related to the same MC label
131 std::vector<RecTrack> recTracks{};
134 int8_t entITS = -1;
135 int8_t entTPC = -1;
136 int8_t entITSTPC = -1;
137 int8_t entITSFound = -1; // ITS track for this MC track, regardless if it was matched to TPC of another track
138 int8_t flags = 0;
139 float tpcT0 = -999.;
140
142 {
143 for (const auto& tr : recTracks) {
144 if (ref == tr.gid) {
145 return true;
146 }
147 }
148 return false;
149 }
150 const RecTrack& getTrackWithITS() const { return entITS < 0 ? dummyRecTrack : recTracks[entITS]; }
151 const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
155
157};
158
160 // contributor to TPC Cluster
161 std::array<float, 3> xyz{};
162 std::array<float, 3> below{};
163 std::array<float, 3> above{};
164 float snp = 0.;
165 float tgl = 0.;
166 float q2pt = 0.;
167 bool corrAttach = false;
168
169 int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
170
171 float getClX() const { return xyz[0]; }
172 float getClY() const { return xyz[1]; }
173 float getClZ() const { return xyz[2]; }
174
175 float getDY() const { return xyz[1] - getYRef(); }
176 float getDZ() const { return xyz[2] - getZRef(); }
177
178 float getYRef() const
179 {
180 float y = 0;
181 int n = 0;
182 if (below[0] > 1.) {
183 y += below[1];
184 n++;
185 }
186 if (above[0] > 1.) {
187 y += above[1];
188 n++;
189 }
190 return n == 1 ? y : 0.5 * y;
191 }
192
193 float getZRef() const
194 {
195 float z = 0;
196 int n = 0;
197 if (below[0] > 1.) {
198 z += below[2];
199 n++;
200 }
201 if (above[0] > 1.) {
202 z += above[2];
203 n++;
204 }
205 return n == 1 ? z : 0.5 * z;
206 }
207
208 float getDXMin() const
209 {
210 float adxA = 1e9, adxB = 1e9;
211 if (above[0] > 1.) {
212 adxA = xyz[0] - above[0];
213 }
214 if (below[0] > 1.) {
215 adxB = xyz[1] - below[0];
216 }
217 return std::abs(adxA) < std::abs(adxB) ? adxA : adxB;
218 }
219
220 float getDXMax() const
221 {
222 float adxA = 0, adxB = 0;
223 if (above[0] > 1.) {
224 adxA = xyz[0] - above[0];
225 }
226 if (below[0] > 1.) {
227 adxB = xyz[0] - below[0];
228 }
229 return std::abs(adxA) > std::abs(adxB) ? adxA : adxB;
230 }
231
232 float getEY() const { return getNExt() > 1 ? below[1] - above[1] : -999; }
233 float getEZ() const { return getNExt() > 1 ? below[2] - above[2] : -999; }
234
236};
237
238struct ClResTPC {
239 uint8_t sect = 0;
240 uint8_t row = 0;
241 uint8_t ncont = 0;
242 uint8_t flags = 0;
245 float qmax = 0;
246 float qtot = 0;
247 float occ = 0;
248 float occBin = 0;
249 float getSigmaPad() const { return float(sigmaPadPacked) * (1.f / 32); }
250 float getSigmaTime() const { return float(sigmaTimePacked) * (1.f / 32); }
251
252 std::vector<ClResTPCCont> contTracks;
253 int getNCont() const { return contTracks.size(); }
254
255 float getDY(int i) const { return i < getNCont() ? contTracks[i].getDY() : -999.; }
256 float getDZ(int i) const { return i < getNCont() ? contTracks[i].getDZ() : -999.; }
257 float getYRef(int i) const { return i < getNCont() ? contTracks[i].getYRef() : -999.; }
258 float getZRef(int i) const { return i < getNCont() ? contTracks[i].getZRef() : -999.; }
259 float getDXMin(int i) const { return i < getNCont() ? contTracks[i].getDXMin() : -999.; }
260 float getDXMax(int i) const { return i < getNCont() ? contTracks[i].getDXMax() : -999.; }
261 float getEY(int i) const { return i < getNCont() ? contTracks[i].getEY() : -999.; }
262 float getEZ(int i) const { return i < getNCont() ? contTracks[i].getEZ() : -999.; }
263
264 void sortCont()
265 {
266 std::sort(contTracks.begin(), contTracks.end(), [](const ClResTPCCont& a, const ClResTPCCont& b) {
267 float dya = a.getDY(), dyb = b.getDY(), dza = a.getDZ(), dzb = b.getDZ();
268 return dya * dya + dza * dza < dyb * dyb + dzb * dzb;
269 });
270 }
271
273};
274
280
281struct MCVertex {
282 float getX() const { return pos[0]; }
283 float getY() const { return pos[1]; }
284 float getZ() const { return pos[2]; }
285
286 std::array<float, 3> pos{0., 0., -1999.f};
287 float ts = 0;
288 int nTrackSel = 0; // number of selected MC charged tracks
289 int ID = -1;
290 std::vector<RecPV> recVtx{};
291 std::vector<float> occTPCV{};
293};
294
295} // namespace o2::trackstudy
296#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
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
ClassDefNV(MCTrackInfo, 7)
std::vector< float > occTPCV
void setBits(std::uint8_t b)
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
std::vector< RecTrack > recTracks
bool contains(const o2::dataformats::VtxTrackIndex &ref) const
const RecTrack & getTrackWithITS() const
ClassDefNV(TrackFamily, 1)