hep: go-hep.org/x/hep/rootio Index | Examples | Files

package rootio

import "go-hep.org/x/hep/rootio"

Package rootio provides a pure-go read-access to ROOT files. rootio might, with time, provide write-access too.

A typical usage is as follows:

f, err := rootio.Open("ntup.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tree")
if err != nil {
    log.Fatal(err)
}
tree := obj.(rootio.Tree)
fmt.Printf("entries= %v\n", tree.Entries())

More complete examples on how to iterate over the content of a Tree can be found in the examples attached to rootio.TreeScanner and rootio.Scanner: https://godoc.org/go-hep.org/x/hep/rootio#pkg-examples

Another possibility is to look at: https://godoc.org/go-hep.org/x/hep/rootio/cmd/root-ls, a command that inspects the content of ROOT files.

File layout

ROOT files are a suite of consecutive data records. Each data record consists of a header part, called a TKey, and a payload whose content, length and meaning are described by the header. The current ROOT file format encodes all data in big endian.

ROOT files initially only supported 32b addressing. Large files support (>4Gb) was added later on by migrating to a 64b addressing.

The on-disk binary layout of a ROOT file header looks like this:

     Type        | Record Name | Description
=================+=============+===========================================
   [4]byte       | "root"      | Root file identifier
   int32         | fVersion    | File format version
   int32         | fBEGIN      | Pointer to first data record
   int32 [int64] | fEND        | Pointer to first free word at the EOF
   int32 [int64] | fSeekFree   | Pointer to FREE data record
   int32         | fNbytesFree | Number of bytes in FREE data record
   int32         | nfree       | Number of free data records
   int32         | fNbytesName | Number of bytes in TNamed at creation time
   byte          | fUnits      | Number of bytes for file pointers
   int32         | fCompress   | Compression level and algorithm
   int32 [int64] | fSeekInfo   | Pointer to TStreamerInfo record
   int32         | fNbytesInfo | Number of bytes in TStreamerInfo record
   [18]byte      | fUUID       | Universal Unique ID
=================+=============+===========================================

This is followed by a sequence of data records, starting at the fBEGIN offset from the beginning of the file.

The on-disk binary layout of a data record is:

      Type     | Member Name | Description
===============+=============+===========================================
 int32         | Nbytes      | Length of compressed object (in bytes)
 int16         | Version     | TKey version identifier
 int32         | ObjLen      | Length of uncompressed object
 int32         | Datime      | Date and time when object was written to file
 int16         | KeyLen      | Length of the key structure (in bytes)
 int16         | Cycle       | Cycle of key
 int32 [int64] | SeekKey     | Pointer to record itself (consistency check)
 int32 [int64] | SeekPdir    | Pointer to directory header
 byte          | lname       | Number of bytes in the class name
 []byte        | ClassName   | Object Class Name
 byte          | lname       | Number of bytes in the object name
 []byte        | Name        | Name of the object
 byte          | lTitle      | Number of bytes in the object title
 []byte        | Title       | Title of the object
 []byte        | DATA        | Data bytes associated to the object
===============+=============+===========================================

The high-level on-disk representation of a ROOT file is thus:

+===============+ -- 0
|               |
|  File Header  |
|               |
+===============+ -- fBEGIN offset
|               |
| Record Header | -->-+
|               |     |
+---------------+     |
|               |     |
|  Record Data  |     | Reference to next Record
|    Payload    |     |
|               |     |
+===============+ <---+
|               |
| Record Header | -->-+
|               |     |
+---------------+     |
|               |     |
|  Record Data  |     | Reference to next Record
|    Payload    |     |
|               |     |
+===============+ <---+
|               |
       ...

|               |
+===============+ -- fSeekInfo
|               |
| Record Header | -->-+
|               |     |
+---------------+     |
|               |     |
|  Record Data  |     | Reference to next Record
|    Payload    |     |
|               |     |
+===============+ <---+ -- fEND offset

Data records payloads and how to deserialize them are described by a TStreamerInfo. The list of all TStreamerInfos that are used to interpret the content of a ROOT file is stored at the end of that ROOT file, at offset fSeekInfo.

Data records

Data records' payloads may be compressed. Detecting whether a payload is compressed is usually done by comparing the object length (ObjLen) field of the record header with the length of the compressed object (Nbytes) field. If they differ after having subtracted the record header length, then the payload has been compressed.

A record data payload is itself split into multiple chunks of maximum size 16*1024*1024 bytes. Each chunk consists of:

- the chunk header,
- the chunk compressed payload.

The chunk header:

- 3 bytes to identify the compression algorithm and version,
- 3 bytes to identify the deflated buffer size,
- 3 bytes to identify the inflated buffer size.

Streamer informations

Streamers describe how a given type, for a given version of that type, is written on disk. In C++/ROOT, a streamer is represented as a TStreamerInfo class that can give metadata about the type it's describing (version, name). When reading a file, all the streamer infos are read back in memory, from disk, by reading the data record at offset fSeekInfo. A streamer info is actually a list of streamer elements, one for each field and, in C++, base class (in Go, this is emulated as an embedded field.)

Index

Examples

Package Files

array_gen.go attaxis.go attfill.go attline.go attmarker.go axis.go basket.go branch.go compress.go consts.go datatypes.go dir.go dobj.go doc.go factory.go file.go fileplugin.go graph.go h1_gen.go h2_gen.go hist.go key.go leaf.go leaf_gen.go list.go memfile.go named.go objarray.go object.go objstring.go rbuffer.go read_streamers.go rootio.go scanner.go sizeof.go streamers.go tchain.go time.go tree.go utils.go uuid.go wbuffer.go wrapper.go

Variables

var Factory = factory{
    // contains filtered or unexported fields
}

func NewObjString Uses

func NewObjString(s string) *tobjstring

NewObjString creates a new ObjString.

type Array Uses

type Array interface {
    Len() int // number of array elements
    Get(i int) interface{}
    Set(i int, v interface{})
}

Array describes ROOT abstract array type.

type ArrayD Uses

type ArrayD struct {
    Data []float64
}

ArrayD implements ROOT TArrayD

func (*ArrayD) At Uses

func (arr *ArrayD) At(i int) float64

func (*ArrayD) Class Uses

func (*ArrayD) Class() string

Class returns the ROOT class name.

func (*ArrayD) Get Uses

func (arr *ArrayD) Get(i int) interface{}

func (*ArrayD) Len Uses

func (arr *ArrayD) Len() int

func (*ArrayD) MarshalROOT Uses

func (arr *ArrayD) MarshalROOT(w *WBuffer) (int, error)

func (*ArrayD) Set Uses

func (arr *ArrayD) Set(i int, v interface{})

func (*ArrayD) UnmarshalROOT Uses

func (arr *ArrayD) UnmarshalROOT(r *RBuffer) error

type ArrayF Uses

type ArrayF struct {
    Data []float32
}

ArrayF implements ROOT TArrayF

func (*ArrayF) At Uses

func (arr *ArrayF) At(i int) float32

func (*ArrayF) Class Uses

func (*ArrayF) Class() string

Class returns the ROOT class name.

func (*ArrayF) Get Uses

func (arr *ArrayF) Get(i int) interface{}

func (*ArrayF) Len Uses

func (arr *ArrayF) Len() int

func (*ArrayF) MarshalROOT Uses

func (arr *ArrayF) MarshalROOT(w *WBuffer) (int, error)

func (*ArrayF) Set Uses

func (arr *ArrayF) Set(i int, v interface{})

func (*ArrayF) UnmarshalROOT Uses

func (arr *ArrayF) UnmarshalROOT(r *RBuffer) error

type ArrayI Uses

type ArrayI struct {
    Data []int32
}

ArrayI implements ROOT TArrayI

func (*ArrayI) At Uses

func (arr *ArrayI) At(i int) int32

func (*ArrayI) Class Uses

func (*ArrayI) Class() string

Class returns the ROOT class name.

func (*ArrayI) Get Uses

func (arr *ArrayI) Get(i int) interface{}

func (*ArrayI) Len Uses

func (arr *ArrayI) Len() int

func (*ArrayI) MarshalROOT Uses

func (arr *ArrayI) MarshalROOT(w *WBuffer) (int, error)

func (*ArrayI) Set Uses

func (arr *ArrayI) Set(i int, v interface{})

func (*ArrayI) UnmarshalROOT Uses

func (arr *ArrayI) UnmarshalROOT(r *RBuffer) error

type ArrayL64 Uses

type ArrayL64 struct {
    Data []int64
}

ArrayL64 implements ROOT TArrayL64

func (*ArrayL64) At Uses

func (arr *ArrayL64) At(i int) int64

func (*ArrayL64) Class Uses

func (*ArrayL64) Class() string

Class returns the ROOT class name.

func (*ArrayL64) Get Uses

func (arr *ArrayL64) Get(i int) interface{}

func (*ArrayL64) Len Uses

func (arr *ArrayL64) Len() int

func (*ArrayL64) MarshalROOT Uses

func (arr *ArrayL64) MarshalROOT(w *WBuffer) (int, error)

func (*ArrayL64) Set Uses

func (arr *ArrayL64) Set(i int, v interface{})

func (*ArrayL64) UnmarshalROOT Uses

func (arr *ArrayL64) UnmarshalROOT(r *RBuffer) error

type Axis Uses

type Axis interface {
    Named
    XMin() float64
    XMax() float64
    NBins() int
    XBins() []float64
    BinCenter(int) float64
    BinLowEdge(int) float64
    BinWidth(int) float64
}

Axis describes a ROOT TAxis.

type Basket Uses

type Basket struct {
    // contains filtered or unexported fields
}

func (*Basket) Class Uses

func (b *Basket) Class() string

func (*Basket) Name Uses

func (b *Basket) Name() string

func (*Basket) Title Uses

func (b *Basket) Title() string

func (*Basket) UnmarshalROOT Uses

func (b *Basket) UnmarshalROOT(r *RBuffer) error

type Branch Uses

type Branch interface {
    Named
    Branches() []Branch
    Leaves() []Leaf
    Branch(name string) Branch
    Leaf(name string) Leaf

    GoType() reflect.Type
    // contains filtered or unexported methods
}

Branch describes a branch of a ROOT Tree.

type Class Uses

type Class interface {
    // GetCheckSum gets the check sum for this ROOT class
    CheckSum() int

    // Members returns the list of members for this ROOT class
    Members() []Member

    // Version returns the version number for this ROOT class
    Version() int

    // ClassName returns the ROOT class name for this ROOT class
    ClassName() string
}

Class represents a ROOT class. Class instances are created by a ClassFactory.

type ClassFactory Uses

type ClassFactory interface {
    Create(name string) Class
}

ClassFactory creates ROOT classes

type Collection Uses

type Collection interface {
    Object

    // Name returns the name of the collection.
    Name() string

    // Last returns the last element index
    Last() int

    // At returns the element at index i
    At(i int) Object

    // Len returns the number of elements in the collection
    Len() int
}

Collection is a collection of ROOT Objects.

type Directory Uses

type Directory interface {
    // Get returns the object identified by namecycle
    //   namecycle has the format name;cycle
    //   name  = * is illegal, cycle = * is illegal
    //   cycle = "" or cycle = 9999 ==> apply to a memory object
    //
    //   examples:
    //     foo   : get object named foo in memory
    //             if object is not in memory, try with highest cycle from file
    //     foo;1 : get cycle 1 of foo on file
    Get(namecycle string) (Object, error)

    // Put puts the object v under the key with the given name.
    Put(name string, v Object) error

    // Keys returns the list of keys being held by this directory.
    Keys() []Key
}

Directory describes a ROOT directory structure in memory.

type Double32 Uses

type Double32 float64

Double32 is a float64 in memory, written as a float32 to disk.

type FactoryFct Uses

type FactoryFct func() reflect.Value

FactoryFct creates new values of a given type.

type File Uses

type File struct {
    // contains filtered or unexported fields
}

