26{
29
30 const size_t N = 3;
31
33
34 const double xmin = -10.0;
35 const double xmax = +10.0;
36
37 unsigned int numberOfEvents;
40 double precision;
42
43 try {
44
45 JParser<> zap(
"Example program to test Legendre polynome.");
46
52
53 zap(argc, argv);
54 }
55 catch(const exception &error) {
56 FATAL(error.what() << endl);
57 }
58
59
61
63
65
67
69 }
70
71 for (collection_type::const_iterator i =
data.begin(); i !=
data.end(); ++i) {
72 DEBUG(
"data: " <<
FIXED(7,3) << i->getX() <<
' ' <<
FIXED(7,3) << i->getY() << endl);
73 }
74
75
77
78 for (
size_t n = 0;
n !=
g1.size(); ++
n) {
79 STATUS(
"Legendre: " << setw(2) << n <<
' ' <<
FIXED(7,3) <<
g1[n] << endl);
80 }
81
82
84
85 if (numberOfEvents > 0) {
86
87 for (unsigned int i = 0; i != numberOfEvents; ++i) {
88
89 const double x = gRandom->Uniform(xmin, xmax);
90 const double y =
f1(x);
91 const double z =
g1(x);
92
94 }
95
97 }
98
99 ASSERT(numberOfEvents > 0);
100
102
103 for (
size_t n = 0;
n !=
g1.size(); ++
n) {
104 ASSERT(fabs(f1[n] -
g1[n]) <= precision,
"Legendre: " << setw(2) << n <<
' ' <<
FIXED(7,3) <<
g1[n]);
105 }
106
108
110
111 return 0;
112}
#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.
int numberOfBins
number of bins for average CDF integral of optical module
Template definition of linear fit.
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Base class for Legendre polynome.
Template definition for function evaluation of Legendre polynome.