RooFit pdf normalization not to unity?

Dear all,

in roofit, pdfs should be always normalised to unity, however if I plot simple pdfs they are always normalized to different values, is this a “feature”? (For example, even the two gaussians at page 8 of the roofit manual v2.91 are normalised to 0.2.)
I suppose (as stated in the manual) that each pdf is normalised in the given variable range.

For example if I plot a polynomial and a gaussian with:

RooRealVar x("x", "x", 0, -1., 1.);
RooRealVar a("a", "a", 0.1);
RooPolynomial pol("pol", "pol",x, RooArgSet(a));
 RooGaussian gauss("gauss","gauss",x, RooFit::RooConst(0),RooFit::RooConst(1));
RooPlot *xframe = x.frame();
pol.plotOn(xframe);
 gauss.plotOn(xframe);
xframe->Draw(); 

I get the plot in attachment, which shows that the normalisation is clearly 0.02.

What am I missing? Perhaps a hidden “bin width”?

cheers,
Francesco

Note: I tried this on different computers and different root versions.
The current version in my pc is: 5.29/01


Dear all,
I have investigated this further (with Nicola Serra’s help) and it is indeed related to binning.
There is a solution for the cases when the range is integer, that is to modify the binning accordingly:

  double max = 1;
  double min = -1;
  double range = max - min;
  RooRealVar x("x", "x", 0, min, max);
  RooRealVar a("a", "a", 0.);
  
  RooPolynomial pol("pol", "pol",x, RooArgSet(a));
  RooGaussian gauss("gauss","gauss",x, RooFit::RooConst(0),RooFit::RooConst(1));
  RooPlot *xframe =  new RooPlot("plot", "plot", x, min, max,range);
  gauss.plotOn(xframe);
  pol.plotOn(xframe);
  xframe->Draw(); 

however this cannot work on non-integer ranges.
The solution should be to divide the function by the bin width when plotted alone, could this be done by default?

cheers,

Francesco

Hello,

I assume you can use RooRealVar::setBins() to force a customized binning.

– Gregory