A ROOT file is a suite of consecutive data records (TKey's) with the following format (see also the TKey class). If the key is located past the 32 bit file limit (> 2 GB) then some fields will be 8 instead of 4 bytes:

1->4            Nbytes    = Length of compressed object (in bytes)
5->6            Version   = TKey version identifier
7->10           ObjLen    = Length of uncompressed object
11->14          Datime    = Date and time when object was written to file
15->16          KeyLen    = Length of the key structure (in bytes)
17->18          Cycle     = Cycle of key
19->22 [19->26] SeekKey   = Pointer to record itself (consistency check)
23->26 [27->34] SeekPdir  = Pointer to directory header
27->27 [35->35] lname     = Number of bytes in the class name
28->.. [36->..] ClassName = Object Class Name
..->..          lname     = Number of bytes in the object name
..->..          Name      = lName bytes with the name of the object
..->..          lTitle    = Number of bytes in the object title
..->..          Title     = Title of the object
----->          DATA      = Data bytes associated to the object

The first data record starts at byte fBEGIN (currently set to kBEGIN). Bytes 1->kBEGIN contain the file description, when fVersion >= 1000000 it is a large file (> 2 GB) and the offsets will be 8 bytes long and fUnits will be set to 8:

1->4            "root"      = Root file identifier
5->8            fVersion    = File format version
9->12           fBEGIN      = Pointer to first data record
13->16 [13->20] fEND        = Pointer to first free word at the EOF
17->20 [21->28] fSeekFree   = Pointer to FREE data record
21->24 [29->32] fNbytesFree = Number of bytes in FREE data record
25->28 [33->36] nfree       = Number of free data records
29->32 [37->40] fNbytesName = Number of bytes in TNamed at creation time
33->33 [41->41] fUnits      = Number of bytes for file pointers
34->37 [42->45] fCompress   = Compression level and algorithm
38->41 [46->53] fSeekInfo   = Pointer to TStreamerInfo record
42->45 [54->57] fNbytesInfo = Number of bytes in TStreamerInfo record
46->63 [58->75] fUUID       = Universal Unique ID

func Create Uses

func Create(name string, opts ...FileOption) (*File, error)

Create creates the named ROOT file for writing.

Code:

const fname = "objstring.root"
defer os.Remove(fname)

w, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer w.Close()

var (
    k   = "my-objstring"
    v   = rootio.NewObjString("Hello World from Go-HEP!")
)

err = w.Put(k, v)
if err != nil {
    log.Fatal(err)
}

fmt.Printf("wkeys: %d\n", len(w.Keys()))

err = w.Close()
if err != nil {
    log.Fatalf("could not close file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatalf("could not open file: %v", err)
}
defer r.Close()

fmt.Printf("rkeys: %d\n", len(r.Keys()))

for _, k := range r.Keys() {
    fmt.Printf("key: name=%q, type=%q\n", k.Name(), k.ClassName())
}

obj, err := r.Get(k)
if err != nil {
    log.Fatal(err)
}
rv := obj.(rootio.ObjString)
fmt.Printf("objstring=%q\n", rv)

Output:

wkeys: 1
rkeys: 1
key: name="my-objstring", type="TObjString"
objstring="Hello World from Go-HEP!"

Code:

const fname = "empty.root"
defer os.Remove(fname)

w, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer w.Close()

// empty file. close it.
err = w.Close()
if err != nil {
    log.Fatalf("could not close empty file: %v", err)
}

// read back.
r, err := rootio.Open(fname)
if err != nil {
    log.Fatalf("could not open empty file: %v", err)
}
defer r.Close()

fmt.Printf("file: %q\n", r.Name())

Output:

file: "empty.root"

Code:

const fname = "graph_example.root"
defer os.Remove(fname)

f, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer f.Close()

hg := hbook.NewS2D(hbook.Point2D{X: 1, Y: 1}, hbook.Point2D{X: 2, Y: 1.5}, hbook.Point2D{X: -1, Y: +2})

fmt.Printf("original graph:\n")
for i, pt := range hg.Points() {
    fmt.Printf("pt[%d]=%+v\n", i, pt)
}

rg := rootio.NewGraphFrom(hg)

err = f.Put("gr", rg)
if err != nil {
    log.Fatal(err)
}

err = f.Close()
if err != nil {
    log.Fatalf("error closing ROOT file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatal(err)
}
defer r.Close()

robj, err := r.Get("gr")
if err != nil {
    log.Fatal(err)
}

hr, err := rootcnv.S2D(robj.(rootio.Graph))
if err != nil {
    log.Fatal(err)
}

fmt.Printf("\ngraph read back:\n")
for i, pt := range hr.Points() {
    fmt.Printf("pt[%d]=%+v\n", i, pt)
}

Output:

original graph:
pt[0]={X:1 Y:1 ErrX:{Min:0 Max:0} ErrY:{Min:0 Max:0}}
pt[1]={X:2 Y:1.5 ErrX:{Min:0 Max:0} ErrY:{Min:0 Max:0}}
pt[2]={X:-1 Y:2 ErrX:{Min:0 Max:0} ErrY:{Min:0 Max:0}}

graph read back:
pt[0]={X:1 Y:1 ErrX:{Min:0 Max:0} ErrY:{Min:0 Max:0}}
pt[1]={X:2 Y:1.5 ErrX:{Min:0 Max:0} ErrY:{Min:0 Max:0}}
pt[2]={X:-1 Y:2 ErrX:{Min:0 Max:0} ErrY:{Min:0 Max:0}}

Code:

const fname = "graphasymmerr_example.root"
defer os.Remove(fname)

f, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer f.Close()

hg := hbook.NewS2D(
    hbook.Point2D{X: 1, Y: 1, ErrX: hbook.Range{Min: 1, Max: 2}, ErrY: hbook.Range{Min: 3, Max: 4}},
    hbook.Point2D{X: 2, Y: 1.5, ErrX: hbook.Range{Min: 1, Max: 2}, ErrY: hbook.Range{Min: 3, Max: 4}},
    hbook.Point2D{X: -1, Y: +2, ErrX: hbook.Range{Min: 1, Max: 2}, ErrY: hbook.Range{Min: 3, Max: 4}},
)

fmt.Printf("original graph:\n")
for i, pt := range hg.Points() {
    fmt.Printf("pt[%d]=%+v\n", i, pt)
}

rg := rootio.NewGraphAsymmErrorsFrom(hg)

err = f.Put("gr", rg)
if err != nil {
    log.Fatal(err)
}

err = f.Close()
if err != nil {
    log.Fatalf("error closing ROOT file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatal(err)
}
defer r.Close()

robj, err := r.Get("gr")
if err != nil {
    log.Fatal(err)
}

hr, err := rootcnv.S2D(robj.(rootio.GraphErrors))
if err != nil {
    log.Fatal(err)
}

fmt.Printf("\ngraph read back:\n")
for i, pt := range hr.Points() {
    fmt.Printf("pt[%d]=%+v\n", i, pt)
}

Output:

original graph:
pt[0]={X:1 Y:1 ErrX:{Min:1 Max:2} ErrY:{Min:3 Max:4}}
pt[1]={X:2 Y:1.5 ErrX:{Min:1 Max:2} ErrY:{Min:3 Max:4}}
pt[2]={X:-1 Y:2 ErrX:{Min:1 Max:2} ErrY:{Min:3 Max:4}}

graph read back:
pt[0]={X:1 Y:1 ErrX:{Min:1 Max:2} ErrY:{Min:3 Max:4}}
pt[1]={X:2 Y:1.5 ErrX:{Min:1 Max:2} ErrY:{Min:3 Max:4}}
pt[2]={X:-1 Y:2 ErrX:{Min:1 Max:2} ErrY:{Min:3 Max:4}}

Code:

const fname = "grapherr_example.root"
defer os.Remove(fname)

f, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer f.Close()

hg := hbook.NewS2D(
    hbook.Point2D{X: 1, Y: 1, ErrX: hbook.Range{Min: 2, Max: 2}, ErrY: hbook.Range{Min: 3, Max: 3}},
    hbook.Point2D{X: 2, Y: 1.5, ErrX: hbook.Range{Min: 2, Max: 2}, ErrY: hbook.Range{Min: 3, Max: 3}},
    hbook.Point2D{X: -1, Y: +2, ErrX: hbook.Range{Min: 2, Max: 2}, ErrY: hbook.Range{Min: 3, Max: 3}},
)

fmt.Printf("original graph:\n")
for i, pt := range hg.Points() {
    fmt.Printf("pt[%d]=%+v\n", i, pt)
}

rg := rootio.NewGraphErrorsFrom(hg)

err = f.Put("gr", rg)
if err != nil {
    log.Fatal(err)
}

err = f.Close()
if err != nil {
    log.Fatalf("error closing ROOT file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatal(err)
}
defer r.Close()

robj, err := r.Get("gr")
if err != nil {
    log.Fatal(err)
}

hr, err := rootcnv.S2D(robj.(rootio.GraphErrors))
if err != nil {
    log.Fatal(err)
}

fmt.Printf("\ngraph read back:\n")
for i, pt := range hr.Points() {
    fmt.Printf("pt[%d]=%+v\n", i, pt)
}

Output:

original graph:
pt[0]={X:1 Y:1 ErrX:{Min:2 Max:2} ErrY:{Min:3 Max:3}}
pt[1]={X:2 Y:1.5 ErrX:{Min:2 Max:2} ErrY:{Min:3 Max:3}}
pt[2]={X:-1 Y:2 ErrX:{Min:2 Max:2} ErrY:{Min:3 Max:3}}

graph read back:
pt[0]={X:1 Y:1 ErrX:{Min:2 Max:2} ErrY:{Min:3 Max:3}}
pt[1]={X:2 Y:1.5 ErrX:{Min:2 Max:2} ErrY:{Min:3 Max:3}}
pt[2]={X:-1 Y:2 ErrX:{Min:2 Max:2} ErrY:{Min:3 Max:3}}

Code:

const fname = "h1d_example.root"
defer os.Remove(fname)

f, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer f.Close()

const npoints = 10000

// Create a normal distribution.
dist := distuv.Normal{
    Mu:    0,
    Sigma: 1,
    Src:   rand.New(rand.NewSource(0)),
}

// Draw some random values from the standard
// normal distribution.
h := hbook.NewH1D(20, -4, +4)
for i := 0; i < npoints; i++ {
    v := dist.Rand()
    h.Fill(v, 1)
}
h.Fill(-10, 1) // fill underflow
h.Fill(-20, 2)
h.Fill(+10, 3) // fill overflow

fmt.Printf("original histo:\n")
fmt.Printf("w-mean:    %.7f\n", h.XMean())
fmt.Printf("w-rms:     %.7f\n", h.XRMS())

hroot := rootio.NewH1DFrom(h)

err = f.Put("h1", hroot)
if err != nil {
    log.Fatal(err)
}

err = f.Close()
if err != nil {
    log.Fatalf("error closing ROOT file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatal(err)
}
defer r.Close()

robj, err := r.Get("h1")
if err != nil {
    log.Fatal(err)
}

hr, err := rootcnv.H1D(robj.(rootio.H1))
if err != nil {
    log.Fatal(err)
}

fmt.Printf("\nhisto read back:\n")
fmt.Printf("r-mean:    %.7f\n", hr.XMean())
fmt.Printf("r-rms:     %.7f\n", hr.XRMS())

Output:

original histo:
w-mean:    0.0023919
w-rms:     1.0628679

histo read back:
r-mean:    0.0023919
r-rms:     1.0628679

Code:

const fname = "h2d_example.root"
defer os.Remove(fname)

f, err := rootio.Create(fname)
if err != nil {
    log.Fatal(err)
}
defer f.Close()

const npoints = 1000

// Create a normal distribution.
dist := distuv.Normal{
    Mu:    0,
    Sigma: 1,
    Src:   rand.New(rand.NewSource(0)),
}

// Draw some random values from the standard
// normal distribution.
h := hbook.NewH2D(5, -4, +4, 6, -4, +4)
for i := 0; i < npoints; i++ {
    x := dist.Rand()
    y := dist.Rand()
    h.Fill(x, y, 1)
}
h.Fill(-10, -10, 1) // fill underflow
h.Fill(-10, +10, 1)
h.Fill(+10, -10, 1)
h.Fill(+10, +10, 3) // fill overflow

fmt.Printf("original histo:\n")
fmt.Printf("w-mean-x:    %+.6f\n", h.XMean())
fmt.Printf("w-rms-x:     %+.6f\n", h.XRMS())
fmt.Printf("w-mean-y:    %+.6f\n", h.YMean())
fmt.Printf("w-rms-y:     %+.6f\n", h.YRMS())

hroot := rootio.NewH2DFrom(h)

err = f.Put("h2", hroot)
if err != nil {
    log.Fatal(err)
}

err = f.Close()
if err != nil {
    log.Fatalf("error closing ROOT file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatal(err)
}
defer r.Close()

robj, err := r.Get("h2")
if err != nil {
    log.Fatal(err)
}

hr, err := rootcnv.H2D(robj.(rootio.H2))
if err != nil {
    log.Fatal(err)
}

fmt.Printf("\nhisto read back:\n")
fmt.Printf("w-mean-x:    %+.6f\n", hr.XMean())
fmt.Printf("w-rms-x:     %+.6f\n", hr.XRMS())
fmt.Printf("w-mean-y:    %+.6f\n", hr.YMean())
fmt.Printf("w-rms-y:     %+.6f\n", hr.YRMS())

Output:

original histo:
w-mean-x:    +0.046442
w-rms-x:     +1.231044
w-mean-y:    -0.018977
w-rms-y:     +1.253143

histo read back:
w-mean-x:    +0.046442
w-rms-x:     +1.231044
w-mean-y:    -0.018977
w-rms-y:     +1.253143

Code:

const fname = "objstring-zlib.root"
defer os.Remove(fname)

w, err := rootio.Create(fname, rootio.WithZlib(flate.BestCompression))
if err != nil {
    log.Fatal(err)
}
defer w.Close()

var (
    k   = "my-objstring"
    v   = rootio.NewObjString("Hello World from Go-HEP!")
)

err = w.Put(k, v)
if err != nil {
    log.Fatal(err)
}

err = w.Close()
if err != nil {
    log.Fatalf("could not close writable file: %v", err)
}

r, err := rootio.Open(fname)
if err != nil {
    log.Fatalf("could not open file: %v", err)
}
defer r.Close()

for _, k := range r.Keys() {
    fmt.Printf("key: name=%q, type=%q\n", k.Name(), k.ClassName())
}

obj, err := r.Get(k)
if err != nil {
    log.Fatalf("could not get key %q: %v", k, err)
}
rv := obj.(rootio.ObjString)
fmt.Printf("objstring=%q\n", rv)

Output:

key: name="my-objstring", type="TObjString"
objstring="Hello World from Go-HEP!"

func NewReader Uses

func NewReader(r Reader) (*File, error)

NewReader creates a new ROOT file reader.

func Open Uses

func Open(path string) (*File, error)

Open opens the named ROOT file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode os.O_RDONLY.

func (*File) Class Uses

func (f *File) Class() string

func (*File) Close Uses

func (f *File) Close() error

Close closes the File, rendering it unusable for I/O. It returns an error, if any.

func (*File) Get Uses

func (f *File) Get(namecycle string) (Object, error)

Get returns the object identified by namecycle

namecycle has the format name;cycle
name  = * is illegal, cycle = * is illegal
cycle = "" or cycle = 9999 ==> apply to a memory object

examples:
  foo   : get object named foo in memory
          if object is not in memory, try with highest cycle from file
  foo;1 : get cycle 1 of foo on file

func (*File) Keys Uses

func (f *File) Keys() []Key

Keys returns the list of keys this File contains

func (*File) Name Uses

func (f *File) Name() string

func (*File) Put Uses

func (f *File) Put(name string, v Object) error

Put puts the object v under the key with the given name.

func (*File) Read Uses

func (f *File) Read(p []byte) (int, error)

Read implements io.Reader

func (*File) ReadAt Uses

func (f *File) ReadAt(p []byte, off int64) (int, error)

ReadAt implements io.ReaderAt

func (*File) Seek Uses

func (f *File) Seek(offset int64, whence int) (int64, error)

Seek implements io.Seeker

func (*File) Stat Uses

func (f *File) Stat() (os.FileInfo, error)

Stat returns the os.FileInfo structure describing this file.

func (*File) StreamerInfo Uses

func (f *File) StreamerInfo(name string) (StreamerInfo, error)

StreamerInfo returns the StreamerInfo with name of this file and an error if any.

func (*File) StreamerInfos Uses

func (f *File) StreamerInfos() []StreamerInfo

StreamerInfos returns the list of StreamerInfos of this file.

func (*File) Tell Uses

func (f *File) Tell() int64

func (*File) Title Uses

func (f *File) Title() string

func (*File) Version Uses

func (f *File) Version() int

Version returns the ROOT version this file was created with.

type FileOption Uses

type FileOption func(f *File) error

FileOption configures internal states of a ROOT file.

func WithLZ4 Uses

func WithLZ4(level int) FileOption

WithLZ4 configures a ROOT file to use LZ4 as a compression mechanism.

func WithLZMA Uses

func WithLZMA(level int) FileOption

WithLZMA configures a ROOT file to use LZMA as a compression mechanism.

func WithZlib Uses

func WithZlib(level int) FileOption

WithZlib configures a ROOT file to use zlib as a compression mechanism.

func WithoutCompression Uses

func WithoutCompression() FileOption

WithoutCompression configures a ROOT file to not use any compression mechanism.

type Float16 Uses

type Float16 float32

Float16 is a float32 in memory, written with a truncated mantissa.

type Graph Uses

type Graph interface {
    Named
    Len() int
    XY(i int) (float64, float64)
}

Graph describes a ROOT TGraph

Code:

f, err := rootio.Open("testdata/graphs.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tg")
if err != nil {
    log.Fatal(err)
}

g := obj.(rootio.Graph)
fmt.Printf("name:  %q\n", g.Name())
fmt.Printf("title: %q\n", g.Title())
fmt.Printf("#pts:  %d\n", g.Len())
for i := 0; i < g.Len(); i++ {
    x, y := g.XY(i)
    fmt.Printf("(x,y)[%d] = (%+e, %+e)\n", i, x, y)
}

Output:

name:  "tg"
title: "graph without errors"
#pts:  4
(x,y)[0] = (+1.000000e+00, +2.000000e+00)
(x,y)[1] = (+2.000000e+00, +4.000000e+00)
(x,y)[2] = (+3.000000e+00, +6.000000e+00)
(x,y)[3] = (+4.000000e+00, +8.000000e+00)

func NewGraphFrom Uses

func NewGraphFrom(s2 *hbook.S2D) Graph

NewGraphFrom creates a new Graph from 2-dim hbook data points.

type GraphErrors Uses

type GraphErrors interface {
    Graph
    // XError returns two error values for X data.
    XError(i int) (float64, float64)
    // YError returns two error values for Y data.
    YError(i int) (float64, float64)
}

GraphErrors describes a ROOT TGraphErrors

Code:

f, err := rootio.Open("testdata/graphs.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tge")
if err != nil {
    log.Fatal(err)
}

g := obj.(rootio.GraphErrors)
fmt.Printf("name:  %q\n", g.Name())
fmt.Printf("title: %q\n", g.Title())
fmt.Printf("#pts:  %d\n", g.Len())
for i := 0; i < g.Len(); i++ {
    x, y := g.XY(i)
    xlo, xhi := g.XError(i)
    ylo, yhi := g.YError(i)
    fmt.Printf("(x,y)[%d] = (%+e +/- [%+e, %+e], %+e +/- [%+e, %+e])\n", i, x, xlo, xhi, y, ylo, yhi)
}

Output:

name:  "tge"
title: "graph with errors"
#pts:  4
(x,y)[0] = (+1.000000e+00 +/- [+1.000000e-01, +1.000000e-01], +2.000000e+00 +/- [+2.000000e-01, +2.000000e-01])
(x,y)[1] = (+2.000000e+00 +/- [+2.000000e-01, +2.000000e-01], +4.000000e+00 +/- [+4.000000e-01, +4.000000e-01])
(x,y)[2] = (+3.000000e+00 +/- [+3.000000e-01, +3.000000e-01], +6.000000e+00 +/- [+6.000000e-01, +6.000000e-01])
(x,y)[3] = (+4.000000e+00 +/- [+4.000000e-01, +4.000000e-01], +8.000000e+00 +/- [+8.000000e-01, +8.000000e-01])

Code:

f, err := rootio.Open("testdata/graphs.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tgae")
if err != nil {
    log.Fatal(err)
}

g := obj.(rootio.GraphErrors)
fmt.Printf("name:  %q\n", g.Name())
fmt.Printf("title: %q\n", g.Title())
fmt.Printf("#pts:  %d\n", g.Len())
for i := 0; i < g.Len(); i++ {
    x, y := g.XY(i)
    xlo, xhi := g.XError(i)
    ylo, yhi := g.YError(i)
    fmt.Printf("(x,y)[%d] = (%+e +/- [%+e, %+e], %+e +/- [%+e, %+e])\n", i, x, xlo, xhi, y, ylo, yhi)
}

Output:

name:  "tgae"
title: "graph with asymmetric errors"
#pts:  4
(x,y)[0] = (+1.000000e+00 +/- [+1.000000e-01, +2.000000e-01], +2.000000e+00 +/- [+3.000000e-01, +4.000000e-01])
(x,y)[1] = (+2.000000e+00 +/- [+2.000000e-01, +4.000000e-01], +4.000000e+00 +/- [+6.000000e-01, +8.000000e-01])
(x,y)[2] = (+3.000000e+00 +/- [+3.000000e-01, +6.000000e-01], +6.000000e+00 +/- [+9.000000e-01, +1.200000e+00])
(x,y)[3] = (+4.000000e+00 +/- [+4.000000e-01, +8.000000e-01], +8.000000e+00 +/- [+1.200000e+00, +1.600000e+00])

func NewGraphAsymmErrorsFrom Uses

func NewGraphAsymmErrorsFrom(s2 *hbook.S2D) GraphErrors

NewGraphAsymmErrorsFrom creates a new GraphAsymErrors from 2-dim hbook data points.

func NewGraphErrorsFrom Uses

func NewGraphErrorsFrom(s2 *hbook.S2D) GraphErrors

NewGraphErrorsFrom creates a new GraphErrors from 2-dim hbook data points.

type H1 Uses

type H1 interface {
    Named

    // Entries returns the number of entries for this histogram.
    Entries() float64
    // SumW returns the total sum of weights
    SumW() float64
    // SumW2 returns the total sum of squares of weights
    SumW2() float64
    // SumWX returns the total sum of weights*x
    SumWX() float64
    // SumWX2 returns the total sum of weights*x*x
    SumWX2() float64
    // SumW2s returns the array of sum of squares of weights
    SumW2s() []float64
    // contains filtered or unexported methods
}

H1 is a 1-dim ROOT histogram

type H1D Uses

type H1D struct {
    // contains filtered or unexported fields
}

H1D implements ROOT TH1D

func NewH1DFrom Uses

func NewH1DFrom(h *hbook.H1D) *H1D

NewH1DFrom creates a new 1-dim histogram from hbook.

func (*H1D) Array Uses

func (h *H1D) Array() ArrayD

func (*H1D) Class Uses

func (*H1D) Class() string

Class returns the ROOT class name.

func (*H1D) Entries Uses

func (h *H1D) Entries() float64

Entries returns the number of entries for this histogram.

func (*H1D) MarshalROOT Uses

func (h *H1D) MarshalROOT(w *WBuffer) (int, error)

func (*H1D) MarshalYODA Uses

func (h *H1D) MarshalYODA() ([]byte, error)

MarshalYODA implements the YODAMarshaler interface.

func (*H1D) NbinsX Uses

func (h *H1D) NbinsX() int

NbinsX returns the number of bins in X.

func (*H1D) Rank Uses

func (h *H1D) Rank() int

Rank returns the number of dimensions of this histogram.

func (*H1D) SumW Uses

func (h *H1D) SumW() float64

SumW returns the total sum of weights

func (*H1D) SumW2 Uses

func (h *H1D) SumW2() float64

SumW2 returns the total sum of squares of weights

func (*H1D) SumW2s Uses

func (h *H1D) SumW2s() []float64

SumW2s returns the array of sum of squares of weights

func (*H1D) SumWX Uses

func (h *H1D) SumWX() float64

SumWX returns the total sum of weights*x

func (*H1D) SumWX2 Uses

func (h *H1D) SumWX2() float64

SumWX2 returns the total sum of weights*x*x

func (*H1D) UnmarshalROOT Uses

func (h *H1D) UnmarshalROOT(r *RBuffer) error

func (*H1D) UnmarshalYODA Uses

func (h *H1D) UnmarshalYODA(raw []byte) error

UnmarshalYODA implements the YODAUnmarshaler interface.

func (*H1D) XAxis Uses

func (h *H1D) XAxis() Axis

XAxis returns the axis along X.

func (*H1D) XBinCenter Uses

func (h *H1D) XBinCenter(i int) float64

XBinCenter returns the bin center value in X.

func (*H1D) XBinContent Uses

func (h *H1D) XBinContent(i int) float64

XBinContent returns the bin content value in X.

func (*H1D) XBinError Uses

func (h *H1D) XBinError(i int) float64

XBinError returns the bin error in X.

func (*H1D) XBinLowEdge Uses

func (h *H1D) XBinLowEdge(i int) float64

XBinLowEdge returns the bin lower edge value in X.

func (*H1D) XBinWidth Uses

func (h *H1D) XBinWidth(i int) float64

XBinWidth returns the bin width in X.

type H1F Uses

type H1F struct {
    // contains filtered or unexported fields
}

H1F implements ROOT TH1F

func NewH1FFrom Uses

func NewH1FFrom(h *hbook.H1D) *H1F

NewH1FFrom creates a new 1-dim histogram from hbook.

func (*H1F) Array Uses

func (h *H1F) Array() ArrayF

func (*H1F) Class Uses

func (*H1F) Class() string

Class returns the ROOT class name.

func (*H1F) Entries Uses

func (h *H1F) Entries() float64

Entries returns the number of entries for this histogram.

func (*H1F) MarshalROOT Uses

func (h *H1F) MarshalROOT(w *WBuffer) (int, error)

func (*H1F) MarshalYODA Uses

func (h *H1F) MarshalYODA() ([]byte, error)

MarshalYODA implements the YODAMarshaler interface.

func (*H1F) NbinsX Uses

func (h *H1F) NbinsX() int

NbinsX returns the number of bins in X.

func (*H1F) Rank Uses

func (h *H1F) Rank() int

Rank returns the number of dimensions of this histogram.

func (*H1F) SumW Uses

func (h *H1F) SumW() float64

SumW returns the total sum of weights

func (*H1F) SumW2 Uses

func (h *H1F) SumW2() float64

SumW2 returns the total sum of squares of weights

func (*H1F) SumW2s Uses

func (h *H1F) SumW2s() []float64

SumW2s returns the array of sum of squares of weights

func (*H1F) SumWX Uses

func (h *H1F) SumWX() float64

SumWX returns the total sum of weights*x

func (*H1F) SumWX2 Uses

func (h *H1F) SumWX2() float64

SumWX2 returns the total sum of weights*x*x

func (*H1F) UnmarshalROOT Uses

func (h *H1F) UnmarshalROOT(r *RBuffer) error

func (*H1F) UnmarshalYODA Uses

func (h *H1F) UnmarshalYODA(raw []byte) error

UnmarshalYODA implements the YODAUnmarshaler interface.

func (*H1F) XAxis Uses

func (h *H1F) XAxis() Axis

XAxis returns the axis along X.

func (*H1F) XBinCenter Uses

func (h *H1F) XBinCenter(i int) float64

XBinCenter returns the bin center value in X.

func (*H1F) XBinContent Uses

func (h *H1F) XBinContent(i int) float64

XBinContent returns the bin content value in X.

func (*H1F) XBinError Uses

func (h *H1F) XBinError(i int) float64

XBinError returns the bin error in X.

func (*H1F) XBinLowEdge Uses

func (h *H1F) XBinLowEdge(i int) float64

XBinLowEdge returns the bin lower edge value in X.

func (*H1F) XBinWidth Uses

func (h *H1F) XBinWidth(i int) float64

XBinWidth returns the bin width in X.

type H1I Uses

type H1I struct {
    // contains filtered or unexported fields
}

H1I implements ROOT TH1I

func NewH1IFrom Uses

func NewH1IFrom(h *hbook.H1D) *H1I

NewH1IFrom creates a new 1-dim histogram from hbook.

func (*H1I) Array Uses

func (h *H1I) Array() ArrayI

func (*H1I) Class Uses

func (*H1I) Class() string

Class returns the ROOT class name.

func (*H1I) Entries Uses

func (h *H1I) Entries() float64

Entries returns the number of entries for this histogram.

func (*H1I) MarshalROOT Uses

func (h *H1I) MarshalROOT(w *WBuffer) (int, error)

func (*H1I) MarshalYODA Uses

func (h *H1I) MarshalYODA() ([]byte, error)

MarshalYODA implements the YODAMarshaler interface.

func (*H1I) NbinsX Uses

func (h *H1I) NbinsX() int

NbinsX returns the number of bins in X.

func (*H1I) Rank Uses

func (h *H1I) Rank() int

Rank returns the number of dimensions of this histogram.

func (*H1I) SumW Uses

func (h *H1I) SumW() float64

SumW returns the total sum of weights

func (*H1I) SumW2 Uses

func (h *H1I) SumW2() float64

SumW2 returns the total sum of squares of weights

func (*H1I) SumW2s Uses

func (h *H1I) SumW2s() []float64

SumW2s returns the array of sum of squares of weights

func (*H1I) SumWX Uses

func (h *H1I) SumWX() float64

SumWX returns the total sum of weights*x

func (*H1I) SumWX2 Uses

func (h *H1I) SumWX2() float64

SumWX2 returns the total sum of weights*x*x

func (*H1I) UnmarshalROOT Uses

func (h *H1I) UnmarshalROOT(r *RBuffer) error

func (*H1I) UnmarshalYODA Uses

func (h *H1I) UnmarshalYODA(raw []byte) error

UnmarshalYODA implements the YODAUnmarshaler interface.

func (*H1I) XAxis Uses

func (h *H1I) XAxis() Axis

XAxis returns the axis along X.

func (*H1I) XBinCenter Uses

func (h *H1I) XBinCenter(i int) float64

XBinCenter returns the bin center value in X.

func (*H1I) XBinContent Uses

func (h *H1I) XBinContent(i int) float64

XBinContent returns the bin content value in X.

func (*H1I) XBinError Uses

func (h *H1I) XBinError(i int) float64

XBinError returns the bin error in X.

func (*H1I) XBinLowEdge Uses

func (h *H1I) XBinLowEdge(i int) float64

XBinLowEdge returns the bin lower edge value in X.

func (*H1I) XBinWidth Uses

func (h *H1I) XBinWidth(i int) float64

XBinWidth returns the bin width in X.

type H2 Uses

type H2 interface {
    Named

    // Entries returns the number of entries for this histogram.
    Entries() float64
    // SumW returns the total sum of weights
    SumW() float64
    // SumW2 returns the total sum of squares of weights
    SumW2() float64
    // SumWX returns the total sum of weights*x
    SumWX() float64
    // SumWX2 returns the total sum of weights*x*x
    SumWX2() float64
    // SumW2s returns the array of sum of squares of weights
    SumW2s() []float64
    // SumWY returns the total sum of weights*y
    SumWY() float64
    // SumWY2 returns the total sum of weights*y*y
    SumWY2() float64
    // SumWXY returns the total sum of weights*x*y
    SumWXY() float64
    // contains filtered or unexported methods
}

H2 is a 2-dim ROOT histogram

type H2D Uses

type H2D struct {
    // contains filtered or unexported fields
}

H2D implements ROOT TH2D

func NewH2DFrom Uses

func NewH2DFrom(h *hbook.H2D) *H2D

NewH2DFrom creates a new H2D from hbook 2-dim histogram.

func (*H2D) Array Uses

func (h *H2D) Array() ArrayD

func (*H2D) Class Uses

func (*H2D) Class() string

Class returns the ROOT class name.

func (*H2D) MarshalROOT Uses

func (h *H2D) MarshalROOT(w *WBuffer) (int, error)

func (*H2D) MarshalYODA Uses

func (h *H2D) MarshalYODA() ([]byte, error)

MarshalYODA implements the YODAMarshaler interface.

func (*H2D) NbinsX Uses

func (h *H2D) NbinsX() int

NbinsX returns the number of bins in X.

func (*H2D) NbinsY Uses

func (h *H2D) NbinsY() int

NbinsY returns the number of bins in Y.

func (*H2D) Rank Uses

func (h *H2D) Rank() int

Rank returns the number of dimensions of this histogram.

func (*H2D) SumWXY Uses

func (h *H2D) SumWXY() float64

SumWXY returns the total sum of weights*x*y

func (*H2D) SumWY Uses

func (h *H2D) SumWY() float64

SumWY returns the total sum of weights*y

func (*H2D) SumWY2 Uses

func (h *H2D) SumWY2() float64

SumWY2 returns the total sum of weights*y*y

func (*H2D) UnmarshalROOT Uses

func (h *H2D) UnmarshalROOT(r *RBuffer) error

func (*H2D) UnmarshalYODA Uses

func (h *H2D) UnmarshalYODA(raw []byte) error

UnmarshalYODA implements the YODAUnmarshaler interface.

func (*H2D) XAxis Uses

func (h *H2D) XAxis() Axis

XAxis returns the axis along X.

func (*H2D) XBinCenter Uses

func (h *H2D) XBinCenter(i int) float64

XBinCenter returns the bin center value in X.

func (*H2D) XBinContent Uses

func (h *H2D) XBinContent(i int) float64

XBinContent returns the bin content value in X.

func (*H2D) XBinError Uses

func (h *H2D) XBinError(i int) float64

XBinError returns the bin error in X.

func (*H2D) XBinLowEdge Uses

func (h *H2D) XBinLowEdge(i int) float64

XBinLowEdge returns the bin lower edge value in X.

func (*H2D) XBinWidth Uses

func (h *H2D) XBinWidth(i int) float64

XBinWidth returns the bin width in X.

func (*H2D) YAxis Uses

func (h *H2D) YAxis() Axis

YAxis returns the axis along Y.

func (*H2D) YBinCenter Uses

func (h *H2D) YBinCenter(i int) float64

YBinCenter returns the bin center value in Y.

func (*H2D) YBinContent Uses

func (h *H2D) YBinContent(i int) float64

YBinContent returns the bin content value in Y.

func (*H2D) YBinError Uses

func (h *H2D) YBinError(i int) float64

YBinError returns the bin error in Y.

func (*H2D) YBinLowEdge Uses

func (h *H2D) YBinLowEdge(i int) float64

YBinLowEdge returns the bin lower edge value in Y.

func (*H2D) YBinWidth Uses

func (h *H2D) YBinWidth(i int) float64

YBinWidth returns the bin width in Y.

type H2F Uses

type H2F struct {
    // contains filtered or unexported fields
}

H2F implements ROOT TH2F

func NewH2FFrom Uses

func NewH2FFrom(h *hbook.H2D) *H2F

NewH2FFrom creates a new H2F from hbook 2-dim histogram.

func (*H2F) Array Uses

func (h *H2F) Array() ArrayF

func (*H2F) Class Uses

func (*H2F) Class() string

Class returns the ROOT class name.

func (*H2F) MarshalROOT Uses

func (h *H2F) MarshalROOT(w *WBuffer) (int, error)

func (*H2F) MarshalYODA Uses

func (h *H2F) MarshalYODA() ([]byte, error)

MarshalYODA implements the YODAMarshaler interface.

func (*H2F) NbinsX Uses

func (h *H2F) NbinsX() int

NbinsX returns the number of bins in X.

func (*H2F) NbinsY Uses

func (h *H2F) NbinsY() int

NbinsY returns the number of bins in Y.

func (*H2F) Rank Uses

func (h *H2F) Rank() int

Rank returns the number of dimensions of this histogram.

func (*H2F) SumWXY Uses

func (h *H2F) SumWXY() float64

SumWXY returns the total sum of weights*x*y

func (*H2F) SumWY Uses

func (h *H2F) SumWY() float64

SumWY returns the total sum of weights*y

func (*H2F) SumWY2 Uses

func (h *H2F) SumWY2() float64

SumWY2 returns the total sum of weights*y*y

func (*H2F) UnmarshalROOT Uses

func (h *H2F) UnmarshalROOT(r *RBuffer) error

func (*H2F) UnmarshalYODA Uses

func (h *H2F) UnmarshalYODA(raw []byte) error

UnmarshalYODA implements the YODAUnmarshaler interface.

func (*H2F) XAxis Uses

func (h *H2F) XAxis() Axis

XAxis returns the axis along X.

func (*H2F) XBinCenter Uses

func (h *H2F) XBinCenter(i int) float64

XBinCenter returns the bin center value in X.

func (*H2F) XBinContent Uses

func (h *H2F) XBinContent(i int) float64

XBinContent returns the bin content value in X.

func (*H2F) XBinError Uses

func (h *H2F) XBinError(i int) float64

XBinError returns the bin error in X.

func (*H2F) XBinLowEdge Uses

func (h *H2F) XBinLowEdge(i int) float64

XBinLowEdge returns the bin lower edge value in X.

func (*H2F) XBinWidth Uses

func (h *H2F) XBinWidth(i int) float64

XBinWidth returns the bin width in X.

func (*H2F) YAxis Uses

func (h *H2F) YAxis() Axis

YAxis returns the axis along Y.

func (*H2F) YBinCenter Uses

func (h *H2F) YBinCenter(i int) float64

YBinCenter returns the bin center value in Y.

func (*H2F) YBinContent Uses

func (h *H2F) YBinContent(i int) float64

YBinContent returns the bin content value in Y.

func (*H2F) YBinError Uses

func (h *H2F) YBinError(i int) float64

YBinError returns the bin error in Y.

func (*H2F) YBinLowEdge Uses

func (h *H2F) YBinLowEdge(i int) float64

YBinLowEdge returns the bin lower edge value in Y.

func (*H2F) YBinWidth Uses

func (h *H2F) YBinWidth(i int) float64

YBinWidth returns the bin width in Y.

type H2I Uses

type H2I struct {
    // contains filtered or unexported fields
}

H2I implements ROOT TH2I

func NewH2IFrom Uses

func NewH2IFrom(h *hbook.H2D) *H2I

NewH2IFrom creates a new H2I from hbook 2-dim histogram.

func (*H2I) Array Uses

func (h *H2I) Array() ArrayI

func (*H2I) Class Uses

func (*H2I) Class() string

Class returns the ROOT class name.

func (*H2I) MarshalROOT Uses

func (h *H2I) MarshalROOT(w *WBuffer) (int, error)

func (*H2I) MarshalYODA Uses

func (h *H2I) MarshalYODA() ([]byte, error)

MarshalYODA implements the YODAMarshaler interface.

func (*H2I) NbinsX Uses

func (h *H2I) NbinsX() int

NbinsX returns the number of bins in X.

func (*H2I) NbinsY Uses

func (h *H2I) NbinsY() int

NbinsY returns the number of bins in Y.

func (*H2I) Rank Uses

func (h *H2I) Rank() int

Rank returns the number of dimensions of this histogram.

func (*H2I) SumWXY Uses

func (h *H2I) SumWXY() float64

SumWXY returns the total sum of weights*x*y

func (*H2I) SumWY Uses

func (h *H2I) SumWY() float64

SumWY returns the total sum of weights*y

func (*H2I) SumWY2 Uses

func (h *H2I) SumWY2() float64

SumWY2 returns the total sum of weights*y*y

func (*H2I) UnmarshalROOT Uses

func (h *H2I) UnmarshalROOT(r *RBuffer) error

func (*H2I) UnmarshalYODA Uses

func (h *H2I) UnmarshalYODA(raw []byte) error

UnmarshalYODA implements the YODAUnmarshaler interface.

func (*H2I) XAxis Uses

func (h *H2I) XAxis() Axis

XAxis returns the axis along X.

func (*H2I) XBinCenter Uses

func (h *H2I) XBinCenter(i int) float64

XBinCenter returns the bin center value in X.

func (*H2I) XBinContent Uses

func (h *H2I) XBinContent(i int) float64

XBinContent returns the bin content value in X.

func (*H2I) XBinError Uses

func (h *H2I) XBinError(i int) float64

XBinError returns the bin error in X.

func (*H2I) XBinLowEdge Uses

func (h *H2I) XBinLowEdge(i int) float64

XBinLowEdge returns the bin lower edge value in X.

func (*H2I) XBinWidth Uses

func (h *H2I) XBinWidth(i int) float64

XBinWidth returns the bin width in X.

func (*H2I) YAxis Uses

func (h *H2I) YAxis() Axis

YAxis returns the axis along Y.

func (*H2I) YBinCenter Uses

func (h *H2I) YBinCenter(i int) float64

YBinCenter returns the bin center value in Y.

func (*H2I) YBinContent Uses

func (h *H2I) YBinContent(i int) float64

YBinContent returns the bin content value in Y.

func (*H2I) YBinError Uses

func (h *H2I) YBinError(i int) float64

YBinError returns the bin error in Y.

func (*H2I) YBinLowEdge Uses

func (h *H2I) YBinLowEdge(i int) float64

YBinLowEdge returns the bin lower edge value in Y.

func (*H2I) YBinWidth Uses

func (h *H2I) YBinWidth(i int) float64

YBinWidth returns the bin width in Y.

type Key Uses

type Key struct {
    // contains filtered or unexported fields
}

Key is a key (a label) in a ROOT file

The Key class includes functions to book space on a file,
 to create I/O buffers, to fill these buffers
 to compress/uncompress data buffers.

Before saving (making persistent) an object on a file, a key must
be created. The key structure contains all the information to
uniquely identify a persistent object on a file.
The Key class is used by ROOT:
  - to write an object in the Current Directory
  - to write a new ntuple buffer

func (*Key) Bytes Uses

func (k *Key) Bytes() ([]byte, error)

Bytes returns the buffer of bytes corresponding to the Key's value

func (*Key) Class Uses

func (*Key) Class() string

func (*Key) ClassName Uses

func (k *Key) ClassName() string

func (*Key) Cycle Uses

func (k *Key) Cycle() int

func (*Key) MarshalROOT Uses

func (k *Key) MarshalROOT(w *WBuffer) (int, error)

MarshalROOT encodes the key to the provided buffer.

func (*Key) Name Uses

func (k *Key) Name() string

func (*Key) Object Uses

func (k *Key) Object() (Object, error)

Object returns the (ROOT) object corresponding to the Key's value.

func (*Key) ObjectType Uses

func (k *Key) ObjectType() reflect.Type

ObjectType returns the Key's payload type.

ObjectType returns nil if the Key's payload type is not known to the registry of rootio.

func (*Key) Title Uses

func (k *Key) Title() string

func (*Key) UnmarshalROOT Uses

func (k *Key) UnmarshalROOT(r *RBuffer) error

UnmarshalROOT decodes the content of data into the Key

func (*Key) Value Uses

func (k *Key) Value() interface{}

Value returns the data corresponding to the Key's value

type Leaf Uses

type Leaf interface {
    Named
    ArrayDim() int
    Branch() Branch
    HasRange() bool
    IsUnsigned() bool
    LeafCount() Leaf // returns the leaf count if is variable length
    Len() int        // Len returns the number of fixed length elements
    LenType() int    // LenType returns the number of bytes for this data type
    MaxIndex() []int
    Offset() int
    Kind() reflect.Kind
    Type() reflect.Type
    Value(int) interface{}
    TypeName() string
    // contains filtered or unexported methods
}

Leaf describes branches data types

type LeafB Uses

type LeafB struct {
    // contains filtered or unexported fields
}

LeafB implements ROOT TLeafB

func (*LeafB) ArrayDim Uses

func (leaf *LeafB) ArrayDim() int

func (*LeafB) Branch Uses

func (leaf *LeafB) Branch() Branch

func (*LeafB) Class Uses

func (leaf *LeafB) Class() string

Class returns the ROOT class name.

func (*LeafB) HasRange Uses

func (leaf *LeafB) HasRange() bool

func (*LeafB) IsUnsigned Uses

func (leaf *LeafB) IsUnsigned() bool

func (*LeafB) Kind Uses

func (*LeafB) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafB) LeafCount Uses

func (leaf *LeafB) LeafCount() Leaf

func (*LeafB) Len Uses

func (leaf *LeafB) Len() int

func (*LeafB) LenType Uses

func (leaf *LeafB) LenType() int

func (*LeafB) MarshalROOT Uses

func (leaf *LeafB) MarshalROOT(w *WBuffer) (int, error)

func (*LeafB) MaxIndex Uses

func (leaf *LeafB) MaxIndex() []int

func (*LeafB) Maximum Uses

func (leaf *LeafB) Maximum() int8

Maximum returns the maximum value of the leaf.

func (*LeafB) Minimum Uses

func (leaf *LeafB) Minimum() int8

Minimum returns the minimum value of the leaf.

func (*LeafB) Name Uses

func (leaf *LeafB) Name() string

Name returns the name of the instance

func (*LeafB) Offset Uses

func (leaf *LeafB) Offset() int

func (*LeafB) Title Uses

func (leaf *LeafB) Title() string

Title returns the title of the instance

func (*LeafB) Type Uses

func (*LeafB) Type() reflect.Type

Type returns the leaf's type.

func (*LeafB) TypeName Uses

func (leaf *LeafB) TypeName() string

func (*LeafB) UnmarshalROOT Uses

func (leaf *LeafB) UnmarshalROOT(r *RBuffer) error

func (*LeafB) Value Uses

func (leaf *LeafB) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafC Uses

type LeafC struct {
    // contains filtered or unexported fields
}

LeafC implements ROOT TLeafC

func (*LeafC) ArrayDim Uses

func (leaf *LeafC) ArrayDim() int

func (*LeafC) Branch Uses

func (leaf *LeafC) Branch() Branch

func (*LeafC) Class Uses

func (leaf *LeafC) Class() string

Class returns the ROOT class name.

func (*LeafC) HasRange Uses

func (leaf *LeafC) HasRange() bool

func (*LeafC) IsUnsigned Uses

func (leaf *LeafC) IsUnsigned() bool

func (*LeafC) Kind Uses

func (*LeafC) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafC) LeafCount Uses

func (leaf *LeafC) LeafCount() Leaf

func (*LeafC) Len Uses

func (leaf *LeafC) Len() int

func (*LeafC) LenType Uses

func (leaf *LeafC) LenType() int

func (*LeafC) MarshalROOT Uses

func (leaf *LeafC) MarshalROOT(w *WBuffer) (int, error)

func (*LeafC) MaxIndex Uses

func (leaf *LeafC) MaxIndex() []int

func (*LeafC) Maximum Uses

func (leaf *LeafC) Maximum() int32

Maximum returns the maximum value of the leaf.

func (*LeafC) Minimum Uses

func (leaf *LeafC) Minimum() int32

Minimum returns the minimum value of the leaf.

func (*LeafC) Name Uses

func (leaf *LeafC) Name() string

Name returns the name of the instance

func (*LeafC) Offset Uses

func (leaf *LeafC) Offset() int

func (*LeafC) Title Uses

func (leaf *LeafC) Title() string

Title returns the title of the instance

func (*LeafC) Type Uses

func (*LeafC) Type() reflect.Type

Type returns the leaf's type.

func (*LeafC) TypeName Uses

func (leaf *LeafC) TypeName() string

func (*LeafC) UnmarshalROOT Uses

func (leaf *LeafC) UnmarshalROOT(r *RBuffer) error

func (*LeafC) Value Uses

func (leaf *LeafC) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafD Uses

type LeafD struct {
    // contains filtered or unexported fields
}

LeafD implements ROOT TLeafD

func (*LeafD) ArrayDim Uses

func (leaf *LeafD) ArrayDim() int

func (*LeafD) Branch Uses

func (leaf *LeafD) Branch() Branch

func (*LeafD) Class Uses

func (leaf *LeafD) Class() string

Class returns the ROOT class name.

func (*LeafD) HasRange Uses

func (leaf *LeafD) HasRange() bool

func (*LeafD) IsUnsigned Uses

func (leaf *LeafD) IsUnsigned() bool

func (*LeafD) Kind Uses

func (*LeafD) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafD) LeafCount Uses

func (leaf *LeafD) LeafCount() Leaf

func (*LeafD) Len Uses

func (leaf *LeafD) Len() int

func (*LeafD) LenType Uses

func (leaf *LeafD) LenType() int

func (*LeafD) MarshalROOT Uses

func (leaf *LeafD) MarshalROOT(w *WBuffer) (int, error)

func (*LeafD) MaxIndex Uses

func (leaf *LeafD) MaxIndex() []int

func (*LeafD) Maximum Uses

func (leaf *LeafD) Maximum() float64

Maximum returns the maximum value of the leaf.

func (*LeafD) Minimum Uses

func (leaf *LeafD) Minimum() float64

Minimum returns the minimum value of the leaf.

func (*LeafD) Name Uses

func (leaf *LeafD) Name() string

Name returns the name of the instance

func (*LeafD) Offset Uses

func (leaf *LeafD) Offset() int

func (*LeafD) Title Uses

func (leaf *LeafD) Title() string

Title returns the title of the instance

func (*LeafD) Type Uses

func (*LeafD) Type() reflect.Type

Type returns the leaf's type.

func (*LeafD) TypeName Uses

func (leaf *LeafD) TypeName() string

func (*LeafD) UnmarshalROOT Uses

func (leaf *LeafD) UnmarshalROOT(r *RBuffer) error

func (*LeafD) Value Uses

func (leaf *LeafD) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafF Uses

type LeafF struct {
    // contains filtered or unexported fields
}

LeafF implements ROOT TLeafF

func (*LeafF) ArrayDim Uses

func (leaf *LeafF) ArrayDim() int

func (*LeafF) Branch Uses

func (leaf *LeafF) Branch() Branch

func (*LeafF) Class Uses

func (leaf *LeafF) Class() string

Class returns the ROOT class name.

func (*LeafF) HasRange Uses

func (leaf *LeafF) HasRange() bool

func (*LeafF) IsUnsigned Uses

func (leaf *LeafF) IsUnsigned() bool

func (*LeafF) Kind Uses

func (*LeafF) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafF) LeafCount Uses

func (leaf *LeafF) LeafCount() Leaf

func (*LeafF) Len Uses

func (leaf *LeafF) Len() int

func (*LeafF) LenType Uses

func (leaf *LeafF) LenType() int

func (*LeafF) MarshalROOT Uses

func (leaf *LeafF) MarshalROOT(w *WBuffer) (int, error)

func (*LeafF) MaxIndex Uses

func (leaf *LeafF) MaxIndex() []int

func (*LeafF) Maximum Uses

func (leaf *LeafF) Maximum() float32

Maximum returns the maximum value of the leaf.

func (*LeafF) Minimum Uses

func (leaf *LeafF) Minimum() float32

Minimum returns the minimum value of the leaf.

func (*LeafF) Name Uses

func (leaf *LeafF) Name() string

Name returns the name of the instance

func (*LeafF) Offset Uses

func (leaf *LeafF) Offset() int

func (*LeafF) Title Uses

func (leaf *LeafF) Title() string

Title returns the title of the instance

func (*LeafF) Type Uses

func (*LeafF) Type() reflect.Type

Type returns the leaf's type.

func (*LeafF) TypeName Uses

func (leaf *LeafF) TypeName() string

func (*LeafF) UnmarshalROOT Uses

func (leaf *LeafF) UnmarshalROOT(r *RBuffer) error

func (*LeafF) Value Uses

func (leaf *LeafF) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafI Uses

type LeafI struct {
    // contains filtered or unexported fields
}

LeafI implements ROOT TLeafI

func (*LeafI) ArrayDim Uses

func (leaf *LeafI) ArrayDim() int

func (*LeafI) Branch Uses

func (leaf *LeafI) Branch() Branch

func (*LeafI) Class Uses

func (leaf *LeafI) Class() string

Class returns the ROOT class name.

func (*LeafI) HasRange Uses

func (leaf *LeafI) HasRange() bool

func (*LeafI) IsUnsigned Uses

func (leaf *LeafI) IsUnsigned() bool

func (*LeafI) Kind Uses

func (*LeafI) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafI) LeafCount Uses

func (leaf *LeafI) LeafCount() Leaf

func (*LeafI) Len Uses

func (leaf *LeafI) Len() int

func (*LeafI) LenType Uses

func (leaf *LeafI) LenType() int

func (*LeafI) MarshalROOT Uses

func (leaf *LeafI) MarshalROOT(w *WBuffer) (int, error)

func (*LeafI) MaxIndex Uses

func (leaf *LeafI) MaxIndex() []int

func (*LeafI) Maximum Uses

func (leaf *LeafI) Maximum() int32

Maximum returns the maximum value of the leaf.

func (*LeafI) Minimum Uses

func (leaf *LeafI) Minimum() int32

Minimum returns the minimum value of the leaf.

func (*LeafI) Name Uses

func (leaf *LeafI) Name() string

Name returns the name of the instance

func (*LeafI) Offset Uses

func (leaf *LeafI) Offset() int

func (*LeafI) Title Uses

func (leaf *LeafI) Title() string

Title returns the title of the instance

func (*LeafI) Type Uses

func (*LeafI) Type() reflect.Type

Type returns the leaf's type.

func (*LeafI) TypeName Uses

func (leaf *LeafI) TypeName() string

func (*LeafI) UnmarshalROOT Uses

func (leaf *LeafI) UnmarshalROOT(r *RBuffer) error

func (*LeafI) Value Uses

func (leaf *LeafI) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafL Uses

type LeafL struct {
    // contains filtered or unexported fields
}

LeafL implements ROOT TLeafL

func (*LeafL) ArrayDim Uses

func (leaf *LeafL) ArrayDim() int

func (*LeafL) Branch Uses

func (leaf *LeafL) Branch() Branch

func (*LeafL) Class Uses

func (leaf *LeafL) Class() string

Class returns the ROOT class name.

func (*LeafL) HasRange Uses

func (leaf *LeafL) HasRange() bool

func (*LeafL) IsUnsigned Uses

func (leaf *LeafL) IsUnsigned() bool

func (*LeafL) Kind Uses

func (*LeafL) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafL) LeafCount Uses

func (leaf *LeafL) LeafCount() Leaf

func (*LeafL) Len Uses

func (leaf *LeafL) Len() int

func (*LeafL) LenType Uses

func (leaf *LeafL) LenType() int

func (*LeafL) MarshalROOT Uses

func (leaf *LeafL) MarshalROOT(w *WBuffer) (int, error)

func (*LeafL) MaxIndex Uses

func (leaf *LeafL) MaxIndex() []int

func (*LeafL) Maximum Uses

func (leaf *LeafL) Maximum() int64

Maximum returns the maximum value of the leaf.

func (*LeafL) Minimum Uses

func (leaf *LeafL) Minimum() int64

Minimum returns the minimum value of the leaf.

func (*LeafL) Name Uses

func (leaf *LeafL) Name() string

Name returns the name of the instance

func (*LeafL) Offset Uses

func (leaf *LeafL) Offset() int

func (*LeafL) Title Uses

func (leaf *LeafL) Title() string

Title returns the title of the instance

func (*LeafL) Type Uses

func (*LeafL) Type() reflect.Type

Type returns the leaf's type.

func (*LeafL) TypeName Uses

func (leaf *LeafL) TypeName() string

func (*LeafL) UnmarshalROOT Uses

func (leaf *LeafL) UnmarshalROOT(r *RBuffer) error

func (*LeafL) Value Uses

func (leaf *LeafL) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafO Uses

type LeafO struct {
    // contains filtered or unexported fields
}

LeafO implements ROOT TLeafO

func (*LeafO) ArrayDim Uses

func (leaf *LeafO) ArrayDim() int

func (*LeafO) Branch Uses

func (leaf *LeafO) Branch() Branch

func (*LeafO) Class Uses

func (leaf *LeafO) Class() string

Class returns the ROOT class name.

func (*LeafO) HasRange Uses

func (leaf *LeafO) HasRange() bool

func (*LeafO) IsUnsigned Uses

func (leaf *LeafO) IsUnsigned() bool

func (*LeafO) Kind Uses

func (*LeafO) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafO) LeafCount Uses

