Home | News | Documentation | Download

Set PDF normalization range in RooFit

Dear experts,

Hope you are doing well!

I am reaching out since I have a question on how to properly set the PDF normalization range in the RooFit. Currently, I have some PDFs fitted to some signal MCs in a subrange, and want to keep this range as the signal PDF normalization range (i.e., PDF goes to 0 outside of this range) to interface with other tools (CMS CombinedLimit). Although I know that within RooFit calling fitTo with Range(a,b) will do desired job for fitting and plotting, I am not sure if this normalization range would also be stored within RooAbsPdf as when I trying to plot it outside of the fitting session (i.e, I output the fitted PDF into a workspace, and then access it again in another session), it still gives me a full range plot.

Do I need to define the subrange as my whole range when I create the variable x for each fit in order to force such a range?

Thanks a lot!


I guess @moneta and @StephanH can help you.

Hello Sebastian,

It sounds like you are looking for something like NormRange or Range. See here:

Deasr Stephan,

Thanks a lot, but I think I am looking for the “real” range of a PDF, which essentially says that if x is out of this range, the PDF goes to 0.

The plotOn(Range()) seems to only have an effect on plotting, but do not force the actual PDF values to 0 (or something else equivalent) when going outside of this range.

Thanks a lot!


The “real” range as you call it would be the range of the observable, in which you defined the PDF. For example, the range of x in
Gauss(x | mu, sigma).
Note that many PDFs never go to zero exactly, so RooFit doesn’t assume this. The only thing it does to normalise is to integrate a PDF from x.low to x.high, regardless of whether the PDF falls to zero within that range or not.
Therefore, I’m not sure what you need exactly to complete your task.

If you want to force a PDF to zero, let’s say a Gaussian that’s clipped at +/- 5, you can wrap a Gaussian into some kind of window function, and use this as a PDF. But somehow I have the impression that this is not what you are looking for. So maybe there is some kind of misunderstanding, which might clear up if you repeat your question in different words.

Dear Stephan,

Ah! I think the window function solution is exactly what I am seeking, which is chunking, for example, a Gaussian at ±5 sigma.

Do you have suggestions on properly implement this with RooFit?

Thanks a lot!


Something like

RooGenericPdf window("window", "(x > -5)*(x < 5) * function", RooArgset(x, function))

Dear Stephan,

I tried out your method over the weekend and it worked! Really appreciate your inputs on this!

Best regards,

:+1: .