# Access data across event/row in RDataFrame

**URL:** <https://root-forum.cern.ch/t/access-data-across-event-row-in-rdataframe/56945>\
**Category:** ROOT\
**Tags:** tree, rdataframe\
**Created:** [November 1, 2023, 1:06am UTC](https://root-forum.cern.ch/t/access-data-across-event-row-in-rdataframe/56945 "2023-11-01T01:06:45Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![vpadulan](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/vpadulan/32/25315_2.png) [@vpadulan](https://root-forum.cern.ch/u/vpadulan)\
**Post date:** [November 1, 2023, 1:27pm UTC](https://root-forum.cern.ch/t/access-data-across-event-row-in-rdataframe/56945/2 "2023-11-01T13:27:42Z")

</div>

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](https://root-forum.cern.ch/t/event-mixing-with-rdataframe/48009/5). 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

---

_[View the full topic](https://root-forum.cern.ch/t/access-data-across-event-row-in-rdataframe/56945)._