func (leaf *LeafO) LeafCount() Leaf

func (*LeafO) Len Uses

func (leaf *LeafO) Len() int

func (*LeafO) LenType Uses

func (leaf *LeafO) LenType() int

func (*LeafO) MarshalROOT Uses

func (leaf *LeafO) MarshalROOT(w *WBuffer) (int, error)

func (*LeafO) MaxIndex Uses

func (leaf *LeafO) MaxIndex() []int

func (*LeafO) Maximum Uses

func (leaf *LeafO) Maximum() bool

Maximum returns the maximum value of the leaf.

func (*LeafO) Minimum Uses

func (leaf *LeafO) Minimum() bool

Minimum returns the minimum value of the leaf.

func (*LeafO) Name Uses

func (leaf *LeafO) Name() string

Name returns the name of the instance

func (*LeafO) Offset Uses

func (leaf *LeafO) Offset() int

func (*LeafO) Title Uses

func (leaf *LeafO) Title() string

Title returns the title of the instance

func (*LeafO) Type Uses

func (*LeafO) Type() reflect.Type

Type returns the leaf's type.

func (*LeafO) TypeName Uses

func (leaf *LeafO) TypeName() string

func (*LeafO) UnmarshalROOT Uses

func (leaf *LeafO) UnmarshalROOT(r *RBuffer) error

func (*LeafO) Value Uses

func (leaf *LeafO) Value(i int) interface{}

Value returns the leaf value at index i.

type LeafS Uses

type LeafS struct {
    // contains filtered or unexported fields
}

LeafS implements ROOT TLeafS

func (*LeafS) ArrayDim Uses

func (leaf *LeafS) ArrayDim() int

func (*LeafS) Branch Uses

func (leaf *LeafS) Branch() Branch

func (*LeafS) Class Uses

func (leaf *LeafS) Class() string

Class returns the ROOT class name.

func (*LeafS) HasRange Uses

func (leaf *LeafS) HasRange() bool

func (*LeafS) IsUnsigned Uses

func (leaf *LeafS) IsUnsigned() bool

func (*LeafS) Kind Uses

func (*LeafS) Kind() reflect.Kind

Kind returns the leaf's kind.

func (*LeafS) LeafCount Uses

func (leaf *LeafS) LeafCount() Leaf

func (*LeafS) Len Uses

func (leaf *LeafS) Len() int

func (*LeafS) LenType Uses

func (leaf *LeafS) LenType() int

func (*LeafS) MarshalROOT Uses

func (leaf *LeafS) MarshalROOT(w *WBuffer) (int, error)

func (*LeafS) MaxIndex Uses

func (leaf *LeafS) MaxIndex() []int

