16#ifndef ALICEO2_TPC_CMVCONTAINER_H_
17#define ALICEO2_TPC_CMVCONTAINER_H_
32struct CMVPerTFCompressed;
36 static constexpr uint8_t
kNone = 0x00;
38 static constexpr uint8_t
kDelta = 0x02;
71 std::unique_ptr<TTree>
toTTree()
const;
76 static std::vector<std::pair<int, uint32_t>> decodeSparsePositions(
const uint8_t*&
ptr,
const uint8_t*
end);
80 static std::vector<uint32_t> decodeValueStream(
const uint8_t*&
ptr,
const uint8_t*
end, uint32_t N, uint8_t
flags);
83 static void decodeSparseValues(
const std::vector<uint32_t>& symbols,
84 const std::vector<std::pair<int, uint32_t>>& positions,
88 static void decodeDenseValues(
const std::vector<uint32_t>& symbols, uint8_t
flags,
CMVPerTF* cmv);
104 uint16_t
getCMV(
const int cru,
const int timeBin)
const;
107 float getCMVFloat(
const int cru,
const int timeBin)
const;
124 std::unique_ptr<TTree>
toTTree()
const;
130 static int32_t cmvToSigned(uint16_t raw);
131 static uint16_t quantizeBelowThreshold(uint16_t raw,
float quantizationMean,
float quantizationSigma);
132 static uint32_t zigzagEncode(int32_t
value);
133 static void encodeVarintInto(uint32_t
value, std::vector<uint8_t>& out);
Common mode values data format definition.
GLsizei const GLfloat * value
Global TPC definitions and constants.
Bitmask flags describing which encoding stages are applied in CMVPerTFCompressed.
static constexpr uint8_t kDelta
Delta coding between consecutive values (dense only)
static constexpr uint8_t kVarint
Varint compression of the value stream.
static constexpr uint8_t kHuffman
Canonical Huffman compression of the value stream.
static constexpr uint8_t kNone
No compression — raw uint16 values stored flat.
static constexpr uint8_t kSparse
Non-zero positions stored sparsely (varint-encoded deltas)
static constexpr uint8_t kZigzag
Zigzag encoding of deltas or signed values.
std::unique_ptr< TTree > toTTree() const
Serialise into a TTree; each Fill() call appends one entry (one TF)
void decompress(CMVPerTF *cmv) const
Restore a CMVPerTF from this compressed object into *cmv (must not be null)
std::vector< uint8_t > mData
Encoded payload.
uint8_t mFlags
Bitmask of CMVEncoding values.
uint16_t firstBC
First bunch crossing of this TF.
uint32_t firstOrbit
First orbit of this TF.
uint32_t firstOrbit
First orbit of this TF, from heartbeatOrbit of the first CMV packet.
void zeroSmallValues(float threshold=1.0f)
Zero out raw CMV values whose float magnitude is below threshold.
CMVPerTFCompressed compress(uint8_t flags) const
static void writeToFile(const std::string &filename, const std::unique_ptr< TTree > &tree)
Write the TTree to a ROOT file.
uint16_t mDataPerTF[CRU::MaxCRU *cmv::NTimeBinsPerTF]
void roundToIntegers(uint16_t threshold)
Round values to the nearest integer ADC for all values whose rounded magnitude is <= threshold.
void trimGaussianPrecision(float mean, float sigma)
std::unique_ptr< TTree > toTTree() const
Serialise into a TTree; each Fill() call appends one entry (one TF)
uint16_t getCMV(const int cru, const int timeBin) const
Return the raw 16-bit CMV value for a given CRU and timebin within this TF.
float getCMVFloat(const int cru, const int timeBin) const
Return the float CMV value for a given CRU and timebin within this TF.
uint16_t firstBC
First bunch crossing of this TF, from heartbeatBC of the first CMV packet.
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))