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
37 changes: 19 additions & 18 deletions brio/cmd/brio-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,31 @@
// For each type given to brio-gen, marshaling and unmarshaling code will be
// generated so the types implement binary.Binary(Un)Marshaler.
//
// - values are encoded using binary.LittleEndian,
// - int and uint are encoded as (resp.) int64 and uint64,
// - booleans are encoded as a single uint8 (0==false, 1==true),
// - strings are encoded as a pair(uint64, []byte),
// - arrays are encoded as a sequence of Ts, the length is implicit as it is
// part of the array type,
// - slices are encoded as a pair(uint64, T...)
// - pointers are encoded as *T (like encoding/gob)
// - interfaces are not supported.
//
// - values are encoded using binary.LittleEndian,
// - int and uint are encoded as (resp.) int64 and uint64,
// - booleans are encoded as a single uint8 (0==false, 1==true),
// - strings are encoded as a pair(uint64, []byte),
// - arrays are encoded as a sequence of Ts, the length is implicit as it is
// part of the array type,
// - slices are encoded as a pair(uint64, T...)
// - pointers are encoded as *T (like encoding/gob)
// - interfaces are not supported.
//
// Usage: brio-gen [options]
//
// ex:
// $> brio-gen -p image -t Point -o image_brio.go
// $> brio-gen -p go-hep.org/x/hep/hbook -t Dist0D,Dist1D,Dist2D -o foo_brio.go
//
// $> brio-gen -p image -t Point -o image_brio.go
// $> brio-gen -p go-hep.org/x/hep/hbook -t Dist0D,Dist1D,Dist2D -o foo_brio.go
//
// options:
// -o string
// output file name (default "brio_gen.go")
// -p string
// package import path
// -t string
// comma-separated list of type names
//
// -o string
// output file name (default "brio_gen.go")
// -p string
// package import path
// -t string
// comma-separated list of type names
package main