func (*LeafS) Maximum Uses

func (leaf *LeafS) Maximum() int16

Maximum returns the maximum value of the leaf.

func (*LeafS) Minimum Uses

func (leaf *LeafS) Minimum() int16

Minimum returns the minimum value of the leaf.

func (*LeafS) Name Uses

func (leaf *LeafS) Name() string

Name returns the name of the instance

func (*LeafS) Offset Uses

func (leaf *LeafS) Offset() int

func (*LeafS) Title Uses

func (leaf *LeafS) Title() string

Title returns the title of the instance

func (*LeafS) Type Uses

func (*LeafS) Type() reflect.Type

Type returns the leaf's type.

func (*LeafS) TypeName Uses

func (leaf *LeafS) TypeName() string

func (*LeafS) UnmarshalROOT Uses

func (leaf *LeafS) UnmarshalROOT(r *RBuffer) error

func (*LeafS) Value Uses

func (leaf *LeafS) Value(i int) interface{}

Value returns the leaf value at index i.

type List Uses

type List interface {
    SeqCollection
}

List is a list of ROOT Objects.

type Member Uses

type Member interface {
    // GetArrayDim returns the dimension of the array (if any)
    ArrayDim() int

    // GetComment returns the comment associated with this member
    Comment() string

    // Name returns the name of this member
    Name() string

    // Type returns the class of this member
    Type() Class

    // GetValue returns the value of this member
    Value(o Object) reflect.Value
}

