Belle II Software development
ECLBaseCompress Class Reference

ECL waveform compression/decompression to/from the BitStream storage with the BASE algorithm. More...

#include <ECLCompress.h>

Inheritance diagram for ECLBaseCompress:
ECLCompress

Public Member Functions

void compress (BitStream &out, const int *adc) override
 Compress the ECL waveform.
 
void uncompress (BitStream &out, int *adc) override
 Decompress the ECL waveform.
 

Detailed Description

ECL waveform compression/decompression to/from the BitStream storage with the BASE algorithm.

Definition at line 60 of file ECLCompress.h.

Member Function Documentation

◆ compress()

void compress ( BitStream out,
const int *  adc 
)
overridevirtual

Compress the ECL waveform.

Parameters
out– where we stream the compressed data
adc– the waveform to compress

Implements ECLCompress.

Definition at line 35 of file ECLCompress.cc.

36{
37 int amin = adc[0], amax = adc[0];
38 for (unsigned int i = 0; i < EclConfiguration::m_nsmp; i++) {
39 amax = std::max(amax, adc[i]);
40 amin = std::min(amin, adc[i]);
41 }
42
43 amin &= 0x3ffff;
44 out.putNBits(amin, 18);
45 unsigned int w = ilog2(amax - amin) + 1;
46 w &= 0x1f;
47 out.putNBits(w, 5);
48
49 for (unsigned int i = 0; i < EclConfiguration::m_nsmp; i++) {
50 unsigned int d = adc[i] - amin;
51 out.putNBits(d, w);
52 }
53}
static constexpr int m_nsmp
number of ADC measurements for signal fitting

◆ uncompress()

void uncompress ( BitStream in,
int *  adc 
)
overridevirtual

Decompress the ECL waveform.

Parameters
in– the stream from which we fetch the compressed data
adc– the decompressed waveform

Implements ECLCompress.

Definition at line 55 of file ECLCompress.cc.

56{
57 unsigned int amin = out.getNBits(18), w = out.getNBits(5);
58 for (unsigned int i = 0; i < EclConfiguration::m_nsmp; i++)
59 adc[i] = amin + out.getNBits(w);
60}

The documentation for this class was generated from the following files: