42     static const char SEPARATOR = 
';';
 
   51     friend inline std::istream& 
operator>>(std::istream& 
in, JCondition& 
object)
 
   58       if ((in >> 
object.range) && ! (in >> 
object.weight)) {
 
   73     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JCondition& 
object)
 
   75       out << 
object.formula << SEPARATOR << 
object.range << 
' ' << 
object.weight << std::endl;
 
   93 int main(
int argc, 
char **argv)
 
  109   JCondition_t    condition;
 
  118     const JGITTags_t::key_type date   (
"2019-04-12");
 
  119     const TRegexp              
version(
"v.*\\..*\\..*");
 
  122     for (JGITTags_t::const_reverse_iterator i = tags.rbegin(); i.base() != tags.lower_bound(date); ++i) {
 
  123       if (TString(i->second.c_str()).Contains(version)) {
 
  128     JParser<> zap(
"Example program to plot quality data from data base."\
 
  129                   "\nThe condition and veto can be any TFormula compatible expression involving QA/QC parameters (see e.g. JQAQC.sh -h).");
 
  134     zap[
'f'] = 
make_field(inputFile,  
"Optional input file instead of database.")       = 
"";
 
  135     zap[
'o'] = 
make_field(
outputFile, 
"Output file containing histograms and n-tuple.") = 
"quality.root";
 
  138     zap[
'S'] = 
make_field(source,     
"GIT versions")                                   = buffer;
 
  139     zap[
'Q'] = 
make_field(condition,  
"User defined conditions");
 
  147   catch(
const exception &error) {
 
  148     FATAL(error.what() << endl);
 
  154   for (JCondition_t::const_iterator i = condition.begin(); i != condition.end(); ++i) {
 
  159     FATAL(
"Invalid total weight: " << W << endl);
 
  166   if (inputFile == 
"") {
 
  177         ID = to_value<int>(detid);
 
  185       selection += getSelector<JRuns>(
ID);
 
  187       ResultSet& rs  = 
getResultSet(getTable<JRuns>(), selection);
 
  190         if (TString(parameters.RUNSETUPNAME.c_str()).Contains(regexp)) {
 
  191           setup.put(parameters);
 
  204         JSelector selector = getSelector<JRunSummaryNumbers>(detid, runs.getLowerLimit(), runs.getUpperLimit());
 
  206         selector.add(&JRunSummaryNumbers::SOURCE_NAME, *i);
 
  210           ResultSet& rs  = 
getResultSet(getTable<JRunSummaryNumbers>(), selector);
 
  212           for (JRunSummaryNumbers parameters; rs >> 
parameters; ) {
 
  213             if (setup.has(parameters.RUN)) {
 
  214               zmap[parameters.RUN].insert(make_pair(parameters.PARAMETER_NAME, parameters.DATA_VALUE));
 
  218         catch(
const exception& error) {}
 
  220         for (map_type::const_iterator run = zmap.begin(); run != zmap.end(); ++run) {
 
  225           quality.detector = 
ID;
 
  226           quality.run      = run->first;
 
  228           for (data_type::const_iterator p = run->second.begin(); p != run->second.end(); ++p) {
 
  229             quality.put(p->first, p->second);
 
  232           buffer.insert(quality);
 
  236     catch(
const exception& error) {
 
  237       FATAL(error.what() << endl);
 
  242     ifstream 
in(inputFile.c_str());
 
  244     for (JRunQuality quality; in >> quality; ) {
 
  245       buffer.insert(quality);
 
  251   if (buffer.empty()) {
 
  252     FATAL(
"No data." << endl);
 
  257       cout << i->run << 
' ' << i->GIT << endl;
 
  262   runs = 
JRange_t(buffer.begin()->run, buffer.rbegin()->run);
 
  264   TH1D h0(
"h0", NULL, 1000, 0.0, 1.01);
 
  265   TH1D 
h1(
"h1", NULL, condition.size(), -0.5, condition.size() + 0.5);
 
  268   h0.SetMaximum(1.1 * (runs.getUpperLimit() - runs.getLowerLimit()));
 
  271   h1.SetMaximum(1.1 * (runs.getUpperLimit() - runs.getLowerLimit()));
 
  273   JManager<TString, TH1D> zmap(
new TH1D(
"%", NULL, 
 
  274                                         runs.getLength() + 1,
 
  275                                         runs.getLowerLimit() - 0.5,
 
  276                                         runs.getUpperLimit() + 0.5));
 
  280   for (JCondition_t::const_iterator i = condition.begin(); i != condition.end();++i) {
 
  282     const string buffer = i->formula;
 
  284     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":upper"), 
MAKE_CSTRING(i->range.getUpperLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  285     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":lower"), 
MAKE_CSTRING(i->range.getLowerLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  288   for (JCondition_t::const_iterator i = veto.begin(); i != veto.end();++i) {
 
  290     const string buffer = 
MAKE_STRING(
"VETO[" << i->formula << 
"]");
 
  292     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":upper"), 
MAKE_CSTRING(i->range.getUpperLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  293     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":lower"), 
MAKE_CSTRING(i->range.getLowerLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  300   for (
size_t i = 0; i != condition.size(); ++i) {
 
  301     os << 
":" << (char) (
'a' + i);
 
  306   TNtuple n1(
"n1", 
"quality", os.str().c_str());
 
  320     tuple.push_back((Float_t) quality->run);
 
  324     for (
size_t i = 0; i != condition.size(); ++i) {
 
  326       const JCondition& ps = condition[i];
 
  327       const double      y  = 
getResult(ps.formula, *quality);
 
  329       tuple.push_back((Float_t) y);
 
  331       TH1D* p = zmap[ps.formula];
 
  333       p->SetBinContent(p->FindBin((
double) quality->run), y);
 
  334       p->SetBinError  (p->FindBin((
double) quality->run), 0.0);
 
  340       h1.AddBinContent(i + 1, ps.range(y) ? 1.0 : 0.0);
 
  343     const double Q = w/W;
 
  345     tuple.push_back((Float_t) Q);
 
  349     for (
size_t i = 0; i != veto.size(); ++i) {
 
  351       const JCondition& ps = veto[i];
 
  352       const double      y  = 
getResult(ps.formula, *quality);
 
  354       TH1D* p = zmap[
MAKE_STRING(
"VETO[" << ps.formula << 
"]")];
 
  356       p->SetBinContent(p->FindBin((
double) quality->run), ps.range(y) ? 0.0 : 1.0);
 
  357       p->SetBinError  (p->FindBin((
double) quality->run), 0.0);
 
  364     tuple.push_back((Float_t) V);
 
  365     tuple.push_back((Float_t) setup.get(quality->run));
 
  368     n1.Fill(tuple.data());
 
  370     cout << setw(8) << quality->run << 
' ' << 
FIXED(5,3) << Q << 
' ' << setw(2) << V << endl;
 
  375   for (Int_t i = 0; i <= h0.GetXaxis()->GetNbins(); ++i) {
 
  376     h0.SetBinContent(i, (
w += h0.GetBinContent(i)));
 
  383   out << h0 << h1 << n1 << zmap;
 
Utility class to parse command line options. 
 
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
 
#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)...
 
Dynamic ROOT object management. 
 
Auxiliary data structure for floating point format specification. 
 
#define MAKE_STRING(A)
Make string. 
 
std::map< JDate<'-'>, std::string > JGITTags_t
Type definition of dated GIT tags. 
 
#define ASSERT(A,...)
Assert macro. 
 
std::string getGITVersion(const std::string &tag)
Get GIT version for given GIT tag. 
 
#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. 
 
then usage $script[detector file[variant[identifier]]] fi case set_variable ID
 
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. 
 
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. 
 
const JGITTags_t & getGITTags()
Get GIT dated tags. 
 
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. 
 
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object. 
 
std::vector< double > weight
 
int main(int argc, char *argv[])