Member represents a single member of a ROOT class

type Named Uses

type Named interface {
    Object

    // Name returns the name of this ROOT object
    Name() string

    // Title returns the title of this ROOT object
    Title() string
}

Named represents a ROOT TNamed object

type ObjArray Uses

type ObjArray interface {
    SeqCollection
    LowerBound() int
}

ObjArray is an array of ROOT Objects.

type ObjString Uses

type ObjString interface {
    Name() string
    String() string
    // contains filtered or unexported methods
}

ObjString is a ROOT string that implements ROOT TObject.

type Object Uses

type Object interface {
    // Class returns the ROOT class of this object
    Class() string
}

Object represents a ROOT object

type RBuffer Uses

type RBuffer struct {
    // contains filtered or unexported fields
}

RBuffer is a read-only ROOT buffer for streaming.

func NewRBuffer Uses

func NewRBuffer(data []byte, refs map[int64]interface{}, offset uint32, ctx StreamerInfoContext) *RBuffer

func (*RBuffer) CheckByteCount Uses

func (r *RBuffer) CheckByteCount(pos, count int32, start int64, class string)

func (*RBuffer) Err Uses

func (r *RBuffer) Err() error

func (*RBuffer) Len Uses

func (r *RBuffer) Len() int64

func (*RBuffer) Pos Uses

func (r *RBuffer) Pos() int64

func (*RBuffer) ReadBool Uses

func (r *RBuffer) ReadBool() bool

func (*RBuffer) ReadCString Uses

func (r *RBuffer) ReadCString(n int) string

func (*RBuffer) ReadF32 Uses

func (r *RBuffer) ReadF32() float32

func (*RBuffer) ReadF64 Uses

func (r *RBuffer) ReadF64() float64

func (*RBuffer) ReadFastArrayBool Uses

func (r *RBuffer) ReadFastArrayBool(n int) []bool

func (*RBuffer) ReadFastArrayF32 Uses

func (r *RBuffer) ReadFastArrayF32(n int) []float32

func (*RBuffer) ReadFastArrayF64 Uses

func (r *RBuffer) ReadFastArrayF64(n int) []float64

func (*RBuffer) ReadFastArrayI16 Uses

func (r *RBuffer) ReadFastArrayI16(n int) []int16

func (*RBuffer) ReadFastArrayI32 Uses

func (r *RBuffer) ReadFastArrayI32(n int) []int32

func (*RBuffer) ReadFastArrayI64 Uses

func (r *RBuffer) ReadFastArrayI64(n int) []int64

func (*RBuffer) ReadFastArrayI8 Uses

func (r *RBuffer) ReadFastArrayI8(n int) []int8

func (*RBuffer) ReadFastArrayString Uses

func (r *RBuffer) ReadFastArrayString(n int) []string

func (*RBuffer) ReadFastArrayU16 Uses

func (r *RBuffer) ReadFastArrayU16(n int) []uint16

func (*RBuffer) ReadFastArrayU32 Uses

func (r *RBuffer) ReadFastArrayU32(n int) []uint32

func (*RBuffer) ReadFastArrayU64 Uses

func (r *RBuffer) ReadFastArrayU64(n int) []uint64

func (*RBuffer) ReadFastArrayU8 Uses

func (r *RBuffer) ReadFastArrayU8(n int) []uint8

func (*RBuffer) ReadI16 Uses

func (r *RBuffer) ReadI16() int16

func (*RBuffer) ReadI32 Uses

func (r *RBuffer) ReadI32() int32

func (*RBuffer) ReadI64 Uses

func (r *RBuffer) ReadI64() int64

func (*RBuffer) ReadI8 Uses

func (r *RBuffer) ReadI8() int8

func (*RBuffer) ReadObject Uses

func (r *RBuffer) ReadObject(class string) Object

func (*RBuffer) ReadObjectAny Uses

func (r *RBuffer) ReadObjectAny() (obj Object)

func (*RBuffer) ReadStaticArrayI32 Uses

func (r *RBuffer) ReadStaticArrayI32() []int32

func (*RBuffer) ReadString Uses

func (r *RBuffer) ReadString() string

func (*RBuffer) ReadU16 Uses

func (r *RBuffer) ReadU16() uint16

func (*RBuffer) ReadU32 Uses

func (r *RBuffer) ReadU32() uint32

func (*RBuffer) ReadU64 Uses

