79bool initOptionsAndParse(bpo::options_description& options,
int argc,
char* argv[], bpo::variables_map& vm)
81 options.add_options()(
82 "run,r", bpo::value<int>()->default_value(8),
"Run number to inspect")(
83 "enable-debug,d", bpo::value<bool>()->default_value(
false)->implicit_value(
true),
"Enable debug logs")(
84 "help,h",
"Produce help message.");
87 bpo::store(parse_command_line(argc, argv, options), vm);
90 if (vm.count(
"help")) {
91 std::cout << options << std::endl;
96 }
catch (
const bpo::error& e) {
97 std::cerr << e.what() <<
"\n\n";
98 std::cerr <<
"Error parsing command line arguments; Available options:\n";
100 std::cerr << options << std::endl;
106int main(
int argc,
char* argv[])
108 bpo::options_description options(
"Allowed options");
109 bpo::variables_map vm;
114 auto run = vm[
"run"].as<
int>();
115 auto debug = vm[
"enable-debug"].as<
bool>();
121 ccdb_inst.setURL(
"http://alice-ccdb.cern.ch");
122 std::pair<uint64_t, uint64_t> run_times = ccdb_inst.getRunDuration(run);
123 long run_O2duration =
long(run_times.second - run_times.first);
125 int64_t tsSOR = run_times.first;
126 int64_t tsEOR = run_times.second;
127 LOGP(info,
"tsSOR = {} ms, tsEOR = {} ms", tsSOR, tsEOR);
130 LOGP(info,
"Getting B field");
131 std::map<std::string, std::string> metadata;
132 ccdb_inst.setFatalWhenNull(
true);
134 o2::units::Current_t magFieldL3Curr = magField->
getL3Current();
135 LOGP(info,
"run {}: B field = {}", run, magFieldL3Curr);
139 LOGP(info,
"Getting detector participating in the run");
140 std::map<std::string, std::string> metadataRun;
143 std::string dets =
"";
149 LOGP(info,
"run {}: detectors in readout = {}", run, dets);
152 LOGP(info,
"Checking IR and duration");
155 ccdb_inst.setFatalWhenNull(
false);
156 metadata[
"runNumber"] = Form(
"%d", run);
159 LOGP(info,
"CTP/Calib/Scalers object does not exist in production CCDB, trying test CCDB");
160 ccdb_inst.setURL(
"http://ccdb-test.cern.ch:8080");
163 LOGP(info,
"Cannot get IR for run {} neither from production nor test CCDB, writing -1.f", run);
164 LOGP(info,
"In addition, the duration for these runs is O2end - O2start: if the run was short, this might overestimate the duration");
174 int n = mScalerRecordO2.size();
176 std::int64_t totScalers = 0;
177 std::vector<int64_t> vOrbit;
178 std::vector<int64_t> vScaler;
180 for (
auto& record : mScalerRecordO2) {
182 record.printStream(std::cout);
184 std::vector<CTPScalerO2>& scalers = record.scalers;
186 vOrbit.push_back(intRecord.
orbit);
188 LOGP(info,
"{} orbit = {} scalers = {}",
i, intRecord.
orbit, scalers[0].lmBefore);
190 vScaler.push_back(scalers[0].lmBefore);
191 totScalers += scalers[0].lmBefore;
195 duration = std::round((vOrbit.back() - vOrbit.front()) *
orbitDuration * 1e-6);
196 ir = float(vScaler.back() - vScaler.front()) / duration;
197 LOGP(info,
"run {}: orbit.front = {} orbit.back = {} duration = {} s scalers = {} IR = {} Hz", run, vOrbit.front(), vOrbit.back(), duration, vScaler.back() - vScaler.front(),
ir);
201 LOGP(info,
"IR < 100 kHz");
203 LOGP(info,
"IR > 100 kHz");