54 JParser<> zap(
"Example program to test multi-dimensional interpolation.");
63 catch(
const exception &error) {
64 FATAL(error.what() << endl);
68 const double xmin = -1.0;
69 const double xmax = +1.0;
73 typedef JGridPolint3Function1D_t JFunction1D_t;
75 typedef JMAPLIST<JPolint3FunctionalGridMap,
76 JPolint3FunctionalGridMap>::maplist JMaplist_t;
78 typedef JMultiFunction<JFunction1D_t, JMaplist_t> JMultiFunction_t;
84 for (
double x = xmin; x < xmax + 0.5*dx; x += dx) {
85 for (
double y = xmin; y < xmax + 0.5*dx; y += dx) {
86 for (
double z = xmin; z < xmax + 0.5*dx; z += dx) {
87 g3[x][y][z] =
f3(x,y,z);
94 g3.setExceptionHandler(
new JFunction1D_t::JDefaultResult(
JMATH::zero));
97 if (numberOfEvents > 0) {
103 for (
int i = 0; i != numberOfEvents; ++i) {
105 const double x = gRandom->Uniform(xmin, xmax);
106 const double y = gRandom->Uniform(xmin, xmax);
107 const double z = gRandom->Uniform(xmin, xmax);
109 const double v =
f3(x,y,z);
113 const double w = g3(x,y,z);
124 timer.print(cout, 1.0 / numberOfEvents,
micro_t);
127 ASSERT(Q.getMean() <= precision);
128 ASSERT(Q.getSTDev() <= precision);
134 cout <<
"> " << flush;
138 if (
getline(cin, buffer) && !buffer.empty()) {
142 istringstream(buffer) >> x >> y >> z;
145 cout <<
f3(x,y,z) <<
' ' << g3(x,y,z) << endl;
147 catch(
const JException& exception) {
148 cout << exception << endl;
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
static const JZero zero
Function object to assign zero value.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
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