I want to get the maximum value of tree branch.
Without any condition command is like this: tree->GetMaximum(“branch name”) - works fine.
But if I want maximum value of same branch after some condition then what will be the exact command?
tree->GetMaximum(“branch name”,“condition”) - doesn’t work.
Hi renu,
if you have access to ROOT v6-10, TDataFrame can help you:
#include "ROOT/TDataFrame.hxx"
using namespace ROOT::Experimental;
int main() {
TDataFrame d("treename", "filename.root");
auto max = d.Filter("condition").Max("branch");
return 0;
}
where “condition” can be a string that must contain a valid c++ expression that returns a boolean, or you can pass a proper c++ function (or lambda, or functor class) like this:
I am afraid not, TDataFrame is a new interface introduced in v6.10. I suggest you upgrade if you can, ROOT 5 has not been updated in more than one year and has several known issues.
With that said, maybe @pcanal or @Danilo know how to get the maximum of a filtered branch in ROOT 5.