Event weighting with TDataFrame

Hi,

i’m learning how to use TDataFrame but I have a question:
how can i weight events in a Histo1D like doing?

mytree->Draw("a_variable>>myhisto","eventweight","");

for example I have an histogram like this one and I want to apply to it the weight eventweight like in the previous line:

auto myhisto = selected_events.Histo1D({"myhisto", "myhisto", 10, 1, 11}, "avariable");

Federico


ROOT Version:
Platform, compiler:


Hi Federico,

you can add the column name that you want to act as weight as the third argument of the Histo1D method. In code, it’s shorter than in English :slight_smile:

auto myhisto = selected_events.Histo1D({"myhisto", "myhisto", 10, 1, 11}, "avariable", "eventweight");

Cheers,
D

2 Likes

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