12#define BOOST_TEST_MODULE Test CTPCTFIO
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>
34namespace boost_data = boost::unit_test::data;
40 std::vector<CTPDigit>
digits;
45 std::random_device
rd;
47 std::uniform_int_distribution<unsigned long long>
distr;
48 for (
int itrg = 0; itrg < 1000; itrg++) {
50 auto& dig =
digits.emplace_back();
58 std::vector<o2::ctf::BufferType>
vec;
65 LOG(info) <<
"Compressed in " <<
sw.CpuTime() <<
" s";
71 TFile
flOut(
"test_ctf_ctp.root",
"recreate");
77 LOG(info) <<
"Wrote to tree in " <<
sw.CpuTime() <<
" s";
84 TFile
flIn(
"test_ctf_ctp.root");
89 LOG(info) <<
"Read back from tree in " <<
sw.CpuTime() <<
" s";
101 LOG(info) <<
"Decompressed in " <<
sw.CpuTime() <<
" s";
103 LOG(info) <<
" BOOST_CHECK(digitsD.size() " <<
digitsD.size() <<
" digigits.size()) " <<
digits.size();
class for entropy encoding/decoding of CTP data
definition of CTPDigit, CTPInputDigit
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 CTPDigit > &data, const LumiInfo &lumi)
entropy-encode data to buffer with CTF
o2::ctf::CTFIOSize decode(const CTF::base &ec, VTRG &data, LumiInfo &lumi)
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"
std::mt19937_64 eng(rd())
std::vector< CTPDigit > digitsD
std::uniform_int_distribution< unsigned long long > distr
std::vector< o2::ctf::ANSHeader > ANSVersions
o2::InteractionRecord ir(ir0)
TFile flOut("test_ctf_ctp.root", "recreate")
TTree ctfTree(std::string(o2::base::NameConf::CTFTREENAME).c_str(), "O2 CTF tree")
o2::InteractionRecord ir0(3, 5)
BOOST_TEST(digits==digitsD, boost::test_tools::per_element())
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))
TFile flIn("test_ctf_ctp.root")
std::vector< Digit > digits