22#include <unordered_map>
26#include <boost/program_options.hpp>
28#include <fmt/format.h>
35#include "TMultiGraph.h"
52using DPMAP = std::unordered_map<DPID, std::vector<DPVAL>>;
53using DPMAP2 = std::map<std::string, std::map<uint64_t, double>>;
54using RBMAP = std::map<int, std::pair<uint64_t, uint64_t>>;
55using DPBMAP = std::map<uint64_t, uint64_t>;
56using ISSUE = std::tuple<uint64_t, uint64_t, double, double, std::string>;
58using ISSUEMAP = std::map<std::string, ISSUELIST>;
66 auto itKey = std::find_if(Keys.begin(), Keys.end(), [&
data](
const auto&
key) {
67 return data.find(key) != data.npos;
70 return itKey != Keys.end();
78 static const std::vector<std::string> aliases =
80 mch::dcs::MeasurementType::LV_V_FEE_ANALOG,
81 mch::dcs::MeasurementType::LV_V_FEE_DIGITAL,
82 mch::dcs::MeasurementType::LV_V_SOLAR});
84 auto itAlias = std::find_if(aliases.begin(), aliases.end(), [&alias](
const auto&
a) {
85 return a.find(alias) != a.npos;
88 return itAlias != aliases.end();
92void scanWhat(std::string what, std::string&
path,
bool& scanHV,
bool& scanAll, std::set<std::string>& aliases)
96 static const std::set<std::string> hvKeys{
"HV",
"Quad",
"Slat"};
97 static const std::set<std::string> lvKeys{
"LV",
"Group",
"an",
"di",
"Sol"};
103 path =
"MCH/Calib/HV";
108 printf(
"error: cannot scan HV and LV channels at the same time\n");
111 path =
"MCH/Calib/LV";
114 printf(
"error: no valid HV or LV channel to scan\n");
119 if (what.find(scanHV ?
"HV" :
"LV") != what.npos) {
124 std::istringstream input(what);
125 for (std::string alias; std::getline(input, alias,
',');) {
127 aliases.insert(alias);
129 printf(
"error: \"%s\" invalid (part of) HV or LV alias\n", alias.c_str());
141 return (ts + 500) / 1000;
151 std::string
time = std::ctime(&
t);
162 auto dt =
ms2s(tStop - tStart);
164 auto m = (dt / 60) % 60;
165 auto h = (dt / 3600) % 24;
168 return fmt::format(
"{:02}d {:02}:{:02}:{:02}",
d,
h,
m,
s);
176 std::set<int>
runs{};
178 auto isNumber = [](std::string
val) {
return !
val.empty() &&
val.find_first_not_of(
"0123456789") ==
val.npos; };
180 if (isNumber(runList)) {
182 runs.insert(std::stoi(runList));
184 }
else if (runList.find(
",") != runList.npos) {
186 std::istringstream input(runList);
187 for (std::string run; std::getline(input, run,
',');) {
189 runs.insert(std::stoi(run));
195 std::ifstream input(runList);
196 if (input.is_open()) {
197 for (std::string run; std::getline(input, run);) {
199 runs.insert(std::stoi(run));
213 RBMAP runBoundaries{};
217 for (
auto run :
runs) {
219 runBoundaries.emplace(run, boundaries);
222 return runBoundaries;
230 if (runBoundaries.empty()) {
231 printf(
"error: no run found from the list\n");
239 for (
const auto& [run, boundaries] : runBoundaries) {
240 if (boundaries.second <= boundaries.first) {
241 printf(
"error: run %d EOR <= SOR: %llu - %llu (%s - %s)\n",
242 run, (
ULL)boundaries.first, (
ULL)boundaries.second,
243 getTime(boundaries.first).c_str(),
getTime(boundaries.second).c_str());
246 if (boundaries.first <= endOfPreviousRun) {
247 printf(
"error: SOR run %d <= EOR run %d: %llu (%s) <= %llu (%s)\n",
248 run, previousRun, (
ULL)boundaries.first,
getTime(boundaries.first).c_str(),
249 (
ULL)endOfPreviousRun,
getTime(endOfPreviousRun).c_str());
253 endOfPreviousRun = boundaries.second;
266 printf(
"\nlist of runs with their boundaries:\n");
267 printf(
"------------------------------------\n");
269 for (
const auto& [run, boundaries] : runBoundaries) {
270 printf(
"%d: %llu - %llu (%s - %s)\n", run, (
ULL)boundaries.first, (
ULL)boundaries.second,
271 getTime(boundaries.first).c_str(),
getTime(boundaries.second).c_str());
274 printf(
"------------------------------------\n");
284 for (
const auto& [run, boundaries] : runBoundaries) {
286 TLine* startRunLine =
new TLine(
ms2s(boundaries.first),
c->GetUymin(),
ms2s(boundaries.first),
c->GetUymax());
287 startRunLine->SetUniqueID(run);
288 startRunLine->SetLineColor(4);
289 startRunLine->SetLineWidth(1);
290 startRunLine->Draw();
292 TLine* endRunLine =
new TLine(
ms2s(boundaries.second),
c->GetUymin(),
ms2s(boundaries.second),
c->GetUymax());
293 endRunLine->SetUniqueID(run);
294 endRunLine->SetLineColor(2);
295 endRunLine->SetLineWidth(1);
302 uint64_t tStart, uint64_t tStop, uint64_t timeInterval)
308 static const uint64_t timeMarging = 60000;
310 std::istringstream fileInfo(api.
list(what.c_str(),
false,
"text/plain",
311 tStop + timeInterval + timeMarging, tStart - timeMarging));
318 for (std::string line; std::getline(fileInfo, line);) {
319 if (line.find(
"Validity:") == 0) {
320 std::istringstream in(line);
321 in >> dummy >> begin >> dummy >>
end;
322 dpBoundaries.emplace(begin,
end);
326 if (dpBoundaries.empty()) {
327 printf(
"\e[0;31merror: no file found in %s in time range %llu - %llu (%s - %s) --> use the default one\e[0m\n",
329 dpBoundaries.emplace(1, 9999999999999);
342 if (dpBoundaries.begin()->first > tStart) {
343 printf(
"error: the beginning of the time range is not covered: %llu > %llu (%s > %s)\n",
344 (
ULL)dpBoundaries.begin()->first, (
ULL)tStart,
345 getTime(dpBoundaries.begin()->first).c_str(),
getTime(tStart).c_str());
348 if (dpBoundaries.rbegin()->second < tStop) {
349 printf(
"error: the end of the time range is not covered: %llu < %llu (%s < %s)\n",
350 (
ULL)dpBoundaries.rbegin()->second, (
ULL)tStop,
351 getTime(dpBoundaries.rbegin()->second).c_str(),
getTime(tStop).c_str());
355 uint64_t previousTStop = dpBoundaries.begin()->first;
356 for (
auto [tStart, tStop] : dpBoundaries) {
357 if (tStop <= tStart) {
358 printf(
"error: EOF <= SOF: %llu - %llu (%s - %s)\n",
362 if (tStart != previousTStop) {
363 printf(
"error: end of %s file != start of next %s file: %llu (%s) != %llu (%s))\n",
364 scanHV ?
"HV" :
"LV", scanHV ?
"HV" :
"LV",
368 previousTStop = tStop;
381 printf(
"\nlist of %s file time boundaries:\n", scanHV ?
"HV" :
"LV");
382 printf(
"------------------------------------\n");
384 for (
auto [tStart, tStop] : dpBoundaries) {
385 printf(
"%llu - %llu (%s - %s)", (
ULL)tStart, (
ULL)tStop,
getTime(tStart).c_str(),
getTime(tStop).c_str());
386 if (tStop - tStart < 60000 * (timeInterval - 1) || tStop - tStart > 60000 * (timeInterval + 1)) {
387 printf(
"\e[0;31m ! warning: validity range %s != %llu±1 min\e[0m\n",
394 printf(
"------------------------------------\n");
402 static const double lvLimits[3] = {1.5, 1.5, 6.};
404 if (alias.find(
"an") != alias.npos) {
406 }
else if (alias.find(
"di") != alias.npos) {
419 TLine* l =
new TLine(
c->GetUxmin(), limit,
c->GetUxmax(), limit);
438 return converter.value;
452 : fmt::format(
"DE{}", *
de);
459void fillDataPoints(
const std::vector<DPVAL>& dps, std::map<uint64_t, double>& dps2,
460 uint64_t tMin, uint64_t tMax,
int warningLevel)
464 static const uint64_t tolerance = 5000;
467 printf(
"error: the file does not contain any data point\n");
471 auto itDP = dps.begin();
472 auto ts = itDP->get_epoch_time();
473 std::string
header =
"warning:";
474 std::string
color = (ts + tolerance < tMin || ts > tMin + tolerance) ?
"\e[0;31m" :
"\e[0;34m";
475 bool printWarning = warningLevel > 1 || (warningLevel == 1 &&
color ==
"\e[0;31m");
479 auto previousTS = dps2.rbegin()->first;
480 if (ts != previousTS ||
getValue(*itDP) != dps2.rbegin()->second) {
481 if (ts <= previousTS) {
482 printf(
"\e[0;31mwarning: wrong data point order (%llu <= %llu)\e[0m\n", (
ULL)ts, (
ULL)previousTS);
485 printf(
"%s%s missing the previous data point (dt = %s%llu ms)",
color.c_str(),
header.c_str(),
486 (previousTS < tMin) ?
"-" :
"+",
487 (
ULL)((previousTS < tMin) ? tMin - previousTS : previousTS - tMin));
489 printf(
" but get one at dt = -%llu ms\e[0m\n", (
ULL)(tMin - ts));
500 printf(
"error: first data point exceeding file validity range (dt = +%llu ms)\n", (
ULL)(ts - tMax));
502 }
else if (ts > tMin && printWarning) {
503 printf(
"%s%s missing data point prior file start of validity (dt = +%llu ms)\e[0m\n",
510 auto previousTS = ts;
511 for (++itDP; itDP < dps.end(); ++itDP) {
512 ts = itDP->get_epoch_time();
513 if (ts <= previousTS) {
514 printf(
"\e[0;31mwarning: wrong data point order (%llu <= %llu)\e[0m\n", (
ULL)ts, (
ULL)previousTS);
518 if (ts < tMin && (warningLevel > 1 || (warningLevel == 1 && ts + tolerance < tMin))) {
519 printf(
"%s%s data point outside of file validity range (dt = -%llu ms)\e[0m\n",
520 (ts + tolerance < tMin) ?
"\e[0;31m" :
"\e[0;34m",
header.c_str(), (
ULL)(tMin - ts));
521 }
else if (ts >= tMax && warningLevel >= 1) {
522 printf(
"\e[0;31m%s data point outside of file validity range (dt = +%llu ms)\e[0m\n",
535 for (
int ch = 0; ch < 10; ++ch) {
536 for (
auto& [alias, dps] : dpsMapsPerCh[ch]) {
541 auto itFirst = dps.lower_bound(tStart);
542 if (itFirst != dps.begin()) {
543 double previousVal = std::prev(itFirst)->second;
544 for (
auto it = dps.begin(); it != itFirst;) {
547 dps.emplace(tStart, previousVal);
548 }
else if (itFirst->first != tStart) {
549 if (itFirst->first > tStop) {
550 printf(
"error (%s): all data points are posterior to the end of the time range\n", alias.c_str());
552 printf(
"error (%s): first data point is posterior to the beginning of the time range\n", alias.c_str());
554 dps.emplace(tStart, itFirst->second);
559 auto itLast = dps.upper_bound(tStop);
560 double previousVal = std::prev(itLast)->second;
561 for (
auto it = itLast; it != dps.end();) {
564 dps.emplace(tStop, previousVal);
574 const auto format1 = fmt::format(
" %llu (%s): {} V\n", hvlvFormat.c_str());
575 const auto format2 = fmt::format(
": %llu (%s): {} V -- %llu (%s): {} V\n",
576 hvlvFormat.c_str(), hvlvFormat.c_str());
578 for (
int ch = 0; ch < 10; ++ch) {
580 printf(
"\n------------ chamber %d ------------\n", ch + 1);
582 for (
const auto& [alias, dps] : dpsMapsPerCh[ch]) {
584 printf(
"- %s: %zu values", alias.c_str(), dps.size());
589 for (
const auto& [ts,
val] : dps) {
593 }
else if (!dps.empty()) {
595 const auto firstdt = dps.begin();
596 const auto lastdt = dps.rbegin();
597 printf(format2.c_str(),
598 (
ULL)firstdt->first,
getTime(firstdt->first).c_str(), firstdt->second,
599 (
ULL)lastdt->first,
getTime(lastdt->first).c_str(), lastdt->second);
609TGraph*
mapToGraph(std::string alias,
const std::map<uint64_t, double>& dps)
613 TGraph*
g =
new TGraph(dps.size());
615 auto pos = alias.find(
".");
616 auto shortAlias = alias.substr(0,
pos);
618 auto title =
de.empty() ? fmt::format(
"{}", shortAlias.c_str())
619 : fmt::format(
"{} ({})",
de.c_str(), shortAlias.c_str());
620 g->SetNameTitle(alias.c_str(), title.c_str());
623 for (
auto [ts,
val] : dps) {
628 g->SetMarkerSize(1.5);
629 g->SetMarkerStyle(2);
640 TCanvas*
c =
new TCanvas(mg->GetName(), mg->GetHistogram()->GetTitle(), 1500, 900);
642 mg->Draw(
"A plc pmc");
645 mg->GetXaxis()->SetTimeDisplay(1);
646 mg->GetXaxis()->SetTimeFormat(
"%d/%m %H:%M");
647 mg->GetXaxis()->SetTimeOffset(0,
"local");
648 mg->GetXaxis()->SetNdivisions(21010);
667 for (
auto [ts,
val] : dps) {
684 mean += prevVal * (ts - prevTS);
689 }
else if (tStart > 0) {
692 mean += prevVal * (ts - prevTS);
693 mean /= (ts - tStart);
694 issues.emplace_back(tStart, ts,
min, mean,
"");
700 if (tStart > 0 && prevTS != tStart) {
701 mean /= (prevTS - tStart);
702 issues.emplace_back(tStart, prevTS,
min, mean,
"");
708 uint64_t tMin, uint64_t tMax)
713 if (o2issues.empty()) {
714 printf(
"error: O2 returns an empty list of issues\n");
718 for (
auto itIssue = o2issues.begin(); itIssue != o2issues.end(); ++itIssue) {
721 if (itIssue->end <= tMin || itIssue->begin >= tMax) {
722 printf(
"\e[0;35mwarning: skipping O2 issue outside of file boundaries (%llu - %llu)\e[0m\n",
723 (
ULL)itIssue->begin, (
ULL)itIssue->end);
728 if (itIssue->begin < tMin - mch::StatusMapCreatorParam::Instance().timeMargin &&
729 (itIssue != o2issues.begin() || itIssue->begin != 0)) {
730 printf(
"\e[0;35mwarning: O2 returns an issue with uncommon start time (%llu < %llu)\e[0m\n",
731 (
ULL)itIssue->begin, (
ULL)(tMin - mch::StatusMapCreatorParam::Instance().timeMargin));
735 if (itIssue->end >= tMax + mch::StatusMapCreatorParam::Instance().timeMargin &&
736 (itIssue != std::prev(o2issues.end()) || itIssue->end != std::numeric_limits<uint64_t>::max())) {
737 printf(
"\e[0;35mwarning: O2 returns an issue with uncommon end time (%llu >= %llu)\e[0m\n",
738 (
ULL)itIssue->end, (
ULL)(tMax + mch::StatusMapCreatorParam::Instance().timeMargin));
743 if (itIssue->begin <= tMin && !issues.empty() && std::get<1>(issues.back()) == tMin) {
744 std::get<1>(issues.back()) = std::min(itIssue->end, tMax);
746 issues.emplace_back(std::max(itIssue->begin, tMin), std::min(itIssue->end, tMax), 0., 0.,
"");
758 for (
const auto& [run, boundaries] : runBoundaries) {
760 if (boundaries.second <= tStart) {
762 }
else if (boundaries.first >= tStop) {
766 runs += fmt::format(
"{},", run);
781 for (
int ch = 0; ch < 10; ++ch) {
782 for (
auto& issues : issuesPerCh[ch]) {
783 for (
auto itIssue = issues.second.begin(); itIssue != issues.second.end();) {
785 auto tStart = std::get<0>(*itIssue);
786 auto tStop = std::get<1>(*itIssue);
788 if (tStop - tStart < minDuration) {
790 itIssue = issues.second.erase(itIssue);
798 itIssue = issues.second.erase(itIssue);
802 std::get<4>(*itIssue) =
runs;
817 for (
int ch = 0; ch < 10; ++ch) {
818 for (
auto& issues : issuesPerCh[ch]) {
819 for (
auto itIssue = issues.second.begin(); itIssue != issues.second.end();) {
821 auto& tStart = std::get<0>(*itIssue);
822 auto& tStop = std::get<1>(*itIssue);
828 itIssue = issues.second.erase(itIssue);
832 tStart = std::max(tStart, runBoundaries.begin()->second.first);
833 tStop = std::min(tStop, runBoundaries.rbegin()->second.second);
834 std::get<4>(*itIssue) =
runs;
848 auto itIssue = std::find_if(issues.begin(), issues.end(), [&issue](
const auto&
i) {
849 return (std::get<0>(i) == std::get<0>(issue) &&
850 std::get<1>(i) == std::get<1>(issue) &&
851 std::get<4>(i) == std::get<4>(issue));
854 if (itIssue != issues.end()) {
855 issues.erase(itIssue);
864 bool scanHV, std::string hvlvFormat)
871 for (
int ch = 0; ch < 10; ++ch) {
872 issuesPerChCopy[ch] = issuesPerCh[ch];
873 o2IssuesPerChCopy[ch] = o2IssuesPerCh[ch];
878 for (
int ch = 0; ch < 10; ++ch) {
879 for (
const auto& [alias, o2Issues] : o2IssuesPerChCopy[ch]) {
880 if (!o2Issues.empty()) {
881 issuesPerChCopy[ch].try_emplace(alias,
ISSUELIST{});
889 printf(
"Problem found for %s:\n", alias.c_str());
891 printf(
"Problem found for %s (%s):\n", alias.c_str(),
de.c_str());
895 const auto format = fmt::format(
"%llu - %llu: %s (duration = %s, min = {} V, mean = {} V) --> run(s) %s\n",
896 hvlvFormat.c_str(), hvlvFormat.c_str());
899 const auto& [tStart, tStop,
min, mean,
runs] = issue;
900 printf(
"%s",
color.c_str());
907 printf(
"\n------ list of issues from \e[0;31mthis macro only\e[0m, \e[0;35mO2 only\e[0m, or \e[0;32mboth\e[0m ------\n");
909 printf(
"\n------ list of issues ------\n");
912 bool foundIssues =
false;
914 for (
int ch = 0; ch < 10; ++ch) {
915 for (
const auto& [alias, issues] : issuesPerChCopy[ch]) {
917 auto& o2Issues = o2IssuesPerChCopy[ch][alias];
919 if (!issues.empty() || !o2Issues.empty()) {
925 for (
const auto& issue : issues) {
927 std::string
color = (scanHV && !
eraseIssue(issue, o2Issues)) ?
"\e[0;31m" :
"\e[0;32m";
928 printIssue(issue,
color);
932 for (
const auto& issue : o2Issues) {
933 printIssue(issue,
"\e[0;35m");
936 printf(
"----------------------------\n");
942 printf(
"----------------------------\n");
951 std::string runList =
"";
952 std::string what =
"";
953 std::string config =
"";
956 int warningLevel = 1;
958 std::string outFileName =
"";
960 po::options_description
usage(
"Usage");
963 (
"help,h",
"produce help message")
964 (
"runs,r",po::value<std::string>(&runList)->default_value(
""),
"run(s) to scan (comma separated list of runs or ASCII file with one run per line)")
965 (
"channels,c",po::value<std::string>(&what)->default_value(
""),R
"(channel(s) to scan ("HV" or "LV" or comma separated list of (part of) DCS aliases))")
966 ("configKeyValues",po::value<std::string>(&config)->default_value(
""),
"Semicolon separated key=value strings to change HV thresholds")
967 (
"duration,d",po::value<uint64_t>(&minDuration)->default_value(0),
"minimum duration (ms) of HV/LV issues to consider")
968 (
"interval,i",po::value<uint64_t>(&timeInterval)->default_value(30),
"creation time interval (minutes) between CCDB files")
969 (
"warning,w",po::value<int>(&warningLevel)->default_value(1),
"warning level (0, 1 or 2)")
970 (
"print,p",po::value<int>(&printLevel)->default_value(1),
"print level (0, 1, 2 or 3)")
971 (
"output,o",po::value<std::string>(&outFileName)->default_value(
"scan.root"),
"output root file name")
975 po::options_description cmdline;
978 po::variables_map vm;
979 po::store(po::command_line_parser(argc, argv).options(cmdline).run(), vm);
981 if (vm.count(
"help")) {
982 std::cout <<
"This program scans HV or LV channels looking for issues\n";
983 std::cout <<
usage <<
"\n";
989 }
catch (
const po::error&
e) {
990 std::cout <<
"error: " <<
e.what() <<
"\n";
994 if (runList.empty()) {
995 printf(
"error: you must provide run(s) to scan\n");
1000 printf(
"error: you must provide channel(s) to scan\n");
1005 const double hvRange[2] = {-10., 1700.};
1006 const double lvRange[3] = {-1., 4., 8.};
1007 const std::string hvFormat =
"%7.2f";
1008 const std::string lvFormat =
"%4.2f";
1009 gStyle->SetPalette(kVisibleSpectrum);
1018 bool scanHV =
false;
1019 bool scanAll =
false;
1020 std::set<std::string> aliases{};
1024 api.
init(
"http://alice-ccdb.cern.ch");
1028 if (printLevel > 0) {
1034 auto dpBoundaries =
getDPBoundaries(api,
path.c_str(), runBoundaries.begin()->second.first,
1035 runBoundaries.rbegin()->second.second, timeInterval * 60000);
1036 if (printLevel > 0) {
1040 runBoundaries.rbegin()->second.second);
1046 std::map<std::string, std::string> metadata;
1047 for (
auto boundaries : dpBoundaries) {
1052 for (
const auto& [dpid, dps] : *dpMap) {
1053 std::string alias(dpid.get_alias());
1055 printf(
"error: invalid DCS alias: %s\n", alias.c_str());
1058 if ((scanAll ||
containsAKey(alias, aliases)) && (!scanHV || alias.find(
".iMon") == alias.npos)) {
1060 fillDataPoints(dps, dpsMapsPerCh[chamber][alias], boundaries.first, boundaries.second, warningLevel);
1066 hvStatusCreator.findBadHVs(*dpMap);
1067 for (
const auto& [alias, issues] : hvStatusCreator.getBadHVs()) {
1070 fillO2Issues(issues, o2issuesPerCh[chamber][alias], boundaries.first, boundaries.second);
1075 if (printLevel > 1) {
1076 printf(
"\nall data points:");
1077 printDataPoints(dpsMapsPerCh, scanHV ? hvFormat : lvFormat, printLevel > 2);
1081 selectDataPoints(dpsMapsPerCh, runBoundaries.begin()->second.first, runBoundaries.rbegin()->second.second);
1082 if (printLevel > 1) {
1083 printf(
"\ndata points in the time range covered by runs:");
1084 printDataPoints(dpsMapsPerCh, scanHV ? hvFormat : lvFormat, printLevel > 2);
1089 TMultiGraph* mg[10];
1090 std::set<double> limits;
1091 for (
int ch = 0; ch < 10; ++ch) {
1092 mg[ch] =
new TMultiGraph;
1093 mg[ch]->SetNameTitle(fmt::format(
"ch{}", ch + 1).c_str(),
1094 fmt::format(
"chamber {};time;{} (V)", ch + 1, scanHV ?
"HV" :
"LV").c_str());
1095 for (
const auto& [alias, dps] : dpsMapsPerCh[ch]) {
1097 auto limit = scanHV ? mch::StatusMapCreatorParam::Instance().hvLimits[ch] :
getLVLimit(alias);
1098 limits.emplace(limit);
1099 findIssues(dps, limit, issuesPerCh[ch][alias]);
1106 printIssues(issuesPerCh, o2issuesPerCh, scanHV, scanHV ? hvFormat : lvFormat);
1110 for (
int ch = 0; ch < 10; ++ch) {
1113 drawLimit(mch::StatusMapCreatorParam::Instance().hvLimits[ch],
c[ch]);
1115 auto lvMax = (what.find(
"LV") != what.npos || what.find(
"Sol") != what.npos) ? lvRange[2] : lvRange[1];
1117 for (
auto limit : limits) {
1125 TFile dataFile(outFileName.c_str(),
"recreate");
1126 for (
int ch = 0; ch < 10; ++ch) {
std::vector< std::string > header
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to runs
char error[CURL_ERROR_SIZE]
Class for time synchronization of RawReader instances.
std::pair< int64_t, int64_t > getRunDuration(int runnumber, bool fatal=true)
std::string list(std::string const &path="", bool latestOnly=false, std::string const &returnFormat="text/plain", long createdNotAfter=-1, long createdNotBefore=-1) const
void init(std::string const &hosts)
std::enable_if<!std::is_base_of< o2::conf::ConfigurableParam, T >::value, T * >::type retrieveFromTFileAny(std::string const &path, std::map< std::string, std::string > const &metadata, long timestamp=-1, std::map< std::string, std::string > *headers=nullptr, std::string const &etag="", const std::string &createdNotAfter="", const std::string &createdNotBefore="") const
static void setValue(std::string const &mainkey, std::string const &subkey, T x)
static void updateFromString(std::string const &)
Find HV issues from DCS data points and add them to the status map.
std::unordered_map< DPID, std::vector< DPVAL > > DPMAP
GLsizei const GLfloat * value
GLsizei const GLchar *const * path
GLboolean GLboolean GLboolean GLboolean a
GLint GLint GLsizei GLint GLenum format
GLsizeiptr const void GLenum usage
int toInt(Chamber chamber)
Chamber aliasToChamber(std::string_view alias)
int aliasToNumber(std::string_view dcsAlias)
std::vector< std::string > aliases(std::vector< MeasurementType > types={ MeasurementType::HV_V, MeasurementType::HV_I, MeasurementType::LV_V_FEE_ANALOG, MeasurementType::LV_V_FEE_DIGITAL, MeasurementType::LV_V_SOLAR})
std::optional< int > aliasToDetElemId(std::string_view dcsAlias)
bool isValid(std::string_view dcsAlias)
bool isQuadrant(Chamber chamber)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string to_string(gsl::span< T, Size > span)
void printDPBoundaries(const DPBMAP &dpBoundaries, bool scanHV, uint64_t timeInterval)
std::string getTime(uint64_t ts)
void printIssues(const ISSUEMAP issuesPerCh[10], const ISSUEMAP o2IssuesPerCh[10], bool scanHV, std::string hvlvFormat)
bool isValid(std::string alias)
std::tuple< uint64_t, uint64_t, double, double, std::string > ISSUE
void selectIssues(ISSUEMAP issuesPerCh[10], const RBMAP &runBoundaries, uint64_t minDuration)
void selectO2Issues(ISSUEMAP issuesPerCh[10], const RBMAP &runBoundaries)
std::string getDE(std::string alias)
void fillO2Issues(const std::vector< mch::HVStatusCreator::TimeRange > &o2issues, ISSUELIST &issues, uint64_t tMin, uint64_t tMax)
bool containsAKey(std::string data, const std::set< std::string > &Keys)
void printDataPoints(const DPMAP2 dpsMapsPerCh[10], std::string hvlvFormat, bool all)
void drawRunBoudaries(const RBMAP &runBoundaries, TCanvas *c)
TGraph * mapToGraph(std::string alias, const std::map< uint64_t, double > &dps)
void checkRunBoundaries(const RBMAP &runBoundaries)
double getValue(DPVAL dp)
void checkDPBoundaries(const DPBMAP &dpBoundaries, bool scanHV, uint64_t tStart, uint64_t tStop)
void fillDataPoints(const std::vector< DPVAL > &dps, std::map< uint64_t, double > &dps2, uint64_t tMin, uint64_t tMax, int warningLevel)
std::map< uint64_t, uint64_t > DPBMAP
DPBMAP getDPBoundaries(ccdb::CcdbApi const &api, std::string what, uint64_t tStart, uint64_t tStop, uint64_t timeInterval)
std::set< int > getRuns(std::string runList)
void drawLimit(double limit, TCanvas *c)
std::string getDuration(uint64_t tStart, uint64_t tStop)
std::map< std::string, std::map< uint64_t, double > > DPMAP2
void findIssues(const std::map< uint64_t, double > &dps, double limit, ISSUELIST &issues)
uint64_t ms2s(uint64_t ts)
void selectDataPoints(DPMAP2 dpsMapsPerCh[10], uint64_t tStart, uint64_t tStop)
RBMAP getRunBoundaries(ccdb::CcdbApi const &api, std::string runList)
bool eraseIssue(const ISSUE &issue, ISSUELIST &issues)
std::string findAffectedRuns(const RBMAP &runBoundaries, uint64_t tStart, uint64_t tStop)
void scanWhat(std::string what, std::string &path, bool &scanHV, bool &scanAll, std::set< std::string > &aliases)
TCanvas * drawDataPoints(TMultiGraph *mg, double min, double max)
std::map< std::string, ISSUELIST > ISSUEMAP
std::map< int, std::pair< uint64_t, uint64_t > > RBMAP
void printRunBoundaries(const RBMAP &runBoundaries)
double getLVLimit(std::string alias)
std::vector< ISSUE > ISSUELIST