30{
33
36
38 JRange_t X;
39 JRange_t Y;
40 JRange_t Z;
44 int numberOfOutliers;
45 map_type zmap;
47
48 try {
49
50 JParser<> zap(
"Auxiliary program to test contents of 2D histograms.");
51
52 zap[
'f'] =
make_field(inputFile,
"measurement histogram, e.g: <file name>:<object name>");
53 zap[
'x'] =
make_field(X,
"accepted x-range values") = JRange_t();
54 zap[
'y'] =
make_field(Y,
"accepted y-range values") = JRange_t();
55 zap[
'z'] =
make_field(Z,
"accepted z-range values") = JRange_t();
62
64 }
65 catch(const exception &error) {
67 }
68
70
72
74
76
78 FATAL(
"File: " << input->getFullFilename() <<
" not opened." <<
endl);
79 }
80
82
84
86
87 const TString tag(
key->GetName());
88
90
91
92
94
96
98 const TGraph2D* g2 = (
dynamic_cast<TGraph2D*
>(p) !=
NULL ?
dynamic_cast<TGraph2D*
>(p) :
NULL);
99
100 for (map_type::const_iterator i = zmap.begin(); i != zmap.end(); ++i) {
101
102 const double value =
getResult(i->first, p);
103 const JRange_t& range = i->second;
104
105 DEBUG(
"Global test " << i->first <<
' ' << (range(value) ?
"passed" :
"failed") <<
endl);
106
108 }
109
110
112 int number_of_outliers = 0;
113
115
118
119 const Double_t x = h2->GetXaxis()->GetBinCenter(
ix);
120 const Double_t y = h2->GetYaxis()->GetBinCenter(
iy);
122
125
127
129
130 DEBUG(
"Test outlier " << h2->GetName() <<
" bin (" <<
ix <<
"," <<
iy <<
") (" << h2->GetXaxis()->GetBinLabel(
ix) <<
"," << h2->GetYaxis()->GetBinLabel(
iy) <<
") " << z <<
' ' << (
ok ?
"passed" :
"failed") <<
endl);
131
133 ++number_of_outliers;
134 }
135 }
136 }
137 }
138
139 }
else if (g2 !=
NULL) {
140
141 for (
Int_t i = 0; i != g2->GetN(); ++i) {
142
146
149
151
153
154 DEBUG(
"Test outlier " << g2->GetName() <<
" bin (" << i <<
") " << z <<
' ' << (
ok ?
"passed" :
"failed") <<
endl);
155
157 ++number_of_outliers;
158 }
159 }
160 }
161
162 } else {
163
164 FATAL(
"Object at " << *input <<
" is not TH2 nor TGraph2D." <<
endl);
165 }
166
167
168 cout << (number_of_outliers > numberOfOutliers ? RED : GREEN);
171
172 if (number_of_outliers > numberOfOutliers) {
174 }
175 }
176 }
177 }
178
180
181 return 0;
182}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
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)...