12#define BOOST_TEST_MODULE Test TOFCTFIO
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>
30#include <TStopwatch.h>
34namespace boost_data = boost::unit_test::data;
42 std::vector<ReadoutWindowData>
rows;
48 for (
int irof = 0; irof < 100; irof++) {
49 auto& rofr =
rows.emplace_back();
54 int ndig = gRandom->Poisson(50);
56 rofr.setFirstEntry(
digits.size());
57 rofr.setNEntries(ndig);
59 rofr.setFirstEntryDia(
pattVec.size());
60 rofr.setNEntriesDia(0);
61 std::vector<int> istrip;
62 for (
int i = 0;
i < ndig;
i++) {
65 std::sort(istrip.begin(), istrip.end());
67 for (
int i = 0;
i < ndig;
i++) {
69 uint16_t TDC = gRandom->Integer(1024);
70 uint16_t TOT = gRandom->Integer(2048);
73 digits.emplace_back(ch, TDC, TOT, BC);
78 int strip1 = a.getChannel() / Geo::NPADS, strip2 = b.getChannel() / Geo::NPADS;
79 if (strip1 == strip2) {
80 if (a.getBC() == b.getBC()) {
81 return a.getTDC() < b.getTDC();
83 return a.getBC() < b.getBC();
85 return strip1 < strip2;
92 LOG(info) <<
"Generated " <<
digits.size() <<
" in " <<
rows.size() <<
" ROFs in " <<
sw.CpuTime() <<
" s";
95 std::vector<o2::ctf::BufferType>
vec;
102 LOG(info) <<
"Compressed in " <<
sw.CpuTime() <<
" s";
107 TFile
flOut(
"test_ctf_tof.root",
"recreate");
114 LOG(info) <<
"Wrote to tree in " <<
sw.CpuTime() <<
" s";
121 TFile
flIn(
"test_ctf_tof.root");
124 CTF::readFromTree(
vec, *(
tree.get()),
"TOF");
126 LOG(info) <<
"Read back from tree in " <<
sw.CpuTime() <<
" s";
130 std::vector<ReadoutWindowData>
rowsD;
139 LOG(info) <<
"Decompressed in " <<
sw.CpuTime() <<
" s";
151 for (
int i = 0;
i <
npatt;
i += 100) {
unsigned short int uint16_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
BOOST_DATA_TEST_CASE(DefaultConstructorNofSamplesIsInvariant, boost::unit_test::data::make(nsamples), nofSamples)
Definition of the Names Generator class.
class for entropy encoding/decoding of TOF compressed infos data
static constexpr std::string_view CTFTREENAME
void setANSVersion(const ctf::ANSHeader &ansVersion) noexcept
o2::ctf::CTFIOSize encode(VEC &buff, const gsl::span< const ReadoutWindowData > &rofRecVec, const gsl::span< const Digit > &cdigVec, const gsl::span< const uint8_t > &pattVec)
entropy-encode clusters to buffer with CTF
o2::ctf::CTFIOSize decode(const CTF::base &ec, VROF &rofRecVec, VDIG &cdigVec, VPAT &pattVec)
entropy decode clusters from buffer with CTF
TOF digit implementation.
static constexpr Int_t NPADS
static constexpr int BC_IN_ORBIT
static constexpr int NWINDOW_IN_ORBIT
static constexpr Int_t NSTRIPS
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
constexpr ANSHeader ANSVersionCompat
constexpr ANSHeader ANSVersion1
std::vector< Digit > digits
std::vector< o2::ctf::BufferType > vec
std::vector< uint8_t > pattVec
std::vector< ReadoutWindowData > rowsD
std::vector< o2::ctf::ANSHeader > ANSVersions
std::vector< uint8_t > pattVecD
TFile flIn("test_ctf_tof.root")
TTree ctfTree(std::string(o2::base::NameConf::CTFTREENAME).c_str(), "O2 CTF tree")
std::vector< ReadoutWindowData > rows
TFile flOut("test_ctf_tof.root", "recreate")
LOG(info)<< "Generated "<< digits.size()<< " in "<< rows.size()<< " ROFs in "<< sw.CpuTime()<< " s"
std::vector< Digit > digitsD
std::unique_ptr< TTree > tree((TTree *) flIn.Get(std::string(o2::base::NameConf::CTFTREENAME).c_str()))