Project
Loading...
Searching...
No Matches
CTFHelper.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_MCH_CTF_HELPER_H
17#define O2_MCH_CTF_HELPER_H
18
21#include "DataFormatsMCH/CTF.h"
22#include <gsl/span>
23
24namespace o2
25{
26namespace mch
27{
28
30{
31
32 public:
33 CTFHelper(const gsl::span<const o2::mch::ROFRecord>& rofData, const gsl::span<const o2::mch::Digit>& digData)
34 : mROFData(rofData), mDigData(digData) {}
35
37 {
38 CTFHeader h{o2::detectors::DetID::MCH, 0, 1, 0, // dummy timestamp, version 1.0
39 uint32_t(mROFData.size()), uint32_t(mDigData.size()), 0, 0};
40 if (mROFData.size()) {
41 h.firstOrbit = mROFData[0].getBCData().orbit;
42 h.firstBC = mROFData[0].getBCData().bc;
43 }
44 return h;
45 }
46
47 size_t getSize() const { return mROFData.size() * sizeof(o2::mch::ROFRecord) + mDigData.size() * sizeof(o2::mch::Digit); }
48
49 //>>> =========================== ITERATORS ========================================
50
51 template <typename I, typename D, typename T, int M = 1>
52 class _Iter
53 {
54 public:
55 using difference_type = std::ptrdiff_t;
56 using value_type = T;
57 using pointer = const T*;
58 using reference = const T&;
59 using iterator_category = std::random_access_iterator_tag;
60
61 _Iter(const gsl::span<const D>& data, bool end = false) : mData(data), mIndex(end ? M * data.size() : 0){};
62 _Iter() = default;
63
64 inline I& operator++() noexcept
65 {
66 ++mIndex;
67 return static_cast<I&>(*this);
68 }
69
70 inline I operator++(int)
71 {
72 I res = *(static_cast<I*>(this));
73 ++mIndex;
74 return res;
75 }
76
77 inline I& operator--() noexcept
78 {
79 mIndex--;
80 return static_cast<I&>(*this);
81 }
82
83 inline I operator--(int)
84 {
85 I res = *(static_cast<I*>(this));
86 --mIndex;
87 return res;
88 }
89
91 {
92 mIndex += i;
93 return static_cast<I&>(*this);
94 }
95
97 {
98 I res = *(const_cast<I*>(static_cast<const I*>(this)));
99 return res += i;
100 }
101
103 {
104 mIndex -= i;
105 return static_cast<I&>(*this);
106 }
107
109 {
110 I res = *(const_cast<I*>(static_cast<const I*>(this)));
111 return res -= i;
112 }
113
114 difference_type operator-(const I& other) const noexcept { return mIndex - other.mIndex; }
115
116 inline friend I operator+(difference_type i, const I& iter) { return iter + i; };
117
118 bool operator!=(const I& other) const noexcept { return mIndex != other.mIndex; }
119 bool operator==(const I& other) const noexcept { return mIndex == other.mIndex; }
120 bool operator>(const I& other) const noexcept { return mIndex > other.mIndex; }
121 bool operator<(const I& other) const noexcept { return mIndex < other.mIndex; }
122 bool operator>=(const I& other) const noexcept { return mIndex >= other.mIndex; }
123 bool operator<=(const I& other) const noexcept { return mIndex <= other.mIndex; }
124
125 protected:
126 gsl::span<const D> mData{};
128 };
129
130 //_______________________________________________
131 // BC difference wrt previous if in the same orbit, otherwise the abs.value.
132 // For the very 1st entry return 0 (diff wrt 1st BC in the CTF header)
133 class Iter_bcIncROF : public _Iter<Iter_bcIncROF, ROFRecord, int16_t>
134 {
135 public:
136 using _Iter<Iter_bcIncROF, ROFRecord, int16_t>::_Iter;
138 {
139 if (mIndex) {
140 if (mData[mIndex].getBCData().orbit == mData[mIndex - 1].getBCData().orbit) {
141 return value_type(mData[mIndex].getBCData().bc - mData[mIndex - 1].getBCData().bc);
142 } else {
143 return value_type(mData[mIndex].getBCData().bc);
144 }
145 }
146 return 0;
147 }
149 {
150 size_t id = mIndex + i;
151 if (id) {
152 if (mData[id].getBCData().orbit == mData[id - 1].getBCData().orbit) {
153 return value_type(mData[id].getBCData().bc - mData[id - 1].getBCData().bc);
154 } else {
155 return value_type(mData[id].getBCData().bc);
156 }
157 }
158 return 0;
159 }
160 };
161
162 //_______________________________________________
163 // Orbit difference wrt previous. For the very 1st entry return 0 (diff wrt 1st BC in the CTF header)
164 class Iter_orbitIncROF : public _Iter<Iter_orbitIncROF, ROFRecord, int32_t>
165 {
166 public:
168 value_type operator*() const { return value_type(mIndex ? mData[mIndex].getBCData().orbit - mData[mIndex - 1].getBCData().orbit : 0); }
170 {
171 size_t id = mIndex + i;
172 return value_type(id ? mData[id].getBCData().orbit - mData[id - 1].getBCData().orbit : 0);
173 }
174 };
175
176 //_______________________________________________
177 // Number of entries in the ROF
178 class Iter_nDigitsROF : public _Iter<Iter_nDigitsROF, ROFRecord, uint32_t>
179 {
180 public:
182 value_type operator*() const { return mData[mIndex].getNEntries(); }
183 value_type operator[](difference_type i) const { return mData[mIndex + i].getNEntries(); }
184 };
185
186 //_______________________________________________
187 class Iter_tfTime : public _Iter<Iter_tfTime, Digit, int32_t>
188 {
189 public:
191 value_type operator*() const { return mData[mIndex].getTime(); }
192 value_type operator[](difference_type i) const { return mData[mIndex + i].getTime(); }
193 };
194
195 //_______________________________________________
196 class Iter_nSamples : public _Iter<Iter_nSamples, Digit, uint16_t>
197 {
198 public:
200 value_type operator*() const { return mData[mIndex].getNofSamples(); }
201 value_type operator[](difference_type i) const { return mData[mIndex + i].getNofSamples(); }
202 };
203
204 //_______________________________________________
205 class Iter_isSaturated : public _Iter<Iter_isSaturated, Digit, uint8_t>
206 {
207 public:
209 value_type operator*() const { return mData[mIndex].isSaturated(); }
210 value_type operator[](difference_type i) const { return mData[mIndex + i].isSaturated(); }
211 };
212
213 //_______________________________________________
214 class Iter_detID : public _Iter<Iter_detID, Digit, int16_t>
215 {
216 public:
217 using _Iter<Iter_detID, Digit, int16_t>::_Iter;
218 value_type operator*() const { return mData[mIndex].getDetID(); }
219 value_type operator[](difference_type i) const { return mData[mIndex + i].getDetID(); }
220 };
221
222 //_______________________________________________
223 class Iter_padID : public _Iter<Iter_padID, Digit, int16_t>
224 {
225 public:
226 using _Iter<Iter_padID, Digit, int16_t>::_Iter;
227 value_type operator*() const { return mData[mIndex].getPadID(); }
228 value_type operator[](difference_type i) const { return mData[mIndex + i].getPadID(); }
229 };
230
231 //_______________________________________________
232 class Iter_ADC : public _Iter<Iter_ADC, Digit, uint32_t>
233 {
234 public:
236 value_type operator*() const { return mData[mIndex].getADC(); }
237 value_type operator[](difference_type i) const { return mData[mIndex + i].getADC(); }
238 };
239
240 //<<< =========================== ITERATORS ========================================
241
242 Iter_bcIncROF begin_bcIncROF() const { return Iter_bcIncROF(mROFData, false); }
243 Iter_bcIncROF end_bcIncROF() const { return Iter_bcIncROF(mROFData, true); }
244
245 Iter_orbitIncROF begin_orbitIncROF() const { return Iter_orbitIncROF(mROFData, false); }
246 Iter_orbitIncROF end_orbitIncROF() const { return Iter_orbitIncROF(mROFData, true); }
247
248 Iter_nDigitsROF begin_nDigitsROF() const { return Iter_nDigitsROF(mROFData, false); }
249 Iter_nDigitsROF end_nDigitsROF() const { return Iter_nDigitsROF(mROFData, true); }
250
251 Iter_tfTime begin_tfTime() const { return Iter_tfTime(mDigData, false); }
252 Iter_tfTime end_tfTime() const { return Iter_tfTime(mDigData, true); }
253
254 Iter_nSamples begin_nSamples() const { return Iter_nSamples(mDigData, false); }
255 Iter_nSamples end_nSamples() const { return Iter_nSamples(mDigData, true); }
256
257 Iter_isSaturated begin_isSaturated() const { return Iter_isSaturated(mDigData, false); }
258 Iter_isSaturated end_isSaturated() const { return Iter_isSaturated(mDigData, true); }
259
260 Iter_detID begin_detID() const { return Iter_detID(mDigData, false); }
261 Iter_detID end_detID() const { return Iter_detID(mDigData, true); }
262
263 Iter_padID begin_padID() const { return Iter_padID(mDigData, false); }
264 Iter_padID end_padID() const { return Iter_padID(mDigData, true); }
265
266 Iter_ADC begin_ADC() const { return Iter_ADC(mDigData, false); }
267 Iter_ADC end_ADC() const { return Iter_ADC(mDigData, true); }
268
269 private:
270 const gsl::span<const o2::mch::ROFRecord> mROFData;
271 const gsl::span<const o2::mch::Digit> mDigData;
272};
273
274} // namespace mch
275} // namespace o2
276
277#endif
uint64_t orbit
Definition RawEventData.h:6
uint64_t bc
Definition RawEventData.h:5
unsigned short int uint16_t
unsigned int uint32_t
int32_t i
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 Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
Definitions for MCH CTF data.
Definition of the MCH ROFrame record.
uint32_t res
Definition RawData.h:0
Class for time synchronization of RawReader instances.
value_type operator[](difference_type i) const
Definition CTFHelper.h:237
value_type operator*() const
Definition CTFHelper.h:236
value_type operator[](difference_type i) const
Definition CTFHelper.h:148
value_type operator[](difference_type i) const
Definition CTFHelper.h:219
value_type operator*() const
Definition CTFHelper.h:218
value_type operator[](difference_type i) const
Definition CTFHelper.h:210
value_type operator[](difference_type i) const
Definition CTFHelper.h:183
value_type operator[](difference_type i) const
Definition CTFHelper.h:201
value_type operator[](difference_type i) const
Definition CTFHelper.h:169
value_type operator[](difference_type i) const
Definition CTFHelper.h:228
value_type operator*() const
Definition CTFHelper.h:227
value_type operator*() const
Definition CTFHelper.h:191
value_type operator[](difference_type i) const
Definition CTFHelper.h:192
I & operator-=(difference_type i) noexcept
Definition CTFHelper.h:102
I & operator--() noexcept
Definition CTFHelper.h:77
friend I operator+(difference_type i, const I &iter)
Definition CTFHelper.h:116
std::random_access_iterator_tag iterator_category
Definition CTFHelper.h:59
_Iter(const gsl::span< const D > &data, bool end=false)
Definition CTFHelper.h:61
I operator+(difference_type i) const
Definition CTFHelper.h:96
gsl::span< const D > mData
Definition CTFHelper.h:126
I & operator++() noexcept
Definition CTFHelper.h:64
difference_type operator-(const I &other) const noexcept
Definition CTFHelper.h:114
bool operator>=(const I &other) const noexcept
Definition CTFHelper.h:122
I operator-(difference_type i) const
Definition CTFHelper.h:108
bool operator<=(const I &other) const noexcept
Definition CTFHelper.h:123
bool operator==(const I &other) const noexcept
Definition CTFHelper.h:119
bool operator<(const I &other) const noexcept
Definition CTFHelper.h:121
bool operator>(const I &other) const noexcept
Definition CTFHelper.h:120
difference_type mIndex
Definition CTFHelper.h:127
bool operator!=(const I &other) const noexcept
Definition CTFHelper.h:118
I & operator+=(difference_type i) noexcept
Definition CTFHelper.h:90
std::ptrdiff_t difference_type
Definition CTFHelper.h:55
CTFHelper(const gsl::span< const o2::mch::ROFRecord > &rofData, const gsl::span< const o2::mch::Digit > &digData)
Definition CTFHelper.h:33
CTFHeader createHeader()
Definition CTFHelper.h:36
Iter_detID end_detID() const
Definition CTFHelper.h:261
Iter_nSamples end_nSamples() const
Definition CTFHelper.h:255
Iter_tfTime begin_tfTime() const
Definition CTFHelper.h:251
Iter_ADC end_ADC() const
Definition CTFHelper.h:267
Iter_nDigitsROF end_nDigitsROF() const
Definition CTFHelper.h:249
Iter_nDigitsROF begin_nDigitsROF() const
Definition CTFHelper.h:248
Iter_orbitIncROF begin_orbitIncROF() const
Definition CTFHelper.h:245
Iter_isSaturated end_isSaturated() const
Definition CTFHelper.h:258
Iter_orbitIncROF end_orbitIncROF() const
Definition CTFHelper.h:246
size_t getSize() const
Definition CTFHelper.h:47
Iter_detID begin_detID() const
Definition CTFHelper.h:260
Iter_isSaturated begin_isSaturated() const
Definition CTFHelper.h:257
Iter_ADC begin_ADC() const
Definition CTFHelper.h:266
Iter_padID end_padID() const
Definition CTFHelper.h:264
Iter_padID begin_padID() const
Definition CTFHelper.h:263
Iter_tfTime end_tfTime() const
Definition CTFHelper.h:252
Iter_bcIncROF end_bcIncROF() const
Definition CTFHelper.h:243
Iter_bcIncROF begin_bcIncROF() const
Definition CTFHelper.h:242
Iter_nSamples begin_nSamples() const
Definition CTFHelper.h:254
MCH digit implementation.
Definition Digit.h:31
GLsizeiptr size
Definition glcorearb.h:659
GLuint GLuint end
Definition glcorearb.h:469
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Header for a single CTF.
Definition CTF.h:30
VectorOfTObjectPtrs other
std::array< std::vector< ROFRecord >, NEvTypes > rofData