where do_something is the name of some function that you want to execute for each event that passes the filter. More RDF tutorials here.
If you really have to use a TCut object in conjuction with a TTreeReader: I don’t think there is a direct way to do that, but you should be able to produce a TEntryList from a TCut using TTree::Draw and then you can use the TEntryList with TTreeReader.
thanks for your reply. Actually I would like to create an array of cuts and apply them through an iteration. It is much more flexible than changing them inside the reader loop each time. I tried to find out how the TCut works in the TTree->Draw() function but is seems quite complex.
The RDataFrame solution seems to be very convenient.
Hi,
note that the strings passed to RDataFrame must be valid C++ code, they do not follow any other special syntax other than the fact that you can use branch names as variables. But yes, in general RDataFrame is pretty flexible.
Using TTree::Draw to fill a TEntryList is actually quite simple: tree.Draw(">>yplus","y>0") fills a TEntryList called yplus with the entries for which y > 0 is true. You can read more at the TTree::Draw docs (search for " Saving the result of Draw to a TEventList, a TEntryList or a TEntryListArray").