31 #define BOOST_TEST_MODULE ( rawdigit_test )
32 #include "boost/test/unit_test.hpp"
49 unsigned short samples,
55 BOOST_TEST(samples == uncompressed_adclist.size());
59 BOOST_TEST(digits.
Channel() == channel);
65 BOOST_TEST(digits.
Samples() == samples);
66 BOOST_TEST(digits.
Samples() == uncompressed_adclist.size());
74 BOOST_WARN(digits.
NADC() <= samples);
76 (
std::equal(ADCs.begin(), ADCs.end(), uncompressed_adclist.begin()));
92 const unsigned short samples = 0;
105 CheckRawDigit(digits, channel, samples, adclist, compression);
116 const unsigned short samples = 1000;
118 for (
size_t i = 0; i < samples; ++i)
119 adclist[i] = (i % 3)? 0: i;
124 std::vector<short> buffer(adclist);
132 raw::RawDigit digits1(channel, samples, buffer, compression );
135 CheckRawDigit(digits1, channel, samples, adclist, compression);
142 std::vector<short> buffer_copy(buffer);
144 (channel, samples, std::move(buffer_copy), compression );
147 CheckRawDigit(digits2, channel, samples, adclist, compression);
150 BOOST_TEST(buffer_copy.empty());
161 const unsigned short samples = 1000;
163 for (
size_t i = 0; i < samples; ++i)
164 adclist[i] = (i % 3)? 0: i;
168 std::vector<short> buffer(adclist);
175 raw::RawDigit digits1(channel, samples, buffer, compression );
178 CheckRawDigit(digits1, channel, samples, adclist, compression);
float GetPedestal() const
const ADCvector_t & ADCs() const
Reference to the compressed ADC count vector.
TString compression(pset.get< std::string >("CompressionType"))
enum raw::_compress Compress_t
ULong64_t Samples() const
Number of samples in the uncompressed ADC data.
Collection of charge vs time digitized from a single readout channel.
void RawDigitTestCustomConstructors()
ChannelID_t Channel() const
DAQ channel this raw data was read from.
std::vector< short > ADCvector_t
Type representing a (compressed) vector of ADC counts.
Definition of basic raw digits.
void CheckRawDigit(raw::RawDigit const &digits, raw::ChannelID_t channel, unsigned short samples, raw::RawDigit::ADCvector_t const &uncompressed_adclist, raw::Compress_t compression)
void RawDigitTestDefaultConstructor()
constexpr ChannelID_t InvalidChannelID
ID of an invalid channel.
void FibonacciCompressionTestCustomConstructor()
Collect all the RawData header files together.
size_t NADC() const
Number of elements in the compressed ADC sample vector.
raw::Compress_t Compression() const
Compression algorithm used to store the ADC counts.
bool equal(double a, double b)
Comparison tolerance, in centimeters.
void Compress(std::vector< short > &adc, raw::Compress_t compress)
Compresses a raw data buffer.
unsigned int ChannelID_t
Type representing the ID of a readout channel.
void Uncompress(const std::vector< short > &adc, std::vector< short > &uncompressed, raw::Compress_t compress)
Uncompresses a raw data buffer.
float GetSigma() const
TODO RMS of the pedestal level?