Select unique candidates based on their ID and variable

Thanks Danilo for your prompt answer.

You have a dataset and some entries (events) are logically grouped via a certain category variable, the “evt number ID”. You would like for each value of this ID select of the events characterised by it only one based on a second variable, called x (please correct me if I am wrong).

Indeed that’s exactly the functionality I’m trying to implement.

Have you tried to enhance your filtering class to somehow store the pairs category-x during the first loop and to use them for filtering during subsequent loops? Or to extract the “analysis state”, the collection of category-x pairs, and use it to initialise a second simple filtering class that just checks if the entry being processed is in the list (this second one, since we’ll just be reading will not need locks)?

As I’m not very familiar with RDataFrames I wasn’t sure whether (and how to) perform two subsequent loops within one instance of Filter. Do you have a skeleton example or boiler plate I could have a look at?

Thanks in advance!
Davide