30 int main(
int argc, 
char **argv)
 
   49     JParser<> zap(
"Auxiliary program to test contents of 1D histograms.");
 
   51     zap[
'f'] = 
make_field(inputFile,  
"measurement histogram, e.g: <file name>:<object name>");
 
   62   catch(
const exception &error) {
 
   63     FATAL(error.what() << endl);
 
   67   int number_of_failures = 0;
 
   71     DEBUG(
"Input: " << *input << endl);
 
   76       FATAL(
"File: " << input->getFullFilename() << 
" not opened." << endl);
 
   79     const TRegexp regexp(input->getObjectName());
 
   81     TIter iter(dir->GetListOfKeys());
 
   83     for (TKey* key; (key = (TKey*) iter.Next()) != NULL; ) {
 
   85       const TString tag(key->GetName());
 
   87       DEBUG(
"Key: " << tag << 
" match = " << tag.Contains(regexp) << endl);
 
   91       if (tag.Contains(regexp) && 
isTObject(key)) {
 
   95         const TH1*    h1 = ( 
dynamic_cast<TProfile*
>(p) != NULL ? 
dynamic_cast<TProfile*
>(p) :
 
   96                             (
dynamic_cast<TH1*
>(p)      != NULL ? 
dynamic_cast<TH1*
>(p)      : NULL) );
 
   97         const TGraph* 
g1 = ( 
dynamic_cast<TGraph*
>(p)   != NULL ? 
dynamic_cast<TGraph*
>(p)   : NULL );
 
   99         for (map_type::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
 
  101           const double    value = 
getResult(i->first, p);
 
  104           DEBUG(
"Global test " << i->first << 
' ' << (range(value) ? 
"passed" : 
"failed") << endl);
 
  110         int number_of_events   = 0;
 
  111         int number_of_outliers = 0;
 
  115           for (Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
 
  117             const Double_t 
x = h1->GetBinCenter (i);
 
  118             const Double_t 
y = h1->GetBinContent(i);
 
  120             if (X(
x) == !invertX) {
 
  124               const bool ok = (Y(
y) == !invertY);
 
  126               DEBUG(
"Test outlier " << h1->GetName() << 
" bin (" << i << 
") (" << h1->GetXaxis()->GetBinLabel(i) << 
") " << 
y << 
' ' << (ok ? 
"passed" : 
"failed") << endl);
 
  129                 ++number_of_outliers;
 
  134         } 
else if (
g1 != NULL) {
 
  136           for (Int_t i = 0; i != 
g1->GetN(); ++i) {
 
  138             const Double_t 
x = 
g1->GetX()[i];
 
  139             const Double_t 
y = 
g1->GetY()[i];
 
  141             if (X(
x) == !invertX) {
 
  145               const bool ok = (Y(
y) == !invertY);
 
  147               DEBUG(
"Test outlier " << 
g1->GetName() << 
" bin (" << i << 
") " << 
y << 
' ' << (ok ? 
"passed" : 
"failed") << endl);
 
  150                 ++number_of_outliers;
 
  157           FATAL(
"Object at " << *input << 
" is not TH1 nor TGraph." << endl);
 
  161         cout << (number_of_outliers > numberOfOutliers ? 
RED : 
GREEN);
 
  162         NOTICE(
"Number of outliers \"" << p->GetName() << 
"\" = " << number_of_outliers << 
"/" << number_of_events << endl);
 
  165         if (number_of_outliers > numberOfOutliers) {
 
  166           ++number_of_failures;
 
  172   ASSERT(number_of_failures == 0);
 
I/O coloring auxiliaries.
 
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
 
Double_t g1(const Double_t x)
Function.
 
Auxiliary class to define a range between two values.
 
int main(int argc, char **argv)
 
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)...