Combining different TTree entries with dataframes

Hello,

I am continuing my fight to switch my analysis codes to dataframes…

I have to generate “uncorrelated data”, by plotting values of a column from a TTree entry versus the same column but from another TTree entry. Let’s say I have an array of double corresponding to energies. I need to plot a TH2 histogram with the energies of entry i on x versus the energies of entry i+1, i+2,… i+N. This is what we called event mixing normalization.

With “classical” selector, this is really easy to do, but how can I handle this with dataframes ?

In a similar way, I have to do an event builder where I take as input a TTree with timestamped entries, and I need to generate a new TTree with merged events on the basis of a time window. Here also I will have to access at the same time to different entries.

Sorry for all my questions… and thank you for your help

Jérémie

Hi @dudouet,

Thank you for your question. It would be great if you can provide small sample snippets of code that you would like to switch to rdataframe. Adding @mczurylo and @vpadulan in the loop.

Cheers,
Devajith

Hi @devajith,

Sorry for the delay, I took the time to write a dedicated and commented macro example to make things easier for you.

Please find the macro here:
macro_example.C (5.5 KB)

And the example input data file here:
ExampleTree.root (2.1 MB)

Please let me know if your need more information of anything

Cheers

Jérémie

Thanks for the example. I’ll try pinging our experts @mczurylo and @vpadulan again!

Cheers,
Devajith

1 Like

Dear @dudouet ,

Thank you for reaching out to the forum and for your macro! Let me have a look at it and I’ll come back to you soon.

Cheers,
Vincenzo