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
72 o2::track::TrackPar getTrackParTPC(float b, float x = 90) const;
73 float getTrackParTPCPar(int i, float b, float x = 90) const;
74 float getTrackParTPCPhiSec(float b, float x = 90) const;
75
77};
78
79struct RecTrack {
80 enum FakeFlag {
81 FakeITS = 0x1 << 0,
82 FakeTPC = 0x1 << 1,
83 FakeTRD = 0x1 << 2,
84 FakeTOF = 0x1 << 3,
85 FakeITSTPC = 0x1 << 4,
86 FakeITSTPCTRD = 0x1 << 5,
87 HASACSides = 0x1 << 6,
88 FakeGLO = 0x1 << 7
89 };
94 short pvID = -1;
95 uint8_t nClTPCShared = 0;
96 uint8_t flags = 0;
97 uint8_t nClITS = 0;
98 uint8_t nClTPC = 0;
99 uint8_t pattITS = 0;
100 int8_t lowestPadRow = -1;
101 int8_t padFromEdge = -1;
102 uint8_t rowMaxTPC = 0;
103 uint8_t rowCountTPC = 0;
104
105 bool isFakeGLO() const { return flags & FakeGLO; }
106 bool isFakeITS() const { return flags & FakeITS; }
107 bool isFakeTPC() const { return flags & FakeTPC; }
108 bool isFakeTRD() const { return flags & FakeTRD; }
109 bool isFakeTOF() const { return flags & FakeTOF; }
110 bool isFakeITSTPC() const { return flags & FakeITSTPC; }
111 bool hasACSides() const { return flags & HASACSides; }
112
114};
115
119 uint8_t nshTPC = 0;
120 uint8_t nshTPCRow = 0;
121
122 int getComb() const { return tr0.track.getSign() != tr1.track.getSign() ? 0 : (tr0.track.getSign() > 0 ? 1 : 2); }
123 float getDPhi() const
124 {
125 float dphi = tr0.track.getPhi() - tr1.track.getPhi();
126 if (dphi < -o2::constants::math::PI) {
128 } else if (dphi > o2::constants::math::PI) {
130 }
131 return dphi;
132 }
133 float getDTgl() const { return tr0.track.getTgl() - tr1.track.getTgl(); }
134
135 ClassDefNV(TrackPairInfo, 1)
136};
137
138struct TrackFamily { // set of tracks related to the same MC label
140 std::vector<RecTrack> recTracks{};
143 int8_t entITS = -1;
144 int8_t entTPC = -1;
145 int8_t entITSTPC = -1;
146 int8_t entITSFound = -1; // ITS track for this MC track, regardless if it was matched to TPC of another track
147 int8_t flags = 0;
148 float tpcT0 = -999.;
149
151 {
152 for (const auto& tr : recTracks) {
153 if (ref == tr.gid) {
154 return true;
155 }
156 }
157 return false;
158 }
159 const RecTrack& getTrackWithITS() const { return entITS < 0 ? dummyRecTrack : recTracks[entITS]; }
160 const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
164 {
166 return n < 0 ? dummyRecTrack : recTracks[n];
167 }
168 int getLongestTPCTrackEntry() const;
169 int getNTPCClones() const;
171
173};
174
176 // contributor to TPC Cluster
177 std::array<float, 3> xyz{};
178 std::array<float, 3> below{};
179 std::array<float, 3> above{};
180 float snp = 0.;
181 float tgl = 0.;
182 float q2pt = 0.;
183 bool corrAttach = false;
184
185 int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
186
187 float getClX() const { return xyz[0]; }
188 float getClY() const { return xyz[1]; }
189 float getClZ() const { return xyz[2]; }
190
191 float getDY() const { return xyz[1] - getYRef(); }
192 float getDZ() const { return xyz[2] - getZRef(); }
193
194 float getYRef() const
195 {
196 float y = 0;
197 int n = 0;
198 if (below[0] > 1.) {
199 y += below[1];
200 n++;
201 }
202 if (above[0] > 1.) {
203 y += above[1];
204 n++;
205 }
206 return n == 1 ? y : 0.5 * y;
207 }
208
209 float getZRef() const
210 {
211 float z = 0;
212 int n = 0;
213 if (below[0] > 1.) {
214 z += below[2];
215 n++;
216 }
217 if (above[0] > 1.) {
218 z += above[2];
219 n++;
220 }
221 return n == 1 ? z : 0.5 * z;
222 }
223
224 float getDXMin() const
225 {
226 float adxA = 1e9, adxB = 1e9;
227 if (above[0] > 1.) {
228 adxA = xyz[0] - above[0];
229 }
230 if (below[0] > 1.) {
231 adxB = xyz[1] - below[0];
232 }
233 return std::abs(adxA) < std::abs(adxB) ? adxA : adxB;
234 }
235
236 float getDXMax() const
237 {
238 float adxA = 0, adxB = 0;
239 if (above[0] > 1.) {
240 adxA = xyz[0] - above[0];
241 }
242 if (below[0] > 1.) {
243 adxB = xyz[0] - below[0];
244 }
245 return std::abs(adxA) > std::abs(adxB) ? adxA : adxB;
246 }
247
248 float getEY() const { return getNExt() > 1 ? below[1] - above[1] : -999; }
249 float getEZ() const { return getNExt() > 1 ? below[2] - above[2] : -999; }
250
252};
253
254struct ClResTPC {
255 uint8_t sect = 0;
256 uint8_t row = 0;
257 uint8_t ncont = 0;
258 uint8_t flags = 0;
261 float qmax = 0;
262 float qtot = 0;
263 float occ = 0;
264 float occBin = 0;
265 float getSigmaPad() const { return float(sigmaPadPacked) * (1.f / 32); }
266 float getSigmaTime() const { return float(sigmaTimePacked) * (1.f / 32); }
267
268 std::vector<ClResTPCCont> contTracks;
269 int getNCont() const { return contTracks.size(); }
270
271 float getDY(int i) const { return i < getNCont() ? contTracks[i].getDY() : -999.; }
272 float getDZ(int i) const { return i < getNCont() ? contTracks[i].getDZ() : -999.; }
273 float getYRef(int i) const { return i < getNCont() ? contTracks[i].getYRef() : -999.; }
274 float getZRef(int i) const { return i < getNCont() ? contTracks[i].getZRef() : -999.; }
275 float getDXMin(int i) const { return i < getNCont() ? contTracks[i].getDXMin() : -999.; }
276 float getDXMax(int i) const { return i < getNCont() ? contTracks[i].getDXMax() : -999.; }
277 float getEY(int i) const { return i < getNCont() ? contTracks[i].getEY() : -999.; }
278 float getEZ(int i) const { return i < getNCont() ? contTracks[i].getEZ() : -999.; }
279
280 void sortCont()
281 {
282 std::sort(contTracks.begin(), contTracks.end(), [](const ClResTPCCont& a, const ClResTPCCont& b) {
283 float dya = a.getDY(), dyb = b.getDY(), dza = a.getDZ(), dzb = b.getDZ();
284 return dya * dya + dza * dza < dyb * dyb + dzb * dzb;
285 });
286 }
287
289};
290
296
297struct MCVertex {
298 float getX() const { return pos[0]; }
299 float getY() const { return pos[1]; }
300 float getZ() const { return pos[2]; }
301
302 std::array<float, 3> pos{0., 0., -1999.f};
303 float ts = 0;
304 int nTrackSel = 0; // number of selected MC charged tracks
305 int ID = -1;
306 std::vector<RecPV> recVtx{};
307 std::vector<float> occTPCV{};
309};
310
311} // namespace o2::trackstudy
312#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
ClassDefNV(MCTrackInfo, 7)
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)