Jpp  master_rocky-43-ge265d140c
the software that should make you happy
Functions
JPrintTestResults.cc File Reference

Auxiliary program to print histogram comparison results. More...

#include <iostream>
#include <iomanip>
#include <string>
#include "Jeep/JPrint.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JLang/JPredicate.hh"
#include "JLang/JVectorize.hh"
#include "JGizmo/JRootObjectID.hh"
#include "JCompareHistograms/JTest_t.hh"
#include "TString.h"
#include "TRegexp.h"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print histogram comparison results.

Author
bjung

Definition in file JPrintTestResults.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 89 of file JPrintTestResults.cc.

90 {
91  using namespace std;
92  using namespace JPP;
93 
94  string inputFile;
95 
96  vector<string> keys;
97  map<string, string> selections;
98 
99  int debug;
100 
101  try {
102 
103  JProperties properties;
104 
105  const array_type<string>& listOfKeys = get_keys(JTestSummary().getProperties());
106  const string& keyExplainer = MAKE_STRING("Summary information:" << endl << listOfKeys);
107 
108  for (array_type<string>::const_iterator i = listOfKeys.cbegin(); i != listOfKeys.cend(); ++i) {
109  selections[*i] = WILDCARD;
110  properties[*i] = selections[*i];
111  }
112 
113  JParser<> zap("Auxiliary program to print histogram comparison results.");
114 
115  zap['f'] = make_field(inputFile, "Histogram comparison ASCII output file");
116  zap['k'] = make_field(keys, keyExplainer) = JPARSER::initialised();
117  zap['@'] = make_field(properties, "Selection criteria") = JPARSER::initialised();
118  zap['d'] = make_field(debug) = 3;
119 
120  zap(argc, argv);
121  }
122  catch (const exception &error) {
123  FATAL(error.what() << endl);
124  }
125 
126  ifstream in(inputFile);
127 
128  for (string buffer; getline(in, buffer); ) {
129 
130  istringstream iss(buffer);
131  stripColor(iss);
132 
133  if (iss.peek() == (int) COMMENT) {
134  continue;
135  }
136 
137  JTestSummary summary;
138  read(iss, summary);
139 
140  if (compare(summary.getProperties(), selections)) {
141  print(cout, summary, keys.cbegin(), keys.cend(), ' ', false);
142  }
143  }
144 
145  return 0;
146 }
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:63
Class dedicated to standardize the title of the graphical objects produced by the JTest_t() derived c...
Definition: JTestSummary.hh:34
JProperties getProperties(const JEquationParameters &equation=JTestSummary::getEquationParameters())
Get properties of this class.
Utility class to parse parameter values.
Definition: JProperties.hh:501
Utility class to parse command line options.
Definition: JParser.hh:1698
std::ostream & print(std::ostream &out, const JTestSummary &summary, const char delimiter=' ', const bool useColors=true)
Print test summary.
std::istream & read(std::istream &in, JTestSummary &summary, const char delimiter=' ')
Read test summary.
JProperties & getProperties(T &object, const JEquationParameters &parameters=JEquationParameters(), const int debug=1)
Get properties of a given object.
const array_type< JKey_t > & get_keys(const std::map< JKey_t, JValue_t, JComparator_t, JAllocator_t > &data)
Method to create array of keys of map.
Definition: JVectorize.hh:139
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static const char WILDCARD
Definition: JDAQTags.hh:56
Definition: JSTDTypes.hh:14
Auxiliary data structure for return type of make methods.
Definition: JVectorize.hh:28
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:68