31{
34
37
39 JRange_t X;
40 JRange_t Y;
43 int numberOfOutliers;
44 map_type zmap;
46
47 try {
48
49 JParser<> zap(
"Auxiliary program to test contents of 1D histograms.");
50
51 zap[
'f'] =
make_field(inputFile,
"measurement histogram, e.g: <file name>:<object name>");
52 zap[
'x'] =
make_field(X,
"accepted x-range values") = JRange_t();
53 zap[
'y'] =
make_field(Y,
"accepted y-range values") = JRange_t();
59
61 }
62 catch(const exception &error) {
64 }
65
66
68
70
72
74
76 FATAL(
"File: " << input->getFullFilename() <<
" not opened." <<
endl);
77 }
78
80
82
84
85 const TString tag(
key->GetName());
86
88
89
90
92
94
97 const TGraph*
g1 = (
dynamic_cast<TGraph*
>(p) !=
NULL ?
dynamic_cast<TGraph*
>(p) :
NULL );
98
99 for (map_type::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
100
101 const double value =
getResult(i->first, p);
102 const JRange_t& range = i->second;
103
104 DEBUG(
"Global test " << i->first <<
' ' << (range(value) ?
"passed" :
"failed") <<
endl);
105
107 }
108
109
111 int number_of_outliers = 0;
112
114
115 for (
Int_t i = 1; i <= h1->GetNbinsX(); ++i) {
116
119
121
123
125
126 DEBUG(
"Test outlier " << h1->GetName() <<
" bin (" << i <<
") (" << h1->GetXaxis()->GetBinLabel(i) <<
") " << y <<
' ' << (
ok ?
"passed" :
"failed") <<
endl);
127
129 ++number_of_outliers;
130 }
131 }
132 }
133
135
136 for (
Int_t i = 0; i !=
g1->GetN(); ++i) {
137
140
142
144
146
147 DEBUG(
"Test outlier " <<
g1->GetName() <<
" bin (" << i <<
") " << y <<
' ' << (
ok ?
"passed" :
"failed") <<
endl);
148
150 ++number_of_outliers;
151 }
152 }
153 }
154
155 } else {
156
157 FATAL(
"Object at " << *input <<
" is not TH1 nor TGraph." <<
endl);
158 }
159
160
161 cout << (number_of_outliers > numberOfOutliers ? RED : GREEN);
164
165 if (number_of_outliers > numberOfOutliers) {
167 }
168 }
169 }
170 }
171
173
174 return 0;
175}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Double_t g1(const Double_t x)
Function.
Template definition of a multi-dimensional oscillation probability interpolation table.
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).
Empty structure for specification of parser element that is initialised (i.e. does not require input)...