using namespace ROOT::Experimental;
TDataFrame df("ntuple", "file.root");
df.Filter("value < 300").Foreach(doStuff);
TDataFrame uses TTreeReader under the hood and has one notable advantage which is easy parallel execution: you just need to call ROOT::EnableImplicitMT() before constructing the TDataFrame object.
Hope this helps, just ask if you have more questions.
I already came across TDataFrame. It should give what I am looking for but right now I am not able to update to 6.10 without some testing of my code.
However, the first solution should do the trick.
But i think I do not gain much compared to just using if-statements right?
My idea was to do such selections without to much overhead of defining variables and such (by simply defining a string as in TTree->CloneTree ) since I am usually evaluating multiple and more complex logical expressions.
But i think I do not gain much compared to just using if-statements right?
Well I am just using if statements That’s pretty much the fastest single-thread code you can write.
I agree it can get verbose, that was one of the main reasons to introduce TDataFrame.
Or if you don’t mind a bit of a performance hit you can switch to python and pyROOT – pyROOT syntax is more terse