TDataFrame "report" with weighted events

Hi everyone,

is it possibile to have the “report” function output that takes into account weighted events instead of only events (== number of entries that survive a certain selection cut)?

Cheers,
Federico


_ROOT Version: 6.12
_Platform: Centos7
Compiler: Not Provided


Hi Federico,

unfortunately this is not possible: Report “counts” entries which are passing a certain sequence of filters. Perhaps you can solve your case “accumulating the weights” with an action hanging from the last of the filters in the chain?

Best,
D

Hi,

I’m sorry but I’ve not understood what you suggest.
Is it a possible to ask you a small example of what you mean ?
Also because one of the best feature of the TDataFrame is the multithread option and summing a variable is not always “thread safe”.

Cheers,
Federico

Hi Federico,

the method I am suggesting to use is Sum. This method returns a ResultPtr to the sum of the elements in the column specified:

auto  mySum = tdf.Filter(myfilter, mycolumns).Sum("myweights");
std::cout << mySum.GetValue() << std::endl;

And, most importantly, all actions performed by TDF are thread-safe (unless thread unsafe lambdas are injected by the user in the graph).

Cheers,
D

2 Likes

Thank you !!! I’ve just modified my program and it works properly !

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