Access data across event/row in RDataFrame

Dear @zhangdanyi ,

Thank you for asking your question on the forum. You are totally right in that the native way of execution of RDataFrame is per-event (soon it will be per-group-of-events), but in general there is no direct way in the API to establish relations between the current event and others.

There have been similar discussions on the forum, one way to achieve what you want is implementing an helper to act as a “sliding window” on the values of your dataset. See a concrete example in this forum post. One potential issue I see is regarding this specific statement

for each row it will be an array of the distances between this row and other rows.

This means that somehow you need to store all the values of the column in memory, and for each event compare the current value against all the others. It can be done, but it surely has a cost.

Cheers,
Vincenzo

1 Like