44     static const char SEPARATOR = 
';';
 
   53     friend inline std::istream& 
operator>>(std::istream& 
in, JCondition& 
object)
 
   60       if ((in >> 
object.
range) && ! (in >> 
object.weight)) {
 
   75     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JCondition& 
object)
 
   77       out << 
object.formula << SEPARATOR << 
object.range << 
' ' << 
object.weight << std::endl;
 
   95 int main(
int argc, 
char **argv)
 
  100   typedef JRange<int>         JRange_t; 
 
  111   JCondition_t    condition;
 
  119     JParser<> zap(
"Example program to plot quality data from data base."\
 
  120                   "\nThe condition and veto can be any TFormula compatible expression involving QA/QC parameters (see e.g. JQAQC.sh -h).");
 
  125     zap[
'f'] = 
make_field(inputFile,  
"Optional input file instead of database.")       = 
"";
 
  126     zap[
'o'] = 
make_field(
outputFile, 
"Output file containing histograms and n-tuple.") = 
"quality.root";
 
  128     zap[
'R'] = 
make_field(runs,       
"Run range")                                      = JRange_t(1, JRange_t::getMaximum());
 
  129     zap[
'S'] = 
make_field(source,     
"GIT versions")                                   = 
getGITTags(TRegexp(
"v.*\\..*\\..*"), JGITTags_t::key_type(
"2019-04-12"));
 
  130     zap[
'Q'] = 
make_field(condition,  
"User defined conditions");
 
  138   catch(
const exception &error) {
 
  139     FATAL(error.what() << endl);
 
  145   for (JCondition_t::const_iterator i = condition.begin(); i != condition.end(); ++i) {
 
  150     FATAL(
"Invalid total weight: " << W << endl);
 
  157   if (inputFile == 
"") {
 
  168         ID = to_value<int>(detid);
 
  176       selection += getSelector<JRuns>(
ID);
 
  178       ResultSet& rs  = 
getResultSet(getTable<JRuns>(), selection);
 
  181         if (TString(parameters.RUNSETUPNAME.c_str()).Contains(regexp)) {
 
  182           setup.put(parameters);
 
  195         JSelector selector = getSelector<JRunSummaryNumbers>(detid, runs.getLowerLimit(), runs.getUpperLimit());
 
  197         selector.add(&JRunSummaryNumbers::SOURCE_NAME, *i);
 
  201           ResultSet& rs  = 
getResultSet(getTable<JRunSummaryNumbers>(), selector);
 
  203           for (JRunSummaryNumbers parameters; rs >> 
parameters; ) {
 
  204             if (setup.has(parameters.RUN)) {
 
  205               zmap[parameters.RUN].insert(make_pair(parameters.PARAMETER_NAME, parameters.DATA_VALUE));
 
  211         catch(
const exception& error) {}
 
  213         for (map_type::const_iterator run = zmap.begin(); run != zmap.end(); ++run) {
 
  218           quality.detector = 
ID;
 
  219           quality.run      = run->first;
 
  221           for (data_type::const_iterator p = run->second.begin(); p != run->second.end(); ++p) {
 
  222             quality.put(p->first, p->second);
 
  225           buffer.insert(quality);
 
  229     catch(
const exception& error) {
 
  230       FATAL(error.what() << endl);
 
  235     ifstream 
in(inputFile.c_str());
 
  237     for (JRunQuality quality; in >> quality; ) {
 
  238       buffer.insert(quality);
 
  244   if (buffer.empty()) {
 
  245     FATAL(
"No data." << endl);
 
  258   runs = JRange_t(buffer.begin()->run, buffer.rbegin()->run);
 
  260   TH1D h0(
"h0", NULL, 1000, 0.0, 1.01);
 
  261   TH1D 
h1(
"h1", NULL, condition.size(), -0.5, condition.size() + 0.5);
 
  264   h0.SetMaximum(1.1 * (runs.getUpperLimit() - runs.getLowerLimit()));
 
  267   h1.SetMaximum(1.1 * (runs.getUpperLimit() - runs.getLowerLimit()));
 
  269   JManager<TString, TH1D> zmap(
new TH1D(
"%", NULL, 
 
  270                                         runs.getLength() + 1,
 
  271                                         runs.getLowerLimit() - 0.5,
 
  272                                         runs.getUpperLimit() + 0.5));
 
  276   for (JCondition_t::const_iterator i = condition.begin(); i != condition.end();++i) {
 
  278     const string buffer = i->formula;
 
  280     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":upper"), 
MAKE_CSTRING(i->range.getUpperLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  281     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":lower"), 
MAKE_CSTRING(i->range.getLowerLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  284   for (JCondition_t::const_iterator i = veto.begin(); i != veto.end();++i) {
 
  286     const string buffer = 
MAKE_STRING(
"VETO[" << i->formula << 
"]");
 
  288     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":upper"), 
MAKE_CSTRING(i->range.getUpperLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  289     zmap[buffer]->GetListOfFunctions()->Add(
new TF1(
MAKE_CSTRING(buffer << 
":lower"), 
MAKE_CSTRING(i->range.getLowerLimit()), runs.getLowerLimit(), runs.getUpperLimit()));
 
  296   for (
size_t i = 0; i != condition.size(); ++i) {
 
  297     os << 
":" << (char) (
'a' + i);
 
  302   TNtuple n1(
"n1", 
"quality", os.str().c_str());
 
  316     tuple.push_back((Float_t) quality->run);
 
  320     for (
size_t i = 0; i != condition.size(); ++i) {
 
  322       const JCondition& ps = condition[i];
 
  323       const double      y  = 
getResult(ps.formula, *quality);
 
  325       DEBUG(ps.formula << 
' ' << y << endl);
 
  327       tuple.push_back((Float_t) y);
 
  329       TH1D* p = zmap[ps.formula];
 
  331       p->SetBinContent(p->FindBin((
double) quality->run), y);
 
  332       p->SetBinError  (p->FindBin((
double) quality->run), 0.0);
 
  338       h1.AddBinContent(i + 1, ps.range(y) ? 1.0 : 0.0);
 
  341     const double Q = w/W;
 
  343     tuple.push_back((Float_t) Q);
 
  347     for (
size_t i = 0; i != veto.size(); ++i) {
 
  349       const JCondition& ps = veto[i];
 
  350       const double      y  = 
getResult(ps.formula, *quality);
 
  352       TH1D* p = zmap[
MAKE_STRING(
"VETO[" << ps.formula << 
"]")];
 
  354       p->SetBinContent(p->FindBin((
double) quality->run), ps.range(y) ? 0.0 : 1.0);
 
  355       p->SetBinError  (p->FindBin((
double) quality->run), 0.0);
 
  362     tuple.push_back((Float_t) V);
 
  363     tuple.push_back((Float_t) setup.get(quality->run));
 
  366     n1.Fill(tuple.data());
 
  368     cout << setw(8) << quality->run << 
' ' << 
FIXED(5,3) << Q << 
' ' << setw(2) << V << endl;
 
  373   for (Int_t i = 0; i <= h0.GetXaxis()->GetNbins(); ++i) {
 
  374     h0.SetBinContent(i, (
w += h0.GetBinContent(i)));
 
  381   out << h0 << h1 << n1 << zmap;
 
Utility class to parse command line options. 
 
int main(int argc, char *argv[])
 
std::vector< std::string > getGITTags(const TRegexp regexp, const JGITTags_t::key_type date)
Get selection of GIT tags. 
 
Print objects in ASCII format using ROOT dictionary. 
 
*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. 
 
bool resetObject(JManager< JKey_t, JValue_t > *object, const bool reset=false)
Reset JManager object. 
 
#define MAKE_STRING(A)
Make string. 
 
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. 
 
General purpose messaging. 
 
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
 
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. 
 
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
 
std::vector< double > weight
 
#define DEBUG(A)
Message macros.