Skip to content
This repository was archived by the owner on Oct 30, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 2 additions & 15 deletions groot/cmd/root-gen-type/testdata/rvec.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package main

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbase"
Expand Down Expand Up @@ -45,13 +44,7 @@ func (o *ROOT__VecOps__RVec_float_) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

r.ReadStdVectorF32(&o.This)

Expand Down Expand Up @@ -124,13 +117,7 @@ func (o *ROOT__VecOps__RVec_int_) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

r.ReadStdVectorI32(&o.This)

Expand Down
17 changes: 2 additions & 15 deletions groot/cmd/root-gen-type/testdata/small-evnt-tree-fullsplit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package main

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbase"
Expand Down Expand Up @@ -129,13 +128,7 @@ func (o *Event) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

o.Beg = r.ReadString()
o.I16 = r.ReadI16()
Expand Down Expand Up @@ -760,13 +753,7 @@ func (o *P3) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

o.Px = r.ReadI32()
o.Py = r.ReadF64()
Expand Down
17 changes: 2 additions & 15 deletions groot/cmd/root-gen-type/testdata/streamers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package main

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbase"
Expand Down Expand Up @@ -147,13 +146,7 @@ func (o *Event) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

o.Beg = r.ReadString()
o.I16 = r.ReadI16()
Expand Down Expand Up @@ -890,13 +883,7 @@ func (o *P3) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

o.Px = r.ReadI32()
o.Py = r.ReadF64()
Expand Down
25 changes: 3 additions & 22 deletions groot/cmd/root-gen-type/testdata/tbase.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
package main

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbase"
Expand Down Expand Up @@ -47,13 +46,7 @@ func (o *D1) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

r.ReadObject(&o.base0)
o.D32 = r.ReadI32()
Expand Down Expand Up @@ -140,13 +133,7 @@ func (o *Base) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

o.I32 = r.ReadI32()

Expand Down Expand Up @@ -221,13 +208,7 @@ func (o *D2) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(o.Class())
if hdr.Vers > o.RVersion() {
panic(fmt.Errorf(
"rbytes: invalid %s version=%d > %d",
o.Class(), hdr.Vers, o.RVersion(),
))
}
hdr := r.ReadHeader(o.Class(), o.RVersion())

r.ReadObject(&o.base0)
o.I32 = r.ReadI32()
Expand Down
4 changes: 2 additions & 2 deletions groot/exp/rntup/rntup.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (*NTuple) Class() string {
}

func (*NTuple) RVersion() int16 {
return 0 // FIXME(sbinet): generate through gen.rboot
return 1 // FIXME(sbinet): generate through gen.rboot
}

func (nt *NTuple) String() string {
Expand Down Expand Up @@ -72,7 +72,7 @@ func (nt *NTuple) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(nt.Class())
hdr := r.ReadHeader(nt.Class(), nt.RVersion())

nt.rvers = r.ReadU32()
nt.size = r.ReadU32()
Expand Down
2 changes: 1 addition & 1 deletion groot/gen.rbytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func (r *RBuffer) ReadStdVector{{.Name}}(sli *[]{{.Type}}) {
return
}

hdr := r.ReadHeader("vector<{{.Type}}>")
hdr := r.ReadHeader("vector<{{.Type}}>", rvers.StreamerInfo)
if hdr.Vers != rvers.StreamerInfo {
r.err = fmt.Errorf(
"rbytes: invalid %s version: got=%d, want=%d",
Expand Down
10 changes: 2 additions & 8 deletions groot/gen.rhist.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,7 @@ func (h *{{.Name}}) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(h.Class())
if hdr.Vers > rvers.{{.Name}} {
panic(fmt.Errorf("rhist: invalid {{.Name}} version=%d > %d", hdr.Vers, rvers.{{.Name}}))
}
hdr := r.ReadHeader(h.Class(), h.RVersion())

r.ReadObject(&h.th1)
r.ReadObject(&h.arr)
Expand Down Expand Up @@ -777,10 +774,7 @@ func (h *{{.Name}}) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(h.Class())
if hdr.Vers > rvers.{{.Name}} {
panic(fmt.Errorf("rhist: invalid {{.Name}} version=%d > %d", hdr.Vers, rvers.{{.Name}}))
}
hdr := r.ReadHeader(h.Class(), h.RVersion())
if hdr.Vers < 1 {
return fmt.Errorf("rhist: T{{.Name}} version too old (%d<1)", hdr.Vers)
}
Expand Down
6 changes: 1 addition & 5 deletions groot/gen.rtree.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,7 @@ func (leaf *{{.Name}}) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(leaf.Class())
if hdr.Vers > rvers.{{.Name}} {
panic(fmt.Errorf("rtree: invalid T{{.Name}} version=%d > %d", hdr.Vers, rvers.{{.Name}}))
}

hdr := r.ReadHeader(leaf.Class(), leaf.RVersion())
leaf.rvers = hdr.Vers

r.ReadObject(&leaf.tleaf)
Expand Down
7 changes: 1 addition & 6 deletions groot/rbase/attaxis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package rbase

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbytes"
Expand Down Expand Up @@ -78,11 +77,7 @@ func (a *AttAxis) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(a.Class())
if hdr.Vers < 4 {
return fmt.Errorf("rbase: TAttAxis version too old (%d < 4)", hdr.Vers)
}

hdr := r.ReadHeader(a.Class(), a.RVersion())
a.Ndivs = r.ReadI32()
a.AxisColor = r.ReadI16()
a.LabelColor = r.ReadI16()
Expand Down
2 changes: 1 addition & 1 deletion groot/rbase/attfill.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (a *AttFill) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(a.Class())
hdr := r.ReadHeader(a.Class(), a.RVersion())

a.Color = r.ReadI16()
a.Style = r.ReadI16()
Expand Down
6 changes: 1 addition & 5 deletions groot/rbase/attline.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package rbase

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbytes"
Expand Down Expand Up @@ -54,10 +53,7 @@ func (a *AttLine) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(a.Class())
if hdr.Vers > rvers.AttLine {
panic(fmt.Errorf("rbase: invalid attline version=%d > %d", hdr.Vers, rvers.AttLine))
}
hdr := r.ReadHeader(a.Class(), a.RVersion())

a.Color = r.ReadI16()
a.Style = r.ReadI16()
Expand Down
6 changes: 1 addition & 5 deletions groot/rbase/attmarker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package rbase

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbytes"
Expand Down Expand Up @@ -53,10 +52,7 @@ func (a *AttMarker) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(a.Class())
if hdr.Vers > rvers.AttMarker {
panic(fmt.Errorf("rbase: invalid attmarker version=%d > %d", hdr.Vers, rvers.AttMarker))
}
hdr := r.ReadHeader(a.Class(), a.RVersion())

a.Color = r.ReadI16()
a.Style = r.ReadI16()
Expand Down
2 changes: 1 addition & 1 deletion groot/rbase/attpad.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (a *AttPad) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(a.Class())
hdr := r.ReadHeader(a.Class(), a.RVersion())
a.fLeftMargin = r.ReadF32()
a.fRightMargin = r.ReadF32()
a.fBottomMargin = r.ReadF32()
Expand Down
6 changes: 1 addition & 5 deletions groot/rbase/named.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package rbase

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbytes"
Expand Down Expand Up @@ -76,10 +75,7 @@ func (n *Named) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(n.Class())
if hdr.Vers > rvers.Named {
panic(fmt.Errorf("rbase: invalid named version=%d > %d", hdr.Vers, rvers.Named))
}
hdr := r.ReadHeader(n.Class(), n.RVersion())

r.ReadObject(&n.obj)

Expand Down
9 changes: 1 addition & 8 deletions groot/rbase/objstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package rbase

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbytes"
Expand Down Expand Up @@ -54,13 +53,7 @@ func (obj *ObjString) String() string {
// ROOTUnmarshaler is the interface implemented by an object that can
// unmarshal itself from a ROOT buffer
func (obj *ObjString) UnmarshalROOT(r *rbytes.RBuffer) error {
hdr := r.ReadHeader(obj.Class())
if hdr.Vers > rvers.ObjString {
panic(fmt.Errorf(
"rbase: invalid %s version=%d > %d",
obj.Class(), hdr.Vers, rvers.ObjString,
))
}
hdr := r.ReadHeader(obj.Class(), obj.RVersion())
r.ReadObject(&obj.obj)
obj.str = r.ReadString()

Expand Down
5 changes: 1 addition & 4 deletions groot/rbase/processid.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ func (pid *ProcessID) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(pid.Class())
if hdr.Vers > rvers.ProcessID {
panic(fmt.Errorf("rbase: invalid %s version=%d > %d", pid.Class(), hdr.Vers, rvers.ProcessID))
}
hdr := r.ReadHeader(pid.Class(), pid.RVersion())

r.ReadObject(&pid.named)

Expand Down
6 changes: 1 addition & 5 deletions groot/rbase/vpad.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package rbase

import (
"fmt"
"reflect"

"go-hep.org/x/hep/groot/rbytes"
Expand Down Expand Up @@ -35,10 +34,7 @@ func (vpad *VirtualPad) UnmarshalROOT(r *rbytes.RBuffer) error {
return r.Err()
}

hdr := r.ReadHeader(vpad.Class())
if hdr.Vers > rvers.VirtualPad {
panic(fmt.Errorf("rbase: invalid virtualpad version=%d > %d", hdr.Vers, rvers.VirtualPad))
}
hdr := r.ReadHeader(vpad.Class(), vpad.RVersion())

r.ReadObject(&vpad.obj)
r.ReadObject(&vpad.attline)
Expand Down
Loading