func (r *RBuffer) ReadU64() uint64

func (*RBuffer) ReadU8 Uses

func (r *RBuffer) ReadU8() uint8

func (*RBuffer) ReadVersion Uses

func (r *RBuffer) ReadVersion() (vers int16, pos, n int32)

func (*RBuffer) SkipObject Uses

func (r *RBuffer) SkipObject()

func (*RBuffer) SkipVersion Uses

func (r *RBuffer) SkipVersion(class string)

func (*RBuffer) StreamerInfo Uses

func (r *RBuffer) StreamerInfo(name string) (StreamerInfo, error)

type ROOTMarshaler Uses

type ROOTMarshaler interface {
    MarshalROOT(w *WBuffer) (int, error)
}

ROOTMarshaler is the interface implemented by an object that can marshal itself into a ROOT buffer

type ROOTUnmarshaler Uses

type ROOTUnmarshaler interface {
    UnmarshalROOT(r *RBuffer) error
}

ROOTUnmarshaler is the interface implemented by an object that can unmarshal itself from a ROOT buffer

type RStreamer Uses

type RStreamer interface {
    RStream(r *RBuffer) error
}

type Reader Uses

type Reader interface {
    io.Reader
    io.ReaderAt
    io.Seeker
    io.Closer
}

type ScanVar Uses

type ScanVar struct {
    Name  string      // name of the branch to read
    Leaf  string      // name of the leaf to read
    Value interface{} // pointer to the value to fill
}

ScanVar describes a variable to be read out of a tree during a scan.

type Scanner Uses

type Scanner struct {
    // contains filtered or unexported fields
}

Scanner scans, selects and iterates over Tree entries. Scanner is bound to values the user provides, Scanner will then read data into these values during the tree scan.

Code:

log.SetPrefix("rootio: ")
log.SetFlags(0)

f, err := rootio.Open("testdata/small-flat-tree.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tree")
if err != nil {
    log.Fatal(err)
}

tree := obj.(rootio.Tree)

type Data struct {
    I64    int64       `rootio:"Int64"`
    F64    float64     `rootio:"Float64"`
    Str    string      `rootio:"Str"`
    ArrF64 [10]float64 `rootio:"ArrayFloat64"`
    N      int32       `rootio:"N"`
    SliF64 []float64   `rootio:"SliceFloat64"`
}

var data Data
sc, err := rootio.NewScanner(tree, &data)
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

for sc.Next() {
    err := sc.Scan()
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("entry[%d]: %+v\n", sc.Entry(), data)
    if sc.Entry() == 9 {
        break
    }
}

if err := sc.Err(); err != nil && err != io.EOF {
    log.Fatal(err)
}

Output:

entry[0]: {I64:0 F64:0 Str:evt-000 ArrF64:[0 0 0 0 0 0 0 0 0 0] N:0 SliF64:[]}
entry[1]: {I64:1 F64:1 Str:evt-001 ArrF64:[1 1 1 1 1 1 1 1 1 1] N:1 SliF64:[1]}
entry[2]: {I64:2 F64:2 Str:evt-002 ArrF64:[2 2 2 2 2 2 2 2 2 2] N:2 SliF64:[2 2]}
entry[3]: {I64:3 F64:3 Str:evt-003 ArrF64:[3 3 3 3 3 3 3 3 3 3] N:3 SliF64:[3 3 3]}
entry[4]: {I64:4 F64:4 Str:evt-004 ArrF64:[4 4 4 4 4 4 4 4 4 4] N:4 SliF64:[4 4 4 4]}
entry[5]: {I64:5 F64:5 Str:evt-005 ArrF64:[5 5 5 5 5 5 5 5 5 5] N:5 SliF64:[5 5 5 5 5]}
entry[6]: {I64:6 F64:6 Str:evt-006 ArrF64:[6 6 6 6 6 6 6 6 6 6] N:6 SliF64:[6 6 6 6 6 6]}
entry[7]: {I64:7 F64:7 Str:evt-007 ArrF64:[7 7 7 7 7 7 7 7 7 7] N:7 SliF64:[7 7 7 7 7 7 7]}
entry[8]: {I64:8 F64:8 Str:evt-008 ArrF64:[8 8 8 8 8 8 8 8 8 8] N:8 SliF64:[8 8 8 8 8 8 8 8]}
entry[9]: {I64:9 F64:9 Str:evt-009 ArrF64:[9 9 9 9 9 9 9 9 9 9] N:9 SliF64:[9 9 9 9 9 9 9 9 9]}

Code:

log.SetPrefix("rootio: ")
log.SetFlags(0)

f, err := rootio.Open("testdata/small-flat-tree.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tree")
if err != nil {
    log.Fatal(err)
}

tree := obj.(rootio.Tree)

var (
    i64 int64
    f64 float64
    str string
    arr [10]float64
    n   int32
    sli []float64
)
scanVars := []rootio.ScanVar{
    {Name: "Int64", Value: &i64},
    {Name: "Float64", Value: &f64},
    {Name: "Str", Value: &str},
    {Name: "ArrayFloat64", Value: &arr},
    {Name: "N", Value: &n},
    {Name: "SliceFloat64", Value: &sli},
}
sc, err := rootio.NewScannerVars(tree, scanVars...)
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

for sc.Next() {
    err := sc.Scan()
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf(
        "entry[%d]: i64=%v f64=%v str=%q arr=%v n=%d sli=%v\n",
        sc.Entry(),
        i64, f64, str, arr, n, sli,
    )
    if sc.Entry() == 9 {
        break
    }
}

if err := sc.Err(); err != nil && err != io.EOF {
    log.Fatal(err)
}

Output:

entry[0]: i64=0 f64=0 str="evt-000" arr=[0 0 0 0 0 0 0 0 0 0] n=0 sli=[]
entry[1]: i64=1 f64=1 str="evt-001" arr=[1 1 1 1 1 1 1 1 1 1] n=1 sli=[1]
entry[2]: i64=2 f64=2 str="evt-002" arr=[2 2 2 2 2 2 2 2 2 2] n=2 sli=[2 2]
entry[3]: i64=3 f64=3 str="evt-003" arr=[3 3 3 3 3 3 3 3 3 3] n=3 sli=[3 3 3]
entry[4]: i64=4 f64=4 str="evt-004" arr=[4 4 4 4 4 4 4 4 4 4] n=4 sli=[4 4 4 4]
entry[5]: i64=5 f64=5 str="evt-005" arr=[5 5 5 5 5 5 5 5 5 5] n=5 sli=[5 5 5 5 5]
entry[6]: i64=6 f64=6 str="evt-006" arr=[6 6 6 6 6 6 6 6 6 6] n=6 sli=[6 6 6 6 6 6]
entry[7]: i64=7 f64=7 str="evt-007" arr=[7 7 7 7 7 7 7 7 7 7] n=7 sli=[7 7 7 7 7 7 7]
entry[8]: i64=8 f64=8 str="evt-008" arr=[8 8 8 8 8 8 8 8 8 8] n=8 sli=[8 8 8 8 8 8 8 8]
entry[9]: i64=9 f64=9 str="evt-009" arr=[9 9 9 9 9 9 9 9 9 9] n=9 sli=[9 9 9 9 9 9 9 9 9]

func NewScanner Uses

func NewScanner(t Tree, ptr interface{}) (*Scanner, error)

NewScanner creates a new Scanner bound to a (pointer to a) struct value. Scanner will read the branches' data during Scan() and load them into the fields of the struct value.

func NewScannerVars Uses

func NewScannerVars(t Tree, vars ...ScanVar) (*Scanner, error)

NewScannerVars creates a new Scanner from a list of pairs (branch-name, target-address). Scanner will read the branches' data during Scan() and load them into these target-addresses.

func (*Scanner) Close Uses

func (s *Scanner) Close() error

Close closes the Scanner, preventing further iteration. Close is idempotent and does not affect the result of Err.

func (*Scanner) Entry Uses

func (s *Scanner) Entry() int64

Entry returns the entry number of the last read row.

func (*Scanner) Err Uses

func (s *Scanner) Err() error

Err returns the error, if any, that was encountered during iteration.

func (*Scanner) Next Uses

func (s *Scanner) Next() bool

Next prepares the next result row for reading with the Scan method. It returns true on success, false if there is no next result row. Every call to Scan, even the first one, must be preceded by a call to Next.

func (*Scanner) Scan Uses

func (s *Scanner) Scan() error

Scan copies data loaded from the underlying Tree into the values the Scanner is bound to. The values bound to the Scanner are valid until the next call to Scan.

func (*Scanner) SeekEntry Uses

func (s *Scanner) SeekEntry(i int64) error

SeekEntry points the scanner to the i-th entry, ready to call Next.

type SeqCollection Uses

type SeqCollection interface {
    Collection
}

SeqCollection is a sequential collection of ROOT Objects.

type SetFiler Uses

type SetFiler interface {
    SetFile(f *File)
}

SetFiler is a simple interface to establish File ownership.

type StreamerElement Uses

type StreamerElement interface {
    Named
    ArrayDim() int
    ArrayLen() int
    Type() int
    Offset() uintptr
    Size() uintptr
    TypeName() string
}

StreamerElement describes a ROOT StreamerElement

type StreamerInfo Uses

type StreamerInfo interface {
    Named
    CheckSum() int
    ClassVersion() int
    Elements() []StreamerElement
}

StreamerInfo describes a ROOT Streamer.

type StreamerInfoContext Uses

type StreamerInfoContext interface {
    StreamerInfo(name string) (StreamerInfo, error)
}

type Tree Uses

type Tree interface {
    Named
    Entries() int64
    TotBytes() int64
    ZipBytes() int64
    Branch(name string) Branch
    Branches() []Branch
    Leaf(name string) Leaf
    Leaves() []Leaf
    // contains filtered or unexported methods
}

Tree is a collection of branches of data.

func Chain Uses

func Chain(trees ...Tree) Tree

Chain returns a tchain that is the concatenation of all the input Trees.

ExampleChain shows how to create a chain made of 2 trees.

Code:

const name = "tree"

f1, err := rootio.Open("testdata/chain.1.root")
if err != nil {
    log.Fatal(err)
}
defer f1.Close()

o1, err := f1.Get(name)
if err != nil {
    log.Fatal(err)
}
t1 := o1.(rootio.Tree)

f2, err := rootio.Open("testdata/chain.2.root")
if err != nil {
    log.Fatal(err)
}
defer f2.Close()

o2, err := f2.Get(name)
if err != nil {
    log.Fatal(err)
}
t2 := o2.(rootio.Tree)

chain := rootio.Chain(t1, t2)

type Data struct {
    Event struct {
        Beg       string      `rootio:"Beg"`
        F64       float64     `rootio:"F64"`
        ArrF64    [10]float64 `rootio:"ArrayF64"`
        N         int32       `rootio:"N"`
        SliF64    []float64   `rootio:"SliceF64"`
        StdStr    string      `rootio:"StdStr"`
        StlVecF64 []float64   `rootio:"StlVecF64"`
        StlVecStr []string    `rootio:"StlVecStr"`
        End       string      `rootio:"End"`
    } `rootio:"evt"`
}

sc, err := rootio.NewTreeScanner(chain, &Data{})
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

for sc.Next() {
    var data Data
    err := sc.Scan(&data)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("entry[%02d]: beg=%q f64=%v\n", sc.Entry(), data.Event.Beg, data.Event.F64)
}

if err := sc.Err(); err != nil {
    log.Fatalf("error during scan: %v", err)
}

Output:

entry[00]: beg="beg-000" f64=0
entry[01]: beg="beg-001" f64=1
entry[02]: beg="beg-002" f64=2
entry[03]: beg="beg-003" f64=3
entry[04]: beg="beg-004" f64=4
entry[05]: beg="beg-005" f64=5
entry[06]: beg="beg-006" f64=6
entry[07]: beg="beg-007" f64=7
entry[08]: beg="beg-008" f64=8
entry[09]: beg="beg-009" f64=9
entry[10]: beg="beg-010" f64=10
entry[11]: beg="beg-011" f64=11
entry[12]: beg="beg-012" f64=12
entry[13]: beg="beg-013" f64=13
entry[14]: beg="beg-014" f64=14
entry[15]: beg="beg-015" f64=15
entry[16]: beg="beg-016" f64=16
entry[17]: beg="beg-017" f64=17
entry[18]: beg="beg-018" f64=18
entry[19]: beg="beg-019" f64=19

func ChainOf Uses

func ChainOf(name string, files ...string) (Tree, func() error, error)

ChainOf returns a Tree, a close function and an error if any. The tree is the logical concatenation of all the name trees located in the input named files. The close function allows to close all the open named files.

ExampleChainOf shows how to create a chain made of trees from 2 files.

Code:

const name = "tree"

chain, closer, err := rootio.ChainOf(name, "testdata/chain.1.root", "testdata/chain.2.root")
if err != nil {
    log.Fatal(err)
}
defer closer()

