12#include <boost/test/tools/old/interface.hpp>
15#define BOOST_TEST_MODULE Test MCHWorkflow DigitsIO
16#define BOOST_TEST_MAIN
17#define BOOST_TEST_DYN_LINK
19#include <boost/test/unit_test.hpp>
20#include <boost/test/data/test_case.hpp>
23#include <fmt/format.h>
87 std::ostringstream
str;
88 std::vector<ROFRecord> rofs;
106 if (not digitFileFormat.hasRof) {
109 std::ostringstream
str;
110 std::vector<ROFRecord> rofs;
111 std::vector<Digit>
digits;
130 buffer.write(
reinterpret_cast<const char*
>(&digitFileFormat),
sizeof(uint64_t));
148 std::vector<Digit>
digits;
151 uint16_t dummySamples{10};
152 for (
int i = 0;
i <
n;
i++) {
154 if (
i == 7 ||
i == 23) {
155 d.setSaturated(
true);
168 if (nrofs >= ndigits) {
169 throw std::invalid_argument(
"cannot have more rofs than digits!");
173 int step = ndigits / nrofs;
174 for (
int i = 0;
i < nrofs;
i++) {
176 tf.rofs.emplace_back(
ir, step *
i,
i == nrofs - 1 ? ndigits - step *
i : step);
204 for (
auto tf : tfs) {
209BOOST_TEST_DECORATOR(*boost::unit_test::disabled())
214 for (
auto tf : tfs) {
244 if (not digitFileFormat.hasRof) {
257 std::vector<Digit>
digits;
258 std::vector<ROFRecord> rofs;
281 std::vector<Digit>
digits;
282 std::vector<ROFRecord> rofs;
284 std::array<int, 3> digits_per_tf = {3, 5, 13};
285 for (
int itf = 0; itf < 3; ++itf) {
293 int ndigits_4th_tf = not digitFileFormat.hasRof ? 8 : 26;
295 if (not digitFileFormat.hasRof) {
DigitFileFormat fileFormat() const
bool read(std::vector< Digit > &digits, std::vector< ROFRecord > &rofs)
size_t nofTimeFrames() const
bool write(gsl::span< const Digit > digits, gsl::span< const ROFRecord > rofs={})
GLfloat GLfloat GLfloat GLfloat v3
GLfloat GLfloat GLfloat v2
bool isValid(DigitFileFormat dff)
constexpr uint64_t TAG_DIGITS
std::array< DigitFileFormat, 5 > digitFileFormats
BOOST_AUTO_TEST_CASE(FlatHisto)
std::unique_ptr< GPUReconstructionTimeframe > tf
std::vector< ROFRecord > rofs
std::vector< Digit > digits
std::vector< TF > testData
void writeTestData(std::ostream &out, DigitFileFormat dff)
BOOST_DATA_TEST_CASE(WriteMustReturnFalseIfDigitVectorIsEmpty, digitFileFormats, digitFileFormat)
TF createDummyData(int ndigits, int nrofs, uint32_t firstOrbit)
std::vector< o2::mch::Digit > createDummyFixedDigits(int n)
DigitFileFormat createFormat(uint8_t fileVersion, uint8_t digitVersion, uint8_t digitSize, uint8_t rofVersion, uint8_t rofSize, bool run2ids, bool hasRof)
o2::InteractionRecord ir(0, 0)
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
std::vector< Digit > digits