Skip to content

[treeplayer] Fix array reading of typedef leaves via branch.leaf syntax - #22950

Merged
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:issue-9758
Jul 29, 2026
Merged

[treeplayer] Fix array reading of typedef leaves via branch.leaf syntax#22950
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:issue-9758

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

TTreeReaderArray<ULong64_t>(r, "x.x") failed with "Leaf of type ULong64_t cannot be read by TTreeReaderValue", while the plain branch name "x" worked.

TTreeReaderArrayBase::GetBranchAndLeaf() matched the leaf type against the reader type by comparing TDictionary object identity. For a typedef'd fundamental such as ULong64_t, the leaf's TDataType is the typedef itself (GetTypeName() returns "ULong64_t", not the resolved "unsigned long long"), so the looked-up dictionary differed from fDict (the "unsigned long long" TDataType) and the match failed even though both denote the same fundamental type.

Compare the underlying EDataType instead, mirroring what TTreeReaderValue already does. This fixes ULong64_t and every other typedef'd fundamental.

Closes #9758.

🤖 Done with the help of AI.

TTreeReaderArray<ULong64_t>(r, "x.x") failed with "Leaf of type ULong64_t
cannot be read by TTreeReaderValue<unsigned long long>", while the plain
branch name "x" worked.

TTreeReaderArrayBase::GetBranchAndLeaf() matched the leaf type against the
reader type by comparing TDictionary object identity. For a typedef'd
fundamental such as ULong64_t, the leaf's TDataType is the typedef itself
(GetTypeName() returns "ULong64_t", not the resolved "unsigned long long"),
so the looked-up dictionary differed from fDict (the "unsigned long long"
TDataType) and the match failed even though both denote the same fundamental
type.

Compare the underlying EDataType instead, mirroring what TTreeReaderValue
already does. This fixes ULong64_t and every other typedef'd fundamental.

Closes root-project#9758.

🤖 Done with the help of AI.

@dpiparo dpiparo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for digging this out. To me the change looks appropriate, also because it realigns TTreeReaderValue and TTreeReaderArray. I would like to ask the opinion of @vepadulano , who has a demonstrated experience with the TTreeReader federation of classes.

@github-actions

Copy link
Copy Markdown

Test Results

    23 files      23 suites   3d 16h 7m 20s ⏱️
 3 875 tests  3 875 ✅ 0 💤 0 ❌
78 940 runs  78 940 ✅ 0 💤 0 ❌

Results for commit e306353.

@vepadulano vepadulano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a verbatim copy of the logic used in TTreeReaderValue at

if (tempDict && fDict->IsA() == TDataType::Class() && tempDict->GetType() == ((TDataType *)fDict)->GetType()) {
, which makes sense.

@guitargeek
guitargeek merged commit a75c339 into root-project:master Jul 29, 2026
42 checks passed
@guitargeek
guitargeek deleted the issue-9758 branch July 29, 2026 15:07
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.

TTreeReaderArray can't read leafs of ULong64_t type (but branches are fine)

3 participants