128   typedef JRange<int>           JRange_t; 
 
  140   JCondition_t    condition;
 
  148     JParser<> zap(
"Main program to evaluate quality data from data base."\
 
  149                   "\nThe condition and veto can be any TFormula compatible expression involving QA/QC parameters (see e.g. JQAQC.sh -h).");
 
  155     zap[
'f'] = 
make_field(inputFile,  
"Optional input file instead of database.")       = 
"";
 
  156     zap[
'o'] = 
make_field(
outputFile, 
"ROOT file with histograms and n-tuple or ASCII file with QA/QC data.") = 
"quality.root";
 
  158     zap[
'R'] = 
make_field(runs,       
"Run range")                                      = JRange_t(1, JRange_t::getMaximum());
 
  159     zap[
'S'] = 
make_field(source,     
"GIT versions")                                   = 
getGITTags(TRegexp(
"v[0-9]*\\.[0-9]*\\.[0-9]*$"), JGITTags_t::key_type(
"2019-04-12"));
 
  168   catch(
const exception &error) {
 
  169     FATAL(error.what() << endl);
 
  175   for (JCondition_t::const_iterator i = condition.begin(); i != condition.end(); ++i) {
 
  181       FATAL(
"Invalid total weight: " << W << endl);
 
  190   if (inputFile == 
"") {                    
 
  201         ID = to_value<int>(detid);
 
  211       selection += getSelector<JRuns>(
ID);
 
  213       NOTICE(
"Extracting run information from database... " << flush);
 
  215       ResultSet& rs  = 
getResultSet(getTable<JRuns>(), selection);
 
  218         if (TString(parameters.RUNSETUPNAME.c_str()).Contains(regexp)) {
 
  219           setups.put(parameters);
 
  236         JSelector selector = getSelector<JRunSummaryNumbers>(detid, runs.getLowerLimit(), runs.getUpperLimit());
 
  238         selector.add(&JRunSummaryNumbers::SOURCE_NAME, *git);
 
  242           NOTICE(
"Extracting run summmary information with source " << *git << 
" from database... " << flush);
 
  244           ResultSet& rs  = 
getResultSet(getTable<JRunSummaryNumbers>(), selector);
 
  246           for (JRunSummaryNumbers parameters; rs >> 
parameters; ) {
 
  247             if (setups.has(parameters.RUN)) {
 
  248               zmap[parameters.RUN].insert(make_pair(parameters.PARAMETER_NAME, parameters.DATA_VALUE));
 
  256         catch(
const exception& error) { 
NOTICE(endl); }
 
  258         for (map_type::const_iterator run = zmap.begin(); run != zmap.end(); ++run) {
 
  263           quality.detector = 
ID;
 
  264           quality.run      = run->first;
 
  266           for (data_type::const_iterator i = run->second.begin(); i != run->second.end(); ++i) {
 
  267             quality.put(i->first, i->second);
 
  270           buffer.insert(quality);           
 
  274     catch(
const exception& error) {
 
  275       FATAL(error.what() << endl);
 
  280     ifstream 
in(inputFile.c_str());
 
  287     int nd = getListOfDataMembers<JRunQuality>().size();
 
  293       istringstream 
is(header);
 
  295       nc = 
distance(istream_iterator<string>(
is), istream_iterator<string>());
 
  300     for (JRunQuality quality; reader.getObject(quality); ) {
 
  302       buffer.insert(quality);
 
  308         reader.getObject(setup);
 
  310         setups[quality.run] = setup;
 
  318   if (buffer.empty()) {
 
  319     FATAL(
"No data." << endl);
 
  325     runs = JRange_t(buffer.begin()->run, buffer.rbegin()->run);
 
  327     TH1D h0(
"h0", NULL, 1000, 0.0, 1.01);
 
  328     TH1D 
h1(
"h1", NULL, condition.size(), -0.5, condition.size() + 0.5);
 
  331     h0.SetMaximum(1.1 * (runs.getUpperLimit() - runs.getLowerLimit()));
 
  334     h1.SetMaximum(1.1 * (runs.getUpperLimit() - runs.getLowerLimit()));
 
  336     const Double_t xmin = runs.getLowerLimit() - 0.5;
 
  337     const Double_t xmax = runs.getUpperLimit() + 0.5;
 
  339     JManager<TString, TH1D> 
H1(
new TH1D(
"%", NULL, runs.getLength() + 1, xmin, xmax));
 
  343     for (JCondition_t::const_iterator i = condition.begin(); i != condition.end();++i) {
 
  344       H1[i->formula]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(
"C " << i->formula << 
":upper"), 
MAKE_CSTRING(i->range.getUpperLimit()), xmin, xmax));
 
  345       H1[i->formula]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(
"C " << i->formula << 
":lower"), 
MAKE_CSTRING(i->range.getLowerLimit()), xmin, xmax));
 
  348     for (JCondition_t::const_iterator i = veto.begin(); i != veto.end();++i) {
 
  349       H1[i->formula]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(
"V " << i->formula << 
":upper"), 
MAKE_CSTRING(i->range.getUpperLimit()), xmin, xmax));
 
  350       H1[i->formula]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(
"V " << i->formula << 
":lower"), 
MAKE_CSTRING(i->range.getLowerLimit()), xmin, xmax));
 
  357     for (
size_t i = 0; i != condition.size(); ++i) {
 
  358       os << 
":" << (char) (
'a' + i);
 
  363     TNtuple n1(
"n1", 
"quality", os.str().c_str());
 
  374       for (
size_t i = 0; i != condition.size(); ++i) {
 
  376         const JCondition& ps = condition[i];
 
  377         const double      y  = 
getResult(ps.formula, *quality);
 
  379         DEBUG(ps.formula << 
' ' << y << endl);
 
  381         tuple.push_back((Float_t) y);
 
  383         TH1D* p = 
H1[ps.formula];
 
  385         p->SetBinContent(p->FindBin((
double) quality->run), y);
 
  386         p->SetBinError  (p->FindBin((
double) quality->run), 0.0);
 
  392         h1.AddBinContent(i + 1, ps.range(y) ? 1.0 : 0.0);
 
  395       const double Q = w/W;
 
  397       tuple.push_back((Float_t) Q);
 
  401       for (
size_t i = 0; i != veto.size(); ++i) {
 
  403         const JCondition& ps = veto[i];
 
  404         const double      y  = 
getResult(ps.formula, *quality);
 
  408         p->SetBinContent(p->FindBin((
double) quality->run), ps.range(y) ? 0.0 : 1.0);
 
  409         p->SetBinError  (p->FindBin((
double) quality->run), 0.0);
 
  416       tuple.push_back((Float_t) V);
 
  417       tuple.push_back((Float_t) setups.get(quality->run));
 
  420       n1.Fill(tuple.data());
 
  422       cout << setw(8) << quality->run << 
' ' << 
FIXED(5,3) << Q << 
' ' << setw(2) << V << endl;
 
  427     for (Int_t i = 0; i <= h0.GetXaxis()->GetNbins(); ++i) {
 
  428       h0.SetBinContent(i, (w += h0.GetBinContent(i)));
 
  435     out << h0 << 
h1 << n1 << 
H1;
 
  450     comment.add(JMeta(argc, argv));
 
  456     for (
const auto& i : getListOfDataMembers<JRunQuality>()) {
 
  457       out << i->GetName() << 
' ';
 
  460     out << 
"setup" << endl;
 
  466       writer.putObject(*i);
 
  470       writer.putObject(setups.get(i->run));
 
Utility class to parse command line options. 
 
Q(UTCMax_s-UTCMin_s)-livetime_s
 
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance. 
 
*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
 
#define MAKE_CSTRING(A)
Make C-string. 
 
then for HISTOGRAM in h0 h1
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Auxiliary data structure for floating point format specification. 
 
static const char *const ASCII_FILE_FORMAT
ASCII file name extension. 
 
#define MAKE_STRING(A)
Make string. 
 
std::vector< std::string > getGITTags(const TRegexp ®exp, const JGITTags_t::key_type &date)
Get selection of GIT tags. 
 
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
 
#define ASSERT(A,...)
Assert macro. 
 
T & getInstance(const T &object)
Get static instance from temporary object. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula. 
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line. 
 
bool is_integer(const std::string &buffer)
Check if string is an integer. 
 
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
ResultSet & getResultSet(const std::string &query)
Get result set. 
 
std::vector< JServer > getServernames()
Get list of names of available database servers. 
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
static const char *const ROOT_FILE_FORMAT
ROOT file name extension.