60 std::vector<std::string> inputfiles{vm[
"input"].as<std::vector<std::string>>()};
62 std::unique_ptr<o2::mid::Decoder> decoder{
nullptr};
66 if (vm.count(
"feeId-config-file")) {
71 if (vm.count(
"electronics-delay-file")) {
76 if (vm.count(
"sync-trigger")) {
81 if (vm.count(
"crate-masks-file")) {
84 checker.
init(crateMasks);
86 auto nHBs = vm[
"nHBs"].as<
unsigned long int>();
87 auto nMaxErrors = vm[
"max-errors"].as<
unsigned long int>();
94 if (vm.count(
"custom-memory-size")) {
98 std::ofstream outFile(outFilename.c_str());
99 if (!outFile.is_open()) {
100 std::cout <<
"Error: cannot create " << outFilename << std::endl;
103 std::cout <<
"Writing output to: " << outFilename <<
" ..." << std::endl;
105 std::vector<o2::mid::ROBoard>
data;
106 std::vector<o2::mid::ROFRecord> rofRecords;
107 std::vector<o2::mid::ROFRecord> hbRecords;
110 unsigned long int iHB = 0;
111 std::stringstream summary;
112 while (rawFileReader.
readHB(vm.count(
"only-closed-HBs") > 0)) {
117 decoder->process(rawFileReader.
getData());
118 rawFileReader.
clear();
120 data.insert(
data.end(), decoder->getData().begin(), decoder->getData().end());
121 for (
auto& rof : decoder->getROFRecords()) {
122 rofRecords.emplace_back(rof.interactionRecord, rof.eventType, rof.firstEntry +
offset, rof.nEntries);
127 if ((nHBs > 0 && iHB >= nHBs)) {
130 if (!checker.
process(
data, rofRecords, hbRecords)) {
138 summary <<
"Too many errors found: abort check!\n";
143 if (
data.size() > 0 && !checker.
process(
data, rofRecords, hbRecords)) {
146 summary <<
"Number of busy raised: " << checker.
getNBusyRaised() <<
"\n";
148 outFile << summary.str();
149 std::cout << summary.str();
157int main(
int argc,
char* argv[])
159 po::variables_map vm;
160 po::options_description
generic(
"Generic options");
163 generic.add_options()
164 (
"help",
"produce help message")
165 (
"nHBs", po::value<unsigned long int>()->default_value(0),
"Number of HBs read")
166 (
"only-closed-HBs", po::value<bool>()->implicit_value(
true),
"Return only closed HBs")
167 (
"custom-memory-size", po::value<uint16_t>()->implicit_value(0x2000 - 0x100),
"Ignore read RDH. Use custom memory size")
168 (
"max-errors", po::value<unsigned long int>()->default_value(10000),
"Maximum number of errors before aborting")
169 (
"feeId-config-file", po::value<std::string>(),
"Filename with crate FEE ID correspondence")
170 (
"crate-masks-file", po::value<std::string>(),
"Filename with crate masks")
171 (
"electronics-delay-file", po::value<std::string>(),
"Filename with electronics delay")
172 (
"output-dir", po::value<std::string>()->default_value(
""),
"Output directory")
173 (
"sync-trigger", po::value<unsigned int>(),
"Trigger used for synchronisation (default is orbit 0x1)");
176 po::options_description hidden(
"hidden options");
178 (
"input", po::value<std::vector<std::string>>(),
"Input filename");
181 po::options_description cmdline;
182 cmdline.add(generic).add(hidden);
184 po::positional_options_description
pos;
185 pos.add(
"input", -1);
187 po::store(po::command_line_parser(argc, argv).options(cmdline).positional(
pos).run(), vm);
190 if (vm.count(
"help")) {
191 std::cout <<
"Usage: " << argv[0] <<
" <input_raw_filename> [input_raw_filename_1 ...]\n";
192 std::cout <<
generic << std::endl;
195 if (vm.count(
"input") == 0) {
196 std::cout <<
"no input file specified" << std::endl;
std::unique_ptr< Decoder > createDecoder(const o2::header::RDHAny &rdh, bool isDebugMode, const ElectronicsDelay &electronicsDelay, const CrateMasks &crateMasks, const FEEIdConfig &feeIdConfig)