THistPainter draws error bars in the wrong place on a pad with SetLogx. Reproducer follows.
import ROOT
can = ROOT.TCanvas()
can.SetLogx()
h = ROOT.TH1D('h', 'h', 5, 1, 6)
for i in xrange(1, 6):
h.SetBinContent(i, i)
h.Draw()
can.Update() # notice that it looks fine
h.Sumw2()
h.Draw()
can.Update() # notice that the histogram disappears
h2 = ROOT.TH1D('h2', 'h2', 5, 0, 5) # now make a histogram with a bin at 0
for i in xrange(1, 6):
h2.SetBinContent(i, i)
h2.Draw()
can.Update() # notice that it looks fine
h2.Sumw2()
h2.Draw()
can.Update() # notice that one bin disappears and the lower limits of each bin extend too low
h2.Draw('h')
can.Update() # notice that the histogram now appears in the right place with only the error bars in the wrong
ROOT Version: master Platform: macOS Compiler: Not Provided
Okay, I was able to track down the source of the problem. THistPainter::PaintErrors failed to adjust for the log scale when calculating the location of the error bars. I have created a JIRA task and submitted a pull request fixing the issue.
The following (simpler ) macro is enough to show the problem.
void graphlogx() {
auto can = new TCanvas();
can->SetLogx();
auto h2 = new TH1D("h2", "h2", 5, 0, 5);
for (int i=1; i<6; i++) h2->SetBinContent(i, i);
h2->Sumw2();
h2->Draw();
h2->Draw("hist same");
}