Dear ROOT-experts,
I’m wondering if there is a way to get the name of the file for which a specific entry in an RDF belongs to. If I create an RDF adding several files together I want to be able to get the filename of this event. E.g. to be used with the DefinePerSample(), where I want to use different numbers depending on the file I process.
Thanks for any help on this!
best,
Eirik
Hi @Eirik_Gramstad,
nice to see you on the forum and thank you for the question.
Yes, there is a way to do it using RSampleInfo (ROOT: ROOT::RDF::RSampleInfo Class Reference). There is a tutorial both in c++ and python showcasing some use of DefinePerSample including retrieving some of the information stored in the corresponding specification json file:
c++ version: https://github.com/root-project/root/blob/master/tutorials/dataframe/df106_HiggsToFourLeptons.C
python version: https://github.com/root-project/root/blob/master/tutorials/dataframe/df106_HiggsToFourLeptons.py
and the corresponding json file: https://github.com/root-project/root/blob/master/tutorials/dataframe/df106_HiggsToFourLeptons_spec.json
Please let me know if you need further information regarding any of these.
Cheers,
Marta
Hi Marta
Thanks a lot! That is exactly what I’m looking for.
best,
Eirik