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
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;
56};
57
58struct RecTrack {
59 enum FakeFlag {
60 FakeITS = 0x1 << 0,
61 FakeTPC = 0x1 << 1,
62 FakeTRD = 0x1 << 2,
63 FakeTOF = 0x1 << 3,
64 FakeITSTPC = 0x1 << 4,
65 FakeITSTPCTRD = 0x1 << 5,
66 FakeGLO = 0x1 << 7
67 };
72 short pvID = -1;
73 uint8_t flags = 0;
74 uint8_t nClITS = 0;
75 uint8_t nClTPC = 0;
76 uint8_t pattITS = 0;
77 int8_t lowestPadRow = -1;
78
79 bool isFakeGLO() const { return flags & FakeGLO; }
80 bool isFakeITS() const { return flags & FakeITS; }
81 bool isFakeTPC() const { return flags & FakeTPC; }
82 bool isFakeTRD() const { return flags & FakeTRD; }
83 bool isFakeTOF() const { return flags & FakeTOF; }
84 bool isFakeITSTPC() const { return flags & FakeITSTPC; }
85
87};
88
92 uint8_t nshTPC = 0;
93 uint8_t nshTPCRow = 0;
94
95 int getComb() const { return tr0.track.getSign() != tr1.track.getSign() ? 0 : (tr0.track.getSign() > 0 ? 1 : 2); }
96 float getDPhi() const
97 {
98 float dphi = tr0.track.getPhi() - tr1.track.getPhi();
99 if (dphi < -o2::constants::math::PI) {
101 } else if (dphi > o2::constants::math::PI) {
103 }
104 return dphi;
105 }
106 float getDTgl() const { return tr0.track.getTgl() - tr1.track.getTgl(); }
107
108 ClassDefNV(TrackPairInfo, 1)
109};
110
111struct TrackFamily { // set of tracks related to the same MC label
113 std::vector<RecTrack> recTracks{};
116 int8_t entITS = -1;
117 int8_t entTPC = -1;
118 int8_t entITSTPC = -1;
119 int8_t entITSFound = -1; // ITS track for this MC track, regardless if it was matched to TPC of another track
120 int8_t flags = 0;
121 float tpcT0 = -999.;
122
124 {
125 for (const auto& tr : recTracks) {
126 if (ref == tr.gid) {
127 return true;
128 }
129 }
130 return false;
131 }
132 const RecTrack& getTrackWithITS() const { return entITS < 0 ? dummyRecTrack : recTracks[entITS]; }
133 const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
137
139};
140
142 // contributor to TPC Cluster
143 std::array<float, 3> xyz{};
144 std::array<float, 3> below{};
145 std::array<float, 3> above{};
146 float snp = 0.;
147 float tgl = 0.;
148 float q2pt = 0.;
149 bool corrAttach = false;
150
151 int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
152
153 float getClX() const { return xyz[0]; }
154 float getClY() const { return xyz[1]; }
155 float getClZ() const { return xyz[2]; }
156
157 float getDY() const { return xyz[1] - getYRef(); }
158 float getDZ() const { return xyz[2] - getZRef(); }
159
160 float getYRef() const
161 {
162 float y = 0;
163 int n = 0;
164 if (below[0] > 1.) {
165 y += below[1];
166 n++;
167 }
168 if (above[0] > 1.) {
169 y += above[1];
170 n++;
171 }
172 return n == 1 ? y : 0.5 * y;
173 }
174
175 float getZRef() const
176 {
177 float z = 0;
178 int n = 0;
179 if (below[0] > 1.) {
180 z += below[2];
181 n++;
182 }
183 if (above[0] > 1.) {
184 z += above[2];
185 n++;
186 }
187 return n == 1 ? z : 0.5 * z;
188 }
189
190 float getDXMin() const
191 {
192 float adxA = 1e9, adxB = 1e9;
193 if (above[0] > 1.) {
194 adxA = xyz[0] - above[0];
195 }
196 if (below[0] > 1.) {
197 adxB = xyz[1] - below[0];
198 }
199 return std::abs(adxA) < std::abs(adxB) ? adxA : adxB;
200 }
201
202 float getDXMax() const
203 {
204 float adxA = 0, adxB = 0;
205 if (above[0] > 1.) {
206 adxA = xyz[0] - above[0];
207 }
208 if (below[0] > 1.) {
209 adxB = xyz[0] - below[0];
210 }
211 return std::abs(adxA) > std::abs(adxB) ? adxA : adxB;
212 }
213
214 float getEY() const { return getNExt() > 1 ? below[1] - above[1] : -999; }
215 float getEZ() const { return getNExt() > 1 ? below[2] - above[2] : -999; }
216
218};
219
220struct ClResTPC {
221 uint8_t sect = 0;
222 uint8_t row = 0;
223 uint8_t ncont = 0;
224 uint8_t flags = 0;
227 float qmax = 0;
228 float qtot = 0;
229 float occ = 0;
230 float occBin = 0;
231 float getSigmaPad() const { return float(sigmaPadPacked) * (1.f / 32); }
232 float getSigmaTime() const { return float(sigmaTimePacked) * (1.f / 32); }
233
234 std::vector<ClResTPCCont> contTracks;
235 int getNCont() const { return contTracks.size(); }
236
237 float getDY(int i) const { return i < getNCont() ? contTracks[i].getDY() : -999.; }
238 float getDZ(int i) const { return i < getNCont() ? contTracks[i].getDZ() : -999.; }
239 float getYRef(int i) const { return i < getNCont() ? contTracks[i].getYRef() : -999.; }
240 float getZRef(int i) const { return i < getNCont() ? contTracks[i].getZRef() : -999.; }
241 float getDXMin(int i) const { return i < getNCont() ? contTracks[i].getDXMin() : -999.; }
242 float getDXMax(int i) const { return i < getNCont() ? contTracks[i].getDXMax() : -999.; }
243 float getEY(int i) const { return i < getNCont() ? contTracks[i].getEY() : -999.; }
244 float getEZ(int i) const { return i < getNCont() ? contTracks[i].getEZ() : -999.; }
245
246 void sortCont()
247 {
248 std::sort(contTracks.begin(), contTracks.end(), [](const ClResTPCCont& a, const ClResTPCCont& b) {
249 float dya = a.getDY(), dyb = b.getDY(), dza = a.getDZ(), dzb = b.getDZ();
250 return dya * dya + dza * dza < dyb * dyb + dzb * dzb;
251 });
252 }
253
255};
256
262
263struct MCVertex {
264 float getX() const { return pos[0]; }
265 float getY() const { return pos[1]; }
266 float getZ() const { return pos[2]; }
267
268 std::array<float, 3> pos{0., 0., -1999.f};
269 float ts = 0;
270 int nTrackSel = 0; // number of selected MC charged tracks
271 int ID = -1;
272 std::vector<RecPV> recVtx{};
274};
275
276} // namespace o2::trackstudy
277#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, 4)
std::array< float, 3 > pos
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)