12#define BOOST_TEST_MODULE Test HMPIDCTFIO
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>
33namespace boost_data = boost::unit_test::data;
39 std::vector<Trigger> triggers;
45 for (
int irof = 0; irof < 1000; irof++) {
46 ir += 1 + gRandom->Integer(200);
51 while ((chID += gRandom->Integer(10)) < 0xff) {
52 uint16_t q = gRandom->Integer(0xffff);
53 uint8_t ph = gRandom->Integer(0xff);
54 uint8_t
x = gRandom->Integer(0xff);
55 uint8_t
y = gRandom->Integer(0xff);
56 digits.emplace_back(chID, ph,
x,
y, q);
62 std::vector<o2::ctf::BufferType>
vec;
69 LOG(info) <<
"Compressed in " <<
sw.CpuTime() <<
" s";
75 TFile
flOut(
"test_ctf_hmpid.root",
"recreate");
81 LOG(info) <<
"Wrote to tree in " <<
sw.CpuTime() <<
" s";
86 LOG(info) <<
"Start reading from tree ";
89 TFile
flIn(
"test_ctf_hmpid.root");
94 LOG(info) <<
"Read back from tree in " <<
sw.CpuTime() <<
" s";
107 LOG(info) <<
"Decompressed in " <<
sw.CpuTime() <<
" s";
class for entropy encoding/decoding of HMPID 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
o2::ctf::CTFIOSize encode(VEC &buff, const gsl::span< const Trigger > &trigData, const gsl::span< const Digit > &digData)
entropy-encode data to buffer with CTF
o2::ctf::CTFIOSize decode(const CTF::base &ec, VTRG &trigVec, VDIG &digVec)
entropy decode data from buffer with CTF
constexpr ANSHeader ANSVersionCompat
constexpr ANSHeader ANSVersion1
std::vector< o2::ctf::BufferType > vec
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
TFile flOut("test_ctf_hmpid.root", "recreate")
std::vector< Digit > digits
std::vector< Trigger > triggersD
std::vector< o2::ctf::ANSHeader > ANSVersions
o2::InteractionRecord ir(0, 0)
TFile flIn("test_ctf_hmpid.root")
TTree ctfTree(std::string(o2::base::NameConf::CTFTREENAME).c_str(), "O2 CTF tree")
std::vector< Digit > digitsD
BOOST_TEST(triggersD==triggers, boost::test_tools::per_element())
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))