type Data struct {
    Event struct {
        Beg       string      `rootio:"Beg"`
        F64       float64     `rootio:"F64"`
        ArrF64    [10]float64 `rootio:"ArrayF64"`
        N         int32       `rootio:"N"`
        SliF64    []float64   `rootio:"SliceF64"`
        StdStr    string      `rootio:"StdStr"`
        StlVecF64 []float64   `rootio:"StlVecF64"`
        StlVecStr []string    `rootio:"StlVecStr"`
        End       string      `rootio:"End"`
    } `rootio:"evt"`
}

sc, err := rootio.NewTreeScanner(chain, &Data{})
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

for sc.Next() {
    var data Data
    err := sc.Scan(&data)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("entry[%02d]: beg=%q f64=%v\n", sc.Entry(), data.Event.Beg, data.Event.F64)
}

if err := sc.Err(); err != nil {
    log.Fatalf("error during scan: %v", err)
}

Output:

entry[00]: beg="beg-000" f64=0
entry[01]: beg="beg-001" f64=1
entry[02]: beg="beg-002" f64=2
entry[03]: beg="beg-003" f64=3
entry[04]: beg="beg-004" f64=4
entry[05]: beg="beg-005" f64=5
entry[06]: beg="beg-006" f64=6
entry[07]: beg="beg-007" f64=7
entry[08]: beg="beg-008" f64=8
entry[09]: beg="beg-009" f64=9
entry[10]: beg="beg-010" f64=10
entry[11]: beg="beg-011" f64=11
entry[12]: beg="beg-012" f64=12
entry[13]: beg="beg-013" f64=13
entry[14]: beg="beg-014" f64=14
entry[15]: beg="beg-015" f64=15
entry[16]: beg="beg-016" f64=16
entry[17]: beg="beg-017" f64=17
entry[18]: beg="beg-018" f64=18
entry[19]: beg="beg-019" f64=19

type TreeScanner Uses

type TreeScanner struct {
    // contains filtered or unexported fields
}

TreeScanner scans, selects and iterates over Tree entries.

Code:

log.SetPrefix("rootio: ")
log.SetFlags(0)

f, err := rootio.Open("testdata/small-flat-tree.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tree")
if err != nil {
    log.Fatal(err)
}

tree := obj.(rootio.Tree)

type Data struct {
    I64    int64       `rootio:"Int64"`
    F64    float64     `rootio:"Float64"`
    Str    string      `rootio:"Str"`
    ArrF64 [10]float64 `rootio:"ArrayFloat64"`
    N      int32       `rootio:"N"`
    SliF64 []float64   `rootio:"SliceFloat64"`
}

sc, err := rootio.NewTreeScanner(tree, &Data{})
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

for sc.Next() {
    var data Data
    err := sc.Scan(&data)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("entry[%d]: %+v\n", sc.Entry(), data)
    if sc.Entry() == 9 {
        break
    }
}

if err := sc.Err(); err != nil && err != io.EOF {
    log.Fatal(err)
}

Output:

entry[0]: {I64:0 F64:0 Str:evt-000 ArrF64:[0 0 0 0 0 0 0 0 0 0] N:0 SliF64:[]}
entry[1]: {I64:1 F64:1 Str:evt-001 ArrF64:[1 1 1 1 1 1 1 1 1 1] N:1 SliF64:[1]}
entry[2]: {I64:2 F64:2 Str:evt-002 ArrF64:[2 2 2 2 2 2 2 2 2 2] N:2 SliF64:[2 2]}
entry[3]: {I64:3 F64:3 Str:evt-003 ArrF64:[3 3 3 3 3 3 3 3 3 3] N:3 SliF64:[3 3 3]}
entry[4]: {I64:4 F64:4 Str:evt-004 ArrF64:[4 4 4 4 4 4 4 4 4 4] N:4 SliF64:[4 4 4 4]}
entry[5]: {I64:5 F64:5 Str:evt-005 ArrF64:[5 5 5 5 5 5 5 5 5 5] N:5 SliF64:[5 5 5 5 5]}
entry[6]: {I64:6 F64:6 Str:evt-006 ArrF64:[6 6 6 6 6 6 6 6 6 6] N:6 SliF64:[6 6 6 6 6 6]}
entry[7]: {I64:7 F64:7 Str:evt-007 ArrF64:[7 7 7 7 7 7 7 7 7 7] N:7 SliF64:[7 7 7 7 7 7 7]}
entry[8]: {I64:8 F64:8 Str:evt-008 ArrF64:[8 8 8 8 8 8 8 8 8 8] N:8 SliF64:[8 8 8 8 8 8 8 8]}
entry[9]: {I64:9 F64:9 Str:evt-009 ArrF64:[9 9 9 9 9 9 9 9 9 9] N:9 SliF64:[9 9 9 9 9 9 9 9 9]}

Code:

log.SetPrefix("rootio: ")
log.SetFlags(0)

f, err := rootio.Open("testdata/small-flat-tree.root")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

obj, err := f.Get("tree")
if err != nil {
    log.Fatal(err)
}

tree := obj.(rootio.Tree)

scanVars := []rootio.ScanVar{
    {Name: "Int64"},
    {Name: "Float64"},
    {Name: "Str"},
    {Name: "ArrayFloat64"},
    {Name: "N"},
    {Name: "SliceFloat64"},
}
sc, err := rootio.NewTreeScannerVars(tree, scanVars...)
if err != nil {
    log.Fatal(err)
}
defer sc.Close()

for sc.Next() {
    var (
        i64 int64
        f64 float64
        str string
        arr [10]float64
        n   int32
        sli []float64
    )
    err := sc.Scan(&i64, &f64, &str, &arr, &n, &sli)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf(
        "entry[%d]: i64=%v f64=%v str=%q arr=%v n=%d sli=%v\n",
        sc.Entry(),
        i64, f64, str, arr, n, sli,
    )
    if sc.Entry() == 9 {
        break
    }
}

if err := sc.Err(); err != nil && err != io.EOF {
    log.Fatal(err)
}

Output:

entry[0]: i64=0 f64=0 str="evt-000" arr=[0 0 0 0 0 0 0 0 0 0] n=0 sli=[]
entry[1]: i64=1 f64=1 str="evt-001" arr=[1 1 1 1 1 1 1 1 1 1] n=1 sli=[1]
entry[2]: i64=2 f64=2 str="evt-002" arr=[2 2 2 2 2 2 2 2 2 2] n=2 sli=[2 2]
entry[3]: i64=3 f64=3 str="evt-003" arr=[3 3 3 3 3 3 3 3 3 3] n=3 sli=[3 3 3]
entry[4]: i64=4 f64=4 str="evt-004" arr=[4 4 4 4 4 4 4 4 4 4] n=4 sli=[4 4 4 4]
entry[5]: i64=5 f64=5 str="evt-005" arr=[5 5 5 5 5 5 5 5 5 5] n=5 sli=[5 5 5 5 5]
entry[6]: i64=6 f64=6 str="evt-006" arr=[6 6 6 6 6 6 6 6 6 6] n=6 sli=[6 6 6 6 6 6]
entry[7]: i64=7 f64=7 str="evt-007" arr=[7 7 7 7 7 7 7 7 7 7] n=7 sli=[7 7 7 7 7 7 7]
entry[8]: i64=8 f64=8 str="evt-008" arr=[8 8 8 8 8 8 8 8 8 8] n=8 sli=[8 8 8 8 8 8 8 8]
entry[9]: i64=9 f64=9 str="evt-009" arr=[9 9 9 9 9 9 9 9 9 9] n=9 sli=[9 9 9 9 9 9 9 9 9]

func NewTreeScanner Uses

func NewTreeScanner(t Tree, ptr interface{}) (*TreeScanner, error)

NewTreeScanner creates a new Scanner connecting the pointer to some user provided type to the given Tree.

func NewTreeScannerVars Uses

func NewTreeScannerVars(t Tree, vars ...ScanVar) (*TreeScanner, error)

NewTreeScannerVars creates a new Scanner from a list of branches. It will return an error if the provided type does not match the type stored in the corresponding branch.

func (*TreeScanner) Close Uses

func (s *TreeScanner) Close() error

Close closes the TreeScanner, preventing further iteration. Close is idempotent and does not affect the result of Err.

func (*TreeScanner) Entry Uses

func (s *TreeScanner) Entry() int64

Entry returns the entry number of the last read row.

func (*TreeScanner) Err Uses

func (s *TreeScanner) Err() error

Err returns the error, if any, that was encountered during iteration.

func (*TreeScanner) Next Uses

func (s *TreeScanner) Next() bool

Next prepares the next result row for reading with the Scan method. It returns true on success, false if there is no next result row. Every call to Scan, even the first one, must be preceded by a call to Next.

func (*TreeScanner) Scan Uses

func (s *TreeScanner) Scan(args ...interface{}) (err error)

Scan copies data loaded from the underlying Tree into the values pointed at by args.

func (*TreeScanner) SeekEntry Uses

func (s *TreeScanner) SeekEntry(i int64) error

SeekEntry points the scanner to the i-th entry, ready to call Next.

type WBuffer Uses

type WBuffer struct {
    // contains filtered or unexported fields
}

WBuffer is a write-only ROOT buffer for streaming.

func NewWBuffer Uses

func NewWBuffer(data []byte, refs map[interface{}]int64, offset uint32, ctx StreamerInfoContext) *WBuffer

func (*WBuffer) Pos Uses

func (w *WBuffer) Pos() int64

func (*WBuffer) SetByteCount Uses

func (w *WBuffer) SetByteCount(beg int64, class string) (int, error)

func (*WBuffer) WriteBool Uses

func (w *WBuffer) WriteBool(v bool)

func (*WBuffer) WriteCString Uses

func (w *WBuffer) WriteCString(v string)

func (*WBuffer) WriteClass Uses

func (w *WBuffer) WriteClass(beg int64, obj Object) (uint32, error)

func (*WBuffer) WriteF32 Uses

func (w *WBuffer) WriteF32(v float32)

func (*WBuffer) WriteF64 Uses

func (w *WBuffer) WriteF64(v float64)

func (*WBuffer) WriteFastArrayBool Uses

func (w *WBuffer) WriteFastArrayBool(v []bool)

func (*WBuffer) WriteFastArrayF32 Uses

func (w *WBuffer) WriteFastArrayF32(v []float32)

func (*WBuffer) WriteFastArrayF64 Uses

func (w *WBuffer) WriteFastArrayF64(v []float64)

func (*WBuffer) WriteFastArrayI16 Uses

func (w *WBuffer) WriteFastArrayI16(v []int16)

func (*WBuffer) WriteFastArrayI32 Uses

func (w *WBuffer) WriteFastArrayI32(v []int32)

func (*WBuffer) WriteFastArrayI64 Uses

func (w *WBuffer) WriteFastArrayI64(v []int64)

func (*WBuffer) WriteFastArrayI8 Uses

func (w *WBuffer) WriteFastArrayI8(v []int8)

func (*WBuffer) WriteFastArrayU16 Uses

func (w *WBuffer) WriteFastArrayU16(v []uint16)

func (*WBuffer) WriteFastArrayU32 Uses

func (w *WBuffer) WriteFastArrayU32(v []uint32)

func (*WBuffer) WriteFastArrayU64 Uses

func (w *WBuffer) WriteFastArrayU64(v []uint64)

func (*WBuffer) WriteFastArrayU8 Uses

func (w *WBuffer) WriteFastArrayU8(v []uint8)

func (*WBuffer) WriteI16 Uses

func (w *WBuffer) WriteI16(v int16)

func (*WBuffer) WriteI32 Uses

func (w *WBuffer) WriteI32(v int32)

func (*WBuffer) WriteI64 Uses

func (w *WBuffer) WriteI64(v int64)

func (*WBuffer) WriteI8 Uses

func (w *WBuffer) WriteI8(v int8)

func (*WBuffer) WriteObjectAny Uses

func (w *WBuffer) WriteObjectAny(obj Object) error

func (*WBuffer) WriteStaticArrayI32 Uses

func (w *WBuffer) WriteStaticArrayI32(v []int32)

func (*WBuffer) WriteString Uses

func (w *WBuffer) WriteString(v string)

func (*WBuffer) WriteU16 Uses

func (w *WBuffer) WriteU16(v uint16)

func (*WBuffer) WriteU32 Uses

func (w *WBuffer) WriteU32(v uint32)

func (*WBuffer) WriteU64 Uses

func (w *WBuffer) WriteU64(v uint64)

func (*WBuffer) WriteU8 Uses

func (w *WBuffer) WriteU8(v uint8)

func (*WBuffer) WriteVersion Uses

func (w *WBuffer) WriteVersion(vers int16)

type Writer Uses

type Writer interface {
    io.Writer
    io.WriterAt
    io.Seeker
    io.Closer
}

Package rootio imports 27 packages (graph). Updated 2018-11-20. Refresh now. Tools for package owners.