Skip to content

TTreeFormula give the wrong result in case of renaming rule (both simple and complex) #14493

Open
@pcanal

Description

@pcanal

Check duplicate issues.

  • Checked for duplicates

Description

TTreeFormula (and thus by extend TTree::Scan and TTree::Draw) does not handle well (under-statement) cases of schema evolution that involves renaming a class. See the reproducer for more details.

We need to verify if whether TTreeReader and thus RDataFrame suffer from the same issue

Reproducer

conversion.tgz
run:

    root.exe -b -l -q writedata.C+
    # Read with the 'old' schema, the result is accurate.
    root.exe -b -l -q oldread.C+
    # Read with the complex rule ; TTree::Scan is broken
    root.exe -b -l -q readwithrule.C+
    # Read with the renaming rule ; TTree::Scan only works for accessing the inner content in the case of a split branch.
    root.exe -b -l -q readwithrenaming.C+

The correct output for the full object printing part of the reading script is:

Content of branch seg_split.
Wrapper
CSCSegment::someValue = 1
CSCSegment::theDuplicateSegments size = 2
  MatchedCSCSegment::someValue = 2
  MatchedCSCSegment::someValue = 3
Content of branch seg_unsplit.
Wrapper
CSCSegment::someValue = 1
CSCSegment::theDuplicateSegments size = 2
  MatchedCSCSegment::someValue = 2
  MatchedCSCSegment::someValue = 3

The expected result of the TTree::Scan part of the reading script is:

******************************************************************
*    Row   * Instance * [email protected] *
******************************************************************
*        0 *        0 *                                        2 *
******************************************************************
**************************************************************************************
*    Row   * Instance *                 seg_split.obj.theDuplicateSegments.someValue *
**************************************************************************************
*        0 *        0 *                                                            2 *
*        0 *        1 *                                                            3 *
**************************************************************************************
******************************************************************
*    Row   * Instance * [email protected] *
******************************************************************
*        0 *        0 *                                        2 *
******************************************************************
**************************************************************************************
*    Row   * Instance *               seg_unsplit.obj.theDuplicateSegments.someValue *
**************************************************************************************
*        0 *        0 *                                                            2 *
*        0 *        1 *                                                            3 *
**************************************************************************************

which is seen only when running oldread.C+

readingwithrules gives the wrong output for all 4 call to TTree::Scan and has debug print out that shows that the read rule function is run too many times.

readingwithrenaming give the right result on for reading the data member of the inner collection when stored in a split branch (4th instance of TTree::Scan.)

ROOT version

master (and at least v6.30 and 6.28 and probably all older releases)

Installation method

any

Operating system

any

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions