Skip to content

Fix reading of objects with custom streamer stored in TTree branch - #432

Merged
linev merged 2 commits into
root-project:devfrom
Prafyl:fix-tlv-branch
Oct 26, 2026
Merged

linev merged 2 commits into
root-project:devfrom
Prafyl:fix-tlv-branch

Conversation

@Prafyl

@Prafyl Prafyl commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

when a class with its own Streamer is stored with tree->Branch("lv", &lv) (TLorentzVector, TVector3, TGraph, TMatrixD, TVectorD ...) ROOT doesnt split it and writes each entry with the class streamer, so every entry starts with version and bytecount. jsroot ran the member streamers directly without reading that header, so all values came out shifted, for TLorentzVector fE was the same garbage number in every entry.

for branches with fType -1 it now uses buf.classStreamer(), which reads the header and still handles classes like TDatime that have none. this also fixes Branch("oa", "TObjArray", &arr) which threw a RangeError, and TList which came back empty.

added demo/node/tree_tobject_test made with ROOT 6.40, it fails on current dev and passes with the fix.

this was assisted by ai

@linev linev closed this Oct 26, 2026
@linev linev reopened this Oct 26, 2026
@linev

linev commented Oct 26, 2026

Copy link
Copy Markdown
Member

I closed and open again PR to restart CI jobs

@linev linev self-assigned this Oct 26, 2026

@linev linev 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.

I can confirm that correspondent code exists in ROOT
In TTreeReaderValue.cxx, line 771

      } else if (brElement->GetType() == -1 && brElement->GetTypeName()) {
         dict = TDictionary::GetDictionary(brElement->GetTypeName());
         ResolveTypedef();
         return brElement->GetTypeName();
      }

Thanks for fixing it!

@linev
linev merged commit fa4a38a into root-project:dev Oct 26, 2026
23 of 35 checks passed
linev added a commit that referenced this pull request Oct 26, 2026
linev added a commit that referenced this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants