Documentation

Overview

    Package ntroot provides convenience functions to access ROOT trees as n-tuple data.

    Example:

    nt, err := ntroot.Open("testdata/simple.root", "mytree")
    if err != nil {
        log.Fatalf("%+v", err)
    }
    defer nt.DB().Close()
    

    Index

    Examples

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func Open

    func Open(name, tree string) (*ntup.Ntuple, error)

      Open opens the named ROOT file in read-only mode and returns an n-tuple connected to the named tree.

      Example

      Code:

      package main
      
      import (
      	"fmt"
      	"log"
      
      	"go-hep.org/x/hep/hbook/ntup/ntroot"
      )
      
      func main() {
      	nt, err := ntroot.Open("../../../groot/testdata/simple.root", "tree")
      	if err != nil {
      		log.Fatalf("could not open n-tuple: %+v", err)
      	}
      	defer nt.DB().Close()
      
      	err = nt.Scan(
      		"(one, two, three)",
      		func(i int32, f float32, s string) error {
      			fmt.Printf("row=(%v, %v, %q)\n", i, f, s)
      			return nil
      		},
      	)
      
      	if err != nil {
      		log.Fatalf("could not scan n-tuple: %+v", err)
      	}
      
      }
      
      row=(1, 1.1, "uno")
      row=(2, 2.2, "dos")
      row=(3, 3.3, "tres")
      row=(4, 4.4, "quatro")
      

      Types

      This section is empty.

      Source Files