26int main(
int argc,
char** argv)
28 bpo::variables_map vm;
29 bpo::options_description opt_general(
"Usage:\n " + std::string(argv[0]) +
31 " Tool will decode the DDLx data for EMCAL 0\n"
32 "Commands / Options");
33 bpo::options_description opt_hidden(
"");
34 bpo::options_description opt_all;
35 bpo::positional_options_description opt_pos;
38 auto add_option = opt_general.add_options();
39 add_option(
"help,h",
"Print this help message");
40 add_option(
"verbose,v", bpo::value<uint32_t>()->default_value(0),
"Select verbosity level [0 = no output]");
41 add_option(
"version",
"Print version information");
42 add_option(
"input-file,i", bpo::value<std::string>()->required(),
"Specifies input file.");
43 add_option(
"debug,d", bpo::value<uint32_t>()->default_value(0),
"Select debug output level [0 = no debug output]");
45 opt_all.add(opt_general).add(opt_hidden);
46 bpo::store(bpo::command_line_parser(argc, argv).options(opt_all).positional(opt_pos).run(), vm);
48 if (vm.count(
"help") || argc == 1) {
49 std::cout << opt_general << std::endl;
53 if (vm.count(
"version")) {
59 }
catch (bpo::error& e) {
60 std::cerr <<
"ERROR: " << e.what() << std::endl
62 std::cerr << opt_general << std::endl;
64 }
catch (std::exception& e) {
65 std::cerr << e.what() <<
", application will now exit" << std::endl;
69 auto rawfilename = vm[
"input-file"].as<std::string>();
75 reader.addFile(rawfilename);
79 int tfID = reader.getNextTFToRead();
80 if (tfID >= reader.getNTimeFrames()) {
81 LOG(info) <<
"nothing left to read after " << tfID <<
" TFs read";
84 std::vector<char> dataBuffer;
85 for (
int il = 0; il < reader.getNLinks(); il++) {
86 auto& link = reader.getLink(il);
87 std::cout <<
"Decoding link " << il << std::endl;
89 auto sz = link.getNextTFSize();
90 dataBuffer.resize(sz);
91 link.readNextTF(dataBuffer.data());
98 if (o2::raw::RDHUtils::getFEEID(parser.
getRawHeader()) >= 40) {
106 std::cout <<
"Hw address: " << chan.getHardwareAddress() << std::endl;
107 for (
auto& bunch : chan.getBunches()) {
108 std::cout <<
"BunchLength: " <<
int(bunch.getBunchLength()) << std::endl;
109 auto adcs = bunch.getADC();
110 int time = bunch.getStartTime();
111 for (
int i = adcs.size() - 1;
i >= 0;
i--) {
112 std::cout <<
"Timebin " <<
time <<
", ADC " << adcs[
i] << std::endl;
119 reader.setNextTFToRead(++tfID);