13 #include "TTimeStamp.h" 
   45 inline std::istream& 
operator>>(std::istream& 
in, TTimeStamp& 
object)
 
   60     is.str(
replace(buffer, 
'-', 
' '));
 
   62     if (is >> year >> month >> day) {
 
   71         is.str(
replace(buffer, 
':', 
' '));
 
   73         if (is >> hour >> min >> sec) {
 
   75           object = TTimeStamp(year, month, day, hour, min, sec);
 
   83   in.setstate(ios::failbit);
 
   96 inline std::ostream& 
operator>>(std::ostream& out, 
const TTimeStamp& 
object)
 
   98   return out << 
object.AsString();
 
  108 int main(
int argc, 
char **argv)
 
  122   JRange<TTimeStamp> UTC;
 
  128     JParser<> zap(
"Example program to plot quality data from data base.");
 
  137     zap[
'U'] = 
make_field(UTC)           = JRange<TTimeStamp>();
 
  143   catch(
const exception &error) {
 
  144     FATAL(error.what() << endl);
 
  159       ID = to_value<int>(detid);
 
  167       ResultSet& rs  = 
getResultSet(getTable<JRuns>(), getSelector<JRuns>(ID));
 
  171         parameters.DETID = 
ID;
 
  173         if (UTC(parameters.getRunStartTime())) {
 
  174           data.push_back(parameters);
 
  180     catch(
const exception& error) {}
 
  195       JSelector selector = getSelector<JRunSummaryNumbers>(detid, runs.getLowerLimit(), runs.getUpperLimit());
 
  197       selector.add(&JRunSummaryNumbers::SOURCE_NAME, *i);
 
  201         ResultSet& rs  = 
getResultSet(getTable<JRunSummaryNumbers>(), selector);
 
  204           zmap[parameters.RUN].insert(make_pair(parameters.PARAMETER_NAME, parameters.DATA_VALUE));
 
  207       catch(
const exception& error) {}
 
  209       for (map_type::const_iterator run = zmap.begin(); run != zmap.end(); ++run) {
 
  214         quality.detector = 
ID;
 
  215         quality.run      = run->first;
 
  217         for (data_type::const_iterator p = run->second.begin(); p != run->second.end(); ++p) {
 
  218           quality.put(p->first, p->second);
 
  221         qaqc.insert(JRun_t(ID, quality.run));
 
  223         if (UTC(TTimeStamp(quality.UTCMin_s, 0)) &&
 
  224             UTC(TTimeStamp(quality.UTCMax_s, 0))) {
 
  228           if (p == buffer.end() || p->run != quality.run) {
 
  229             buffer.insert(p, quality);
 
  235   catch(
const exception& error) {
 
  236     FATAL(error.what() << endl);
 
  239   if (buffer.empty()) {
 
  240     FATAL(
"No valid QA/QC data for detector " << detid << endl);
 
  249     X.push_back(quality->UTCMin_s);
 
  250     X.push_back(quality->UTCMax_s);
 
  253   sort(X.begin(), X.end());
 
  260     bool operator()(
const double x1, 
const double x2) 
 
  262       return x2 - x1 <= xmin;
 
  268   X.push_back(data.rbegin()->getRunStartTime());    
 
  270   X.erase(unique(X.begin(), X.end(), Xmin(Tmin_s)), X.end());
 
  272   TH1D h0(
"livetime_s", NULL, X.size() - 1, X.data());
 
  273   TH1D 
h1(
"QAQC",       NULL, X.size() - 1, X.data());
 
  277     const JRun_t run(i->DETID,i->RUN);
 
  282            << setw(8) << i->RUN                                        << 
' '  
  283            << TTimeStamp((time_t) i->UNIXSTARTTIME/1000).AsString(
"c") << 
' ';
 
  287       if (quality != buffer.end() && quality->run == i->RUN) {
 
  288         cout << 
"[" << TTimeStamp((time_t) quality->UTCMin_s).AsString(
"c") << 
"," << TTimeStamp((time_t) quality->UTCMax_s).AsString(
"c") << 
"]";
 
  290         cout << (
qaqc.count(run) == 0 ? 
"missing" : 
"invalid") << 
" QA/QC data";
 
  298     if (! binary_search(buffer.begin(), buffer.end(), run)) {
 
  299       W = (
qaqc.count(run) == 0 ? -1.0 : 0.0);
 
  302     h1.Fill(i->getRunStartTime() + Tmin_s, W);
 
  305   JManager<string, TH1D> H1(
new TH1D(
"%", NULL, X.size() - 1, X.data()));  
 
  309     const double x = 0.5 * (quality->UTCMin_s + quality->UTCMax_s);
 
  311     h0.Fill(x, 100.0 * quality->livetime_s / (quality->UTCMax_s - quality->UTCMin_s));
 
  313     H1[
"JDAQEvent"]        -> Fill(x, quality->JDAQEvent);
 
  314     H1[
"JTrigger3DShower"] -> Fill(x, quality->JTrigger3DShower);
 
  315     H1[
"JTrigger3DMuon"]   -> Fill(x, quality->JTrigger3DMuon);
 
  316     H1[
"JTriggerMXShower"] -> Fill(x, quality->JTriggerMXShower);
 
  320   Double_t W[2] = { 0.0 };
 
  322   W[0] = *X.rbegin() - *X.begin();
 
  325     W[1] += quality->livetime_s;
 
  328   NOTICE(
"Average data taking efficiency  " << 
FIXED(5,1) << 100.0*W[1]/W[0] << 
" %." << endl);
 
  331   for (TH1* buffer[] = { &h0, &
h1, NULL }, **
h1 = buffer; *
h1 != NULL; ++
h1) {
 
  332     (*h1)->GetXaxis()->SetTimeDisplay(1);
 
  333     (*h1)->GetXaxis()->SetTimeFormat(
TIMESTAMP);
 
  336   for (JManager<string, TH1D>::iterator p = H1.begin(); p != H1.end(); ++p) {
 
  338     p->second->GetXaxis()->SetTimeDisplay(1);
 
  339     p->second->GetXaxis()->SetTimeFormat(
TIMESTAMP);
 
  343     for (Int_t i = 1; i <= p->second->GetXaxis()->GetNbins(); ++i) {
 
  344       p->second->SetBinContent(i, (W += p->second->GetBinContent(i)));
 
  350   out << h0 << 
h1 << H1;
 
Utility class to parse command line options. 
 
TString replace(const TString &target, const TRegexp ®exp, const T &replacement)
Replace regular expression in input by given replacement. 
 
Print objects in ASCII format using ROOT dictionary. 
 
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
 
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
 
then for HISTOGRAM in h0 h1
 
Dynamic ROOT object management. 
 
Auxiliary data structure for floating point format specification. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
then usage $script[detector file[variant[identifier]]] fi case set_variable ID
 
bool is_integer(const std::string &buffer)
Check if string is an integer. 
 
Auxiliary methods to convert data members or return values of member methods of a set of objects to a...
 
General purpose messaging. 
 
JRange< Double_t > JRange_t
 
static const JDetectorsHelper & getDetector
Function object for mapping serial number and object identifier of detectors. 
 
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input. 
 
Auxiliary class to define a range between two values. 
 
Utility class to parse command line options. 
 
ResultSet & getResultSet(const std::string &query)
Get result set. 
 
static const char *const TIMESTAMP
Time stamp of earliest UTC time. 
 
int qaqc
QA/QC file descriptor. 
 
int main(int argc, char *argv[])