Functions
gtestBLI2DUnifGrid.cxx File Reference
#include <TMath.h>
#include <TFile.h>
#include <TNtuple.h>
#include "Messenger/Messenger.h"
#include "Numerical/BLI2D.h"
#include "Numerical/RandomGen.h"

Go to the source code of this file.

Functions

double func (double x, double y)
 
int main (int, char **)
 

Function Documentation

double func ( double  x,
double  y 
)

Definition at line 81 of file gtestBLI2DUnifGrid.cxx.

References submit_syst::y.

Referenced by genie::DISXSec::CacheFreeNucleonXSec(), genie::DMDISXSec::CacheFreeNucleonXSec(), genie::ReinSehgalRESXSecWithCache::CacheResExcitationXSec(), genie::ReinSehgalRESXSecWithCacheFast::CacheResExcitationXSec(), genie::utils::kinematics::COHImportanceSamplingEnvelope(), ana::constructBPFPng3dVar(), ana::constructCVNPng3dVar(), ana::constructPng2dVar(), ana::constructPng3dVar(), genie::utils::kinematics::DISImportanceSamplingEnvelope(), FitForMinimum(), PolyDef::FixTerms(), art::for_each_group_with_left(), GammaFit(), PolyDef::GetFunction(), genie::COHXSecAR::Integrate(), genie::IMDXSec::Integrate(), genie::COHXSec::Integrate(), genie::DISXSec::Integrate(), genie::RESXSec::Integrate(), genie::QELXSec::Integrate(), genie::DMDISXSec::Integrate(), genie::DMELXSec::Integrate(), genie::MECXSec::Integrate(), genie::AlamSimoAtharVacasSKXSec::Integrate(), genie::DFRXSec::Integrate(), genie::NuElectronXSec::Integrate(), genie::SmithMonizQELCCXSec::Integrate(), genie::ReinSehgalRESXSec::Integrate(), genie::ReinSehgalRESXSecFast::Integrate(), genie::NewQELXSec::Integrate(), ana::LoadFrom< IDecomp >(), ana::LoadFrom< IExperiment >(), ana::LoadFrom< IExtrap >(), ana::LoadFrom< IPrediction >(), main(), ana::make_test_th2(), Shift::mapScalarVar(), Shift::mapVectorVar(), fhicl::MaybeUseFunction::MaybeUseFunction(), art::detail::PrincipalProcessor< DETAIL >::operator()(), fabricate.Builder::outofdate(), PlotProjection(), PolyDef::PolyDef(), art::detail::PrincipalProcessor< DETAIL >::PrincipalProcessor(), PrintFitResults(), PrintResolutionPlot(), calib::BetheBlochFit::ProfileMPV(), ana::LoadFromRegistry< BaseClass >::Register(), cet::repeated_task(), genie::utils::kinematics::RESImportanceSamplingEnvelope(), evgb::RNGWrapper< T >::set(), test_mc_rejection_method_lin(), test_mc_rejection_method_log(), genie::NievesQELCCPXSec::vcr(), stan::optimization::WolfeLineSearch(), and stan::optimization::WolfLSZoom().

82 {
83  //return x*y+10*x-7*y+1;
84  return TMath::Sin(x)/x * TMath::Sin(y)/y;
85 }
int main ( int  ,
char **   
)

Definition at line 31 of file gtestBLI2DUnifGrid.cxx.

References genie::BLI2DUnifGrid::AddPoint(), dx, dy, genie::BLI2DUnifGrid::Evaluate(), MakeMiniprodValidationCuts::f, func(), genie::RandomGen::Instance(), ip, LOG, nt, pINFO, generate_hists::rnd, genie::RandomGen::RndGen(), submit_syst::x, xmax, make_mec_shifts_plots::xmin, submit_syst::y, ymax, ymin, and test::z.

32 {
33  int npoints=10000;
34 
35  int nx = 100;
36  int ny = 100;
37 
38  double xmin = -5;
39  double xmax = 5;
40  double ymin = -5;
41  double ymax = 5;
42 
43  double dx = (xmax-xmin)/(nx-1);
44  double dy = (ymax-ymin)/(ny-1);
45 
46  BLI2DUnifGrid biln(nx,xmin,xmax,ny,ymin,ymax);
47 
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;
52  double z = func(x,y);
53  biln.AddPoint(x,y,z);
54  }
55  }
56 
57  RandomGen * rnd = RandomGen::Instance();
58 
59  TNtuple * nt = new TNtuple("nt","billinear interpolation validation","x:y:ztrue:zeval");
60 
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);
67  double ze = biln.Evaluate(x,y);
68 
69  nt->Fill(x,y,zt,ze);
70  }
71 
72  TFile f("./bli2dug.root","recreate");
73  nt->Write();
74  f.Close();
75 
76  LOG("test", pINFO) << "Done!";
77  return 0;
78 }
Bilinear interpolation of 2D functions on a regular grid.
Definition: BLI2D.h:76
std::map< std::string, double > xmax
TString ip
Definition: loadincs.C:5
A singleton holding random number generator classes. All random number generation in GENIE should tak...
Definition: RandomGen.h:30
Double_t ymax
Definition: plot.C:25
double dy[NP][NC]
double dx[NP][NC]
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
double func(double x, double y)
#define pINFO
Definition: Messenger.h:63
z
Definition: test.py:28
TRandom3 & RndGen(void) const
rnd number generator for generic usage
Definition: RandomGen.h:81
Double_t ymin
Definition: plot.C:24
TNtuple * nt
Definition: drawXsec.C:2