Home | News | Documentation | Download

Draw options ignored after TH1::Sumw2 (PyRoot)

Hi,

I am trying to draw my histogram with diferent draw options. I also need to normalize my histograms so following the instructions I found I am doing

from ROOT import *

file=TFile("SingleTopNtuple/SingleTop.ntuple.TDR_012.root")
tree=file.Get("UserData")

histo=TH1F("histo","", 100, 100000, 300000) 
tree.Draw("top_m>>histo", "", "goff") 

histo.Sumw2()
histo.Scale(1./histo.GetSumOfWeights())
histo.Draw("e")

This works OK, the errors are calculated correctly by using TH1::Sumw2. The problem is that once I use Sumw2, non-error options are ignored. For instance,

histo.Draw("l")

will now draw with “e”, no lines are drawn and error bars instead. Is there any solution to this?

(you might say, “why do you whant to do ‘l’, if you care about the error”, but it is still useful to be able to draw in different styles after doing the proper normalization:-)

Use
histo.Draw(“hist”);
or
histo.Draw(“hist l”);

see documentation of TH1::Draw

Rene

Hi Rene

Thank you for your reply.
Yes this works, I missed this in the documentation (now I found it).

Cheers
Akira