import (
Expand Down
15 changes: 8 additions & 7 deletions cmd/fits2root/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
//
// Example:
//
// $> fits2root -f ./input.fits -t MyHDU
// $> fits2root -f ./input.fits -t MyHDU
//
// Options:
// -f string
// path to input FITS file name
// -o string
// path to output ROOT file name (default "output.root")
// -t string
// name of the FITS table to convert
//
// -f string
// path to input FITS file name
// -o string
// path to output ROOT file name (default "output.root")
// -t string
// name of the FITS table to convert
package main

import (
Expand Down
4 changes: 2 additions & 2 deletions cmd/lhef2hepmc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
// Example:
//
// $> lhef2hepmc -i in.lhef -o out.hepmc
// $> lhef2hepmc < in.lhef > out.hepmc
// $> lhef2hepmc -i in.lhef -o out.hepmc
// $> lhef2hepmc < in.lhef > out.hepmc
package main // import "go-hep.org/x/hep/cmd/lhef2hepmc"

import (
Expand Down
43 changes: 22 additions & 21 deletions cmd/npy2root/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,35 @@
//
// The NumPy data file format is described here:
//
// https://numpy.org/neps/nep-0001-npy-format.html
// https://numpy.org/neps/nep-0001-npy-format.html
//
// Example:
//
// $> npyio-ls input.npy
// ================================================================================
// file: input.npy
// npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
// data = [0 1 2 3 4 5]
// $> npyio-ls input.npy
// ================================================================================
// file: input.npy
// npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
// data = [0 1 2 3 4 5]
//
// $> npy2root -o output.root -t mytree ./input.npy
// $> root-ls -t ./output.root
// === [./output.root] ===
// version: 61804
// TTree mytree mytree (entries=2)
// numpy "numpy[3]/D" TBranch
// $> npy2root -o output.root -t mytree ./input.npy
// $> root-ls -t ./output.root
// === [./output.root] ===
// version: 61804
// TTree mytree mytree (entries=2)
// numpy "numpy[3]/D" TBranch
//
// $> root-dump ./output.root
// >>> file[./output.root]
// key[000]: mytree;1 "mytree" (TTree)
// [000][numpy]: [0 1 2]
// [001][numpy]: [3 4 5]
// $> root-dump ./output.root
// >>> file[./output.root]
// key[000]: mytree;1 "mytree" (TTree)
// [000][numpy]: [0 1 2]
// [001][numpy]: [3 4 5]
//
// Options:
// -o string
// path to output ROOT file (default "output.root")
// -t string
// name of the output ROOT tree (default "tree")
//
// -o string
// path to output ROOT file (default "output.root")
// -t string
// name of the output ROOT tree (default "tree")
package main

import (
Expand Down
15 changes: 8 additions & 7 deletions cmd/podio-gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
//
// Example:
//
// $> podio-gen -p myedm -o out.go -r 'edm4hep::->edm_,ExNamespace::->exns_' edm.yaml
// $> podio-gen -p myedm -o out.go -r 'edm4hep::->edm_,ExNamespace::->exns_' edm.yaml
//
// Options:
// -o string
// path to the output file containing the generated code (default "out.go")
// -p string
// package name for the PODIO generated types (default "podio")
// -r string
// comma-separated list of rewrite rules (e.g., 'edm4hep::->edm_')
//
// -o string
// path to the output file containing the generated code (default "out.go")
// -p string
// package name for the PODIO generated types (default "podio")
// -r string
// comma-separated list of rewrite rules (e.g., 'edm4hep::->edm_')
package main // import "go-hep.org/x/hep/cmd/podio-gen"

import (
Expand Down
6 changes: 3 additions & 3 deletions cmd/rio2yoda/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Example:
//
// $> rio2yoda file1.rio file2.rio > out.yoda
// $> rio2yoda -o out.yoda file1.rio file2.rio
// $> rio2yoda -o out.yoda.gz file1.rio file2.rio
// $> rio2yoda file1.rio file2.rio > out.yoda
// $> rio2yoda -o out.yoda file1.rio file2.rio
// $> rio2yoda -o out.yoda.gz file1.rio file2.rio
package main

import (
Expand Down
45 changes: 22 additions & 23 deletions cmd/root2arrow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,30 @@

// root2arrow converts the content of a ROOT TTree to an ARROW file.
//
// Usage of root2arrow:
// -o string
// path to output ARROW file name (default "output.data")
// -stream
// enable ARROW stream (default is to create an ARROW file)
// -t string
// name of the tree to convert (default "tree")
// Usage of root2arrow:
// -o string
// path to output ARROW file name (default "output.data")
// -stream
// enable ARROW stream (default is to create an ARROW file)
// -t string
// name of the tree to convert (default "tree")
//
//
// $> root2arrow -o foo.data -t tree ../../groot/testdata/simple.root
// $> arrow-ls ./foo.data
// version: V4
// schema:
// fields: 3
// - one: type=int32
// - two: type=float32
// - three: type=utf8
// records: 1
// $> arrow-cat ./foo.data
// version: V4
// record 1/1...
// col[0] "one": [1 2 3 4]
// col[1] "two": [1.1 2.2 3.3 4.4]
// col[2] "three": ["uno" "dos" "tres" "quatro"]
//
// $> root2arrow -o foo.data -t tree ../../groot/testdata/simple.root
// $> arrow-ls ./foo.data
// version: V4
// schema:
// fields: 3
// - one: type=int32
// - two: type=float32
// - three: type=utf8
// records: 1
// $> arrow-cat ./foo.data
// version: V4
// record 1/1...
// col[0] "one": [1 2 3 4]
// col[1] "two": [1.1 2.2 3.3 4.4]
// col[2] "three": ["uno" "dos" "tres" "quatro"]
package main // import "go-hep.org/x/hep/cmd/root2arrow"

import (
Expand Down
43 changes: 22 additions & 21 deletions cmd/root2csv/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,33 @@

// root2csv converts the content of a ROOT TTree to a CSV file.
//
// Usage of root2csv:
// -f string
// path to input ROOT file name
// -o string
// path to output CSV file name (default "output.csv")
// -t string
// name of the tree to convert (default "tree")
// Usage of root2csv:
// -f string
// path to input ROOT file name
// -o string
// path to output CSV file name (default "output.csv")
// -t string
// name of the tree to convert (default "tree")
//
// By default, root2csv will write out a CSV file with ';' as a column delimiter.
// root2csv ignores the branches of the TTree that are not supported by CSV:
// - slices/arrays
// - C++ objects
// - slices/arrays
// - C++ objects
//
// Example:
// $> root2csv -o out.csv -t tree -f testdata/small-flat-tree.root
// $> head out.csv
// ## Automatically generated from "testdata/small-flat-tree.root"
// Int32;Int64;UInt32;UInt64;Float32;Float64;Str;N
// 0;0;0;0;0;0;evt-000;0
// 1;1;1;1;1;1;evt-001;1
// 2;2;2;2;2;2;evt-002;2
// 3;3;3;3;3;3;evt-003;3
// 4;4;4;4;4;4;evt-004;4
// 5;5;5;5;5;5;evt-005;5
// 6;6;6;6;6;6;evt-006;6
// 7;7;7;7;7;7;evt-007;7
//
// $> root2csv -o out.csv -t tree -f testdata/small-flat-tree.root
// $> head out.csv
// ## Automatically generated from "testdata/small-flat-tree.root"
// Int32;Int64;UInt32;UInt64;Float32;Float64;Str;N
// 0;0;0;0;0;0;evt-000;0
// 1;1;1;1;1;1;evt-001;1
// 2;2;2;2;2;2;evt-002;2
// 3;3;3;3;3;3;evt-003;3
// 4;4;4;4;4;4;evt-004;4
// 5;5;5;5;5;5;evt-005;5
// 6;6;6;6;6;6;evt-006;6
// 7;7;7;7;7;7;evt-007;7
package main

import (
Expand Down
14 changes: 7 additions & 7 deletions cmd/root2fits/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
//
// Example:
//
// $> root2fits -f ./input.root -t tree
// $> root2fits -f ./input.root -t tree
//
// Options:
// -f string
// path to input ROOT file name
// -o string
// path to output FITS file name (default "output.fits")
// -t string
// name of the ROOT tree to convert
//
// -f string
// path to input ROOT file name
// -o string
// path to output FITS file name (default "output.fits")
// -t string
// name of the ROOT tree to convert
package main

import (
Expand Down
Loading