29{
32
33 unsigned int numberOfEvents;
37 double P;
39
40 try {
41
42 JParser<> zap(
"Example program to test 1D Legendre interpolation of a polynome.");
43
50
51 zap(argc, argv);
52 }
53 catch(const exception &error) {
54 FATAL(error.what() << endl);
55 }
56
57
58 const int N = 7;
59 const int M = 3;
60
62 M,
65 double> JFunction1D_t;
66
68
72 double> h1;
73
74 const double xmin = -10.0;
75 const double xmax = +10.0;
76
78
79 for (int i = 0; i != grid.getSize(); ++i) {
80
81 const double x = grid.getX(i);
82
83 g1[
x]=
f1(x) + (
sigma > 0.0 && gRandom->Rndm() < P ? gRandom->Gaus(0.0, sigma) : 0.0);
84 }
85
87
89 h1.compile();
90
91 for (JFunction1D_t::const_iterator i =
g1.begin(); i !=
g1.end(); ++i) {
92 DEBUG(
FIXED(12,5) << i->getX() <<
' ' <<
FIXED(12,5) << i->getY() << endl);
93 }
94
95
96 if (numberOfEvents != 0) {
97
99
100 for (unsigned int i = 0; i != numberOfEvents; ++i) {
101
102 const double x = gRandom->Uniform(xmin, xmax);
103 const double y =
f1(x);
104 const double u =
g1(x);
105 const double v = h1(x);
106
108
111 }
112
114 Q[1].
print(cout,
false);
115 }
116
117 return 0;
118}
#define DEBUG(A)
Message macros.
#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
Utility class to parse command line options.
const JPolynome f1(1.0, 2.0, 3.0)
Function.
void copy(const Head &from, JHead &to)
Copy header from from to to.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.
Recursive template class for polynomial function.