21#ifndef ALICEO2_DATAFORMATSTPC_CMV_H
22#define ALICEO2_DATAFORMATSTPC_CMV_H
30static constexpr uint32_t NTimeBinsPerPacket = 3564;
31static constexpr uint32_t NPacketsPerTFPerCRU = 4;
32static constexpr uint32_t NTimeBinsPerTF = NTimeBinsPerPacket * NPacketsPerTFPerCRU;
35static constexpr uint32_t DataSizeBytes = NTimeBinsPerPacket *
sizeof(uint16_t);
36static constexpr uint32_t DataPaddingBytes = (32 - (DataSizeBytes % 32)) % 32;
83 const bool positive = (
cmv >> 15) & 1;
84 const float magnitude = (
cmv & 0x7FFF) / 128.f;
85 return positive ? magnitude : -magnitude;
91 const bool positive = (
value >= 0.f);
92 const uint16_t magnitude =
static_cast<uint16_t
>(std::abs(
value) * 128.f + 0.5f) & 0x7FFF;
93 cmv = (positive ? 0x8000 : 0x0000) | magnitude;
113 uint16_t
getCMV(uint32_t timeBin)
const {
return data[timeBin].getCMV(); }
GLsizei const GLfloat * value
uint8_t padding[DataPaddingBytes]
trailing padding to align data to 32-byte boundary
void setCMV(uint32_t timeBin, uint16_t value)
float getCMVFloat(uint32_t timeBin) const
Data data[NTimeBinsPerPacket]
data values
const Header & getHeader() const
uint16_t getCMV(uint32_t timeBin) const
const Data * getData() const
void setCMVFloat(uint32_t timeBin, float value)
Header header
CMV data header.
CMV single data container.
uint16_t getCMV() const
raw 16-bit integer representation
float getCMVFloat() const
void setCMVFloat(float value)
void setCMV(uint16_t value)
set raw 16-bit integer representation
uint16_t cmv
16-bit signed fixed point value: bit 15 = sign (1=positive, 0=negative), bits 14-0 = I8F7 magnitude