Hi all, I’m having trouble with trying to fill a TH1 multiple times with an RDataFrame.
Lets say I define an RDataFrame with two columns and a TH1 to fill
df = ROOT.RDataFrame(100)
df = df.Define('x', '1')
df = df.Define('y', '2')
h = ROOT.TH1I('', '', 2, 1, 3)
I can fill it with one column with no issue
h_filled = df.Fill(h, ['x'])
h_filled.Draw()
but If I try twice, only the last Fill will be registered
h_filled = df.Fill(h, ['x'])
h_filled = df.Fill(h, ['y'])
h_filled.Draw() # results in only the '2' bin being filled
I’m not able to use the filled object as an argument to the second fill like this:
h_filled = df.Fill(h, ['x'])
h_filled = df.Fill(h_filled, ['y'])
h_filled.Draw() # runtime error
even trying to make two histograms and adding them together doesn’t work since Add() doesn’t recognise the RResultsPtr as a Histogram:
h = ROOT.TH1I('test', 'test', 3, 0, 3)
h2 = ROOT.TH1I('test2', 'test2', 3, 0, 3)
h_filled1 = df.Fill(h, ['x'])
h_filled2 = df.Fill(h2, ['y'])
h_filled1.Add(h_filled2) # TypeError
h_filled1.Draw()
Is this just not yet possible or am I misunderstanding something here?
ROOT Version: 6.24/00