I’m asking roofit to retrieve the normalization of a RooGaussian after a fit.
Everything seems ok but, if I perform a simple integral on the same histogram in the same interval I got a number that is half of the one from roofit. Clearly I’m doing a mistake somewhere…

My Macro (attached) run with the command:
.x Total_fit.C(“comp_epsilonPlots.root”,“allEpsilon_EBnw”,false,true,true)
and it does:
a) create a PDF:
RooAddPdf model1(“model”,“sig+bkg”,RooArgList(gaus,bkg),RooArgList(Nsig,Nbkg));
a) after the fit create a Range
x.setRange(“sobRange”,mean.getVal()-2.*sigma.getVal(), mean.getVal()+2.sigma.getVal());
[#1] INFO:Eval – RooRealVar::setRange(x) new range named ‘sobRange’ created with bounds [0.104727,0.14857]
b) and integrate:
RooAbsReal integralSig = gaus.createIntegral(x,NormSet(x),Range(“sobRange”));
c)
and the Number of events should be: integralSig->getVal()*Nsig.getVal())
That is 0.954507 * 312218 = 298014

!! If I do the itegral in the same range manually:
root [5] allEpsilon_EBnw->FindBin(0.104727)
(Int_t) 51
root [6] allEpsilon_EBnw->FindBin(0.14857)
(Int_t) 72
root [7] allEpsilon_EBnw->Integral(51,72)
(Double_t) 1.263420e+05
The value is very different from: 298014

Sure:
Here you can find the input file: dropbox.com/s/sh8xhzb8q44ww … .root?dl=0
As I said it run with:
.x Total_fit.C(“comp_epsilonPlots.root”,“allEpsilon_EBnw”,false,true,true)
Please let me know If I have to add some more details.

Thanks for the file. I could reproduce the problem. It is clear the reported number of entries from the fit seems to be wrong. I have tried with a simple ROOT Fit and I get the right number of Nsig and Nbkg.
I will investigate it

Thank you for the file. I could reproduce this problem and I will investigate it. I have tried a simple ROOT fit and I get the correct number of entries. So, there are some problems with the returned values from the fit.