-
Notifications
You must be signed in to change notification settings - Fork 1.5k
TChain::CopyAddresses:0 warning in RDataFrame Snapshot of TChain with multiple files with objects #7727
Copy link
Copy link
Closed
Labels
Description
- Checked for duplicates
Describe the bug
- Use
TChainwith >1 root files as an input for RDataFrame - TChain should have objects like
XYZVectororvector <double>, etc. - Snapshot RDataFrame providing list of columns
- Warning
TChain::CopyAddresses:0: RuntimeWarning: Could not find branch named 'xxx' in tree named 'xxx'appears - Warning appears on the transition between files.
Expected behavior
Expected no warning if it has no effect on the output.
Error, if it effects the output.
List of possible scenarios when it cause code to break?
To Reproduce
Compact reproducer:
import ROOT
ROOT.gInterpreter.Declare(
'''
#include "Math/Vector3D.h"
using namespace ROOT::Math;
''')
def test_warning():
# Create two files to read data from
# Warning appears only for cpp_vec and phys_vec branches
for i in range(2):
ROOT.RDataFrame(10).Define("simple_number", "rdfentry_")\
.Define("cpp_vec", "std::vector<double>{-1, 42, -1}")\
.Define("phys_vec", "XYZVector(-1, 42, -1)")\
.Snapshot("test_tree", "file{}.root".format(i))
ch = ROOT.TChain("test_tree")
# Using only one file shows No warning...
# ch.Add("./file1.root")
ch.Add("./file[01].root")
df = ROOT.RDataFrame(ch).Filter('{cout<<"Event: "<<rdfentry_<< endl;} return true;')
df = df.Define("new_var", "phys_vec.Y()*cpp_vec[1]")
# Snapshoting w/o branch list shows no warning too
# df.Snapshot("new_tree", "new_file.root")
df.Snapshot("new_tree", "new_file.root", ["new_var"])
test_warning()
Setup
- ROOT 6.22/00 from /cvmfs/sft.cern.ch/lcg/views/LCG_98python3/x86_64-centos7-gcc10-opt/bin/root
- Centos 7
- Python 3.7.6
Additional Information
This behaviour was spotted and discussed at ROOT forum:
https://root-forum.cern.ch/t/warning-in-tchain-copyaddresses-could-not-find-branch-named/35055
https://root-forum.cern.ch/t/tchain-0-warning-with-rdataframe-could-not-find-branch-named/44186
Reactions are currently unavailable