Hello Experts
I am trying to follow an example here :
root.cern.ch/root/htmldoc/tutor … ons.C.html
to do the exact same thing, but the histograms I get as the output of these for chi2 and chi2_reduced
show just the total number of samples generated as 1000.
I am hoping this plot to be a distribution of the chi2 from 1000 pseudo experiments I have asked RooMCStudy to generate and Fit.
This is the code snippet:
RooRealVar cbmean(“cb mean”,“cb_mean”,173.2,165,175);
RooRealVar cbwidth(“cb width”,“cb_width”,10,0,15);
RooRealVar cbn(“cb n”,“cb_n”,150,100,180);
RooRealVar cbalpha(“cb alpha”,“cb_alpha”,5,0,10.);
RooCBShape cb(“cb”,“cb”,x,cbmean,cbwidth,cbalpha,cbn) ;
RooAddPdf sum(“cbfit”,“crystal ball fit”,RooArgList(esig));
RooMCStudy* mcstudy =new RooMCStudy(sum,x,Binned(true),Verbose(false),Extended(),Silence() );
// Add a chi2 module
RooChi2MCSModule chi2mod ;
mcstudy->addModule(chi2mod) ;
// Generate and fit results
mcstudy->generateAndFit(1000,2400);
// Fill histograms with distributions chi2 and prob(chi2,ndf) that are calculated by RooChiMCSModule
TH1* hist_chi2 = mcstudy->fitParDataSet().createHistogram(“chi2”) ;
TH1* hist_chi2red = mcstudy->fitParDataSet().createHistogram(“chi2red”) ;
TCanvas* c3=new TCanvas();
c3->cd(1) ; gPad->SetLeftMargin(0.15) ; hist_chi2->GetYaxis()->SetTitleOffset(1.4) ; hist_chi2->Draw() ;
c3->cd(2) ; gPad->SetLeftMargin(0.15) ; hist_chi2red->GetYaxis()->SetTitleOffset(1.4) ; hist_chi2red->Draw() ;
c3->Draw();
Any insights?
Thanks
Ruchika