50     JParser<> zap(
"Auxiliary program to test contents of 2D histograms.");
 
   52     zap[
'f'] = 
make_field(inputFile,  
"measurement histogram, e.g: <file name>:<object name>");
 
   65   catch(
const exception &error) {
 
   66     FATAL(error.what() << endl);
 
   69   int number_of_failures = 0;
 
   73     DEBUG(
"Input: " << *input << endl);
 
   78       FATAL(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
   81     const TRegexp regexp(input->getObjectName());
 
   83     TIter iter(dir->GetListOfKeys());
 
   85     for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
 
   87       const TString tag(key->GetName());
 
   89       DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
   93       if (tag.Contains(regexp) && 
isTObject(key)) {
 
   97         const TH2*      h2 = (
dynamic_cast<TH2*
>(p)      != NULL ? 
dynamic_cast<TH2*
>(p)      : NULL);
 
   98         const TGraph2D* g2 = (
dynamic_cast<TGraph2D*
>(p) != NULL ? 
dynamic_cast<TGraph2D*
>(p) : NULL);
 
  100         for (map_type::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
 
  102           const double    value = 
getResult(i->first, p);
 
  105           DEBUG(
"Global test " << i->first << 
' ' << (range(value) ? 
"passed" : 
"failed") << endl);
 
  111         int number_of_events   = 0;
 
  112         int number_of_outliers = 0;
 
  116           for (Int_t ix = 1; ix <= h2->GetXaxis()->GetNbins(); ++ix) {
 
  117             for (Int_t iy = 1; iy <= h2->GetYaxis()->GetNbins(); ++iy) {
 
  119               const Double_t 
x = h2->GetXaxis()->GetBinCenter(ix);
 
  120               const Double_t 
y = h2->GetYaxis()->GetBinCenter(iy);
 
  121               const Double_t z = h2->GetBinContent(ix, iy);
 
  123               if (X(
x) == !invertX && 
 
  128                 const bool ok = (Z(z) == !invertZ);
 
  130                 DEBUG(
"Test outlier " << h2->GetName() << 
" bin (" << ix << 
"," << iy << 
") (" << h2->GetXaxis()->GetBinLabel(ix) << 
"," << h2->GetYaxis()->GetBinLabel(iy) << 
") " << z << 
' ' << (ok ? 
"passed" : 
"failed") << endl);
 
  133                   ++number_of_outliers;
 
  139         } 
else if (g2 != NULL) {
 
  141           for (Int_t i = 0; i != g2->GetN(); ++i) {
 
  143             const Double_t 
x = g2->GetX()[i];
 
  144             const Double_t 
y = g2->GetY()[i];
 
  145             const Double_t z = g2->GetZ()[i];
 
  147             if (X(
x) == !invertX && 
 
  152               const bool ok = (Z(z) == !invertZ);
 
  154               DEBUG(
"Test outlier " << g2->GetName() << 
" bin (" << i << 
") " << z << 
' ' << (ok ? 
"passed" : 
"failed") << endl);
 
  157                 ++number_of_outliers;
 
  164           FATAL(
"Object at " << *input << 
" is not TH2 nor TGraph2D." << endl);
 
  168         cout << (number_of_outliers > numberOfOutliers ? 
RED : 
GREEN);
 
  169         NOTICE(
"Number of outliers \"" << p->GetName() << 
"\" = " << number_of_outliers << 
"/" << number_of_events << endl);
 
  172         if (number_of_outliers > numberOfOutliers) {
 
  173           ++number_of_failures;
 
  179   ASSERT(number_of_failures == 0);
 
#define DEBUG(A)
Message macros.
 
#define ASSERT(A,...)
Assert macro.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Utility class to parse command line options.
 
TDirectory * getDirectory(const JRootObjectID &id)
Get TDirectory pointer.
 
bool isTObject(const TKey *key)
Check if given key corresponds to a TObject.
 
Double_t getResult(const TString &text, TObject *object=NULL)
Get result of given textual formula.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
std::map< int, range_type > map_type
 
Type definition of range.
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...