52     static const char SEPARATOR = 
';';
 
   61     friend inline std::istream& 
operator>>(std::istream& in, JCondition& 
object)
 
   68       if ((in >> 
object.range) && ! (in >> 
object.weight)) {
 
   83     friend inline std::ostream& 
operator<<(std::ostream& out, 
const JCondition& 
object)
 
   85       out << 
object.formula << SEPARATOR << 
object.range << 
' ' << 
object.weight << std::endl;
 
  127 int main(
int argc, 
char **argv)
 
  144   JCondition_t    condition;
 
  152     JParser<> zap(
"Main program to evaluate quality data from data base."\
 
  153                   "\nThe condition and veto can be any TFormula compatible expression involving QA/QC parameters (see e.g. JQAQC.sh -h).");
 
  159     zap[
'f'] = 
make_field(inputFile,  
"Optional input file instead of database.")       = 
"";
 
  160     zap[
'o'] = 
make_field(
outputFile, 
"ROOT file with histograms and n-tuple or ASCII file with QA/QC data.") = 
"quality.root";
 
  163     zap[
'S'] = 
make_field(source,     
"GIT versions")                                   = 
getGITTags(TRegexp(
"v[0-9]*\\.[0-9]*\\.[0-9]*$"), JGITTags_t::key_type(
"2019-04-12"));
 
