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{};
36 std::vector<o2::track::TrackPar> trackRefsTPC{};
39 float occTPC = -1.f;
40 int occITS = -1.f;
41 int bcInTF = -1;
42 int pdg = 0;
43 int pdgParent = 0;
44 int parentEntry = -1;
45 int16_t nTPCCl = 0;
46 int16_t nTPCClShared = 0;
47 int8_t parentDecID = -1;
48 uint8_t minTPCRow = -1;
49 uint8_t maxTPCRow = 0;
50 uint8_t nUsedPadRows = 0;
51 uint8_t maxTPCRowInner = 0; // highest row in the sector containing the lowest one
52 uint8_t minTPCRowSect = -1;
53 uint8_t maxTPCRowSect = -1;
54 int8_t nITSCl = 0;
55 int8_t pattITSCl = 0;
56 uint8_t flags = 0;
57
58 enum Flags : uint32_t { Primary = 0,
60 BitMask = 0xff };
61
62 bool isPrimary() const { return isBitSet(Primary); }
63 bool isAddedAtRecStage() const { return isBitSet(AddedAtRecStage); }
66
67 uint8_t getBits() const { return flags; }
68 bool isBitSet(int bit) const { return flags & (0xff & (0x1 << bit)); }
69 void setBits(std::uint8_t b) { flags = b; }
70 void setBit(int bit) { flags |= BitMask & (0x1 << bit); }
71 void resetBit(int bit) { flags &= ~(BitMask & (0x1 << bit)); }
72
73 o2::track::TrackPar getTrackParTPC(float b, float x = 90) const;
74 float getTrackParTPCPar(int i, float b, float x = 90) const;
75 float getTrackParTPCPhiSec(float b, float x = 90) const;
76
78};
79
80struct RecTrack {
81 enum FakeFlag {
82 FakeITS = 0x1 << 0,
83 FakeTPC = 0x1 << 1,
84 FakeTRD = 0x1 << 2,
85 FakeTOF = 0x1 << 3,
86 FakeITSTPC = 0x1 << 4,
87 FakeITSTPCTRD = 0x1 << 5,
88 HASACSides = 0x1 << 6,
89 FakeGLO = 0x1 << 7
90 };
95 short pvID = -1;
96 uint8_t nClTPCShared = 0;
97 uint8_t flags = 0;
98 uint8_t nClITS = 0;
99 uint8_t nClTPC = 0;
100 uint8_t pattITS = 0;
101 int8_t lowestPadRow = -1;
102 int8_t padFromEdge = -1;
103 uint8_t rowMaxTPC = 0;
104 uint8_t rowCountTPC = 0;
105
106 bool isFakeGLO() const { return flags & FakeGLO; }
107 bool isFakeITS() const { return flags & FakeITS; }
108 bool isFakeTPC() const { return flags & FakeTPC; }
109 bool isFakeTRD() const { return flags & FakeTRD; }
110 bool isFakeTOF() const { return flags & FakeTOF; }
111 bool isFakeITSTPC() const { return flags & FakeITSTPC; }
112 bool hasACSides() const { return flags & HASACSides; }
113
115};
116
120 uint8_t nshTPC = 0;
121 uint8_t nshTPCRow = 0;
122
123 int getComb() const { return tr0.track.getSign() != tr1.track.getSign() ? 0 : (tr0.track.getSign() > 0 ? 1 : 2); }
124 float getDPhi() const
125 {
126 float dphi = tr0.track.getPhi() - tr1.track.getPhi();
127 if (dphi < -o2::constants::math::PI) {
129 } else if (dphi > o2::constants::math::PI) {
131 }
132 return dphi;
133 }
134 float getDTgl() const { return tr0.track.getTgl() - tr1.track.getTgl(); }
135
136 ClassDefNV(TrackPairInfo, 1)
137};
138
139struct TrackFamily { // set of tracks related to the same MC label
141 std::vector<RecTrack> recTracks{};
144 int8_t entITS = -1;
145 int8_t entTPC = -1;
146 int8_t entITSTPC = -1;
147 int8_t entITSFound = -1; // ITS track for this MC track, regardless if it was matched to TPC of another track
148 int8_t flags = 0;
149 float tpcT0 = -999.;
150
152 {
153 for (const auto& tr : recTracks) {
154 if (ref == tr.gid) {
155 return true;
156 }
157 }
158 return false;
159 }
160 const RecTrack& getTrackWithITS() const { return entITS < 0 ? dummyRecTrack : recTracks[entITS]; }
161 const RecTrack& getTrackWithTPC() const { return entTPC < 0 ? dummyRecTrack : recTracks[entTPC]; }
165 {
167 return n < 0 ? dummyRecTrack : recTracks[n];
168 }
169 int getLongestTPCTrackEntry() const;
170 int getNTPCClones() const;
172
174};
175
177 // contributor to TPC Cluster
178 std::array<float, 3> xyz{};
179 std::array<float, 3> below{};
180 std::array<float, 3> above{};
181 float snp = 0.;
182 float tgl = 0.;
183 float q2pt = 0.;
184 bool corrAttach = false;
185
186 int getNExt() const { return (below[0] > 1.) + (above[0] > 1.); }
187
188 float getClX() const { return xyz[0]; }
189 float getClY() const { return xyz[1]; }
190 float getClZ() const { return xyz[2]; }
191
192 float getDY() const { return xyz[1] - getYRef(); }
193 float getDZ() const { return xyz[2] - getZRef(); }
194
195 float getYRef() const
196 {
197 float y = 0;
198 int n = 0;
199 if (below[0] > 1.) {
200 y += below[1];
201 n++;
202 }
203 if (above[0] > 1.) {
204 y += above[1];
205 n++;
206 }
207 return n == 1 ? y : 0.5 * y;
208 }
209
210 float getZRef() const
211 {
212 float z = 0;
213 int n = 0;
214 if (below[0] > 1.) {
215 z += below[2];
216 n++;
217 }
218 if (above[0] > 1.) {
219 z += above[2];
220 n++;
221 }
222 return n == 1 ? z : 0.5 * z;
223 }
224
225 float getDXMin() const
226 {
227 float adxA = 1e9, adxB = 1e9;
228 if (above[0] > 1.) {
229 adxA = xyz[0] - above[0];
230 }
231 if (below[0] > 1.) {
232 adxB = xyz[1] - below[0];
233 }
234 return std::abs(adxA) < std::abs(adxB) ? adxA : adxB;
235 }
236
237 float getDXMax() const
238 {
239 float adxA = 0, adxB = 0;
240 if (above[0] > 1.) {
241 adxA = xyz[0] - above[0];
242 }
243 if (below[0] > 1.) {
244 adxB = xyz[0] - below[0];
245 }
246 return std::abs(adxA) > std::abs(adxB) ? adxA : adxB;
247 }
248
249 float getEY() const { return getNExt() > 1 ? below[1] - above[1] : -999; }
250 float getEZ() const { return getNExt() > 1 ? below[2] - above[2] : -999; }
251
253};
254
255struct ClResTPC {
256 uint8_t sect = 0;
257 uint8_t row = 0;
258 uint8_t ncont = 0;
259 uint8_t flags = 0;
262 float qmax = 0;
263 float qtot = 0;
264 float occ = 0;
265 float occBin = 0;
266 float getSigmaPad() const { return float(sigmaPadPacked) * (1.f / 32); }
267 float getSigmaTime() const { return float(sigmaTimePacked) * (1.f / 32); }
268
269 std::vector<ClResTPCCont> contTracks;
270 int getNCont() const { return contTracks.size(); }
271
272 float getDY(int i) const { return i < getNCont() ? contTracks[i].getDY() : -999.; }
273 float getDZ(int i) const { return i < getNCont() ? contTracks[i].getDZ() : -999.; }
274 float getYRef(int i) const { return i < getNCont() ? contTracks[i].getYRef() : -999.; }
275 float getZRef(int i) const { return i < getNCont() ? contTracks[i].getZRef() : -999.; }
276 float getDXMin(int i) const { return i < getNCont() ? contTracks[i].getDXMin() : -999.; }
277 float getDXMax(int i) const { return i < getNCont() ? contTracks[i].getDXMax() : -999.; }
278 float getEY(int i) const { return i < getNCont() ? contTracks[i].getEY() : -999.; }
279 float getEZ(int i) const { return i < getNCont() ? contTracks[i].getEZ() : -999.; }
280
281 void sortCont()
282 {
283 std::sort(contTracks.begin(), contTracks.end(), [](const ClResTPCCont& a, const ClResTPCCont& b) {
284 float dya = a.getDY(), dyb = b.getDY(), dza = a.getDZ(), dzb = b.getDZ();
285 return dya * dya + dza * dza < dyb * dyb + dzb * dzb;
286 });
287 }
288
290};
291
297
298struct MCVertex {
299 float getX() const { return pos[0]; }
300 float getY() const { return pos[1]; }
301 float getZ() const { return pos[2]; }
302
303 std::array<float, 3> pos{0., 0., -1999.f};
304 float ts = 0;
305 int nTrackSel = 0; // number of selected MC charged tracks
306 int ID = -1;
307 std::vector<RecPV> recVtx{};
308 std::vector<float> occTPCV{};
310};
311
312} // namespace o2::trackstudy
313#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, 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)