%%cpp -d #include "Riostream.h" #include "TFile.h" #include "TFoam.h" #include "TH1.h" #include "TMath.h" #include "TFoamIntegrand.h" #include "TRandom3.h" class TFDISTR: public TFoamIntegrand { public: TFDISTR(){}; Double_t Density(int nDim, Double_t *Xarg){ // Integrand for mFOAM Double_t Fun1,Fun2,R1,R2; Double_t pos1=1e0/3e0; Double_t pos2=2e0/3e0; Double_t Gam1= 0.100e0; // as in JPC Double_t Gam2= 0.100e0; // as in JPC Double_t sPi = sqrt(TMath::Pi()); Double_t xn1=1e0; Double_t xn2=1e0; int i; R1=0; R2=0; for(i = 0 ; iSetSeed(4357); cout<<"***** Demonstration Program for Foam version "<GetVersion()<<" *****"<SetkDim( kDim); // Mandatory!!! FoamX->SetnCells( nCells); // optional FoamX->SetnSampl( nSampl); // optional FoamX->SetnBin( nBin); // optional FoamX->SetOptRej( OptRej); // optional FoamX->SetOptDrive( OptDrive); // optional FoamX->SetEvPerBin( EvPerBin); // optional FoamX->SetChat( Chat); // optional FoamX->SetRho(rho); FoamX->SetPseRan(PseRan); FoamX->Initialize(); // Initialize simulator FoamX->Write("FoamX"); // Writing Foam on the disk, TESTING PERSISTENCY!!! long nCalls=FoamX->GetnCalls(); cout << "====== Initialization done, entering MC loop" << endl; /*cout<<" About to start MC loop: "; cin.getline(question,20);*/ Double_t *MCvect =new Double_t[kDim]; // vector generated in the MC run TH1D *hst_Wt = new TH1D("hst_Wt" , "Main weight of Foam",25,0,1.25); hst_Wt->Sumw2(); for(loop=0; loopMakeEvent(); // generate MC event /*===============================*/ FoamX->GetMCvect( MCvect); MCwt=FoamX->GetMCwt(); hst_Wt->Fill(MCwt,1.0); if(loop<15){ cout<<"MCwt= "<Print("all"); Double_t eps = 0.0005; Double_t Effic, WtMax, AveWt, Sigma; Double_t IntNorm, Errel; FoamX->Finalize( IntNorm, Errel); // final printout FoamX->GetIntegMC( MCresult, MCerror); // get MC intnegral FoamX->GetWtParams(eps, AveWt, WtMax, Sigma); // get MC wt parameters Effic=0; if(WtMax>0) Effic=AveWt/WtMax; cout << "================================================================" << endl; cout << " MCresult= " << MCresult << " +- " << MCerror << " RelErr= "<< MCerror/MCresult << endl; cout << " Dispersion/= " << Sigma/AveWt << endl; cout << " /WtMax= " << Effic <<", for epsilon = "<