9 #pragma GCC diagnostic push 10 #pragma GCC diagnostic ignored "-Wsign-compare" 12 #define BOOST_TEST_MODULE(MilliSlice_t) 15 BOOST_AUTO_TEST_SUITE(FelixReorder_test)
19 std::vector<int> event_nums = {7258, 7263, 7264, 7269, 7276, 7283, 7284, 7287, 7294, 7296};
23 std::vector<std::string> filenames;
24 for (
auto event : event_nums) {
25 for (
unsigned p = 0;
p < 3; ++
p) {
26 for (
unsigned f = 1;
f < 10; ++
f) {
28 "/dune/app/users/milov/kevlar/newerrun/uBdat/Run_8700-SubRun_145-Event_" +
33 for (
unsigned f = 10;
f < 14; ++
f) {
35 "/dune/app/users/milov/kevlar/newerrun/uBdat/" 36 "Run_8700-SubRun_145-Event_" +
47 std::ifstream in(
filename, std::ios::binary);
49 std::cout <<
"Could not open file " <<
filename <<
".\n";
52 std::string contents((std::istreambuf_iterator<char>(in)),
53 (std::istreambuf_iterator<char>()));
60 std::unique_ptr<artdaq::Fragment> frag_ptr(artdaq::Fragment::FragmentBytes(
62 frag_ptr->resizeBytes(contents.size());
63 memcpy(frag_ptr->dataBeginBytes(), contents.c_str(), contents.size());
66 const size_t frames = flxfrg.total_frames();
90 std::cout <<
"### MEOW -> Compressed FELIX Fragment test.\n";
92 artdaq::Fragment reordfrg(
98 std::cout <<
" -> Total words: " << compflxfrg.
total_words() <<
'\n';
99 std::cout <<
" -> Total frames: " << compflxfrg.
total_frames() <<
'\n';
103 std::cout <<
"### WOOF -> WIB frame test.\n";
104 std::cout <<
" -> SOF: " << unsigned(flxfrg.sof(0)) <<
"\n";
105 std::cout <<
" -> Version: " << unsigned(flxfrg.version(0)) <<
"\n";
106 std::cout <<
" -> FiberNo: " << unsigned(flxfrg.fiber_no(0)) <<
"\n";
107 std::cout <<
" -> SlotNo: " << unsigned(flxfrg.slot_no(0)) <<
"\n";
108 std::cout <<
" -> CrateNo: " << unsigned(flxfrg.crate_no(0)) <<
"\n";
109 std::cout <<
" -> Timestamp: " <<
std::hex << flxfrg.timestamp(0)
113 std::cout <<
"### WOOF -> Reordered WIB frame test.\n";
114 std::cout <<
" -> SOF: " << unsigned(compflxfrg.
sof(0)) <<
"\n";
115 std::cout <<
" -> Version: " << unsigned(compflxfrg.
version(0)) <<
"\n";
116 std::cout <<
" -> FiberNo: " << unsigned(compflxfrg.
fiber_no(0)) <<
"\n";
117 std::cout <<
" -> SlotNo: " << unsigned(compflxfrg.
slot_no(0)) <<
"\n";
118 std::cout <<
" -> CrateNo: " << unsigned(compflxfrg.
crate_no(0)) <<
"\n";
123 std::cout <<
"### MEOW -> Comparing " << frames <<
" frames.\n";
124 std::cout <<
"First compressed frame:\n";
127 for (
unsigned i = 0; i < frames; ++i) {
129 BOOST_REQUIRE_EQUAL(flxfrg.sof(i), compflxfrg.
sof(i));
130 BOOST_REQUIRE_EQUAL(flxfrg.version(i), compflxfrg.
version(i));
131 BOOST_REQUIRE_EQUAL(flxfrg.fiber_no(i), compflxfrg.
fiber_no(i));
132 BOOST_REQUIRE_EQUAL(flxfrg.slot_no(i), compflxfrg.
slot_no(i));
133 BOOST_REQUIRE_EQUAL(flxfrg.crate_no(i), compflxfrg.
crate_no(i));
134 BOOST_REQUIRE_EQUAL(flxfrg.timestamp(i), compflxfrg.
timestamp(i));
135 for (
unsigned j = 0; j < 4; ++j) {
137 BOOST_REQUIRE_EQUAL(flxfrg.s1_error(i, j), compflxfrg.
s1_error(i, j));
138 BOOST_REQUIRE_EQUAL(flxfrg.s2_error(i, j), compflxfrg.
s2_error(i, j));
139 BOOST_REQUIRE_EQUAL(flxfrg.checksum_a(i, j),
141 BOOST_REQUIRE_EQUAL(flxfrg.checksum_b(i, j),
143 BOOST_REQUIRE_EQUAL(flxfrg.coldata_convert_count(i, j),
145 BOOST_REQUIRE_EQUAL(flxfrg.error_register(i, j),
147 for (
unsigned h = 0;
h < 8; ++
h) {
148 BOOST_REQUIRE_EQUAL(flxfrg.hdr(i, j,
h), compflxfrg.
hdr(i, j,
h));
151 for (
unsigned ch = 0; ch < 256; ++ch) {
152 BOOST_REQUIRE_EQUAL(flxfrg.get_ADC(i, ch), compflxfrg.
get_ADC(i, ch));
156 std::cout <<
"### MEOW -> Tests successful.\n";
159 compare_end - compare_begin)
173 BOOST_AUTO_TEST_SUITE_END()
175 #pragma GCC diagnostic pop size_t total_frames() const
uint8_t version(const unsigned &frame_ID=0) const
uint8_t slot_no(const unsigned &frame_ID=0) const
uint8_t crate_no(const unsigned &frame_ID=0) const
uint16_t checksum_b(const unsigned &frame_ID, const uint8_t &block_num) const
uint8_t hdr(const unsigned &frame_ID, const uint8_t &block_num, const uint8_t &hdr_num) const
QTextStream & hex(QTextStream &s)
adc_t get_ADC(const unsigned &frame_ID, const uint8_t channel_ID) const
uint16_t checksum_a(const unsigned &frame_ID, const uint8_t &block_num) const
BOOST_AUTO_TEST_CASE(BaselineTest)
uint16_t error_register(const unsigned &frame_ID, const uint8_t &block_num) const
size_t total_words() const
uint16_t coldata_convert_count(const unsigned &frame_ID, const uint8_t &block_num) const
QTextStream & dec(QTextStream &s)
uint8_t s1_error(const unsigned &frame_ID, const uint8_t &block_num) const
FragmentType toFragmentType(std::string t_string)
millisecond milliseconds
Alias for common language habits.
uint8_t fiber_no(const unsigned &frame_ID=0) const
uint8_t s2_error(const unsigned &frame_ID, const uint8_t &block_num) const
size_t total_adc_values() const
void print(const unsigned i) const
std::string to_string(ModuleType const mt)
uint8_t sof(const unsigned &frame_ID=0) const
Event finding and building.
uint64_t timestamp(const unsigned &frame_ID=0) const