Exclude bins with no entries in RooDataHist fit

Dear RooFit experts,
I have a simple question: in fitting histograms, is it possible to exclude bins, in the distribution you want to fit, containing no statistics? It would be useful for me to do it automatically without going through a “manual” construction.

Thanks in advance,

Hello Federico,

Did you ever figure out a way to do this? Thanks for any thoughts on it.



I don’t think this is possible in RooFit. But, if you are performing a binned likelihood fit, why you want to do this ? It is wrong to exclude bins if the expected number of entries in the bin is not zero. In case it is zero, I think the bins are excluded automatically.

Bins with zero entries are excluded when performing a least square fit in ROOT, since the error in each bin is estimated in this case using the observed events. In this case the bins are excluded, but the result will be biased.
In this case it is recommended to use a likelihood fit, whenever possible

Best Regards


What concerns the “empty bins treatment when fitting”, see [url]Empty bins treatment when fitting
In short, it is possible that a bin is “empty” but it has a non-zero error, and in this case the “chi2 method” will consider this bin (and there’s the “WW” fit option, as well), while “non-empty” bins with zero errors will NOT be considered.
Moreover, the “likelihood method” doesn’t seem to care whether bin errors are zero or non-zero (it considers all available bins in the fit).

Hi everyone, I want to piggyback this thread.

I am doing a binned likelihood fit and also have databins with 0 content. However, since my MC templates are made of limited statistics (histogram PDFs), I can run into cases where PDF > 0, but Data has 0 content, which is like saying that there is data where there’s a 0 % chance it would be. How is this treated in Roofit? If I add a small value, the results become biased.