42 for(i = 0 ; i<nDim ; i++){
43 R1=
R1+(Xarg[i] -pos1)*(Xarg[i] -pos1);
44 R2=
R2+(Xarg[i] -pos2)*(Xarg[i] -pos2);
50 Fun1 =
exp(-(
R1*
R1)/(Gam1*Gam1))/xn1;
51 Fun2 =
exp(-(
R2*
R2)/(Gam2*Gam2))/xn2;
52 return 0.5e0*(Fun1+ Fun2);
59 TFile RootFile(
"foam_demo.root",
"RECREATE",
"histograms");
78 cout<<
"***** Demonstration Program for Foam version "<<FoamX->
GetVersion()<<
" *****"<<endl;
91 FoamX->
Write(
"FoamX");
94 cout <<
"====== Initialization done, entering MC loop" << endl;
99 TH1D *hst_Wt =
new TH1D(
"hst_Wt" ,
"Main weight of Foam",25,0,1.25);
102 for(loop=0; loop<NevTot; loop++){
108 hst_Wt->
Fill(MCwt,1.0);
110 cout<<
"MCwt= "<<MCwt<<
", ";
112 for (
Int_t k=0 ; k<kDim ; k++) cout<<MCvect[k]<<
" "; cout<< endl;
114 if( ((loop)%100000)==0 ){
115 cout<<
" loop= "<<loop<<endl;
121 cout <<
"====== Events generated, entering Finalize" << endl;
123 hst_Wt->
Print(
"all");
130 Effic=0;
if(WtMax>0) Effic=AveWt/WtMax;
131 cout <<
"================================================================" << endl;
132 cout <<
" MCresult= " << MCresult <<
" +- " << MCerror <<
" RelErr= "<< MCerror/MCresult << endl;
133 cout <<
" Dispersion/<wt>= " <<
Sigma/AveWt << endl;
134 cout <<
" <wt>/WtMax= " << Effic <<
", for epsilon = "<<eps << endl;
135 cout <<
" nCalls (initialization only) = " << nCalls << endl;
136 cout <<
"================================================================" << endl;
143 cout <<
"***** End of Demonstration Program *****" << endl;
int Int_t
Signed integer 4 bytes (int).
double Double_t
Double 8 bytes.
#define ClassDef(name, id)
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
Abstract class representing n-dimensional real positive integrand function.
virtual Double_t Density(Int_t ndim, Double_t *)=0
virtual void Finalize(Double_t &, Double_t &)
virtual void SetEvPerBin(Int_t EvPerBin)
virtual void GetMCwt(Double_t &)
virtual void SetnSampl(Long_t nSampl)
virtual void GetIntegMC(Double_t &, Double_t &)
virtual const char * GetVersion() const
virtual void SetRho(TFoamIntegrand *Rho)
virtual void Initialize()
virtual void SetChat(Int_t Chat)
virtual void SetOptDrive(Int_t OptDrive)
virtual void SetnCells(Long_t nCells)
virtual Long_t GetnCalls() const
virtual void GetWtParams(Double_t, Double_t &, Double_t &, Double_t &)
virtual void SetOptRej(Int_t OptRej)
virtual void SetPseRan(TRandom *PseRan)
virtual void SetnBin(Int_t nBin)
virtual void SetkDim(Int_t kDim)
virtual void GetMCvect(Double_t *)
1-D histogram with a double per channel (see TH1 documentation)
void Print(Option_t *option="") const override
Print some global quantities for this histogram.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
Write this object to the current directory.
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.
RVec< PromoteType< T > > exp(const RVec< T > &v)
VecExpr< UnaryOp< Sqrt< T >, VecExpr< A, T, D >, T >, T, D > sqrt(const VecExpr< A, T, D > &rhs)
constexpr Double_t Sigma()
Stefan-Boltzmann constant in : .
#define R1(v, w, x, y, z, i)
#define R2(v, w, x, y, z, i)