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_EMCAL_CTF_HELPER_H
17#define O2_EMCAL_CTF_HELPER_H
18
20#include <gsl/span>
21
22namespace o2
23{
24namespace emcal
25{
26
28{
29
30 public:
31 CTFHelper(const gsl::span<const TriggerRecord>& trgData, const gsl::span<const Cell>& cellData)
32 : mTrigData(trgData), mCellData(cellData) {}
33
35 {
36 CTFHeader h{o2::detectors::DetID::EMC, 0, 1, 0, // dummy timestamp, version 1.0
37 uint32_t(mTrigData.size()), uint32_t(mCellData.size()), 0, 0};
38 if (mTrigData.size()) {
39 h.firstOrbit = mTrigData[0].getBCData().orbit;
40 h.firstBC = mTrigData[0].getBCData().bc;
41 }
42 return h;
43 }
44
45 size_t getSize() const { return mTrigData.size() * sizeof(TriggerRecord) + mCellData.size() * sizeof(Cell); }
46
47 //>>> =========================== ITERATORS ========================================
48
49 template <typename I, typename D, typename T>
50 class _Iter
51 {
52 public:
53 using difference_type = std::ptrdiff_t;
54 using value_type = T;
55 using pointer = const T*;
56 using reference = const T&;
57 using iterator_category = std::random_access_iterator_tag;
58
59 _Iter(const gsl::span<const D>& data, bool end = false) : mData(data), mIndex(end ? data.size() : 0){};
60 _Iter() = default;
61
62 inline I& operator++() noexcept
63 {
64 ++mIndex;
65 return static_cast<I&>(*this);
66 }
67
68 inline I operator++(int)
69 {
70 I res = *(static_cast<I*>(this));
71 ++mIndex;
72 return res;
73 }
74
75 inline I& operator--() noexcept
76 {
77 mIndex--;
78 return static_cast<I&>(*this);
79 }
80
81 inline I operator--(int)
82 {
83 I res = *(static_cast<I*>(this));
84 --mIndex;
85 return res;
86 }
87
89 {
90 mIndex += i;
91 return static_cast<I&>(*this);
92 }
93
95 {
96 I res = *(const_cast<I*>(static_cast<const I*>(this)));
97 return res += i;
98 }
99
101 {
102 mIndex -= i;
103 return static_cast<I&>(*this);
104 }
105
107 {
108 I res = *(const_cast<I*>(static_cast<const I*>(this)));
109 return res -= i;
110 }
111
112 difference_type operator-(const I& other) const noexcept { return mIndex - other.mIndex; }
113
114 inline friend I operator+(difference_type i, const I& iter) { return iter + i; };
115
116 bool operator!=(const I& other) const noexcept { return mIndex != other.mIndex; }
117 bool operator==(const I& other) const noexcept { return mIndex == other.mIndex; }
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
123 protected:
124 gsl::span<const D> mData{};
126 };
127
128 //_______________________________________________
129 // BC difference wrt previous if in the same orbit, otherwise the abs.value.
130 // For the very 1st entry return 0 (diff wrt 1st BC in the CTF header)
131 class Iter_bcIncTrig : public _Iter<Iter_bcIncTrig, TriggerRecord, int16_t>
132 {
133 public:
136 {
137 if (mIndex) {
138 if (mData[mIndex].getBCData().orbit == mData[mIndex - 1].getBCData().orbit) {
139 return value_type(mData[mIndex].getBCData().bc - mData[mIndex - 1].getBCData().bc);
140 } else {
141 return value_type(mData[mIndex].getBCData().bc);
142 }
143 }
144 return 0;
145 }
147 {
148 size_t id = mIndex + i;
149 if (id) {
150 if (mData[id].getBCData().orbit == mData[id - 1].getBCData().orbit) {
151 return value_type(mData[id].getBCData().bc - mData[id - 1].getBCData().bc);
152 } else {
153 return value_type(mData[id].getBCData().bc);
154 }
155 }
156 return 0;
157 }
158 };
159
160 //_______________________________________________
161 // Orbit difference wrt previous. For the very 1st entry return 0 (diff wrt 1st BC in the CTF header)
162 class Iter_orbitIncTrig : public _Iter<Iter_orbitIncTrig, TriggerRecord, int32_t>
163 {
164 public:
166 value_type operator*() const { return value_type(mIndex ? mData[mIndex].getBCData().orbit - mData[mIndex - 1].getBCData().orbit : 0); }
168 {
169 size_t id = mIndex + i;
170 return value_type(id ? mData[id].getBCData().orbit - mData[id - 1].getBCData().orbit : 0);
171 }
172 };
173
174 //_______________________________________________
175 // Number of cells for trigger
176 class Iter_entriesTrig : public _Iter<Iter_entriesTrig, TriggerRecord, uint16_t>
177 {
178 public:
180 value_type operator*() const { return mData[mIndex].getNumberOfObjects(); }
181 value_type operator[](difference_type i) const { return mData[mIndex + i].getNumberOfObjects(); }
182 };
183
184 //_______________________________________________
185 // Trigger word
186 class Iter_trigger : public _Iter<Iter_trigger, TriggerRecord, uint16_t>
187 {
188 public:
190 value_type operator*() const { return mData[mIndex].getTriggerBitsCompressed(); }
191 value_type operator[](difference_type i) const { return mData[mIndex + i].getTriggerBitsCompressed(); }
192 };
193
194 //_______________________________________________
195 class Iter_towerID : public _Iter<Iter_towerID, Cell, uint16_t>
196 {
197 public:
199 value_type operator*() const { return mData[mIndex].getTowerIDEncoded(); }
200 value_type operator[](difference_type i) const { return mData[mIndex + i].getTowerIDEncoded(); }
201 };
202
203 //_______________________________________________
204 class Iter_time : public _Iter<Iter_time, Cell, uint16_t>
205 {
206 public:
208 value_type operator*() const { return mData[mIndex].getTimeStampEncoded(); }
209 value_type operator[](difference_type i) const { return mData[mIndex + i].getTimeStampEncoded(); }
210 };
211
212 //_______________________________________________
213 class Iter_energy : public _Iter<Iter_energy, Cell, uint16_t>
214 {
215 public:
217 value_type operator*() const { return mData[mIndex].getEnergyEncoded(); }
218 value_type operator[](difference_type i) const { return mData[mIndex + i].getEnergyEncoded(); }
219 };
220
221 //_______________________________________________
222 class Iter_status : public _Iter<Iter_status, Cell, uint8_t>
223 {
224 public:
226 value_type operator*() const { return mData[mIndex].getCellTypeEncoded(); }
227 value_type operator[](difference_type i) const { return mData[mIndex + i].getCellTypeEncoded(); }
228 };
229
230 //<<< =========================== ITERATORS ========================================
231
232 Iter_bcIncTrig begin_bcIncTrig() const { return Iter_bcIncTrig(mTrigData, false); }
233 Iter_bcIncTrig end_bcIncTrig() const { return Iter_bcIncTrig(mTrigData, true); }
234
235 Iter_orbitIncTrig begin_orbitIncTrig() const { return Iter_orbitIncTrig(mTrigData, false); }
236 Iter_orbitIncTrig end_orbitIncTrig() const { return Iter_orbitIncTrig(mTrigData, true); }
237
238 Iter_entriesTrig begin_entriesTrig() const { return Iter_entriesTrig(mTrigData, false); }
239 Iter_entriesTrig end_entriesTrig() const { return Iter_entriesTrig(mTrigData, true); }
240
241 Iter_trigger begin_trigger() const { return Iter_trigger(mTrigData, false); }
242 Iter_trigger end_trigger() const { return Iter_trigger(mTrigData, true); }
243
244 Iter_towerID begin_towerID() const { return Iter_towerID(mCellData, false); }
245 Iter_towerID end_towerID() const { return Iter_towerID(mCellData, true); }
246
247 Iter_time begin_time() const { return Iter_time(mCellData, false); }
248 Iter_time end_time() const { return Iter_time(mCellData, true); }
249
250 Iter_energy begin_energy() const { return Iter_energy(mCellData, false); }
251 Iter_energy end_energy() const { return Iter_energy(mCellData, true); }
252
253 Iter_status begin_status() const { return Iter_status(mCellData, false); }
254 Iter_status end_status() const { return Iter_status(mCellData, true); }
255
256 private:
257 const gsl::span<const o2::emcal::TriggerRecord> mTrigData;
258 const gsl::span<const o2::emcal::Cell> mCellData;
259};
260
261} // namespace emcal
262} // namespace o2
263
264#endif
Definitions for EMC CTF data.
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
uint32_t res
Definition RawData.h:0
Class for time synchronization of RawReader instances.
value_type operator[](difference_type i) const
Definition CTFHelper.h:146
value_type operator[](difference_type i) const
Definition CTFHelper.h:218
value_type operator[](difference_type i) const
Definition CTFHelper.h:181
value_type operator[](difference_type i) const
Definition CTFHelper.h:167
value_type operator[](difference_type i) const
Definition CTFHelper.h:227
value_type operator[](difference_type i) const
Definition CTFHelper.h:209
value_type operator*() const
Definition CTFHelper.h:208
value_type operator[](difference_type i) const
Definition CTFHelper.h:200
value_type operator[](difference_type i) const
Definition CTFHelper.h:191
bool operator>(const I &other) const noexcept
Definition CTFHelper.h:118
gsl::span< const D > mData
Definition CTFHelper.h:124
difference_type operator-(const I &other) const noexcept
Definition CTFHelper.h:112
friend I operator+(difference_type i, const I &iter)
Definition CTFHelper.h:114
bool operator<(const I &other) const noexcept
Definition CTFHelper.h:119
I & operator+=(difference_type i) noexcept
Definition CTFHelper.h:88
I & operator--() noexcept
Definition CTFHelper.h:75
std::random_access_iterator_tag iterator_category
Definition CTFHelper.h:57
bool operator<=(const I &other) const noexcept
Definition CTFHelper.h:121
I & operator-=(difference_type i) noexcept
Definition CTFHelper.h:100
bool operator!=(const I &other) const noexcept
Definition CTFHelper.h:116
std::ptrdiff_t difference_type
Definition CTFHelper.h:53
I operator-(difference_type i) const
Definition CTFHelper.h:106
I operator+(difference_type i) const
Definition CTFHelper.h:94
I & operator++() noexcept
Definition CTFHelper.h:62
bool operator>=(const I &other) const noexcept
Definition CTFHelper.h:120
_Iter(const gsl::span< const D > &data, bool end=false)
Definition CTFHelper.h:59
bool operator==(const I &other) const noexcept
Definition CTFHelper.h:117
Iter_orbitIncTrig end_orbitIncTrig() const
Definition CTFHelper.h:236
Iter_status end_status() const
Definition CTFHelper.h:254
Iter_time end_time() const
Definition CTFHelper.h:248
Iter_orbitIncTrig begin_orbitIncTrig() const
Definition CTFHelper.h:235
Iter_towerID end_towerID() const
Definition CTFHelper.h:245
CTFHelper(const gsl::span< const TriggerRecord > &trgData, const gsl::span< const Cell > &cellData)
Definition CTFHelper.h:31
Iter_bcIncTrig end_bcIncTrig() const
Definition CTFHelper.h:233
CTFHeader createHeader()
Definition CTFHelper.h:34
size_t getSize() const
Definition CTFHelper.h:45
Iter_entriesTrig end_entriesTrig() const
Definition CTFHelper.h:239
Iter_status begin_status() const
Definition CTFHelper.h:253
Iter_time begin_time() const
Definition CTFHelper.h:247
Iter_energy end_energy() const
Definition CTFHelper.h:251
Iter_towerID begin_towerID() const
Definition CTFHelper.h:244
Iter_trigger begin_trigger() const
Definition CTFHelper.h:241
Iter_trigger end_trigger() const
Definition CTFHelper.h:242
Iter_entriesTrig begin_entriesTrig() const
Definition CTFHelper.h:238
Iter_bcIncTrig begin_bcIncTrig() const
Definition CTFHelper.h:232
Iter_energy begin_energy() const
Definition CTFHelper.h:250
EMCAL compressed cell information.
Definition Cell.h:57
Header for data corresponding to the same hardware trigger.
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:31
VectorOfTObjectPtrs other