RDataFrame Histo1D Multiple Weight Branches

Dear colleagues,

I have a question concerning the RDataFrame.
I am creating a histogram from a data frame like this:

df.Filter(cut).Histo1D(model, branch_name, weight)

For the cut it works well, with a complicated cut string.
But how can I apply multiple weights here? I have three weight columns, which in principle have to be multiplicated to result in a final weight. So far I only see the option to specify only one weight branch in weight.

ROOT Version: 6.14/04
Platform: Centos 7
Compiler: gcc62

You can try to define your weight as a new column:

df.Filter(cut).Define("w", "w1*w2*w3").Histo1D(model, branch_name, w);
1 Like

Okay, thanks.
I thought that this would decrease the speed of the histogram filling significantly? In principle I am using the RDataFrame because of its great runtime performance.

Hi Alex,
you shouldn’t see a slowdown, as I expect you spend the vast majority of the runtime reading from file (disk access + decompression + ROOT deserialization) and only a tiny fraction in calculations and filling.


1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.