RDataFrame with weight

Dear all:

Thanks a lot for developing the RDataFrame. Currently, I’d like to use it(RDataFrame) to manipulate the branches like tree->Draw(). I saw the comparsion of RDataFrame with tree-Draw() in introduction of RDataFrame. But there is something different.

for example:

tree->Draw(“jet_eta”, “weight *2* (event == 1)”)

will not only apply cut: (event==1), but also weight the jet_eta with weight*2

Could it be possible to do both (weight and cut) with RDataFrame?

RDataFrame::Filter seems doesn’t work

Cheers,
Yingjie


Please read tips for efficient and successful posting and posting code

ROOT Version: root 6.22.06
Platform: centos 7.9
Compiler: gcc 8.3.0


Hi @yingjie_wei ,
you can add a weight to the filling of a histogram by passing a weight parameter to Histo1D:

df.Filter("event == 1").Histo1D("jet_eta", "weight*2")

Cheers,
Enrico

2 Likes

enomous thanks!

Yingjie

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