46int main(
int argc,
char* argv[])
48 po::options_description
generic(
"options");
54 (
"help,h",
"produce help message")
55 (
"userLogic,u",po::bool_switch()->default_value(
true),
"user logic format")
56 (
"dummy-elecmap,d",po::bool_switch()->default_value(
false),
"use a dummy electronic mapping (for testing only, to be removed at some point)")
57 (
"output-dir,o",po::value<std::string>()->default_value(
"./"),
"output directory for file(s)")
58 (
"file-for,f", po::value<std::string>()->default_value(
"all"),
"output one file (file-for=all), per link (file-for=link) or per cru end point (file-for=cruendpoint)")
59 (
"input-file,i",po::value<std::string>(&input)->default_value(
"mchdigits.root"),
"input file name")
60 (
"configKeyValues", po::value<std::string>()->default_value(
""),
"comma-separated configKeyValues")
61 (
"no-empty-hbf,e", po::value<bool>()->default_value(
false),
"do not create empty HBF pages (except for HBF starting TF)")
62 (
"raw-file-writer-verbosity,v", po::value<int>()->default_value(0),
"verbosity level of the RawFileWriter")
64 (
"rdh-version,r", po::value<int>()->default_value(o2::raw::RDHUtils::getVersion<o2::header::RAWDataHeader>()),
"RDH version to use")
65 (
"verbosity,v",po::value<std::string>()->default_value(
"verylow"),
"(fair)logger verbosity");
68 po::options_description cmdline;
71 po::store(po::command_line_parser(argc, argv).options(cmdline).run(), vm);
73 if (vm.count(
"help")) {
74 std::cout <<
generic <<
"\n";
80 }
catch (boost::program_options::error& e) {
81 std::cout <<
"Error: " << e.what() <<
"\n";
88 std::ifstream in(input);
90 LOGF(fatal,
"could not open input file {}", input);
94 std::string confDig = vm[
"hbfutils-config"].as<std::string>();
95 if (!confDig.empty() && confDig !=
"none") {
100 if (vm.count(
"verbosity")) {
101 fair::Logger::SetVerbosity(vm[
"verbosity"].as<std::string>());
106 opts.
noEmptyHBF = vm[
"no-empty-hbf"].as<
bool>();
107 opts.
outputDir = vm[
"output-dir"].as<std::string>();
108 auto fileFor = vm[
"file-for"].as<std::string>();
109 if (fileFor ==
"link") {
111 }
else if (fileFor ==
"cruendpoint") {
112 opts.
splitMode = OutputSplit::PerCruEndpoint;
113 }
else if (fileFor ==
"all") {
116 throw po::validation_error(po::validation_error::invalid_option_value,
"file-for");
118 opts.
userLogic = vm[
"userLogic"].as<
bool>();
121 opts.
rdhVersion = vm[
"rdh-version"].as<
int>();
125 TFile fin(input.c_str());
127 std::cout <<
"Can not open Root input file " << input <<
"\n";
130 TTree*
tree =
static_cast<TTree*
>(fin.Get(
"o2sim"));
132 std::cout <<
"Can not get input tree o2sim from file " << input <<
"\n";
143 dre.addHeartbeats(dsElecIds, firstOrbitOfRun);
146 std::vector<o2::mch::Digit>
digits;
151 LOGP(error,
"Inconsistent rof number of entries {} != number of digits {}", rof.
getNEntries(),
digits.size());