[RooFit] Get pdf normalization

Hello all !

I fit a distribution using roofit and want to get normalization constant from the fit results. How can I do this ? I read that all pdfs are normalized to 1, I tried out several ways of such normalization, but didn’t find real one. However, roofit draws pdf with right normalization somehow (middle pic).
To illustrate the problem, I create a test distribution from my function, fit it (left pic), then create pdf from custom function, fit my distribution with this pdf (mid pic), get fit results, insert them into function and see wrong normalization (right pic). In other words, I want right pic to be like left.

Please, see a code example which produced pictures in attach.
root version: 5.34/09.

Thanks in advance.
ex3.cpp (5.58 KB)


The problem is that the pdf in RooFit are normalised, thus divided by their integral in the given range.
So the definition of the parameter in RooFit is not exactly the same as in ROOT.

If you want to fit the constant term, you would need to define an RooExtendPdf with the number of events as a fit parameter. Instead you cannot have const1 and const2 as fit parameters, but only one. They are 100% correlated.
Then afterwards you need after the fit to get the corresponding value of const1 and const2 given the RooFit parameters.
I might try to give you an example in a simpler case if you need further help on this

Best Regards


1 Like

Hi, just had the same problem. Try to solve it doing the following:

  const double norm = hist->Integral()/mge.createIntegral(time)->getValV();
  func->SetParameter(0, const1 .getValV()*norm);
  func->SetParameter(3, const2 .getValV()*norm);