public:
TFDISTR(){};
int i;
for(i = 0 ; i<nDim ; i++){
R1=
R1+(Xarg[i] -pos1)*(Xarg[i] -pos1);
R2=
R2+(Xarg[i] -pos2)*(Xarg[i] -pos2);
xn1=xn1*Gam1*sPi;
xn2=xn2*Gam2*sPi;
}
Fun1 =
exp(-(
R1*
R1)/(Gam1*Gam1))/xn1;
Fun2 =
exp(-(
R2*
R2)/(Gam2*Gam2))/xn2;
return 0.5e0*(Fun1+ Fun2);
}
};
{
TFile RootFile(
"foam_demo.root",
"RECREATE",
"histograms");
long loop;
long NevTot = 50000;
cout<<
"***** Demonstration Program for Foam version "<<FoamX->
GetVersion()<<
" *****"<<endl;
cout << "====== Initialization done, entering MC loop" << endl;
TH1D *hst_Wt =
new TH1D(
"hst_Wt" ,
"Main weight of Foam",25,0,1.25);
for(loop=0; loop<NevTot; loop++){
if(loop<15){
cout<<"MCwt= "<<MCwt<<", ";
cout<<"MCvect= ";
for (
Int_t k=0 ; k<kDim ; k++) cout<<MCvect[k]<<
" "; cout<< endl;
}
if( ((loop)%100000)==0 ){
cout<<" loop= "<<loop<<endl;
}
}
cout << "====== Events generated, entering Finalize" << endl;
Effic=0; if(WtMax>0) Effic=AveWt/WtMax;
cout << "================================================================" << endl;
cout << " MCresult= " << MCresult << " +- " << MCerror << " RelErr= "<< MCerror/MCresult << endl;
cout <<
" Dispersion/<wt>= " <<
Sigma/AveWt << endl;
cout << " <wt>/WtMax= " << Effic <<", for epsilon = "<<eps << endl;
cout << " nCalls (initialization only) = " << nCalls << endl;
cout << "================================================================" << endl;
delete [] MCvect;
RootFile.ls();
RootFile.Write();
RootFile.Close();
cout << "***** End of Demonstration Program *****" << endl;
return 0;
}
#define ClassDef(name, id)
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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 SetEvPerBin(Int_t EvPerBin)
virtual void Initialize()
Basic initialization of FOAM invoked by the user.
virtual void SetnSampl(Long_t nSampl)
virtual void GetIntegMC(Double_t &, Double_t &)
User method.
virtual const char * GetVersion() const
virtual void GetMCwt(Double_t &)
User may get weight MC weight using this method.
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 SetRho(TFoamIntegrand *Rho)
User may use this method to set the distribution object.
virtual void Finalize(Double_t &, Double_t &)
May be called optionally by the user after the MC run.
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 GetWtParams(Double_t, Double_t &, Double_t &, Double_t &)
May be called optionally after the MC run.
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)