RDataFrame: TProfile gives wrong result

I created a RDataFrame object that fills a TProfile thanks to a lambda function that is passed to the Foreach() method. The TProfile is declared outside the lambda, and its scope is not bound to the RDataFrame object.
The resulting profile does not contain the mean value of the quantity stored in the Y axis, but it rather behaves as a normal TH1.
Is this expected and, if so, why?

Hi @bfontana,
I’m not sure what you mean with

If TProfile as a class does not behave as you expect that’s probably unrelated to RDataFrame. Does the example snippet here behave as you’d expect? If so, how does it differ from the output you get in your case?

Note that RDF provides an action to fill TProfiles (you can search the RDF users guide for “Profile”). One major advantage of the built-in action is that it’s thread-safe, while the lambda you pass to Foreach won’t be unless you explicitly take special precautions.


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