Skip to content

[6.42] [tree] Use the counter of the same object for variable-size arrays - #24264

Merged
pcanal merged 2 commits into
root-project:v6-42-00-patchesfrom
root-project-bot:BP_6.42_pull_24183
Nov 20, 2026
Merged

pcanal merged 2 commits into
root-project:v6-42-00-patchesfrom
root-project-bot:BP_6.42_pull_24183

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #24183, requested by @pcanal. For your information @kr1xh

When two objects of the same class are stored in top-level branches
whose names have no trailing dot, their sub-branches get identical
names, e.g. "fN" and "fX" under both "a" and "b". The counter of a
variable-size array member (`Double_t *fX; //[fN]`) was found with
TTree::GetBranch("fN"), which returns the first match in the tree. So
b.fX used a.fN as its counter, and that link was stored in the file.

Look up the counter among the sub-branches of the array's parent
first, and only fall back to the tree-wide search if it is not there.
This covers basic-type arrays, arrays of objects and the MakeClass
recovery path in ReadLeavesMakeClass.

Files written before this change store the wrong counter and are still
read incorrectly; this is not addressed here.

Assisted-by: claude-code:claude-opus-5-5
(cherry picked from commit d8a37e6)
For a variable-size array member of a split object, TTreeReaderArray
took only the short name of the counter branch ("fN") and looked it up
again in the tree. With two objects of the same class in top-level
branches without a trailing dot, that lookup returns the first "fN" in
the tree, so b.fX was read with a.fN's size even when the file stores
the right counter.

Pass the counter branch itself to the size reader and read the size
through the counter's full name ("b.fN").

Fixes root-project#24146

Assisted-by: claude-code:claude-opus-5-5
(cherry picked from commit 1fa357d)
@github-actions

Copy link
Copy Markdown

Test Results

    24 files      24 suites   4d 2h 36m 20s ⏱️
 3 943 tests  3 943 ✅ 0 💤 0 ❌
85 034 runs  85 034 ✅ 0 💤 0 ❌

Results for commit e02307a.

@pcanal
pcanal merged commit 793da9e into root-project:v6-42-00-patches Nov 20, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants