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_CPV_CTF_HELPER_H
17#define O2_CPV_CTF_HELPER_H
18
19#include "DataFormatsCPV/CTF.h"
20#include <gsl/span>
21
22namespace o2
23{
24namespace cpv
25{
26
28{
29
30 public:
31 CTFHelper(const gsl::span<const TriggerRecord>& trgData, const gsl::span<const Cluster>& cluData)
32 : mTrigData(trgData), mCluData(cluData) {}
33
35 {
36 CTFHeader h{o2::detectors::DetID::CPV, 0, 1, 0, // dummy timestamp, version 1.0
37 uint32_t(mTrigData.size()), uint32_t(mCluData.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) + mCluData.size() * sizeof(Cluster); }
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 class Iter_posX : public _Iter<Iter_posX, Cluster, uint16_t>
186 {
187 public:
189 value_type operator*() const { return mData[mIndex].getPackedPosX(); }
190 value_type operator[](difference_type i) const { return mData[mIndex + i].getPackedPosX(); }
191 };
192
193 //_______________________________________________
194 class Iter_posZ : public _Iter<Iter_posZ, Cluster, uint16_t>
195 {
196 public:
198 value_type operator*() const { return mData[mIndex].getPackedPosZ(); }
199 value_type operator[](difference_type i) const { return mData[mIndex + i].getPackedPosZ(); }
200 };
201
202 //_______________________________________________
203 class Iter_energy : public _Iter<Iter_energy, Cluster, uint8_t>
204 {
205 public:
207 value_type operator*() const { return mData[mIndex].getPackedEnergy(); }
208 value_type operator[](difference_type i) const { return mData[mIndex + i].getPackedEnergy(); }
209 };
210
211 //_______________________________________________
212 class Iter_status : public _Iter<Iter_status, Cluster, uint8_t>
213 {
214 public:
216 value_type operator*() const { return mData[mIndex].getPackedClusterStatus(); }
217 value_type operator[](difference_type i) const { return mData[mIndex + i].getPackedClusterStatus(); }
218 };
219
220 //<<< =========================== ITERATORS ========================================
221
222 Iter_bcIncTrig begin_bcIncTrig() const { return Iter_bcIncTrig(mTrigData, false); }
223 Iter_bcIncTrig end_bcIncTrig() const { return Iter_bcIncTrig(mTrigData, true); }
224
225 Iter_orbitIncTrig begin_orbitIncTrig() const { return Iter_orbitIncTrig(mTrigData, false); }
226 Iter_orbitIncTrig end_orbitIncTrig() const { return Iter_orbitIncTrig(mTrigData, true); }
227
228 Iter_entriesTrig begin_entriesTrig() const { return Iter_entriesTrig(mTrigData, false); }
229 Iter_entriesTrig end_entriesTrig() const { return Iter_entriesTrig(mTrigData, true); }
230
231 Iter_posX begin_posX() const { return Iter_posX(mCluData, false); }
232 Iter_posX end_posX() const { return Iter_posX(mCluData, true); }
233
234 Iter_posZ begin_posZ() const { return Iter_posZ(mCluData, false); }
235 Iter_posZ end_posZ() const { return Iter_posZ(mCluData, true); }
236
237 Iter_energy begin_energy() const { return Iter_energy(mCluData, false); }
238 Iter_energy end_energy() const { return Iter_energy(mCluData, true); }
239
240 Iter_status begin_status() const { return Iter_status(mCluData, false); }
241 Iter_status end_status() const { return Iter_status(mCluData, true); }
242
243 private:
244 const gsl::span<const o2::cpv::TriggerRecord> mTrigData;
245 const gsl::span<const o2::cpv::Cluster> mCluData;
246};
247
248} // namespace cpv
249} // namespace o2
250
251#endif
Definitions for CPV 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*() const
Definition CTFHelper.h:207
value_type operator[](difference_type i) const
Definition CTFHelper.h:208
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:190
value_type operator*() const
Definition CTFHelper.h:189
value_type operator*() const
Definition CTFHelper.h:198
value_type operator[](difference_type i) const
Definition CTFHelper.h:199
value_type operator*() const
Definition CTFHelper.h:216
value_type operator[](difference_type i) const
Definition CTFHelper.h:217
std::random_access_iterator_tag iterator_category
Definition CTFHelper.h:57
I & operator++() noexcept
Definition CTFHelper.h:62
difference_type operator-(const I &other) const noexcept
Definition CTFHelper.h:112
bool operator<(const I &other) const noexcept
Definition CTFHelper.h:119
friend I operator+(difference_type i, const I &iter)
Definition CTFHelper.h:114
I operator+(difference_type i) const
Definition CTFHelper.h:94
_Iter(const gsl::span< const D > &data, bool end=false)
Definition CTFHelper.h:59
bool operator<=(const I &other) const noexcept
Definition CTFHelper.h:121
gsl::span< const D > mData
Definition CTFHelper.h:124
bool operator>=(const I &other) const noexcept
Definition CTFHelper.h:120
difference_type mIndex
Definition CTFHelper.h:125
I & operator--() noexcept
Definition CTFHelper.h:75
std::ptrdiff_t difference_type
Definition CTFHelper.h:53
bool operator==(const I &other) const noexcept
Definition CTFHelper.h:117
I operator-(difference_type i) const
Definition CTFHelper.h:106
bool operator!=(const I &other) const noexcept
Definition CTFHelper.h:116
I & operator+=(difference_type i) noexcept
Definition CTFHelper.h:88
I & operator-=(difference_type i) noexcept
Definition CTFHelper.h:100
bool operator>(const I &other) const noexcept
Definition CTFHelper.h:118
CTFHelper(const gsl::span< const TriggerRecord > &trgData, const gsl::span< const Cluster > &cluData)
Definition CTFHelper.h:31
size_t getSize() const
Definition CTFHelper.h:45
Iter_posZ end_posZ() const
Definition CTFHelper.h:235
Iter_posX end_posX() const
Definition CTFHelper.h:232
Iter_orbitIncTrig begin_orbitIncTrig() const
Definition CTFHelper.h:225
Iter_orbitIncTrig end_orbitIncTrig() const
Definition CTFHelper.h:226
CTFHeader createHeader()
Definition CTFHelper.h:34
Iter_bcIncTrig end_bcIncTrig() const
Definition CTFHelper.h:223
Iter_status end_status() const
Definition CTFHelper.h:241
Iter_energy end_energy() const
Definition CTFHelper.h:238
Iter_entriesTrig end_entriesTrig() const
Definition CTFHelper.h:229
Iter_posX begin_posX() const
Definition CTFHelper.h:231
Iter_entriesTrig begin_entriesTrig() const
Definition CTFHelper.h:228
Iter_energy begin_energy() const
Definition CTFHelper.h:237
Iter_bcIncTrig begin_bcIncTrig() const
Definition CTFHelper.h:222
Iter_status begin_status() const
Definition CTFHelper.h:240
Iter_posZ begin_posZ() const
Definition CTFHelper.h:234
Contains CPV cluster parameters.
Definition Cluster.h:33
Header for data corresponding to the same hardware trigger adapted from DataFormatsEMCAL/TriggerRecor...
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