Skip to content

Commit d3f02ef

Browse files
committed
Use custom streamer for TBranch
Older TBranch versions below 10 requires custom streamers
1 parent 502115c commit d3f02ef

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

modules/io.mjs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,12 @@ CustomStreamers = {
375375
func(buf, obj) { obj.$kind = 'TTree'; obj.$file = buf.fFile; }
376376
},
377377

378+
TBranch(buf, obj) {
379+
if (buf.last_read_version > 9)
380+
buf.streamClassMembers(obj, 'TBranch', buf.last_read_version, buf.last_read_checksum);
381+
382+
},
383+
378384
'ROOT::RNTuple': {
379385
name: '$file',
380386
func(buf, obj) { obj.$kind = 'ROOT::RNTuple'; obj.$file = buf.fFile; }
@@ -2649,6 +2655,17 @@ class TBuffer {
26492655
return obj;
26502656
}
26512657

2658+
/** @summary Stream class members using normal streamer */
2659+
streamClassMembers(obj, classname, version) {
2660+
const streamer = this.fFile.getStreamer(classname, { val: version }, undefined, true);
2661+
if (streamer !== null) {
2662+
const len = streamer.length;
2663+
for (let n = 0; n < len; ++n)
2664+
streamer[n].func(this, obj);
2665+
}
2666+
return obj;
2667+
}
2668+
26522669
} // class TBuffer
26532670

26542671
// ==============================================================================
@@ -3567,7 +3584,7 @@ class TFile {
35673584
/** @summary Returns streamer for the class 'clname',
35683585
* @desc From the list of streamers or generate it from the streamer infos and add it to the list
35693586
* @private */
3570-
getStreamer(clname, ver, s_i) {
3587+
getStreamer(clname, ver, s_i, only_plain) {
35713588
// these are special cases, which are handled separately
35723589
if (clname === clTQObject || clname === clTBasket)
35733590
return null;
@@ -3581,7 +3598,7 @@ class TFile {
35813598
return streamer;
35823599
}
35833600

3584-
const custom = CustomStreamers[clname];
3601+
const custom = only_plain ? null : CustomStreamers[clname];
35853602

35863603
// one can define in the user streamers just aliases
35873604
if (isStr(custom))

0 commit comments

Comments
 (0)