Is there a way to know (initial) number of entries in RDataFrame without explicit loop?
I use RDataFrame to analyse a very large TChain.
Of course I can get number of event from TChain object,
but in my code I have a (python) function that gets as input RDataFrame object,
and it will be nice to get the number of entries from the frame itself.
Surely I can rely of frame.Count() but it triggers the loop.
In other words. is there a way to get number of entries from RDataFrame before running the actual loop?
def my_fun ( frame ) :
nentries = .... ? ## is there a way to get number of entries here?
variables = ...
return frame.Book ( std.move ( MyAction ( ... ) ) , variables )
Yes you are right - currently I am getting number of events from initial TChain (that is out of the scope of my function) but I’d like to keep my code a bit more generic, without loop-back to the initial TChain object.
I’ve inspected RInterfaceBase and RNodeBase and I’ve found no obvious candidates.
Unfortunately, we do not currently plan to add this feature to RDF, to keep the interface minimal and as generic as possible. I hope you can do something with chains. If not, would you like perhaps to share more about your use case if it cannot be catered with RDF?