Bug in v5.28.00 BayesDivide?


I just upgraded from v5.26 to v5.28 because I found that the implementation of BayesDivide as described on the ROOT pages were not in v5.26. I welcome the ability to use do a “Bayes style” Divide with weighted histograms. However, this piece of code in TGraphAsymmErrors::Divide() looks suspicious to me, and gives me problems: when determining for each bin the quantities total “t” and the passed “p”, this code is executed:

      //shall we use number of effective entries = (sum weights)^2 / sum (weights^2)
      //" + 0.5" ensures correct rounding
      if(bEffective) {
	 t =(Int_t)( total->GetBinContent(b) * total->GetBinContent(b) / total->GetSumw2()->At(b-1) + 0.5);
	 p =(Int_t)(pass->GetBinContent(b) * pass->GetBinContent(b) / pass->GetSumw2()->At(b-1) + 0.5);
	 if (p>t) {
	    Warning("Divide","histogram bin %d in pass has more effective entries than corresponding bin in total! (%d>%d)",b,p,t);
	    continue; //we may as well go on...

Shouldn’t “b-1” be “b” instead? The fSumw2 array is allocated space for the underflow and overflow bins, so its indexing should be the same as for bins themselves, as far as I can tell.

Sorry if I’ve overlooked something simple…
-Phil D.

See bug report : savannah.cern.ch/bugs/index.php?78249