54{
57
58 int numberOfEvents;
60 double precision;
62
63 try {
64
65 JParser<> zap(
"Example program to test multi-dimensional interpolation.");
66
74
76 }
77 catch(const exception &error) {
79 }
80
81
82 const double xmin = -1.0;
83 const double xmax = +1.0;
85
91 JMap_t>::maplist JMaplist_t;
92
94 typedef JMultiFunction_t::result_type result_type;
95
97
98
99 for (
double x = xmin;
x < xmax + 0.5*
dx;
x +=
dx) {
100 for (
double y = xmin;
y < xmax + 0.5*
dx;
y +=
dx) {
101 for (
double z = xmin; z < xmax + 0.5*
dx; z +=
dx) {
103 }
104 }
105 }
106
107
109
110
111 if (numberOfEvents > 0) {
112
115
116 for (int i = 0; i != numberOfEvents; ++i) {
117
118 const double x =
gRandom->Uniform(xmin, xmax);
119 const double y =
gRandom->Uniform(xmin, xmax);
120 const double z =
gRandom->Uniform(xmin, xmax);
121
122 const result_type
result =
g3(x,y,z);
123
124 const double v =
f3(x,y,z);
126
128
129 H[0][0].put(fx.getDerivative().getDerivative(x) * fy(y) * fz(z) -
result.fpp.f.f);
130 H[1][0].put(fx.getDerivative(x) * fy.getDerivative(y) * fz(z) -
result.fp.fp.f);
131 H[2][0].put(fx.getDerivative(x) * fy(y) * fz.getDerivative(z) -
result.fp.f.fp);
132
133 H[1][1].put(fx(x) * fy.getDerivative().getDerivative(y) * fz(z) -
result.f.fpp.f);
134 H[2][1].put(fx(x) * fy.getDerivative(y) * fz.getDerivative(z) -
result.f.fp.fp);
135
136 H[2][2].put(fx(x) * fy(y) * fz.getDerivative().getDerivative(z) -
result.f.f.fpp);
137 }
138
140
142
144
145 for (int i = 0; i != N; ++i) {
146 for (
int j = 0;
j <= i; ++
j) {
148 }
150 }
151
152 for (int i = 0; i != N; ++i) {
153 for (
int j = 0;
j <= i; ++
j) {
155 }
157 }
158 }
159
162
163 for (int i = 0; i != N; ++i) {
164 for (
int j = 0;
j <= i; ++
j) {
166 ASSERT(
H[i][
j].getSTDev() <= precision);
167 }
168 }
169
170 } else {
171
172 for ( ; ; ) {
173
174 cout <<
"> " << flush;
175
176 string buffer;
177
178 if (
getline(
cin, buffer) && !buffer.empty()) {
179
181
183
184 try {
186 }
189 }
190
191 } else {
192 break;
193 }
194 }
195 }
196
197 return 0;
198}
double getMean(vector< double > &v)
get mean of vector content
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
double f3(const double x, const double y, const double z)
3D function.
int numberOfBins
number of bins for average CDF integral of optical module
Template definition of a multi-dimensional oscillation probability interpolation table.
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
const parameter_list< JPolynome< ID_t, 0 > > JPolynome< ID_t, 0 >::parameters & JPolynome
Set parameters.
static const double H
Planck constant [eV s].
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary data structure for floating point format specification.