Project
Loading...
Searching...
No Matches
GlobalTrackID.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
15
16#ifndef O2_GLOBAL_TRACK_ID
17#define O2_GLOBAL_TRACK_ID
18
19#include "GPUCommonDef.h"
20
21#include "GPUCommonBitSet.h"
24#ifndef GPUCA_GPUCODE
25#include <iosfwd>
26#include <string>
27#include <array>
28#include <string_view>
29#include <bitset>
30#endif // GPUCA_GPUCODE_DEVICE
31
32namespace o2
33{
34namespace dataformats
35{
36
37class GlobalTrackID : public AbstractRef<25, 5, 2>
38{
39 public:
41
42 enum Source : uint8_t { // provenance of the
43 ITS, // standalone detectors
47 PHS, // FIXME Not sure PHS ... FDD should be kept here, at the moment
48 CPV, // they are here for completeness
58 ITSTPC, // 2-detector tracks
62 ITSTPCTRD, // 3-detector tracks
66 ITSTPCTRDTOF, // full barrel track
67 ITSAB, // ITS AfterBurner tracklets
69 //
70 MCHMID, // Temporary ordering
71 //
73 };
74
75 using AbstractRef<25, 5, 2>::AbstractRef;
76 static_assert(NSources <= 32, "bitset<32> insufficient");
78
79#ifndef GPUCA_GPUCODE
80 static constexpr std::string_view NONE{"none"};
81 static constexpr std::string_view ALL{"all"};
82#endif
83 static GPUglobalconstexpr() mask_t MASK_ALL = (1u << NSources) - 1;
84 static GPUglobalconstexpr() mask_t MASK_NONE = 0;
85
86 // methods for detector level manipulations
87 GPUdi() static constexpr DetID::mask_t getSourceDetectorsMask(int i);
88 GPUdi() static constexpr DetID::mask_t getSourcesDetectorsMask(GlobalTrackID::mask_t srcm);
89 GPUdi() static bool includesDet(DetID id, GlobalTrackID::mask_t srcm);
90 GPUdi() static bool isTrackSource(int s);
91 GPUdi() auto getSourceDetectorsMask() const { return getSourceDetectorsMask(getSource()); }
92 GPUdi() bool includesDet(DetID id) const { return (getSourceDetectorsMask() & DetID::getMask(id)).any(); }
93
94 // methods for source level manipulations
95#ifndef GPUCA_GPUCODE
96 static auto getSourceName(int s)
97 {
98 return s == ITSAB ? std::string{"ITSAB"} : DetID::getNames(getSourceDetectorsMask(s), '-');
99 }
100 static mask_t getSourcesMask(const std::string_view srcList);
101 static std::string getSourcesNames(mask_t srcm);
102 auto getSourceName() const { return getSourceName(getSource()); }
103#endif // GPUCA_GPUCODE
104 GPUd() static constexpr mask_t getSourceMask(int s);
105 GPUdi() mask_t getSourceMask() const { return getSourceMask(getSource()); }
106 GPUdi() static bool includesSource(int s, mask_t srcm) { return srcm[s]; }
107 GPUdi() operator int() const { return int(getIndex()); }
108
109#ifndef GPUCA_GPUCODE
110 std::string asString() const;
111 void print() const;
112#endif // GPUCA_GPUCODE
113
115};
116
117#ifndef GPUCA_GPUCODE
118std::ostream& operator<<(std::ostream& os, const o2::dataformats::GlobalTrackID& v);
119#endif // GPUCA_GPUCODE
120
121namespace globaltrackid_internal
122{
123// static constexpr array class members not possible on the GPU, thus we use this trick.
125GPUconstexpr() DetID::mask_t SourceDetectorsMasks[GlobalTrackID::NSources] = {
126 DetID::mask_t(DetID::getMask(DetID::ITS)),
127 DetID::mask_t(DetID::getMask(DetID::TPC)),
128 DetID::mask_t(DetID::getMask(DetID::TRD)),
129 DetID::mask_t(DetID::getMask(DetID::TOF)),
130 DetID::mask_t(DetID::getMask(DetID::PHS)),
131 DetID::mask_t(DetID::getMask(DetID::CPV)),
132 DetID::mask_t(DetID::getMask(DetID::EMC)),
133 DetID::mask_t(DetID::getMask(DetID::HMP)),
134 DetID::mask_t(DetID::getMask(DetID::MFT)),
135 DetID::mask_t(DetID::getMask(DetID::MCH)),
136 DetID::mask_t(DetID::getMask(DetID::MID)),
137 DetID::mask_t(DetID::getMask(DetID::ZDC)),
138 DetID::mask_t(DetID::getMask(DetID::FT0)),
139 DetID::mask_t(DetID::getMask(DetID::FV0)),
140 DetID::mask_t(DetID::getMask(DetID::FDD)),
141 //
142 DetID::mask_t(DetID::getMask(DetID::ITS) | DetID::getMask(DetID::TPC)),
143 DetID::mask_t(DetID::getMask(DetID::TPC) | DetID::getMask(DetID::TOF)),
144 DetID::mask_t(DetID::getMask(DetID::TPC) | DetID::getMask(DetID::TRD)),
145 DetID::mask_t(DetID::getMask(DetID::MFT) | DetID::getMask(DetID::MCH)),
146 DetID::mask_t(DetID::getMask(DetID::ITS) | DetID::getMask(DetID::TPC) | DetID::getMask(DetID::TRD)),
147 DetID::mask_t(DetID::getMask(DetID::ITS) | DetID::getMask(DetID::TPC) | DetID::getMask(DetID::TOF)),
148 DetID::mask_t(DetID::getMask(DetID::TPC) | DetID::getMask(DetID::TRD) | DetID::getMask(DetID::TOF)),
149 DetID::mask_t(DetID::getMask(DetID::MFT) | DetID::getMask(DetID::MCH) | DetID::getMask(DetID::MID)),
150 DetID::mask_t(DetID::getMask(DetID::ITS) | DetID::getMask(DetID::TPC) | DetID::getMask(DetID::TRD) | DetID::getMask(DetID::TOF)),
151 DetID::mask_t(DetID::getMask(DetID::ITS)),
152 DetID::mask_t(DetID::getMask(DetID::CTP)),
153 DetID::mask_t(DetID::getMask(DetID::MCH) | DetID::getMask(DetID::MID)) // Temporary ordering
154};
155
156GPUconstexpr() GlobalTrackID::mask_t sMasks[GlobalTrackID::NSources] =
157 {
158 GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::ITS)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::TPC)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::TRD)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::TOF)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::PHS)),
159 GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::CPV)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::EMC)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::HMP)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::MFT)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::MCH)),
160 GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::MID)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::ZDC)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::FT0)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::FV0)), GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::FDD)),
163 GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::ITSAB)),
164 GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::CTP)),
165 GlobalTrackID::mask_t(math_utils::bit2Mask(GlobalTrackID::MCHMID)) // Temporary ordering
166};
167
168#if !defined(__OPENCL__) && !defined(__METAL__)
169GPUconstexpr() GlobalTrackID::mask_t sTrackSources =
170 sMasks[GlobalTrackID::ITS] | sMasks[GlobalTrackID::TPC] | sMasks[GlobalTrackID::MFT] | sMasks[GlobalTrackID::MCH] | sMasks[GlobalTrackID::ITSTPC] | sMasks[GlobalTrackID::TPCTOF] |
171 sMasks[GlobalTrackID::TPCTRD] | sMasks[GlobalTrackID::MFTMCH] | sMasks[GlobalTrackID::ITSTPCTRD] | sMasks[GlobalTrackID::ITSTPCTOF] | sMasks[GlobalTrackID::TPCTRDTOF] |
172 sMasks[GlobalTrackID::MFTMCHMID] | sMasks[GlobalTrackID::ITSTPCTRDTOF] | sMasks[GlobalTrackID::ITSAB] | sMasks[GlobalTrackID::MCHMID];
173#endif
174
175} // namespace globaltrackid_internal
176
177GPUdi() constexpr GlobalTrackID::DetID::mask_t GlobalTrackID::getSourceDetectorsMask(int i) { return globaltrackid_internal::SourceDetectorsMasks[i]; }
178GPUdi() constexpr GlobalTrackID::mask_t GlobalTrackID::getSourceMask(int s) { return globaltrackid_internal::sMasks[s]; }
179
180#if !defined(__OPENCL__) && !defined(__METAL__)
181GPUdi() bool GlobalTrackID::isTrackSource(int s)
182{
183 return globaltrackid_internal::sTrackSources[s];
184}
185#endif
186
187GPUdi() bool GlobalTrackID::includesDet(DetID id, GlobalTrackID::mask_t srcm)
188{
189 for (int i = 0; i < NSources; i++) {
190 if (includesSource(i, srcm) && (getSourceDetectorsMask(i) & id.getMask()).any()) {
191 return true;
192 }
193 }
194 return false;
195}
196
197GPUd() constexpr GlobalTrackID::DetID::mask_t GlobalTrackID::getSourcesDetectorsMask(GlobalTrackID::mask_t srcm)
198{
200 for (int i = 0; i < NSources; i++) {
201 if (srcm[i]) {
202 mdet |= getSourceDetectorsMask(i);
203 }
204 }
205 return mdet;
206}
207
208} // namespace dataformats
209} // namespace o2
210
211#ifndef GPUCA_GPUCODE
212namespace std
213{
214// defining std::hash for GlobalTrackIndex to be used with std containers
215template <>
216struct hash<o2::dataformats::GlobalTrackID> {
217 public:
219 {
220 return id.getRawWOFlags();
221 }
222};
223} // namespace std
224#endif // GPUCA_GPUCODE
225
226#endif
Class to refer to object indicating its Indec, Source and status flags.
uint32_t hash
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 bool
GPUdi() static const expr DetID GPUdi() static const expr DetID GPUdi() static bool includesDet(DetID id
static mask_t getSourcesMask(const std::string_view srcList)
GPUdi() static const expr DetID GPUdi() static const expr DetID GlobalTrackID::mask_t srcm
GPUdi() static bool includesSource(int s
static std::string getSourcesNames(mask_t srcm)
o2::gpu::gpustd::bitset< 32 > mask_t
GPUdi() bool includesDet(DetID id) const
static constexpr std::string_view NONE
keywork for no sources
static GPUglobalconstexpr() mask_t MASK_ALL
ClassDefNV(GlobalTrackID, 3)
GPUdi() operator int() const
static constexpr std::string_view ALL
keywork for all sources
static auto getSourceName(int s)
GPUd() static const expr mask_t getSourceMask(int s)
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:60
o2::gpu::gpustd::bitset< 32 > mask_t
Definition DetID.h:100
static std::string getNames(mask_t mask, char delimiter=',')
Definition DetID.cxx:74
static mask_t getMask(const std::string_view detList)
detector masks from any non-alpha-num delimiter-separated list (empty if NONE is supplied)
Definition DetID.cxx:42
const GLdouble * v
Definition glcorearb.h:832
GPUd() const expr GlobalTrackID
std::ostream & operator<<(std::ostream &os, const o2::dataformats::MeanVertexObject &o)
GPUdi() const expr GlobalTrackID
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
size_t operator()(const o2::dataformats::GlobalTrackID &id) const