Looping over different root files (having different tree names but same branches) in RDataFrame

Hello experts,
I am trying to loop over different root files having different tree names (but same names for the branches) using RDataFrame. So to achieve that, this is what I am trying to do:

  1. First I am creating a TChain:
    https://github.com/asantra/FlavorSymmetryArka/blob/master/makeMyFSNtuple.C#L442

  2. Then I am adding different root files in that chain:
    https://github.com/asantra/FlavorSymmetryArka/blob/master/makeMyFSNtuple.C#L456-L458

  3. I am using RDataFrame class instance:
    https://github.com/asantra/FlavorSymmetryArka/blob/master/makeMyFSNtuple.C#L465

The code is compiling fine, but root is breaking while running. When I am using only one tree in the chain, everything is running fine. What am I doing wrong? Any help is appreciated.

Thank you very much,
Arka


_ROOT Version:6.14/04
_Platform:linux SL6
_Compiler:linuxx8664gcc


Hi,
that’s the correct procedure to setup RDF, and it seems to work at least for the small test I attached below.

  1. can you try using v6.16 instead of v6.14? You might be encountering a bug that has been fixed since
  2. can you report the exact error message and complete stacktraces that you get? If stacktraces do not contain line numbers, can you try running your code with a debug build of ROOT? (e.g. a build that ends with -dbg instead of -opt on lxplus/cvmfs)

This works as expected, at least in ROOT v6.16 (EDIT: just tried on v6.14, also works):

#include <ROOT/RDataFrame.hxx>
#include <TChain.h>
#include <iostream>

int main()
{
   // produce two trees with same branches but different names
   auto df = ROOT::RDataFrame(10).Define("x", "42");
   df.Snapshot("tree1", "f1.root");
   df.Snapshot("tree2", "f2.root");

   // add trees to chain
   TChain c("tree1");
   c.Add("f1.root");
   c.Add("f2.root/tree2");

   // pass chain to RDF and process trees with different names
   ROOT::RDataFrame df2(c);
   std::cout << *df2.Mean("x") << std::endl;

   return 0;
}

Hi Enrico,
I have changed to root v6.16. Now, this seems to work. But still, there is a small issue. For example, when I turned this on:

I am getting this error:

Error in TTreeProcessorMT::Process: An error occurred while getting tree ttbar_NoSys from file /eos/atlas/atlascerngroupdisk/phys-susy/2L2J-ANA-SUSY-2018-05/SusySkim2LJets/v1.6/SUSY2/SUSY2_Bkgs_mc16a/diboson_merged_processed.root: skipping this file.
Error in TTreeProcessorMT::Process: An error occurred while getting tree ttbar_NoSys from file /eos/atlas/atlascerngroupdisk/phys-susy/2L2J-ANA-SUSY-2018-05/SusySkim2LJets/v1.6/SUSY2/SUSY2_Bkgs_mc16a/Zjets_merged_processed.root: skipping this file.

How do I solve this problem?

Cheers,
Arka

That’s a bug – it’s now ROOT-10178.

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