Project
Loading...
Searching...
No Matches
TrackITS.h
Go to the documentation of this file.
1// Copyright 2019-2026 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
15
16#ifndef ALICEO2_ITS_TRACKITS_H
17#define ALICEO2_ITS_TRACKITS_H
18
19#include <cstdint>
20
21#include "GPUCommonDef.h"
25
26namespace o2
27{
28namespace itsmft
29{
30class Cluster;
31}
32
33namespace its
34{
35
37{
38 public:
39 static constexpr unsigned int ExtendedPatternShift = 24;
40 static constexpr int MaxLayersInTrackPattern = 8;
41
42 private:
43 enum UserBits {
44 kSharedClusters = 1 << 28
45 };
46
48 using ClusRefs = o2::dataformats::RangeRefComp<4>;
49
50 public:
51 using o2::track::TrackParCov::TrackParCov; // inherit base constructors
52 static constexpr int MaxClusters = 16;
53
54 GPUhdDefault() TrackITS() = default;
55 GPUhdDefault() TrackITS(const TrackITS& t) = default;
56 GPUhd() TrackITS(const o2::track::TrackParCov& parcov) : o2::track::TrackParCov{parcov} {}
57 GPUhd() TrackITS(const o2::track::TrackParCov& parCov, float chi2, const o2::track::TrackParCov& outer)
58 : o2::track::TrackParCov{parCov}, mParamOut{outer}, mChi2{chi2} {}
59 GPUhdDefault() TrackITS& operator=(const TrackITS& tr) = default;
60 GPUhdDefault() TrackITS& operator=(TrackITS&& tr) = default;
61 GPUhdDefault() ~TrackITS() = default;
62
63 // These functions must be provided
64 bool propagate(float alpha, float x, float bz);
65 bool update(const Cluster& c, float chi2);
66
67 // Other functions
68 GPUhdi() float getChi2() const { return mChi2; }
69 GPUhdi() int getNClusters() const { return mClusRef.getEntries(); }
70 GPUhdi() int getNumberOfClusters() const { return getNClusters(); }
71 int getFirstClusterEntry() const { return mClusRef.getFirstEntry(); }
72 int getClusterEntry(int i) const { return getFirstClusterEntry() + i; }
74 {
75 mClusRef.setFirstEntry(mClusRef.getFirstEntry() + bias);
76 }
77 void setFirstClusterEntry(int offs)
78 {
79 mClusRef.setFirstEntry(offs);
80 }
82 {
83 mClusRef.setEntries(n);
84 }
85 bool operator<(const TrackITS& o) const;
86 void getImpactParams(float x, float y, float z, float bz, float ip[2]) const;
87 // bool getPhiZat(float r,float &phi,float &z) const;
88
89 void setClusterRefs(int firstEntry, int n)
90 {
91 mClusRef.set(firstEntry, n);
92 }
93
94 const ClusRefs& getClusterRefs() const { return mClusRef; }
95 GPUhdi() ClusRefs& getClusterRefs() { return mClusRef; }
96
97 GPUhdi() void setChi2(float chi2) { mChi2 = chi2; }
98
99 bool isBetter(const TrackITS& best, float maxChi2) const;
100
101 GPUhdi() auto& getTimeStamp() { return mTime; }
102 GPUhdi() const auto& getTimeStamp() const { return mTime; }
103
104 GPUhdi() o2::track::TrackParCov& getParamIn() { return *this; }
105 GPUhdi() const o2::track::TrackParCov& getParamIn() const { return *this; }
106
107 GPUhdi() o2::track::TrackParCov& getParamOut() { return mParamOut; }
108 GPUhdi() const o2::track::TrackParCov& getParamOut() const { return mParamOut; }
109
110 GPUhdi() void setPattern(uint32_t p) { mPattern = p; }
111 GPUhdi() uint32_t getPattern() const { return mPattern; }
112 bool hasHitOnLayer(uint32_t i) const { return mPattern & (0x1 << i); }
113 bool isFakeOnLayer(uint32_t i) const { return !(mPattern & (0x1 << (16 + i))); }
114 bool isExtendedOnLayer(uint32_t i) const { return (mPattern & (0x1 << (ExtendedPatternShift + i))); } // only correct if getNClusters <= 8 on layers <= 8
115 template <int NLayers>
116 GPUhdi() static constexpr uint32_t getLayerPatternMask()
117 {
118 return (NLayers >= 32) ? 0xffffffffu : ((1u << NLayers) - 1u);
119 }
120 template <int NLayers>
121 GPUhdi() void setExtendedLayerPattern(uint32_t pattern)
122 {
123 pattern &= getLayerPatternMask<NLayers>();
124 setUserField(static_cast<uint16_t>(pattern));
125 if constexpr (NLayers <= MaxLayersInTrackPattern) {
126 setPattern(getPattern() | (pattern << ExtendedPatternShift));
127 }
128 }
129 template <int NLayers>
130 GPUhdi() uint32_t getExtendedLayerPattern() const
131 {
132 const auto mask = getLayerPatternMask<NLayers>();
133 if constexpr (NLayers <= MaxLayersInTrackPattern) {
134 const auto pattern = (getPattern() >> ExtendedPatternShift) & mask;
135 if (pattern) {
136 return pattern;
137 }
138 }
139 return getUserField() & mask;
140 }
141 GPUhdi() void clearExtendedLayerPattern()
142 {
143 setUserField(0);
144 getParamOut().setUserField(0);
145 }
146 GPUhdi() uint32_t getLastClusterLayer() const
147 {
148 uint32_t r{0}, v{mPattern & ((1 << 16) - 1)};
149 while (v >>= 1) {
150 r++;
151 }
152 return r;
153 }
154 GPUhdi() uint32_t getFirstClusterLayer() const
155 {
156 int s{0};
157 while (!(mPattern & (1 << s))) {
158 s++;
159 }
160 return s;
161 }
162 int getNFakeClusters() const;
163
164 void setSharedClusters(bool toggle = true) { mClusterSizes = toggle ? (mClusterSizes | kSharedClusters) : (mClusterSizes & ~kSharedClusters); }
165 bool hasSharedClusters() const { return mClusterSizes & kSharedClusters; }
166
167 void setClusterSize(int l, int size)
168 {
169 if (l >= 8) {
170 return;
171 }
172 if (size > 15) {
173 size = 15;
174 }
175 mClusterSizes &= ~(0xf << (l * 4));
176 mClusterSizes |= (size << (l * 4));
177 }
178
179 int getClusterSize(int l)
180 {
181 if (l >= 7) {
182 return 0;
183 }
184 return (mClusterSizes >> (l * 4)) & 0xf;
185 }
186
187 int getClusterSizes() const
188 {
189 return mClusterSizes;
190 }
191
192 private:
193 o2::track::TrackParCov mParamOut;
194 ClusRefs mClusRef;
195 float mChi2 = 0.;
196 uint32_t mPattern = 0;
197 uint32_t mClusterSizes = 0u;
198 TimeStamp mTime;
199
200 ClassDefNV(TrackITS, 7);
201};
202
203class TrackITSExt : public TrackITS
204{
206 public:
207 static constexpr int MaxClusters = 16;
208 using TrackITS::TrackITS; // inherit base constructors
209
210 GPUh() TrackITSExt(o2::track::TrackParCov&& parCov, short ncl, float chi2, o2::track::TrackParCov&& outer, std::array<int, MaxClusters> cls)
211 : TrackITS(parCov, chi2, outer), mIndex{cls}
212 {
214 }
215
216 GPUh() TrackITSExt(o2::track::TrackParCov& parCov, short ncl, float chi2, std::uint32_t rof, o2::track::TrackParCov& outer, std::array<int, MaxClusters> cls)
217 : TrackITS(parCov, chi2, outer), mIndex{cls}
218 {
220 }
221
223
224 GPUhdi() int getClusterIndex(int lr) const { return mIndex[lr]; }
225
226 GPUh() int getFirstLayerClusterIndex() const
227 {
228 return getClusterIndex(getFirstClusterLayer());
229 }
230
231 GPUhdi() void setExternalClusterIndex(int layer, int idx, bool newCluster = false)
232 {
233 if (newCluster) {
234 getClusterRefs().setEntries(getNumberOfClusters() + 1);
235 uint32_t pattern = getPattern();
236 pattern |= 0x1 << layer;
237 setPattern(pattern);
238 }
239 mIndex[layer] = idx;
240 }
241
243 {
244 return mIndex;
245 }
246
247#ifndef GPUCA_GPUCODE
248 // build order-independent hash via the external cluster idx (unique within a TF) for the selected layers
249 // cluster indices are either sorted inward or outward
250 size_t hash(uint16_t layerMask = 0xFFFF, bool inward = true) const noexcept
251 {
252 size_t h1 = 0, h2 = 0;
253 int from = (int)getLastClusterLayer(), to = -1, step = -1;
254 if (inward) {
255 from = (int)getFirstClusterLayer();
256 to = MaxClusters;
257 step = 1;
258 }
259 // clusters are stored continously but they do not necesarrily correspond to the layers
260 for (int layer = from, slot{0}; layer != to; layer += step) {
261 if (hasHitOnLayer(layer)) {
262 int idx = mIndex[slot++];
263 if (layerMask & (uint16_t(1) << layer)) {
264 size_t v = std::hash<int>{}(idx);
265 h1 ^= v;
266 h2 += v * 0x9e3779b97f4a7c15ULL; // boost's hash_combine
267 }
268 }
269 }
270 return h1 ^ (h2 << 1);
271 }
272#endif
273
274 private:
275 std::array<int, MaxClusters> mIndex = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
276 ClassDefNV(TrackITSExt, 3);
277};
278} // namespace its
279} // namespace o2
280#endif /* ALICEO2_ITS_TRACKITS_H */
Base track model for the Barrel, params only, w/o covariance.
unsigned short int uint16_t
int32_t i
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h configStandalone Internal display display_internal Number of updates the Qt GUI may send ahead of the last one the display has before it waits for the display Opacity of the console background Number of console lines the history is shortened to this when it reaches twice the size Time in seconds an info message fades out after setInfoTime h OpenGL display display Font size Do not use Freetype for font auto
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions false
float chi2
Class to refer to the 1st entry and N elements of some group in the continuous container.
uint32_t c
Definition RawData.h:2
o2::track::TrackParCov TrackParCov
Definition Recon.h:39
HMPID cluster implementation.
Definition Cluster.h:27
GPUhdDefault() TrackITSExt(const TrackITSExt &t)=default
size_t hash(uint16_t layerMask=0xFFFF, bool inward=true) const noexcept
Definition TrackITS.h:250
GPUh() int getFirstLayerClusterIndex() const
Definition TrackITS.h:226
GPUhdi() void setExternalClusterIndex(int layer
int bool MaxClusters & getClusterIndexes()
Definition TrackITS.h:242
static constexpr int MaxClusters
< heavy version of TrackITS, with clusters embedded
Definition TrackITS.h:207
GPUh() TrackITSExt(o2
Definition TrackITS.h:210
GPUhdi() int getClusterIndex(int lr) const
Definition TrackITS.h:224
GPUhdi() void setExtendedLayerPattern(uint32_t pattern)
Definition TrackITS.h:121
GPUhdi() auto &getTimeStamp()
Definition TrackITS.h:101
bool operator<(const TrackITS &o) const
Definition TrackITS.cxx:27
bool hasHitOnLayer(uint32_t i) const
Definition TrackITS.h:112
GPUhdi() const auto &getTimeStamp() const
Definition TrackITS.h:102
const ClusRefs & getClusterRefs() const
Definition TrackITS.h:94
void setClusterRefs(int firstEntry, int n)
Definition TrackITS.h:89
GPUhdi() int getNClusters() const
Definition TrackITS.h:69
int getNFakeClusters() const
Definition TrackITS.cxx:110
static constexpr int MaxClusters
Definition TrackITS.h:52
GPUhdi() ClusRefs &getClusterRefs()
Definition TrackITS.h:95
GPUhdi() uint32_t getLastClusterLayer() const
Definition TrackITS.h:146
void getImpactParams(float x, float y, float z, float bz, float ip[2]) const
Definition TrackITS.cxx:40
GPUhdDefault() TrackITS &operator
int getClusterEntry(int i) const
Definition TrackITS.h:72
void shiftFirstClusterEntry(int bias)
Definition TrackITS.h:73
void setNumberOfClusters(int n)
Definition TrackITS.h:81
GPUhdi() uint32_t getPattern() const
Definition TrackITS.h:111
int getClusterSize(int l)
Definition TrackITS.h:179
GPUhdi() uint32_t getFirstClusterLayer() const
Definition TrackITS.h:154
bool isFakeOnLayer(uint32_t i) const
Definition TrackITS.h:113
GPUhdi() uint32_t getExtendedLayerPattern() const
Definition TrackITS.h:130
void setClusterSize(int l, int size)
Definition TrackITS.h:167
GPUhdi() int getNumberOfClusters() const
Definition TrackITS.h:70
GPUhdi() const o2
Definition TrackITS.h:105
int getFirstClusterEntry() const
Definition TrackITS.h:71
int getClusterSizes() const
Definition TrackITS.h:187
GPUhdi() float getChi2() const
Definition TrackITS.h:68
void setFirstClusterEntry(int offs)
Definition TrackITS.h:77
bool propagate(float alpha, float x, float bz)
Definition TrackITS.cxx:72
bool hasSharedClusters() const
Definition TrackITS.h:165
GPUhd() TrackITS(const o2
Definition TrackITS.h:56
static constexpr unsigned int ExtendedPatternShift
Definition TrackITS.h:39
void setSharedClusters(bool toggle=true)
Definition TrackITS.h:164
static constexpr int MaxLayersInTrackPattern
Definition TrackITS.h:40
GPUhdDefault() TrackITS()=default
GPUhdi() void clearExtendedLayerPattern()
Definition TrackITS.h:141
bool isBetter(const TrackITS &best, float maxChi2) const
Definition TrackITS.cxx:94
bool isExtendedOnLayer(uint32_t i) const
Definition TrackITS.h:114
bool update(const Cluster &c, float chi2)
Definition TrackITS.cxx:82
GPUhdi() void setChi2(float chi2)
Definition TrackITS.h:97
GPUhdi() static const expr uint32_t getLayerPatternMask()
Definition TrackITS.h:116
Cluster class for the ITSMFT.
Definition Cluster.h:34
GLdouble n
Definition glcorearb.h:1982
GLfloat GLfloat GLfloat alpha
Definition glcorearb.h:279
GLint GLenum GLint x
Definition glcorearb.h:403
GLsizeiptr size
Definition glcorearb.h:659
const GLdouble * v
Definition glcorearb.h:832
GLint y
Definition glcorearb.h:270
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
GLboolean r
Definition glcorearb.h:1233
GLint GLuint mask
Definition glcorearb.h:291
GLdouble GLdouble GLdouble z
Definition glcorearb.h:843
const int step
track setChi2(hypo.chi2)
const bool const bool const int FollowDirection BestTrial TrackITSInternal< NLayers > & best
const float const float const float bz
TrackParCovF TrackParCov
Definition Track.h:33
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::array< uint16_t, 5 > pattern