164{
167
168 int numberOfEvents;
170 bool transform;
172
173 try {
174
175 JParser<> zap(
"Example program to test transformable function.");
176
181
182 zap(argc, argv);
183 }
184 catch(const exception &error) {
185 FATAL(error.what() << endl);
186 }
187
188 if (numberOfEvents <= 0) {
189 FATAL(
"No events." << endl);
190 }
191
192
193 const double xmin = 0.1;
194 const double xmax = 1.0;
195 const double dx = (
xmax -
xmin) / 3;
196
197 function_type h2;
198
199 for (
double x = xmin;
x <
xmax + 0.5*dx;
x += dx) {
200
201 const double ymin = -5.0 *
xmax;
202 const double ymax = +5.0 *
xmax;
204
205 for (
double y = ymin;
y < ymax + 0.5*dy;
y += dy) {
207 }
208 }
209
210 h2.setExceptionHandler(
new typename function_type::JDefaultResult(
JMATH::zero));
211
212 if (transform) {
213 h2.transform(JTransformer_t());
214 }
215
216 h2.compile();
217
218
223 };
224
225 const double ymin = -5.0 *
xmax;
226 const double ymax = +5.0 *
xmax;
227
228 for (int i = 0; i != numberOfEvents; ++i) {
229
230 const double x = gRandom->Uniform(xmin, xmax);
231 const double y = gRandom->Uniform(ymin, ymax);
232
233 try {
234
235 const result_type value = h2(x,y);
236
237 const double f = f2(x,y);
238 const double fp = g2(x,y);
239 const double v = G2(x,y);
240
241 Q[0].
put(value.f - f);
242 Q[1].
put(value.fp - fp);
243 Q[2].
put(value.v - v);
244 }
245 catch(const std::exception& error) {}
246 }
247
248
250
251 cout << " ";
252 for (int i = 0; i != sizeof(Q)/sizeof(Q[0]); ++i) {
253 cout <<
" " << setw(10) << Q[i].
getTitle();
254 }
255 cout << endl;
256
257 cout << "mean ";
258 for (int i = 0; i != sizeof(Q)/sizeof(Q[0]); ++i) {
260 }
261 cout << endl;
262
263 cout << "RMS ";
264 for (int i = 0; i != sizeof(Q)/sizeof(Q[0]); ++i) {
266 }
267 cout << endl;
268 }
269}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int numberOfBins
number of bins for average CDF integral of optical module
const std::string & getTitle() const
Get title.
Utility class to parse command line options.
static const JZero zero
Function object to assign zero value.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.