45 virtual ~FoamFunction() {}
46 double Density(
int nDim,
double *
x) {
58 cout<<
"--- kanwa started ---"<<endl;
60 TH2D *hst_xy =
new TH2D(
"foam_hst_xy" ,
"FOAM x-y plot", 50,0,1.0, 50,0,1.0);
70 FoamX->
SetRho(
new FoamFunction() );
84 for(
long loop=0; loop<nev; loop++){
94 hst_xy->
Draw(
"lego2");
100 double time = w.
CpuTime()*1.E9/nev;
101 cout <<
"Time using FOAM \t\t " <<
" \t=\t " << time <<
"\tns/call" << endl;
104 hst_xy->
Draw(
"lego2");
108 cout <<
" MCresult= " << MCresult <<
" +- " << MCerror <<endl;
109 cout<<
"--- kanwa ended ---"<<endl;
123 std::cout <<
"run unuran " << std::endl;
127 TH2D *
h1 =
new TH2D(
"unr_hst_xy" ,
"UNURAN x-y plot", 50,0,1.0, 50,0,1.0);
145 bool ret = unr.
Init(dist,method);
147 std::cerr <<
"Error initializing unuran with method " << unr.
MethodName() << endl;
152 for (
int i = 0; i < nev; ++i) {
160 double time = w.
CpuTime()*1.E9/nev;
161 cout <<
"Time using Unuran " << unr.
MethodName() <<
" \t=\t " << time <<
"\tns/call" << endl;
169 TCanvas *cKanwa =
new TCanvas(
"cKanwa",
"Canvas for plotting",600,1000);
184 std::cout <<
"\nChi2 Test Results (UNURAN-FOAM):\t";
Double_t Camel2(Int_t nDim, Double_t *Xarg)
double dist(Rotation3D const &r1, Rotation3D const &r2)
Random number generator class based on M.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
virtual Double_t Chi2Test(const TH1 *h2, Option_t *option="UU", Double_t *res=0) const
chi^{2} test for comparing weighted and unweighted histograms
TVirtualPad * cd(Int_t subpadnumber=0)
Set current canvas & pad.
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
Double_t CpuTime()
Stop the stopwatch (if it is running) and return the cputime (in seconds) passed between the start an...
virtual void MakeEvent()
User subprogram.
bool SampleMulti(double *x)
Sample multidimensional distributions User is responsible for having previously correctly initialized...
virtual void SetSeed(UInt_t seed=0)
Set the random generator seed.
void Stop()
Stop the stopwatch.
This is the base class for the ROOT Random number generators.
double Dist(void *xp, void *yp)
Service class for 2-Dim histogram classes.
virtual void GetMCvect(Double_t *)
User may get generated MC point/vector with help of this method.
R__EXTERN TSystem * gSystem
virtual void Draw(Option_t *option="")
Draw this histogram with options.
virtual Double_t Density(Int_t ndim, Double_t *)=0
virtual void Initialize()
Basic initialization of FOAM invoked by the user.
ClassDef(TFoamIntegrand, 1)
const std::string & MethodName() const
used Unuran method
TUnuranMultiContDist class describing multi dimensional continuous distributions. ...
A 2-Dim function with parameters.
virtual void SetnCells(Long_t nCells)
double UCamel2(double *x, double *)
virtual void SetPseRan(TRandom *PseRan)
int run_unuran(int nev, std::string method="hitro")
virtual void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
Automatic pad generation by division.
bool Init(const std::string &distr, const std::string &method)
initialize with Unuran string interface
virtual void Update()
Update canvas pad buffers.
Int_t Fill(Double_t)
Invalid Fill method.
virtual void SetRho(TFoamIntegrand *Rho)
User may use this method to set the distribution object.
virtual void GetIntegMC(Double_t &, Double_t &)
User subprogram.
virtual void SetkDim(Int_t kDim)
2-D histogram with a double per channel (see TH1 documentation)}