TDF Branch not found when using friend trees?

Hi,

I’m using TDataFrame to reduce the number of events in my files and encountered a problem when using friend trees and multithreading.

In single threaded operation the following script works fine. However, when ROOT::EnableImplicitMT() is called the following error message appears after which root crashed quite hard (as in .q does not quit). This is running on a recent build of the master branch.

Error output when using implicit MT:

Warning in <TChain::CopyAddresses>: Could not find branch named 'lepton_PromptLeptonIso_TagWeight' in tree named 't'
... some more lines like this ...

Minimal reproducer (might not trigger the crash, but does trigger the warning):

#include "ROOT/TDataFrame.hxx"

using namespace ROOT::Experimental;

void main() {

   ROOT::EnableImplicitMT();

   std::string path {"/eos/atlas/user/r/rpolifka/tthml/v29/gfw2_v29_sysnom.root"};
   std::string friend_path {"/eos/atlas/user/r/rpolifka/tthml/BDTTrainings/BDTTrain_3L_Nom_v29_v2-2L-CFK-Loose0/BDT_3L_v29_v2-2L-CFK-Loose0.root"};

   TFile file {path.c_str()};
   TFile friend_file {friend_path.c_str()};
   TTree * tree = dynamic_cast<TTree *>(file.Get("nominal"));
   TTree * friend_tree = dynamic_cast<TTree *>(friend_file.Get("nominal_friend"));

   tree->AddFriend(friend_tree);

   TDataFrame df {*tree};

   df.Filter("mc_channel_number==410512")
     .Snapshot("t", "out.root", {"BDT_score_ttH", "mc_channel_number"})
     ;
}

Hi Kim,
thank you for the report, it’s certainly not nice of TDF to behave like that.

This is now ROOT-9281, where I added a tweaked version of your script as reproducer. Let’s continue there :slight_smile:

Cheers,
Enrico

1 Like

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