Problem with multiple files in TChain with MakeSelector class

I used MakeSelector on a TTree. When processing with more than one file in a TChain I get the following error after each event once the second file is reached:
Warning in TTreeReader::SetEntryBase(): The current tree in the TChain h42 has changed (e.g. by TTree::Process) even though TTreeReader::SetEntry() was called, which switched the tree again. Did you mean to call TTreeReader::SetLocalEntry()?

I tried the very simple example here:
https://root.cern.ch/root/htmldoc/guides/users-guide/ExampleAnalysis.html
and had the same problem. I have seen this on my mac with version 6.16 and on linux with version 6.12/07.
Is there a way around this problem?


ROOT Version: 6.16/00
Platform: macosx64
Compiler: Not Provided


See the very first “note” in:

I get the exact same skeleton if I do it on the TChain or on the TTree and the same results. I have attached an image showing how simple it is to recreate the problem. The files dstarmb.root and dstarp2.root can be found at http://root.cern.ch/files/h1/dstarmb.root and http://root.cern.ch/files/h1/dstarp2.root

See the third “note” … try to use the “=legacy” option (to generate a pre-ROOT-6 selector):

chain.MakeSelector("h1analysis", "=legacy"); // ROOT 6.06 or newer

Well, you have “covar[ntracks][15]/F” (and “ntracks/I”) but I am not sure if such two dimensional variable size arrays are supported by all ROOT analysis skeletons.

Turns out I should have looked closer at the error message. If I replace fReader.SetEntry(entry); with fReader.SetLocalEntry(entry); in the Process function of the .C file, then it works.

1 Like

@axel It sounds like a bug in the new TTree::MakeSelector (or actually two bugs, one related to the “covar” branch not being treated properly and another one to the SetEntry).

Thank everyone! @pcanal introduced a change here recently. @pcanal could you have a look, please? As the first post says, we have a good reproducer.

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

If I remember correctly TTreeReader (and by extension the ‘new’ MakeSelector and RDataFrame) do not support (yet!) multi-dimensional arrays.

The problem with SetEntry vs SetLocalEntry has been resolved in the master, v6.16, and v6.14 and v6.12 patch branches.

1 Like