Demonstrate the TFoam class.
To run this macro type from CINT command line
public:
TFDISTR(){};
int i;
R1=0;
R2=0;
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;
}
- Author
- Stascek Jadach
Definition in file foam_demo.C.