TGraphAsymmErrors.Divide() has problems with zero bins error

Dear ROOT experts,

I’m using the TGraphAsymmErrors.Divide() function with the ‘cp’ option for fake rate studies. As expected certain points of the TGraph are zero because pass = 0, but total > 0. Unfortunately these zero bins get no error assigned, all other bins show proper error bars.
I checked the two TH1F input histograms and they have both a non-zero error for the problematic bins and both get their SumW2 set right before the Divide() command.

Is there anything missing, to get also these zero bins with an error bar?

I uploaded the python script, you can find it below.

Thanks a lot and best regards, (18.5 KB)

I think @moneta can help you with this.

Thank you Olivier! I’ve contacted Lorenzo


If you are having weighted histograms, the option you have is to use either a likelihood based method which is close to a normal approximation and in this case the empty bins will have an error equal to zero.
The other option is to use a Bayesian based method, in this case the zero bin should have a non-zero error.
To use the Bayesian method use either TEfficiency or TGraphAsymmErrors::BayesDivide or Divide with option “b”.

Sorry for my delayed answer,
Best Regards


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.