15#ifndef ALICEO2_DATAFORMATSTPC_CLUSTERNATIVE_H
16#define ALICEO2_DATAFORMATSTPC_CLUSTERNATIVE_H
17#ifndef GPUCA_GPUCODE_DEVICE
32class ConstMCTruthContainer;
34class ConstMCTruthContainerView;
68 static
GPUglobalconstexpr()
int maxSaturatedQtot = (USHRT_MAX - maxRegularQtot) * scaleSaturatedQtot;
78 GPUd() static uint16_t packPad(
float pad) {
return (uint16_t)(
pad * scalePadPacked + 0.5); }
79 GPUd() static uint32_t packTime(
float time) {
return (uint32_t)(
time * scaleTimePacked + 0.5); }
80 GPUd() static
float unpackPad(uint16_t
pad) {
return float(
pad) * (1.f / scalePadPacked); }
81 GPUd() static
float unpackTime(uint32_t
time) {
return float(
time) * (1.f / scaleTimePacked); }
84 GPUd()
ClusterNative(uint32_t
time, uint8_t
flags, uint16_t
pad, uint8_t
sigmaTime, uint8_t
sigmaPad, uint16_t
qmax, uint16_t
qtotPacked) :
padPacked(
pad),
sigmaTimePacked(
sigmaTime),
sigmaPadPacked(
sigmaPad),
qMax(
qmax),
qTotPacked(
qtotPacked)
89 GPUd() uint16_t getQmax()
const {
return qMax; }
90 GPUd() uint32_t getQtot()
const {
return isSaturated() ? getSaturatedQtot() : (uint32_t)
qTotPacked; }
126 GPUd() float getSigmaTime()
const
128 if (isSaturated()) [[unlikely]] {
135 uint32_t tmp =
sigmaTime * scaleSigmaTimePacked + 0.5;
144 uint32_t tmp =
sigmaPad * scaleSigmaPadPacked + 0.5;
156 if (qtot < maxSaturatedQtot) {
157 this->
qTotPacked = ((qtot + scaleSaturatedQtot / 2) / scaleSaturatedQtot) + maxRegularQtot;
161 GPUd() uint32_t getSaturatedQtot()
const
163 return uint32_t(
qTotPacked - maxRegularQtot) * scaleSaturatedQtot;
171 GPUd() uint32_t getSaturatedTailLength()
const
178 if (this->getTimePacked() != rhs.getTimePacked()) {
179 return (this->getTimePacked() < rhs.getTimePacked());
180 }
else if (this->
padPacked != rhs.padPacked) {
181 return (this->
padPacked < rhs.padPacked);
186 }
else if (this->
qMax != rhs.qMax) {
187 return (this->
qMax < rhs.qMax);
188 }
else if (this->
qTotPacked != rhs.qTotPacked) {
189 return (this->getQtot() < rhs.getQtot());
191 return (this->getFlags() < rhs.getFlags());
197 return this->getTimePacked() == rhs.getTimePacked() &&
201 this->
qMax == rhs.qMax &&
203 this->getFlags() == rhs.getFlags();
207 static constexpr GPUd() uint32_t decodeTailLength(uint8_t code)
231 uint32_t q = (uint32_t)code - 64u;
232 uint32_t exponent = (q >> 5) + 1u;
233 uint32_t mantissa = q & 31u;
235 return (32u + mantissa) << exponent;
239 return 512u + 16u * ((uint32_t)code - 160u);
243 return 1552u + 32u * ((uint32_t)code - 224u);
246 return 2048u + 400u * ((uint32_t)code - 240u);
249 static constexpr GPUd() uint8_t encodeTailLength(uint32_t
value)
252 if (
value >= decodeTailLength(255)) [[unlikely]] {
261 uint8_t mid = lo + ((hi - lo) >> 1);
262 uint32_t decoded = decodeTailLength(mid);
264 if (decoded <
value) {
272 if (lo == 0) [[unlikely]] {
279 uint32_t above_value = decodeTailLength(above_code);
280 uint32_t below_value = decodeTailLength(below_code);
282 uint32_t above_error = above_value -
value;
283 uint32_t below_error =
value - below_value;
286 if (below_error <= above_error) {
300 unsigned int nClusters[constants::MAXSECTOR][constants::MAXGLOBALPADROW];
302 unsigned int clusterOffset[constants::MAXSECTOR][constants::MAXGLOBALPADROW];
317 for (
unsigned int i = 0;
i < constants::MAXSECTOR;
i++) {
319 for (
unsigned int j = 0;
j < constants::MAXGLOBALPADROW;
j++) {
GLsizei const GLfloat * value
typedef void(APIENTRYP PFNGLCULLFACEPROC)(GLenum mode)
uint8_t itsSharedClusterMap uint8_t
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string getTime(uint64_t ts)
unsigned int nClusters[constants::MAXSECTOR][constants::MAXGLOBALPADROW]
unsigned int nClustersSector[constants::MAXSECTOR]
const o2::dataformats::ConstMCTruthContainerView< o2::MCCompLabel > * clustersMCTruth
std::pair< ConstMCLabelContainer, ConstMCLabelContainerView > ConstMCLabelContainerViewWithBuffer
unsigned int nClustersTotal
const ClusterNative * clusters[constants::MAXSECTOR][constants::MAXGLOBALPADROW]
unsigned int clusterOffset[constants::MAXSECTOR][constants::MAXGLOBALPADROW]
const ClusterNative * clustersLinear
uint8_t uint16_t uint8_t uint8_t uint16_t uint16_t qtotPacked
GPUd() bool operator<(const ClusterNative &rhs) const
GPUd() static float unpackTime(uint32_t time)
uint8_t uint16_t uint8_t sigmaTime
uint8_t uint16_t uint8_t uint8_t uint16_t qmax
GPUd() uint32_t getTimePacked() const
GPUd() void setFlags(uint8_t flags)
GPUd() uint16_t getQmax() const
GPUd() uint8_t getFlags() const
GPUd() float getSigmaTime() const
GPUdDefault() ClusterNative()=default
GPUd() float getTime() const
GPUd() uint32_t getSaturatedTailLength() const
GPUd() static float unpackPad(uint16_t pad)
GPUd() void setTime(float time)
GPUd() void setTimeFlags(float time
GPUd() static uint16_t packPad(float pad)
GPUd() uint32_t getQtot() const
uint8_t uint16_t uint8_t uint8_t sigmaPad
static GPUglobalconstexpr() int scaleTimePacked
GPUd() void setSigmaPad(float sigmaPad)
GPUd() void setSaturatedTailLength(uint32_t tail)
GPUd() uint32_t getSaturatedQtot() const
GPUd() float getPad() const
GPUd() void setPad(float pad)
GPUd() void setTimePacked(uint32_t timePacked)
GPUd() void setSaturatedQtot(uint32_t qtot)
GPUd() static uint32_t packTime(float time)
GPUd() void setTimePackedFlags(uint32_t timePacked
GPUd() bool isSaturated() const
GPUd() float getSigmaPad() const
GPUd() void setSigmaTime(float sigmaTime)