Project
Loading...
Searching...
No Matches
ZeroSuppressionLinkBased.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 ALICEO2_DATAFORMATSTPC_ZeroSuppressionLinkBased_H
17#define ALICEO2_DATAFORMATSTPC_ZeroSuppressionLinkBased_H
18
19#include "GPUCommonDef.h"
20
21#ifndef GPUCA_GPUCODE
22#include <cstdint>
23#include <bitset>
24#endif
25
26namespace o2
27{
28namespace tpc
29{
30namespace zerosupp_link_based
31{
32
33static GPUglobalconstexpr() uint32_t DataWordSizeBits = 128;
34static GPUglobalconstexpr() uint32_t DataWordSizeBytes = DataWordSizeBits / 8;
35static GPUglobalconstexpr() uint32_t ChannelPerTBHeader = 80;
36
39 static GPUglobalconstexpr() uint32_t MagicWordLinkZS = 0xFC;
40 static GPUglobalconstexpr() uint32_t MagicWordLinkZSMetaHeader = 0xFD;
41 static GPUglobalconstexpr() uint32_t MagicWordTrigger = 0xAA;
42 static GPUglobalconstexpr() uint32_t MagicWordTriggerV2 = 0xAB;
43
44 union {
46 struct {
48 };
49 };
51 union {
53 struct {
61 };
62 };
63
64 bool hasCorrectMagicWord() const { return (magicWord == MagicWordLinkZS) || (magicWord == MagicWordLinkZSMetaHeader) || (magicWord == MagicWordTrigger) || (magicWord == MagicWordTriggerV2); }
65 bool isLinkZS() const { return (magicWord == MagicWordLinkZS); }
66 bool isMetaHeader() const { return (magicWord == MagicWordLinkZSMetaHeader); }
67 bool isTriggerInfo() const { return (magicWord == MagicWordTrigger); }
68 bool isTriggerInfoV2() const { return (magicWord == MagicWordTriggerV2); }
69};
70
71// GPU Code only requires header definition
72#ifndef GPUCA_GPUCODE
73
75struct Header final : public CommonHeader {
76
77 std::bitset<80> getChannelBits() const
78 {
79 return std::bitset<80>((std::bitset<80>(bitMaskHigh) << 64) | std::bitset<80>(bitMaskLow));
80 }
81
82 bool isFillWord() const { return ((word0 == 0xffffffffffffffff) && (word1 == 0xffffffffffffffff)); }
83};
84
95template <uint32_t DataBitSizeT = 12, uint32_t SignificantBitsT = 2>
96struct Data {
97 static constexpr uint32_t ChannelsPerWord = DataWordSizeBits / DataBitSizeT;
99 static constexpr uint32_t DataBitSize = DataBitSizeT;
100 static constexpr uint32_t SignificantBits = SignificantBitsT;
101 static constexpr uint64_t BitMask = ((uint64_t(1) << DataBitSize) - 1);
102 static constexpr float FloatConversion = 1.f / float(1 << SignificantBits);
103
105
108 {
109 const uint32_t word = pos / ChannelsPerHalfWord;
110 const uint32_t posInWord = pos % ChannelsPerHalfWord;
111
112 const uint64_t set = (value & BitMask) << (posInWord * DataBitSize);
113 const uint64_t mask = (0xFFFFFFFFFFFFFFFF ^ (BitMask << (posInWord * DataBitSize)));
114
115 adcValues[word] &= mask;
116 adcValues[word] |= set;
117 }
118
124
127 {
128 const uint32_t word = pos / ChannelsPerHalfWord;
129 const uint32_t posInWord = pos % ChannelsPerHalfWord;
130
131 return (adcValues[word] >> (posInWord * DataBitSize)) & BitMask;
132 }
133
136 {
138 }
139
141 void reset()
142 {
143 adcValues[0] = 0;
144 adcValues[1] = 0;
145 }
146};
147
148template <uint32_t DataBitSizeT, uint32_t SignificantBitsT, bool HasHeaderT>
150
151template <uint32_t DataBitSizeT, uint32_t SignificantBitsT>
152struct ContainerT<DataBitSizeT, SignificantBitsT, true> {
155
157 uint32_t getBunchCrossing() const { return header.bunchCrossing; }
158
160 uint32_t getDataWords() const { return header.numWordsPayload; }
161
163 uint32_t getTotalWords() const { return header.numWordsPayload + 1; }
164
166 std::bitset<80> getChannelBits() const { return header.getChannelBits(); }
167};
168
169template <uint32_t DataBitSizeT, uint32_t SignificantBitsT>
170struct ContainerT<DataBitSizeT, SignificantBitsT, false> {
172
174 uint32_t getBunchCrossing() const { return 0; }
175
177 uint32_t getDataWords() const { return 7; }
178
180 uint32_t getTotalWords() const { return 7; }
181
183 std::bitset<80> getChannelBits() const { return std::bitset<80>().set(); }
184};
185
189template <uint32_t DataBitSizeT = 12, uint32_t SignificantBitsT = 2, bool HasHeaderT = true>
190struct Container {
191 static constexpr uint32_t ChannelsPerWord = DataWordSizeBits / DataBitSizeT;
192
194
196 uint32_t getADCValue(uint32_t word) { return cont.data[word / ChannelsPerWord].getADCValue(word % ChannelsPerWord); }
197
199 float getADCValueFloat(uint32_t word) { return cont.data[word / ChannelsPerWord].getADCValueFloat(word % ChannelsPerWord); }
200
202 void setADCValue(uint32_t word, uint64_t value) { cont.data[word / ChannelsPerWord].setADCValue(word % ChannelsPerWord, value); }
203
205 void setADCValueFloat(uint32_t word, float value) { cont.data[word / ChannelsPerWord].setADCValueFloat(word % ChannelsPerWord, value); }
206
208 void reset()
209 {
210 for (int i = 0; i < cont.getDataWords(); ++i) {
211 cont.data[i].reset();
212 }
213 }
214
215 uint32_t getBunchCrossing() const { return cont.getBunchCrossing(); }
216 uint32_t getDataWords() const { return cont.getDataWords(); }
217 uint32_t getTotalWords() const { return cont.getTotalWords(); }
218 std::bitset<80> getChannelBits() const { return cont.getChannelBits(); }
219
221 size_t getTotalSizeBytes() const { return getTotalWords() * DataWordSizeBytes; }
222
225 {
226 return (Container*)((const char*)this + getTotalWords() * DataWordSizeBytes);
227 }
228
229}; // namespace zerosupp_link_based
230
233
236 union {
238 struct {
242 };
243 };
245 union {
247 struct {
250 };
251 };
252
253 uint32_t getOrbit() const { return (uint32_t)orbit; }
255};
256
259 union {
261 struct {
264 };
265 };
267 union {
269 struct {
275 };
276 };
277};
278
286
289 static constexpr uint16_t HasTrigger = 0x8;
290 static constexpr uint16_t LaserTriggerMask = 0x4;
291 static constexpr uint16_t PulserTriggerMask = 0x2;
292 static constexpr uint16_t PhysicsTriggerMask = 0x1;
293
294 union {
296 struct {
299 };
300 };
301
302 bool hasTrigger() const { return triggerType & HasTrigger; }
306};
307
314
315 bool hasTrigger() const { return word0 != 0x0; }
316 uint16_t getFirstBC() const { return word0 & 0xFFF; }
317};
318#endif // !defined(GPUCA_GPUCODE)
319
320} // namespace zerosupp_link_based
321} // namespace tpc
322} // namespace o2
323
324#endif
unsigned short int uint16_t
std::vector< std::string > header
int32_t i
#define GPUglobalconstexpr()
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 First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
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
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 true
configStandalone Reconstruction rec_tpc float
uint16_t pos
Definition RawData.h:3
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLint GLuint mask
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...