Easiest way to add entries of a TTree

What is the easiest way to add or make operations with the entries of a TTree? Specifically, I want to do something like \sqrt{entry(1) + entry(2) + … + entry(N)}. This can be easily done with a macro, but I wonder if there is an easier way, even from the TBrowser prompt.

assuming that you want the square root of the sum of the values of a branch, with RDataFrame (available since ROOT v6.16) this would be (in C++ and python alike):

sqrt(RDataFrame("treename", "filename.root").Sum("branch").GetValue())


My ROOT version is 6.06/08, so it does not recognize RDataFrame. I can’t update ROOT since I am running it in an external cluster.

Apart form RDataFrame the only other option I can think of is to write a macro.

You should suggest to whoever is maintaining your cluster to upgrade ROOT!