Project
Loading...
Searching...
No Matches
DataTypes.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#ifndef O2_FRAMEWORK_DATATYPES_H_
12#define O2_FRAMEWORK_DATATYPES_H_
13
15
16#include <cmath>
17#include <cstdint>
18#include <limits>
19#include <array>
20
21namespace o2::aod::bc
22{
23enum BCFlags : uint8_t {
24 ITSUPCMode = 0x1
25};
26}
27
28namespace o2::aod::collision
29{
39} // namespace o2::aod::collision
40namespace o2::aod::track
41{
43 TrackIU = 0, // track at point of innermost update (not propagated)
44 Track = 1, // propagated track
45 StrangeTrack = 2, // track found by strangeness tracking at point of innermost update
46 Run2Track = 254,
47 Run2Tracklet = 255
48};
49enum TrackFlags : uint32_t {
50 TrackTimeResIsRange = 0x1, // Gaussian or range
51 PVContributor = 0x2, // This track has contributed to the collision vertex fit
52 OrphanTrack = 0x4, // Track has no association with any collision vertex
53 TrackTimeAsym = 0x8, // track with an asymmetric time range
54 TPCdEdxAlt = 0x10, // TPCSignal and tpcNClsFindableMinusPID correspond for alternative dEdx since the nominal was 0
55 TPCSideA = 0x20, // TPC track has A-side clusters (if any)
56 TPCSideC = 0x40, // TPC track has C-side clusters (if any)
57 // NOTE Highest 4 (29..32) bits reserved for PID hypothesis
58};
60 ITSrefit = 0x1,
61 FreeClsSPDTracklet = 0x1, // for SPD tracklets, tracklet from cluster not used in tracking
62 TPCrefit = 0x2,
64 TPCout = 0x8
65 // NOTE Highest 4 (29..32) bits reserved for PID hypothesis
66};
68 ITS = 0x1,
69 TPC = 0x2,
70 TRD = 0x4,
71 TOF = 0x8
72};
74 Layer0 = 0x1,
75 Layer1 = 0x2,
76 Layer2 = 0x4,
77 Layer3 = 0x8,
78 Layer4 = 0x10,
79 Layer5 = 0x20,
82};
83namespace extensions
84{
86 // TPC delta forward & backward packing
88 struct {
89 uint16_t timeForward;
90 uint16_t timeBackward;
91 } __attribute__((packed)) deltas;
92 float timeErr;
94 static_assert(sizeof(float) == 2 * sizeof(uint16_t));
95
96 float getTimeErr() const
97 {
98 return encoding.timeErr;
99 }
100
101 // Use all 16 bits of uint16_t to encode delta scale with max precision
102 // e.g., TPCTrack::mDeltaFwd * timeScaler
103 // max range for the time deltas is 0 - <512 (1<<9) TPC time bins
104 static constexpr float timeScaler{(1 << 16) / (1 << 9)};
105 // bogus value to max incorrect usae immedately obvious
106 static constexpr float invalidValue{std::numeric_limits<float>::min()};
107 // convert TPC time bins to ns
109
110 void setDeltaTFwd(float fwd)
111 {
112 encoding.deltas.timeForward = static_cast<uint16_t>(fwd * timeScaler);
113 }
114 void setDeltaTBwd(float bwd)
115 {
116 encoding.deltas.timeBackward = static_cast<uint16_t>(bwd * timeScaler);
117 }
118
119 float getDeltaTFwd() const
120 {
121 return static_cast<float>(encoding.deltas.timeForward) / timeScaler * TPCBinNS;
122 }
123 float getDeltaTBwd() const
124 {
125 return static_cast<float>(encoding.deltas.timeBackward) / timeScaler * TPCBinNS;
126 }
127};
128} // namespace extensions
129
130// Reference radius for extrapolated tracks
131constexpr float trackQARefRadius{50.f};
132constexpr float trackQAScaleBins{5.f};
133// Fit parameters for scale dY, dZ, dSnp, dTgl, dQ2Pt
134constexpr std::array<float, 5> trackQAScaleContP0{0.257192, 0.0775375, 0.00424283, 0.00107201, 0.0335447};
135constexpr std::array<float, 5> trackQAScaleContP1{0.189371, 0.409071, 0.00694444, 0.00720038, 0.0806902};
136constexpr std::array<float, 5> trackQAScaleGloP0{0.130985, 0.0775375, 0.00194703, 0.000405458, 0.0160007};
137constexpr std::array<float, 5> trackQAScaleGloP1{0.183731, 0.409071, 0.00621802, 0.00624881, 0.0418957};
138constexpr std::array<float, 2> trackQAScaledTOF{1.1, 0.33};
139} // namespace o2::aod::track
140
141namespace o2::aod::fwdtrack
142{
143enum ForwardTrackTypeEnum : uint8_t {
144 GlobalMuonTrack = 0, // MFT-MCH-MID
145 GlobalMuonTrackOtherMatch, // MFT-MCH-MID (MCH-MID used another time)
148 MCHStandaloneTrack // MCH
150} // namespace o2::aod::fwdtrack
151
153{
154enum MCParticleFlags : uint8_t {
156 FromBackgroundEvent = 0x2, // Particle from background event (may have been used several times)
157 PhysicalPrimary = 0x4, // Particle is a physical primary according to ALICE definition
158 FromOutOfBunchPileUpCollision = 0x8 // Particle from out-of-bunch pile up collision (currently Run 2 only)
160} // namespace o2::aod::mcparticle::enums
161
162namespace o2::aod::mcparticle
163{
164constexpr float maxRadiusForPhysicalPrimary{5.f};
165
166struct Tools {
167 // trivial helper to remove Physical Primary bit
168 static uint8_t removeIsPhysicalPrimaryBit(uint8_t input_flags, float vx, float vy)
169 {
171 input_flags = input_flags & ~enums::PhysicalPrimary; // remove physical primary bit, keep others
172 }
173 return input_flags;
174 }
175};
176} // namespace o2::aod::mcparticle
177
178namespace o2::aod::run2
179{
196 kTRDHCO, // Offline TRD cosmic trigger decision
197 kTRDHJT, // Offline TRD jet trigger decision
198 kTRDHSE, // Offline TRD single electron trigger decision
199 kTRDHQU, // Offline TRD quarkonium trigger decision
200 kTRDHEE // Offline TRD single-electron-in-EMCAL-acceptance trigger decision
202} // namespace o2::aod::run2
203
204#endif // O2_FRAMEWORK_DATATYPES_H_
Header to collect LHC related constants.
@ Run2VertexerTracksMultiVertex
Definition DataTypes.h:37
@ Run2VertexerTracksWithConstraint
Definition DataTypes.h:35
constexpr float maxRadiusForPhysicalPrimary
Definition DataTypes.h:164
@ kAliEventCutsAccepted
Definition DataTypes.h:191
@ kConsistencySPDandTrackVertices
Definition DataTypes.h:183
constexpr std::array< float, 2 > trackQAScaledTOF
Definition DataTypes.h:138
constexpr std::array< float, 5 > trackQAScaleContP1
Definition DataTypes.h:135
uint8_t itsSharedClusterMap uint8_t
constexpr std::array< float, 5 > trackQAScaleContP0
Definition DataTypes.h:134
constexpr std::array< float, 5 > trackQAScaleGloP0
Definition DataTypes.h:136
constexpr std::array< float, 5 > trackQAScaleGloP1
Definition DataTypes.h:137
constexpr float trackQAScaleBins
Definition DataTypes.h:132
constexpr float trackQARefRadius
Definition DataTypes.h:131
TracksIU::iterator TrackIU
Tracks::iterator Track
constexpr double LHCBunchSpacingNS
static uint8_t removeIsPhysicalPrimaryBit(uint8_t input_flags, float vx, float vy)
Definition DataTypes.h:168
union o2::aod::track::extensions::TPCTimeErrEncoding::TPCDeltaTime encoding