Skip to content

TChain::CopyAddresses:0 warning in RDataFrame Snapshot of TChain with multiple files with objects #7727

@dudarboh

Description

@dudarboh
  • Checked for duplicates

Describe the bug

  1. Use TChain with >1 root files as an input for RDataFrame
  2. TChain should have objects like XYZVector or vector <double>, etc.
  3. Snapshot RDataFrame providing list of columns
  4. Warning TChain::CopyAddresses:0: RuntimeWarning: Could not find branch named 'xxx' in tree named 'xxx'appears
  5. 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

  1. ROOT 6.22/00 from /cvmfs/sft.cern.ch/lcg/views/LCG_98python3/x86_64-centos7-gcc10-opt/bin/root
  2. Centos 7
  3. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions