Bug (?) in TGraphAsymmErrors

We detected an error in the way a TGraphAsymmErrors behaves during plot in three different versions of ROOT using the same script.
The only correct version appears to be ROOT V5.22/00d: the representation error is most evident at the baseline of the curve (where the content of each bin is supposed to be exactly zero). Curiously enough, the correct version is an intermediate version between two incorrect ones.

Here is the code:

[code]#include “TMath.h”
#include “iostream.h”

void BayesianErrors()
{
gROOT->Reset() ;

string title = string("TGraphAsymmErrors with ROOT version ") + gROOT->GetVersion() ;

TH1I * Total = new TH1I ( title.c_str(),title.c_str(), 17 , 0, 17 );
TH1I * Pass = new TH1I ( “Pass”, “Pass”, 17 , 0, 17 );

Total->SetBinContent( 1,10); Pass->SetBinContent( 1, 0);
Total->SetBinContent( 2,10); Pass->SetBinContent( 2, 0);
Total->SetBinContent( 3,10); Pass->SetBinContent( 3, 0);
Total->SetBinContent( 4,10); Pass->SetBinContent( 4, 1);
Total->SetBinContent( 5,10); Pass->SetBinContent( 5, 1);
Total->SetBinContent( 6,10); Pass->SetBinContent( 6, 1);
Total->SetBinContent( 7,10); Pass->SetBinContent( 7, 1);
Total->SetBinContent( 8,10); Pass->SetBinContent( 8, 2);
Total->SetBinContent( 9,10); Pass->SetBinContent( 9, 3);
Total->SetBinContent(10,10); Pass->SetBinContent(10, 7);
Total->SetBinContent(11,10); Pass->SetBinContent(11, 9);
Total->SetBinContent(12,10); Pass->SetBinContent(12, 9);
Total->SetBinContent(13,10); Pass->SetBinContent(13, 9);
Total->SetBinContent(14,10); Pass->SetBinContent(14,10);
Total->SetBinContent(15,10); Pass->SetBinContent(15,10);
Total->SetBinContent(16,10); Pass->SetBinContent(16,10);
Total->SetBinContent(17,10); Pass->SetBinContent(17,10);

TGraphAsymmErrors * tgraphasymmerrors = new TGraphAsymmErrors();

tgraphasymmerrors->BayesDivide(Pass,Total);

TCanvas* c1 = new TCanvas(“c1”,“Efficiency Curve”,50,50,600,600);

TH1F hFrame = ((TPad)c1->cd())->DrawFrame(0.,-.1,17.,1.1);

Total->Draw() ;
Total->SetMaximum(1.1) ;
Total->SetMinimum(-.1) ;

TLine upper(0.,1.,17.,1.) ; TLine lower(0.,0.,17.,0.) ;
upper.SetLineColor(2) ;
lower.SetLineColor(4) ;
upper.DrawLine(0.,1.,17.,1.) ;
lower.DrawLine(0.,0.,17.,0.) ;

tgraphasymmerrors->Draw(“SAMEP0”);

}
[/code]






Hi,

in 5.27.06 we have modified the TGraphAsymmErrors::BayesDivide to use the new TEfficiency class to compute the errors. What is plotted is now the mean of the posterior and its central interval, instead of the mode and the shortest interval. The possibility to plot the mode and the shortest interval (as before in version 5.22) will be restored in the next few days and before the 5.28 release.
See also savannah.cern.ch/bugs/?74056

Best Regards

Lorenzo