12#define BOOST_TEST_MODULE Test FV0CTFIO
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
20#include <boost/test/data/test_case.hpp>
21#include <boost/test/data/dataset.hpp>
28#include <TStopwatch.h>
32namespace boost_data = boost::unit_test::data;
45 for (
int idig = 0; idig < 1000; idig++) {
46 ir += 1 + gRandom->Integer(200);
47 uint8_t ich = gRandom->Poisson(10);
49 int16_t tMeanA = 0, tMeanC = 0;
50 int32_t ampTotA = 0, ampTotC = 0;
53 int16_t t = -2048 + gRandom->Integer(2048 * 2);
54 uint16_t q = gRandom->Integer(4096);
55 uint8_t
chain = gRandom->Rndm() > 0.5 ? 0 : 1;
57 ich += 1 + gRandom->Poisson(10);
65 LOG(info) <<
"Generated " <<
channels.size() <<
" channels in " <<
digits.size() <<
" digits " <<
sw.CpuTime() <<
" s";
68 std::vector<o2::ctf::BufferType>
vec;
75 LOG(info) <<
"Compressed in " <<
sw.CpuTime() <<
" s";
80 TFile
flOut(
"test_ctf_fv0.root",
"recreate");
87 LOG(info) <<
"Wrote to tree in " <<
sw.CpuTime() <<
" s";
94 TFile
flIn(
"test_ctf_fv0.root");
99 LOG(info) <<
"Read back from tree in " <<
sw.CpuTime() <<
" s";
112 LOG(info) <<
"Decompressed in " <<
sw.CpuTime() <<
" s";
116 LOG(info) <<
" BOOST_CHECK digitsD.size() " <<
digitsD.size() <<
" digits.size() " <<
digits.size() <<
" BOOST_CHECK(channelsD.size() " <<
channelsD.size() <<
" channels.size()) " <<
channels.size();
121 LOG(
debug) <<
" dor " << dor.mTriggers.print();
122 LOG(
debug) <<
" ddc " << ddc.mTriggers.print();
General constants in FV0.
class for entropy encoding/decoding of FV0 digits data
BOOST_DATA_TEST_CASE(DefaultConstructorNofSamplesIsInvariant, boost::unit_test::data::make(nsamples), nofSamples)
Definition of the Names Generator class.
static constexpr std::string_view CTFTREENAME
void setANSVersion(const ctf::ANSHeader &ansVersion) noexcept
void readFromTree(TTree &tree, const std::string &name, int ev=0)
read from tree to non-flat object
static auto get(void *head)
cast arbitrary buffer head to container class. Head is supposed to respect the alignment
static auto getImage(const void *newHead)
get const image of the container wrapper, with pointers in the image relocated to new head
void setTriggers(uint8_t trgsig, uint8_t chanA, uint8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC)
o2::ctf::CTFIOSize encode(VEC &buff, const gsl::span< const Digit > &digitVec, const gsl::span< const ChannelData > &channelVec)
entropy-encode digits to buffer with CTF
o2::ctf::CTFIOSize decode(const CTF::base &ec, VDIG &digitVec, VCHAN &channelVec)
entropy decode clusters from buffer with CTF
constexpr ANSHeader ANSVersionCompat
constexpr ANSHeader ANSVersion1
static constexpr int nChannelsPerPm
static constexpr int nPms
TFile flOut("test_ctf_fv0.root", "recreate")
TFile flIn("test_ctf_fv0.root")
std::vector< o2::ctf::BufferType > vec
std::vector< ChannelData > channelsD
std::vector< ChannelData > channels
std::vector< o2::ctf::ANSHeader > ANSVersions
o2::InteractionRecord ir(0, 0)
TTree ctfTree(std::string(o2::base::NameConf::CTFTREENAME).c_str(), "O2 CTF tree")
std::vector< Digit > digitsD
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
LOG(info)<< "Generated "<< channels.size()<< " channels in "<< digits.size()<< " digits "<< sw.CpuTime()<< " s"
std::vector< Digit > digits