38 po::options_description opts(
" Options");
39 auto optsAdd = opts.add_options();
41 optsAdd(
"help,h",
"display this help and exit");
44 optsAdd(
"run,r", po::value<uint32_t>(&
fRunId)->value_name(
"<runID>")->required(),
45 "standard CBM run identifier (required)");
48 optsAdd(
"geotag,g", po::bool_switch(&vbSelected[
EInfo::GeoTag])->default_value(
false),
"prints the geometry tag");
49 optsAdd(
"print,p", po::bool_switch(&vbSelected[
EInfo::Print])->default_value(
false),
50 "print available information on the run ID");
51 optsAdd(
"run-start", po::bool_switch(&vbSelected[
EInfo::RunStart])->default_value(
false),
52 "print a run starttime in nanoseconds since the epoch");
53 optsAdd(
"algo-config", po::bool_switch(&vbSelected[
EInfo::AlgoConfig])->default_value(
false),
54 "print path to the algo config");
55 optsAdd(
"tof-calibration-tag", po::bool_switch(&vbSelected[
EInfo::TofCalibTag])->default_value(
false),
56 "print TOF calibration tag");
57 optsAdd(
"bmon-calibration-tag", po::bool_switch(&vbSelected[
EInfo::BmonCalibTag])->default_value(
false),
58 "print BMON calibration tag");
59 optsAdd(
"alignment-tag", po::bool_switch(&vbSelected[
EInfo::AlignmentTag])->default_value(
false),
60 "print alignment tag");
61 optsAdd(
"reco-par-tag", po::bool_switch(&vbSelected[
EInfo::RecoParTag])->default_value(
false),
62 "print reconstruction parameters tag");
63 optsAdd(
"reco-par-dir", po::bool_switch(&vbSelected[
EInfo::RecoParDir])->default_value(
false),
64 "print reconstruction parameters directory");
67 optsAdd(
"verbose,v", po::bool_switch(&verbose)->default_value(
false),
68 "Switch logging printout ON (default: only FATAL)");
71 po::variables_map vars;
72 po::store(po::parse_command_line(argc, argv, opts), vars);
74 if (vars.count(
"help")) {
75 std::cout << opts << std::endl;
76 std::exit(EXIT_SUCCESS);
81 int nSelectedInfos{0};
83 for (
size_t iInfo = 0; iInfo < vbSelected.size(); ++iInfo) {
84 if (vbSelected[iInfo]) {
85 selectedInfo =
static_cast<EInfo>(iInfo);
89 if (nSelectedInfos > 1) {
90 throw std::logic_error(
"More than one information items were requested. Please request only one item");
94 fair::Logger::SetConsoleSeverity(fair::Severity::fatal);
97 return std::make_optional(selectedInfo);
105 if (!db.LoadRun(
fRunId)) {
106 std::cerr <<
"Failed to load info for run " <<
fRunId <<
" from the database (see error above)" << std::endl;
107 throw std::runtime_error(
"DB Info not available for this run");
109 std::string dir = std::getenv(
"VMCWORKDIR") !=
nullptr ? std::getenv(
"VMCWORKDIR") :
"";
111 throw std::runtime_error(
"VMCWORKDIR environmental variable not found. Please configure your CbmRoot");
115 case EInfo::GeoTag: std::cout << db.GetGeoSetupTag() << std::endl;
break;
120 case EInfo::RecoParDir: std::cout << dir <<
"/" << db.GetRecoParDir() << std::endl;
break;
121 case EInfo::AlgoConfig: std::cout << dir <<
"/" << db.GetAlgoMainConfigPath() << std::endl;
break;
122 case EInfo::RunStart: std::cout << db.GetRunStartTimeNs() << std::endl;
break;
123 case EInfo::Print: std::cout << db.ToString() << std::endl;
break;