How to use GetEntryNumberWithBestIndex()?

Hi,
same answer as Find closest value in a column of a TNtuple? I’m afraid, this usecase is not something RDF is meant for.

GetEntryNumberWithBestIndex is a method to deal with friend trees, it does not solve this usecase.

In fact this is not something Trees/TNtuples are meant for: if I understand correctly, to get the result you need there is no way you can do less than 2 or 3 nested for loops. Nested loops over all events in a TNtuple are not something ROOT interfaces are designed for (you can do nested loops, but it’s very expensive in terms of runtime). The typical way to deal with this is to load the data into memory, as you do in Find closest value in a column of a TNtuple? .

Hope this helps!
Enrico