50inline std::istream&
operator>>(std::istream& in, TTimeStamp&
object)
65 is.str(
replace(buffer,
'-',
' '));
67 if (is >> year >> month >> day) {
76 is.str(
replace(buffer,
':',
' '));
78 if (is >> hour >> min >> sec) {
80 object =
TTimeStamp(year, month, day, hour, min, sec);
88 in.setstate(ios::failbit);
134 JParser<> zap(
"Example program to plot quality data from data base or input file.");
140 zap[
'f'] =
make_field(inputFile,
"Optional input file instead of database.") =
"";
141 zap[
'o'] =
make_field(
outputFile,
"ROOT file with histograms and n-tuple or ASCII file with QA/QC data.") =
"monitor.root";
143 zap[
'S'] =
make_field(source,
"GIT versions") = getGITTags(
TRegexp(
"v[0-9]*\\.[0-9]*\\.[0-9]*$"), JGITTags_t::key_type(
"2019-04-12"));
150 catch(
const exception &error) {
167 NOTICE(
"Extracting run information from database... " << flush);
171 for (
JRuns parameters; rs >> parameters; ) {
173 parameters.DETID =
ID;
175 if (
UTC(parameters.getRunStartTime())) {
185 FATAL(
"No runs for detector " << detid <<
endl);
190 if (inputFile ==
"") {
203 selector.add(&JRunSummaryNumbers::SOURCE_NAME, *git);
207 NOTICE(
"Extracting run summmary information with source " << *git <<
" from database... " << flush);
212 zmap[parameters.RUN].insert(
make_pair(parameters.PARAMETER_NAME, parameters.DATA_VALUE));
219 catch(
const exception& error) {
NOTICE(
endl); }
221 for (map_type::const_iterator run = zmap.begin(); run != zmap.end(); ++run) {
229 for (data_type::const_iterator p = run->second.begin(); p != run->second.end(); ++p) {
230 quality.put(p->first, p->second);
258 catch(
const exception& error) {
263 if (getFilenameExtension(
outputFile) == ROOT_FILE_FORMAT) {
269 X.push_back(
runs. begin()->getRunStartTime());
272 X.push_back(
quality->UTCMin_s);
273 X.push_back(
quality->UTCMax_s);
276 X.push_back(
runs.rbegin()->getRunStartTime());
278 sort(X.begin(), X.end());
285 bool operator()(
const double x1,
const double x2)
287 return x2 - x1 <= xmin;
295 TH1D h0(
"livetime_s",
NULL, X.size() - 1, X.data());
296 TH1D h1(
"QAQC",
NULL, X.size() - 1, X.data());
302 if (
debug >= debug_t) {
305 <<
setw(8) << i->RUN <<
' '
311 cout <<
"missing QA/QC data";
316 h1.Fill(i->getRunStartTime() +
Tmin_s, (
quality != buffer.end() ? 1.0 : -1.0));
319 JManager<string, TH1D>
H1(
new TH1D(
"H[%]",
NULL, X.size() - 1, X.data()));
320 JManager<string, TH1D>
R1(
new TH1D(
"R[%]",
NULL, X.size() - 1, X.data()));
329 H1[
"JTrigger3DShower"] ->
Fill(x,
quality->JTrigger3DShower);
331 H1[
"JTriggerMXShower"] ->
Fill(x,
quality->JTriggerMXShower);
333 if (
quality->livetime_s > 0.0) {
344 W[0] = *X.rbegin() - *X.begin();
350 NOTICE(
"Average data taking efficiency " <<
FIXED(5,1) << 100.0*W[1]/W[0] <<
" %." <<
endl);
353 for (
TH1* p : { &h0, &h1 }) {
354 p->GetXaxis()->SetTimeDisplay(1);
355 p->GetXaxis()->SetTimeFormat(TIMESTAMP);
359 for (JManager<string, TH1D>::iterator p =
H1.begin(); p !=
H1.end(); ++p) {
363 for (
Int_t i = 1; i <= p->second->GetXaxis()->GetNbins(); ++i) {
364 p->second->SetBinContent(i, (W += p->second->GetBinContent(i)));
367 p->second->GetXaxis()->SetTimeDisplay(1);
368 p->second->GetXaxis()->SetTimeFormat(TIMESTAMP);
369 p->second->Sumw2(
false);
372 for (JManager<string, TH1D>::iterator p =
R1.begin(); p !=
R1.end(); ++p) {
374 p->second->GetXaxis()->SetTimeDisplay(1);
375 p->second->GetXaxis()->SetTimeFormat(TIMESTAMP);
376 p->second->Sumw2(
false);
381 out << h0 << h1 <<
H1 <<
R1;
388 if (getFilenameExtension(
outputFile) == ASCII_FILE_FORMAT) {
394 out.setf(ios::fixed);
TString replace(const TString &target, const TRegexp ®exp, const T &replacement)
Replace regular expression in input by given replacement.