I have ROOT files that have the following structure for each entry (=event):
vector<Double_t > primary_vertex_x e.g (1, 2)
vector<Double_t > primary_vertex_y e.g (-1.5, 1)
…
vector<Double_t > primary_vertex_id_for_track e.g ( 0, 1, 0)
vector<Double_t > track_px e.g ( 10, 13,12 )
vector<Double_t > track_py e.g (21, -22, 20)
I have, say, 2 primary vertices and 3 tracks in an event and primary_vertex_id_for_track tells me for each track which primary vertex to link to.
I would like to read this tree and flatten it, such that this event gives me 3 entries.
e.g
primary_vertex_x, primary_vertex_y, track_px, track_py
1, -1.5, 10, 21
2, 1, 13, -22
1, -1.5, 12, 20
I can do this using pyroot by looping over each event. Is there a way to do with RDataFrame in python?