Look at every n-th event

Dear experts,
I am wondering if it is possible to somehow look at every 10th event after particular cut using RDataFrame?
What I basically want to happen is having some pT cut and if pT is more than 45, then look at only every 10th event with pT > 45. And if the pT is less than 45, then I look at every event.
Thank you!

I got an advice from C++ experts to include event adapter, however this seems to be too much complicated. Maybe there is some easier way together with ROOT? You usually helped me out, @eguiraud or @vpadulan, maybe you have some advice regarding this? Sorry for tagging you here. Thanks!

Hi @beg1nner ,

My personal opinion is that your case does not really fit in the columnar logic that should be adopted with RDataFrame. Nonetheless, I think a starting point for you could be leveraging ROOT::RDF::RResultPtr::OnPartialResult, which allows you to pass a callable that gets executed every N events while computing a particular result.

I’m attaching the following example that might give you some inspiration:
test.cpp (1.5 KB)

There might be other ways, this is the fastest that came to mind.