Opening RDataFrame with different Trees

Hi,
I am finding a bug when opening an RDataFrame with multiple files. In particular, due to the data analysis I perform it may happen that the files don’t all have the same TTrees present. When I load them in a TChain and then use the TChain to open the RDataFrame it happens that when the first file doesn’t have all the TTrees of the rest of the files the python kernel crashes (i am doing this operation using pyroot on a jupyter notebook).
I would like to have a solution in order not to make it crash, for me it would be already sufficient to only read the common TTrees among the files.

Best,
Giorgio

ROOT Version: 6.30/02
Platform: Red Hat 11.4.1-2
Compiler: GCC 11.4.1


Hi Giorgio,

Thanks for the post. Let’s disentangle a bit the elements here.
You are creating a chain of trees by adding files, and some of this files do not have the tree you are interested in. In case you use this chain with RDF, your program crashes.
Am I understanding correctly? Sorry if I do not.

If I am, could you post a minimal reproducer in C++?

Cheers,
D

Hi @Danilo ,
Thank you for the quick response. I am trying to produce a demonstrator that you can execute but since the writing of the .root files is done with custom classes I need to reproduce the situation otherwise.

As you said, I create a chain of trees adding files manually (in my files I have several trees that are all friends of the main one called “qtree”). After the chain is created i use it to open an RDataFrame that i use as the python interface to my files.

Anyhow the error it gives me is:

runtime_error: const double& ROOT::RDF::RResultPtr<double>::GetValue() =>
    runtime_error: GetFriendInfo: Could not retrieve TTree "qtree_Calibration" from file "Production_cryo_det_03_016_007_000002_T_p001.root"

which is because I have two files here and only one has the TTree “qtree_Calibration”.

I hope this helps.
Best,
Giorgio

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.