  172   catch(
const exception &error) {
 
  173     FATAL(error.what() << endl);
 
  179   for (JCondition_t::const_iterator i = condition.begin(); i != condition.end(); ++i) {
 
  185       FATAL(
"Invalid total weight: " << W << endl);
 
  194   if (inputFile == 
"") {                    
 
  202       const int ID = getDetector<int>   (detid);
 
  203       detid        = getDetector<string>(detid);
 
  209       NOTICE(
"Extracting run information from database... " << flush);
 
  211       ResultSet& rs  = 
getResultSet(getTable<JRuns>(), selection);
 
  213       for (
JRuns parameters; rs >> parameters; ) {
 
  214         if (TString(parameters.RUNSETUPNAME.c_str()).Contains(regexp)) {
 
  215           setups.
put(parameters);
 
  234         selector.
add(&JRunSummaryNumbers::SOURCE_NAME, *git);
 
  238           NOTICE(
"Extracting run summmary information with source " << *git << 
" from database... " << flush);
 
  240           ResultSet& rs  = 
getResultSet(getTable<JRunSummaryNumbers>(), selector);
 
  243             if (setups.
has(parameters.RUN)) {
 
  244               zmap[parameters.RUN].insert(make_pair(parameters.PARAMETER_NAME, parameters.DATA_VALUE));
 
  252         catch(
const exception& error) { 
NOTICE(endl); }
 
  254         for (map_type::const_iterator run = zmap.begin(); run != zmap.end(); ++run) {
 
  260           quality.
run      = run->first;
 
  261           quality.
name     = setups[run->first].name;
 
  262           quality.
value    = setups[run->first].value;
 
  264           for (data_type::const_iterator i = run->second.begin(); i != run->second.end(); ++i) {
 
  265             quality.
put(i->first, i->second);
 
  270           buffer.insert(quality);           
 
  274     catch(
const exception& error) {
 
  275       FATAL(error.what() << endl);
 
  281       WARNING(
"Detector identifier \"" << detid << 
"\" discarded." << endl);
 
  284     const int ID = (
is_integer(detid) ? to_value<int>(detid) : -1);
 
  293       if (
ID == -1 || 
ID == quality.detector) {
 
  294         if (runs(quality.run)) {
 
  295           buffer.insert(quality);
 
  304   if (buffer.empty()) {
 
  305     FATAL(
"No data." << endl);
 
  313       writer.
put(*quality);
 
  320     runs = 
JRange_t(buffer.begin()->run, buffer.rbegin()->run);
 
  322     TH1D h0(
"h0", NULL, 1000, 0.0, 1.01);
 
  323     TH1D h1(
"h1", NULL, condition.size(), -0.5, condition.size() - 0.5);
 
  325     for (
size_t i = 0; i != condition.size(); ++i) {
 
  326       h1.GetXaxis()->SetBinLabel(i+1, condition[i].formula.c_str());
 
  342     for (JCondition_t::const_iterator i = condition.begin(); i != condition.end();++i) {
 
  347     for (JCondition_t::const_iterator i = veto.begin(); i != veto.end();++i) {
 
  356     for (
size_t i = 0; i != condition.size(); ++i) {
 
  357       os << 
":" << (char) (
'a' + i);
 
  362     TNtuple n1(
"n1", 
"quality", os.str().c_str());
 
  373       for (
size_t i = 0; i != condition.size(); ++i) {
 
  375         const JCondition& ps = condition[i];
 
  376         const double      y  = 
getResult(ps.formula, *quality);
 
  378         DEBUG(ps.formula << 
' ' << 
y << endl);
 
  380         tuple.push_back((Float_t) 
y);
 
  382         TH1D* p = H1[ps.formula];
 
  384         p->SetBinContent(p->FindBin((
double) quality->run), 
y);
 
  391         h1.AddBinContent(i + 1, ps.range(
y) ? 1.0 : 0.0);
 
  394       const double Q = 
w/W;
 
  396       tuple.push_back((Float_t) Q);
 
  400       for (
size_t i = 0; i != veto.size(); ++i) {
 
  402         const JCondition& ps = veto[i];
 
  403         const double      y  = 
getResult(ps.formula, *quality);
 
  405         DEBUG(ps.formula << 
' ' << 
y << endl);
 
  411         p->SetBinContent(p->FindBin((
double) quality->run), 
y);
 
  416         p->SetBinContent(p->FindBin((
double) quality->run), ps.range(
y) ? 0.0 : 1.0);
 
  424       tuple.push_back((Float_t) V);
 
  425       tuple.push_back((Float_t) setups.
get(quality->run));
 
  428       n1.Fill(tuple.data());
 
  430       cout << setw(8) << quality->run << 
' ' << 
FIXED(5,3) << Q << 
' ' << setw(2) << V << endl;
 
  435     for (Int_t i = 0; i <= h0.GetXaxis()->GetNbins(); ++i) {
 
  436       h0.SetBinContent(i, (
w += h0.GetBinContent(i)));
 
  443     out << h0 << h1 << n1 << H1;
 
  456     out.setf(ios::fixed);
 
int main(int argc, char **argv)
 
Specifications of file name extensions.
 
std::istream & operator>>(std::istream &in, JAANET::JHead &header)
Read header from input.
 
Dynamic ROOT object management.
 
General purpose messaging.
 
#define DEBUG(A)
Message macros.
 
#define ASSERT(A,...)
Assert macro.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
TString replace(const TString &target, const TRegexp ®exp, const T &replacement)
Replace regular expression in input by given replacement.
 
#define MAKE_CSTRING(A)
Make C-string.
 
#define MAKE_STRING(A)
Make string.
 
Auxiliary class to define a range between two values.
 
Print objects in ASCII format using ROOT dictionary.
 
Auxiliary class for specifying selection of database data.
 
JSelector & add(const JSelector &selection)
Add selection.
 
Object reading from ASCII file.
 
Object(s) writing to ASCII file.
 
virtual void close()
Close file.
 
Simple data structure to support I/O of equations (see class JLANG::JEquation).
 
Utility class to parse command line options.
 
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
 
void Write(TDirectory &out, const bool wm=false)
Write objects to file.
 
Implementation for ASCII output of objects with ROOT dictionary.
 
JRootWriter & put(const T &object)
Write object according equation format.
 
ResultSet & getResultSet(const std::string &query)
Get result set.
 
std::vector< JServer > getServernames()
Get list of names of available database servers.
 
std::vector< std::string > getGITTags(const TRegexp ®exp, const JGITTags_t::key_type &date)
Get selection of GIT tags.
 
std::string getFilenameExtension(const std::string &file_name)
Get file name extension, i.e. part after last JEEP::FILENAME_SEPARATOR if any.
 
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
 
bool is_integer(const std::string &buffer)
Check if string is an integer.
 
T & getInstance(const T &object)
Get static instance from temporary object.
 
T getMaximum(const array_type< T > &buffer, const T value)
Get maximum of values.
 
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
std::vector< event_type > data_type
 
static const char *const ASCII_FILE_FORMAT
file name extension ASCII format
 
static const char *const ROOT_FILE_FORMAT
file name extension ROOT format
 
std::map< int, range_type > map_type
 
Auxiliary data structure for floating point format specification.
 
Type definition of range.
 
Auxiliary data structure for data quality.
 
double value
setup identifier (see JRunsetups)
 
void put(const std::string &key, const std::string &value)
Put value at given key.
 
std::string name
setup name (see JRunsetups)
 
std::string GIT
GIT version used to write QA/QC data.
 
int detector
detector identifier
 
Auxiliary class for run setup evaluation.
 
void put(const int run, const std::string setup)
Put run parameters.
 
bool has(const int run) const
Check if run setup is vailable.
 
float get(const int run) const
Get run setup value.
 
Wrapper class for server name.
 
Template definition for getting table specific selector.
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...