27 using namespace genie;
29 double func(
double x,
double y);
43 double dx = (xmax-xmin)/(nx-1);
44 double dy = (ymax-ymin)/(ny-1);
48 for(
int ix=0; ix<nx; ix++) {
49 double x = xmin + ix * dx;
50 for(
int iy=0; iy<ny; iy++) {
51 double y = ymin + iy * dy;
59 TNtuple * nt =
new TNtuple(
"nt",
"billinear interpolation validation",
"x:y:ztrue:zeval");
61 for(
int ip=0; ip<npoints; ip++) {
62 double rx = rnd->
RndGen().Uniform();
63 double ry = rnd->
RndGen().Uniform();
64 double x = xmin + (xmax-xmin)*rx;
65 double y = ymin + (ymax-ymin)*ry;
66 double zt =
func(x,y);
72 TFile
f(
"./bli2dug.root",
"recreate");
84 return TMath::Sin(x)/x * TMath::Sin(y)/
y;
Bilinear interpolation of 2D functions on a regular grid.
THE MAIN GENIE PROJECT NAMESPACE
static RandomGen * Instance()
Access instance.
A singleton holding random number generator classes. All random number generation in GENIE should tak...
bool AddPoint(double x, double y, double z)
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
double func(double x, double y)
double Evaluate(double x, double y) const
TRandom3 & RndGen(void) const
rnd number generator for generic usage