This program must be compiled and executed with Aclic as follows. 
 
 
 
 
#include <iostream>
 
 
 
  Dist +=exp(-(sqr(
x-1./3) +sqr(
y-1./3))/GamSq)/GamSq/
TMath::Pi();
 
  Dist +=exp(-(sqr(
x-2./3) +sqr(
y-2./3))/GamSq)/GamSq/
TMath::Pi();
 
  return 0.5*Dist;
}
 
   public:
   virtual ~FoamFunction() {}
   }
 
};
 
 
 
  cout<<"--- kanwa started ---"<<endl;
  TH2D  *hst_xy = 
new TH2D(
"foam_hst_xy" ,  
"FOAM x-y plot", 50,0,1.0, 50,0,1.0);
 
  hFoam = hst_xy;
 
  
  FoamX->
SetRho(
new FoamFunction() );  
 
  
  
 
   
 
 
  
  int nshow=nev;
 
  for(long loop=0; loop<nev; loop++){
    
    
    if(loop == nshow){
      nshow += 5000;
      
    }
  }
 
  double time = 
w.CpuTime()*1.E9/nev;
 
  cout << "Time using FOAM \t\t " << "   \t=\t " << time << "\tns/call" << endl;
 
  
  
  cout << " MCresult= " << MCresult << " +- " << MCerror <<endl;
  cout<<"--- kanwa ended ---"<<endl;
 
  return 0;
}
 
 
 
double UCamel2(
double * 
x, 
double *) {
 
}
 
int run_unuran(int nev, std::string method = "hitro") {
   
 
   std::cout << "run unuran " << std::endl;
 
 
   TH2D  *
h1 = 
new TH2D(
"unr_hst_xy" ,  
"UNURAN x-y plot", 50,0,1.0, 50,0,1.0);
 
 
   TF2 * 
f = 
new TF2(
"f",UCamel2,0,1,0,1,0);
 
 
 
 
 
 
   
 
 
   
   bool ret =   unr.Init(dist,method);
   if (!ret) {
      std::cerr << "Error initializing unuran with method " << unr.MethodName() << endl;
      return -1;
   }
 
   for (int i = 0; i < nev; ++i) {
   }
 
   double time = 
w.CpuTime()*1.E9/nev;
 
   cout << "Time using Unuran  " << unr.MethodName() << "   \t=\t " << time << "\tns/call" << endl;
   return 0;
}
 
 
  
  TCanvas *cKanwa = 
new TCanvas(
"cKanwa",
"Canvas for plotting",600,1000);
 
 
 
 
 
 
 
  std::cout <<"\nChi2 Test Results (UNURAN-FOAM):\t";
  
 
  return 0;
}
#define ClassDef(name, id)
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
 
R__EXTERN TSystem * gSystem
 
TVirtualPad * cd(Int_t subpadnumber=0) override
Set current canvas & pad.
 
void Update() override
Update canvas pad buffers.
 
A 2-Dim function with parameters.
 
Abstract class representing n-dimensional real positive integrand function.
 
virtual Double_t Density(Int_t ndim, Double_t *)=0
 
TFoam is the main class of the multi-dimensional general purpose Monte Carlo event generator (integra...
 
virtual void GetMCvect(Double_t *)
User may get generated MC point/vector with help of this method.
 
virtual void MakeEvent()
User method.
 
virtual void Initialize()
Basic initialization of FOAM invoked by the user.
 
virtual void GetIntegMC(Double_t &, Double_t &)
User method.
 
virtual void SetnCells(Long_t nCells)
 
virtual void SetRho(TFoamIntegrand *Rho)
User may use this method to set the distribution object.
 
virtual void SetPseRan(TRandom *PseRan)
 
virtual void SetkDim(Int_t kDim)
 
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
 
void Draw(Option_t *option="") override
Draw this histogram with options.
 
virtual Double_t Chi2Test(const TH1 *h2, Option_t *option="UU", Double_t *res=nullptr) const
test for comparing weighted and unweighted histograms
 
2-D histogram with a double per channel (see TH1 documentation)}
 
Service class for 2-D histogram classes.
 
Int_t Fill(Double_t) override
Invalid Fill method.
 
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
 
Random number generator class based on M.
 
This is the base class for the ROOT Random number generators.
 
virtual void SetSeed(ULong_t seed=0)
Set the random generator seed.
 
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
 
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
 
TUnuranMultiContDist class describing multi dimensional continuous distributions.
 
double dist(Rotation3D const &r1, Rotation3D const &r2)