Skip to content

Commit cdc0fec

Browse files
committed
add warning
1 parent 37da9df commit cdc0fec

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

Detectors/MUON/MCH/Conditions/src/scan-hvlv-ccdb.cxx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,20 @@ std::string getTime(uint64_t ts)
153153
return time;
154154
}
155155

156+
//----------------------------------------------------------------------------
157+
std::string getDuration(uint64_t tStart, uint64_t tStop)
158+
{
159+
/// get the duration (dd hh:mm:ss) between the two time stamps (ms)
160+
161+
auto dt = ms2s(tStop - tStart);
162+
auto s = dt % 60;
163+
auto m = (dt / 60) % 60;
164+
auto h = (dt / 3600) % 24;
165+
auto d = dt / 86400;
166+
167+
return fmt::format("{:02}d {:02}:{:02}:{:02}", d, h, m, s);
168+
}
169+
156170
//----------------------------------------------------------------------------
157171
std::set<int> getRuns(std::string runList)
158172
{
@@ -359,15 +373,21 @@ void checkDPBoundaries(const DPBMAP& dpBoundaries, bool scanHV, uint64_t tStart,
359373
}
360374

361375
//----------------------------------------------------------------------------
362-
void printDPBoundaries(const DPBMAP& dpBoundaries, bool scanHV)
376+
void printDPBoundaries(const DPBMAP& dpBoundaries, bool scanHV, uint64_t timeInterval)
363377
{
364378
/// print the time boundaries of every HV/LV files found in the full time range
365379

366380
printf("\nlist of %s file time boundaries:\n", scanHV ? "HV" : "LV");
367381
printf("------------------------------------\n");
368382

369383
for (auto [tStart, tStop] : dpBoundaries) {
370-
printf("%llu - %llu (%s - %s)\n", tStart, tStop, getTime(tStart).c_str(), getTime(tStop).c_str());
384+
printf("%llu - %llu (%s - %s)", tStart, tStop, getTime(tStart).c_str(), getTime(tStop).c_str());
385+
if (tStop - tStart < 60000 * (timeInterval - 1) || tStop - tStart > 60000 * (timeInterval + 1)) {
386+
printf("\e[0;31m ! warning: validity range %s != %llu±1 min\e[0m\n",
387+
getDuration(tStart, tStop).c_str(), timeInterval);
388+
} else {
389+
printf("\n");
390+
}
371391
}
372392

373393
printf("------------------------------------\n");
@@ -402,20 +422,6 @@ void drawLimit(double limit, TCanvas* c)
402422
l->Draw();
403423
}
404424

405-
//----------------------------------------------------------------------------
406-
std::string getDuration(uint64_t tStart, uint64_t tStop)
407-
{
408-
/// get the duration (dd hh:mm:ss) between the two time stamps (ms)
409-
410-
auto dt = ms2s(tStop - tStart);
411-
auto s = dt % 60;
412-
auto m = (dt / 60) % 60;
413-
auto h = (dt / 3600) % 24;
414-
auto d = dt / 86400;
415-
416-
return fmt::format("{:02}d {:02}:{:02}:{:02}", d, h, m, s);
417-
}
418-
419425
//----------------------------------------------------------------------------
420426
double getValue(DPVAL dp)
421427
{
@@ -1027,7 +1033,7 @@ int main(int argc, char** argv)
10271033
auto dpBoundaries = getDPBoundaries(api, path.c_str(), runBoundaries.begin()->second.first,
10281034
runBoundaries.rbegin()->second.second, timeInterval * 60000);
10291035
if (printLevel > 0) {
1030-
printDPBoundaries(dpBoundaries, scanHV);
1036+
printDPBoundaries(dpBoundaries, scanHV, timeInterval);
10311037
}
10321038
checkDPBoundaries(dpBoundaries, scanHV, runBoundaries.begin()->second.first,
10331039
runBoundaries.rbegin()->second.second);

0 commit comments

Comments
 (0)