THStack with RDataFrame

Hi, I’m trying to draw a simple THStack using the new RDataFrame class. The problem is that I get the histograms drawn as points, while I would like to have them drawn as line and filled with colors.

c125_25 = ROOT.TCanvas("c1", "c1", 0, 0, 800, 600)

df_top = ROOT.RDataFrame("ttbar", "/mypath/bkgade.root")
df_singletop = ROOT.RDataFrame("Wt", "/mypath/bkgade.root")

hsingletop = df_singletop.Histo1D("BDT_DeltaM100","Weight")
htop = df_top.Histo1D("BDT_DeltaM100","Weight")

hsingletop.SetFillColor(kOrange-9)
htop.SetFillColor(kAzure+1)

hsingletop.GetXaxis().SetLimits(0.,1.)
htop.GetXaxis().SetLimits(0.,1.)

hs = ROOT.THStack("","")    
hs.Add(hsingletop.GetPtr())
hs.Add(htop.GetPtr())
hs.Draw("F")

Hi @eballabe,
welcome to the ROOT forum!

To be 100% sure I understand the problem: can you get the THStack drawn as you want if RDataFrame is not involved?

Cheers,
Enrico

Hi @eguiraud,
I just solved the issue (nothing to do with RDataFrame). I just changed the last line:

hs.Draw("HIST")

as I read here:

Thanks for the reply!
Eric

1 Like