Hi all,
TTree::Draw has an easy to use syntax, but it loops over all event entries for each plot. For large dataset and a large number of plots, this is inefficient due to IO time, which generally trumps CPU time. One can write a macro but of course it doesn’t have the nice syntax of TTree::Draw and is more difficult to maintain, or to port from one analysis to another.
I wonder how TTree/TChain implements parsing of selection string and testing a selection on an event. I would think it should be easy to even allow filling histogram with similar functionality. I am thinking about pseudo codes like the following:
tree->SetDraw(var1,selection1,h1)
...
tree->SetDraw(var100,selection100,h100)
tree->RunDraw() //where it fills all histograms
or (if an explicit loop is needed)
for (...[getting entries]..){
histo1->Fill(var1,selection1);
..
histo100->Fill(var100,selection100);
}
or even just (so that there is no need to write complicated nested if structures.)
if {event->cut(selection1)} histo1->Fill(var1)
In short, is there currently an easy way to fill histograms which has the following feature:
- simple selection string syntax
- scalable with large number of histograms
- (possibly) pyroot support
There were similar questions before:
TDataFrame seems to be working towards that direction, but it baffles me that it doesn’t really do string parsing like TTree::Draw. How hard is it to reuse the selection string feature?
It’d be great if someone could comment on this. Thank you in advance.