[treeplayer] Fix array reading of typedef leaves via branch.leaf syntax - #22950
Merged
Conversation
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
approved these changes
Jul 29, 2026
dpiparo
left a comment
Member
There was a problem hiding this comment.
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.
Test Results 23 files 23 suites 3d 16h 7m 20s ⏱️ Results for commit e306353. |
vepadulano
approved these changes
Jul 29, 2026
vepadulano
left a comment
Member
There was a problem hiding this comment.
This is a verbatim copy of the logic used in TTreeReaderValue at
root/tree/treeplayer/src/TTreeReaderValue.cxx
Line 436 in 7a23951
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.