From 2d8ce49a63b8af6d58808b936aabaffd49af145c Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Tue, 10 May 2022 09:41:19 +0200 Subject: [PATCH 1/2] fwk/internal/fwktest: apply staticcheck cosmetic change Signed-off-by: Sebastien Binet --- fwk/internal/fwktest/reducer.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fwk/internal/fwktest/reducer.go b/fwk/internal/fwktest/reducer.go index 4386a6f9a..6b88d13a1 100644 --- a/fwk/internal/fwktest/reducer.go +++ b/fwk/internal/fwktest/reducer.go @@ -23,9 +23,7 @@ type reducer struct { } func (tsk *reducer) Configure(ctx fwk.Context) error { - var err error - - err = tsk.DeclInPort(tsk.input, reflect.TypeOf(int64(0))) + err := tsk.DeclInPort(tsk.input, reflect.TypeOf(int64(0))) if err != nil { return err } From f979a1cb8ca76dfa6b1c13871a926d33e986704b Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Tue, 10 May 2022 09:43:31 +0200 Subject: [PATCH 2/2] all: apply gofmt-1.19 formating rules Signed-off-by: Sebastien Binet --- brio/cmd/brio-gen/main.go | 37 ++-- cmd/fits2root/main.go | 15 +- cmd/lhef2hepmc/main.go | 4 +- cmd/npy2root/main.go | 43 +++-- cmd/podio-gen/main.go | 15 +- cmd/rio2yoda/main.go | 6 +- cmd/root2arrow/main.go | 45 +++-- cmd/root2csv/main.go | 43 +++-- cmd/root2fits/main.go | 14 +- cmd/root2npy/main.go | 211 ++++++++++----------- cmd/root2yoda/main.go | 6 +- cmd/yoda2rio/main.go | 4 +- cmd/yoda2root/main.go | 4 +- fads/cmd/fads-app/main.go | 61 +++--- fads/cmd/fads-rivet-mc-generic/main.go | 24 +-- fastjet/internal/predicates/float64Pred.go | 2 +- fastjet/internal/predicates/orientation.go | 21 +- fwk/core.go | 10 +- fwk/fwk.go | 86 ++++----- fwk/hbooksvc/hsvc.go | 9 +- fwk/utils/builder/builder.go | 2 +- fwk/utils/tarjan/tarjan.go | 1 - geo/gdml/gdml.go | 2 +- groot/cmd/root-cp/main.go | 7 +- groot/cmd/root-diff/main.go | 19 +- groot/cmd/root-dump/main.go | 65 ++++--- groot/cmd/root-gen-datareader/main.go | 51 ++--- groot/cmd/root-ls/main.go | 57 +++--- groot/cmd/root-merge/main.go | 9 +- groot/cmd/root-print/main.go | 25 ++- groot/cmd/root-split/main.go | 18 +- groot/cmd/root-srv/main.go | 10 +- groot/doc.go | 184 +++++++++--------- groot/rdict/gen.go | 2 +- groot/rdict/object.go | 8 +- groot/riofs/dir.go | 15 +- groot/riofs/file.go | 73 +++---- groot/riofs/key.go | 18 +- groot/riofs/walk.go | 5 +- groot/rmeta/rmeta.go | 7 +- groot/rnpy/arrow.go | 4 +- groot/rsrv/endpoints.go | 109 ++++++----- groot/rtree/tree.go | 11 +- hbook/dist.go | 10 +- hbook/h1d.go | 16 +- hbook/ntup/ntcsv/ntcsv.go | 26 +-- hbook/ntup/ntroot/ntroot.go | 10 +- hbook/ntup/ntuple.go | 27 +-- hepevt/hepevt.go | 6 +- hepmc/go-hepmc-dump/main.go | 36 ++-- hepmc/hepmc.go | 66 ++++--- hepmc/hepmc_test.go | 41 ++-- heppdt/pid.go | 8 +- hplot/figure.go | 3 +- hplot/io.go | 6 +- hplot/plot.go | 4 +- lcio/example/lcio-ex-read-event/main.go | 10 +- pawgo/main.go | 42 ++-- sio/stream.go | 3 +- xrootd/cmd/xrd-cp/main.go | 19 +- xrootd/cmd/xrd-ls/main.go | 15 +- xrootd/xrdio/xrdio.go | 16 +- xrootd/xrdproto/dirlist/dirlist.go | 22 ++- xrootd/xrdproto/xrdproto.go | 4 +- xrootd/xrootd.go | 7 +- 65 files changed, 909 insertions(+), 850 deletions(-) diff --git a/brio/cmd/brio-gen/main.go b/brio/cmd/brio-gen/main.go index 23fb41ba5..164d87f83 100644 --- a/brio/cmd/brio-gen/main.go +++ b/brio/cmd/brio-gen/main.go @@ -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 ( diff --git a/cmd/fits2root/main.go b/cmd/fits2root/main.go index 8a2264499..14367157e 100644 --- a/cmd/fits2root/main.go +++ b/cmd/fits2root/main.go @@ -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 ( diff --git a/cmd/lhef2hepmc/main.go b/cmd/lhef2hepmc/main.go index a50716d52..11e5125e5 100644 --- a/cmd/lhef2hepmc/main.go +++ b/cmd/lhef2hepmc/main.go @@ -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 ( diff --git a/cmd/npy2root/main.go b/cmd/npy2root/main.go index 71b34332d..d83ea2aa5 100644 --- a/cmd/npy2root/main.go +++ b/cmd/npy2root/main.go @@ -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: npyio-ls input.npy +// ================================================================================ +// file: input.npy +// npy-header: Header{Major:1, Minor:0, Descr:{Type: 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 ( diff --git a/cmd/podio-gen/main.go b/cmd/podio-gen/main.go index 2d9d4d33e..7727c5c30 100644 --- a/cmd/podio-gen/main.go +++ b/cmd/podio-gen/main.go @@ -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 ( diff --git a/cmd/rio2yoda/main.go b/cmd/rio2yoda/main.go index 3f4d5fb9c..056fa555a 100644 --- a/cmd/rio2yoda/main.go +++ b/cmd/rio2yoda/main.go @@ -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 ( diff --git a/cmd/root2arrow/main.go b/cmd/root2arrow/main.go index 997e54af3..839d8d18e 100644 --- a/cmd/root2arrow/main.go +++ b/cmd/root2arrow/main.go @@ -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 ( diff --git a/cmd/root2csv/main.go b/cmd/root2csv/main.go index 369b8ea71..1a04bfa68 100644 --- a/cmd/root2csv/main.go +++ b/cmd/root2csv/main.go @@ -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 ( diff --git a/cmd/root2fits/main.go b/cmd/root2fits/main.go index 3ccfb9025..5d06afe75 100644 --- a/cmd/root2fits/main.go +++ b/cmd/root2fits/main.go @@ -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 ( diff --git a/cmd/root2npy/main.go b/cmd/root2npy/main.go index 7fe50e6de..42d3f5393 100644 --- a/cmd/root2npy/main.go +++ b/cmd/root2npy/main.go @@ -4,124 +4,123 @@ // root2npy converts the content of a ROOT TTree to a NumPy data file. // -// Usage of root2npy: -// -f string -// path to input ROOT file name -// -o string -// path to output npz file name (default "output.npz") -// -t string -// name of the tree to convert (default "tree") +// Usage of root2npy: +// -f string +// path to input ROOT file name +// -o string +// path to output npz file name (default "output.npz") +// -t string +// name of the tree to convert (default "tree") // // 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: // -// $> root2npy -f $GOPATH/src/go-hep.org/x/hep/groot/testdata/simple.root -t tree -o output.npz -// $> python2 -c 'import sys, numpy as np; print(dict(np.load(sys.argv[1])))' ./output.npz -// {'one': array([1, 2, 3, 4], dtype=int32), -// 'two': array([ 1.10000002, 2.20000005, 3.29999995, 4.4000001 ], dtype=float32), -// 'three': array([u'uno', u'dos', u'tres', u'quatro'], dtype=' python3 -c 'import sys, numpy as np; print(dict(np.load(sys.argv[1])))' ./output.npz -// {'one': array([1, 2, 3, 4], dtype=int32), -// 'two': array([ 1.10000002, 2.20000005, 3.29999995, 4.4000001 ], dtype=float32), -// 'three': array(['uno', 'dos', 'tres', 'quatro'], dtype=' go get github.com/sbinet/npyio/cmd/npyio-ls -// $> npyio-ls ./output.npz -// ================================================================================ -// file: ./output.npz -// entry: one -// npy-header: Header{Major:2, Minor:0, Descr:{Type: root-ls -t $GOPATH/src/go-hep.org/x/hep/groot/testdata/simple.root -// === [$GOPATH/src/go-hep.org/x/hep/groot/testdata/simple.root] === -// version: 60600 -// TTree tree fake data (entries=4) -// one "one/I" TBranch -// two "two/F" TBranch -// three "three/C" TBranch +// $> root2npy -f $GOPATH/src/go-hep.org/x/hep/groot/testdata/simple.root -t tree -o output.npz +// $> python2 -c 'import sys, numpy as np; print(dict(np.load(sys.argv[1])))' ./output.npz +// {'one': array([1, 2, 3, 4], dtype=int32), +// 'two': array([ 1.10000002, 2.20000005, 3.29999995, 4.4000001 ], dtype=float32), +// 'three': array([u'uno', u'dos', u'tres', u'quatro'], dtype=' python3 -c 'import sys, numpy as np; print(dict(np.load(sys.argv[1])))' ./output.npz +// {'one': array([1, 2, 3, 4], dtype=int32), +// 'two': array([ 1.10000002, 2.20000005, 3.29999995, 4.4000001 ], dtype=float32), +// 'three': array(['uno', 'dos', 'tres', 'quatro'], dtype=' go get github.com/sbinet/npyio/cmd/npyio-ls +// $> npyio-ls ./output.npz +// ================================================================================ +// file: ./output.npz +// entry: one +// npy-header: Header{Major:2, Minor:0, Descr:{Type: root-ls -t $GOPATH/src/go-hep.org/x/hep/groot/testdata/simple.root +// === [$GOPATH/src/go-hep.org/x/hep/groot/testdata/simple.root] === +// version: 60600 +// TTree tree fake data (entries=4) +// one "one/I" TBranch +// two "two/F" TBranch +// three "three/C" TBranch // // If you have a 10-events tree with a branch "doubles" containing an array of 3 float64, // root2npy will convert it to a NumPy data file containing a NumPy array with a shape (10,3). // // Example: // -// $> root-ls -t $GOPATH/src/go-hep.org/x/hep/groot/testdata/small-flat-tree.root -// === [$GOPATH/src/go-hep.org/x/hep/groot/testdata/small-flat-tree.root] === -// version: 60806 -// TTree tree my tree title (entries=100) -// Int32 "Int32/I" TBranch -// Int64 "Int64/L" TBranch -// UInt32 "UInt32/i" TBranch -// UInt64 "UInt64/l" TBranch -// Float32 "Float32/F" TBranch -// Float64 "Float64/D" TBranch -// Str "Str/C" TBranch -// ArrayInt32 "ArrayInt32[10]/I" TBranch -// ArrayInt64 "ArrayInt64[10]/L" TBranch -// ArrayUInt32 "ArrayInt32[10]/i" TBranch -// ArrayUInt64 "ArrayInt64[10]/l" TBranch -// ArrayFloat32 "ArrayFloat32[10]/F" TBranch -// ArrayFloat64 "ArrayFloat64[10]/D" TBranch -// N "N/I" TBranch -// SliceInt32 "SliceInt32[N]/I" TBranch -// SliceInt64 "SliceInt64[N]/L" TBranch -// SliceUInt32 "SliceInt32[N]/i" TBranch -// SliceUInt64 "SliceInt64[N]/l" TBranch -// SliceFloat32 "SliceFloat32[N]/F" TBranch -// SliceFloat64 "SliceFloat64[N]/D" TBranch -// -// $> root2npy $GOPATH/src/go-hep.org/x/hep/groot/testdata/small-flat-tree.root -// root2npy: scanning leaves... -// root2npy: >>> "SliceInt32" []int32 not supported -// root2npy: >>> "SliceInt64" []int64 not supported -// root2npy: >>> "SliceInt32" []int32 not supported -// root2npy: >>> "SliceInt64" []int64 not supported -// root2npy: >>> "SliceFloat32" []float32 not supported -// root2npy: >>> "SliceFloat64" []float64 not supported -// root2npy: scanning leaves... [done] -// -// $> npyio-ls ./output.npz -// ================================================================================ -// file: ./output.npz -// entry: Int32 -// npy-header: Header{Major:2, Minor:0, Descr:{Type: root-ls -t $GOPATH/src/go-hep.org/x/hep/groot/testdata/small-flat-tree.root +// === [$GOPATH/src/go-hep.org/x/hep/groot/testdata/small-flat-tree.root] === +// version: 60806 +// TTree tree my tree title (entries=100) +// Int32 "Int32/I" TBranch +// Int64 "Int64/L" TBranch +// UInt32 "UInt32/i" TBranch +// UInt64 "UInt64/l" TBranch +// Float32 "Float32/F" TBranch +// Float64 "Float64/D" TBranch +// Str "Str/C" TBranch +// ArrayInt32 "ArrayInt32[10]/I" TBranch +// ArrayInt64 "ArrayInt64[10]/L" TBranch +// ArrayUInt32 "ArrayInt32[10]/i" TBranch +// ArrayUInt64 "ArrayInt64[10]/l" TBranch +// ArrayFloat32 "ArrayFloat32[10]/F" TBranch +// ArrayFloat64 "ArrayFloat64[10]/D" TBranch +// N "N/I" TBranch +// SliceInt32 "SliceInt32[N]/I" TBranch +// SliceInt64 "SliceInt64[N]/L" TBranch +// SliceUInt32 "SliceInt32[N]/i" TBranch +// SliceUInt64 "SliceInt64[N]/l" TBranch +// SliceFloat32 "SliceFloat32[N]/F" TBranch +// SliceFloat64 "SliceFloat64[N]/D" TBranch +// +// $> root2npy $GOPATH/src/go-hep.org/x/hep/groot/testdata/small-flat-tree.root +// root2npy: scanning leaves... +// root2npy: >>> "SliceInt32" []int32 not supported +// root2npy: >>> "SliceInt64" []int64 not supported +// root2npy: >>> "SliceInt32" []int32 not supported +// root2npy: >>> "SliceInt64" []int64 not supported +// root2npy: >>> "SliceFloat32" []float32 not supported +// root2npy: >>> "SliceFloat64" []float64 not supported +// root2npy: scanning leaves... [done] +// +// $> npyio-ls ./output.npz +// ================================================================================ +// file: ./output.npz +// entry: Int32 +// npy-header: Header{Major:2, Minor:0, Descr:{Type: root2yoda file1.root file2.root > out.yoda -// $> root2yoda -o out.yoda file1.root file2.root -// $> root2yoda -o out.yoda.gz file1.root file2.root +// $> root2yoda file1.root file2.root > out.yoda +// $> root2yoda -o out.yoda file1.root file2.root +// $> root2yoda -o out.yoda.gz file1.root file2.root package main // import "go-hep.org/x/hep/cmd/root2yoda" import ( diff --git a/cmd/yoda2rio/main.go b/cmd/yoda2rio/main.go index 8ffc9526f..8e4fcc60c 100644 --- a/cmd/yoda2rio/main.go +++ b/cmd/yoda2rio/main.go @@ -7,8 +7,8 @@ // // Example: // -// $> yoda2rio rivet.yoda >| rivet.rio -// $> yoda2rio rivet.yoda.gz >| rivet.rio +// $> yoda2rio rivet.yoda >| rivet.rio +// $> yoda2rio rivet.yoda.gz >| rivet.rio package main // import "go-hep.org/x/hep/cmd/yoda2rio" import ( diff --git a/cmd/yoda2root/main.go b/cmd/yoda2root/main.go index 324e35e0a..351eda1e9 100644 --- a/cmd/yoda2root/main.go +++ b/cmd/yoda2root/main.go @@ -7,8 +7,8 @@ // // Example: // -// $> yoda2root rivet.yoda rivet.root -// $> yoda2root rivet.yoda.gz rivet.root +// $> yoda2root rivet.yoda rivet.root +// $> yoda2root rivet.yoda.gz rivet.root package main // import "go-hep.org/x/hep/cmd/yoda2root" import ( diff --git a/fads/cmd/fads-app/main.go b/fads/cmd/fads-app/main.go index ace35b6ea..98146896f 100644 --- a/fads/cmd/fads-app/main.go +++ b/fads/cmd/fads-app/main.go @@ -7,40 +7,39 @@ // // Example: // -// $> fads-app -help -// Usage: fads-app [options] +// $> fads-app -help +// Usage: fads-app [options] // -// ex: -// $ fads-app -l=INFO -evtmax=-1 ./testdata/hepmc.data +// ex: +// $ fads-app -l=INFO -evtmax=-1 ./testdata/hepmc.data // -// options: -// -cpu-prof -// enable CPU profiling -// -evtmax int -// number of events to process (default -1) -// -l string -// log level (DEBUG|INFO|WARN|ERROR) (default "INFO") -// -nprocs int -// number of concurrent events to process (default -1) -// -o string -// name of output events file (default "data.rio") -// -trace string -// path to file where to store traces -// -// $> fads-app ./testdata/hepmc.data -// ::: fads-app... -// app INFO workers done: 1/4 -// app INFO workers done: 2/4 -// app INFO workers done: 3/4 -// app INFO workers done: 4/4 -// app INFO cpu: 340.092148ms -// app INFO mem: alloc: 17963 kB -// app INFO mem: tot-alloc: 35590 kB -// app INFO mem: n-mallocs: 55399 -// app INFO mem: n-frees: 54777 -// app INFO mem: gc-pauses: 2 ms -// ::: fads-app... [done] (time=343.533436ms) +// options: +// -cpu-prof +// enable CPU profiling +// -evtmax int +// number of events to process (default -1) +// -l string +// log level (DEBUG|INFO|WARN|ERROR) (default "INFO") +// -nprocs int +// number of concurrent events to process (default -1) +// -o string +// name of output events file (default "data.rio") +// -trace string +// path to file where to store traces // +// $> fads-app ./testdata/hepmc.data +// ::: fads-app... +// app INFO workers done: 1/4 +// app INFO workers done: 2/4 +// app INFO workers done: 3/4 +// app INFO workers done: 4/4 +// app INFO cpu: 340.092148ms +// app INFO mem: alloc: 17963 kB +// app INFO mem: tot-alloc: 35590 kB +// app INFO mem: n-mallocs: 55399 +// app INFO mem: n-frees: 54777 +// app INFO mem: gc-pauses: 2 ms +// ::: fads-app... [done] (time=343.533436ms) package main import ( diff --git a/fads/cmd/fads-rivet-mc-generic/main.go b/fads/cmd/fads-rivet-mc-generic/main.go index f4b32b666..2354008c1 100644 --- a/fads/cmd/fads-rivet-mc-generic/main.go +++ b/fads/cmd/fads-rivet-mc-generic/main.go @@ -16,19 +16,19 @@ // // Example: // -// $> curl -O -L http://www.hepforge.org/archive/rivet/Z-hadronic-LEP.hepmc -// $> fads-rivet-mc-generic -nprocs=1 ./Z-hadronic-LEP.hepmc -// ::: fads-rivet-mc-generic... -// app INFO workers done: 1/1 -// app INFO cpu: 6.115538196s -// app INFO mem: alloc: 12997 kB -// app INFO mem: tot-alloc: 751784 kB -// app INFO mem: n-mallocs: 7300674 -// app INFO mem: n-frees: 7336526 -// app INFO mem: gc-pauses: 2 ms -// ::: fads-rivet-mc-generic... [done] (time=6.11575694s) +// $> curl -O -L http://www.hepforge.org/archive/rivet/Z-hadronic-LEP.hepmc +// $> fads-rivet-mc-generic -nprocs=1 ./Z-hadronic-LEP.hepmc +// ::: fads-rivet-mc-generic... +// app INFO workers done: 1/1 +// app INFO cpu: 6.115538196s +// app INFO mem: alloc: 12997 kB +// app INFO mem: tot-alloc: 751784 kB +// app INFO mem: n-mallocs: 7300674 +// app INFO mem: n-frees: 7336526 +// app INFO mem: gc-pauses: 2 ms +// ::: fads-rivet-mc-generic... [done] (time=6.11575694s) // -// $> rio2yoda rivet.rio >| rivet.yoda +// $> rio2yoda rivet.rio >| rivet.yoda package main import ( diff --git a/fastjet/internal/predicates/float64Pred.go b/fastjet/internal/predicates/float64Pred.go index dff90ef97..2c14ffbb0 100644 --- a/fastjet/internal/predicates/float64Pred.go +++ b/fastjet/internal/predicates/float64Pred.go @@ -99,7 +99,7 @@ func (a float64Pred) subFloat64Pred(b float64Pred) float64Pred { // Conclusively, when multiplications are chained, the error also depends on the value // of the number, but this does not apply to sums or subtractions. // -//If this is not a chained multiplication p.e will be 0, making that part irrelevant. +// If this is not a chained multiplication p.e will be 0, making that part irrelevant. func (p float64Pred) mulFloat64(f float64) float64Pred { p.n *= f if p.n == 0 { diff --git a/fastjet/internal/predicates/orientation.go b/fastjet/internal/predicates/orientation.go index 530d96728..6adf42239 100644 --- a/fastjet/internal/predicates/orientation.go +++ b/fastjet/internal/predicates/orientation.go @@ -57,9 +57,10 @@ func Orientation(x1, y1, x2, y2, x, y float64) OrientationKind { // // It computes the determinant of the matrix and returns the orientation based // on the value of the determinant. -// | x1 y1 1 | -// | x2 y2 1 | -// | x y 1 | +// +// | x1 y1 1 | +// | x2 y2 1 | +// | x y 1 | func simpleOrientation(x1, y1, x2, y2, x, y float64) OrientationKind { if (x1 == x2 && x2 == x) || (y1 == y2 && y2 == y) { // points are horizontally or vertically aligned @@ -86,9 +87,10 @@ func simpleOrientation(x1, y1, x2, y2, x, y float64) OrientationKind { // // It computes the determinant of the matrix and returns the orientation based // on the value of the determinant. -// | x1 y1 1 | -// | x2 y2 1 | -// | x y 1 | +// +// | x1 y1 1 | +// | x2 y2 1 | +// | x y 1 | func robustOrientation(x1, y1, x2, y2, x, y *big.Rat) OrientationKind { // Compute the determinant of the matrix // det := x1*y2 + x2*y + x*y1 - x1*y - x2*y1 - x*y2 @@ -113,9 +115,10 @@ func robustOrientation(x1, y1, x2, y2, x, y *big.Rat) OrientationKind { // It first computes the conditional number of the matrix. When the condition number // is higher than the Condition Tolerance, then we assume the matrix is singular and // the determinant is 0. If the determinant is not 0 the sign of the determinant is computed. -// | x1 y1 1 | -// | x2 y2 1 | -// | x y 1 | +// +// | x1 y1 1 | +// | x2 y2 1 | +// | x y 1 | func matOrientation(x1, y1, x2, y2, x, y float64) OrientationKind { if (x1 == x2 && x2 == x) || (y1 == y2 && y2 == y) { // points are horizontally or vertically aligned diff --git a/fwk/core.go b/fwk/core.go index 35a6d016a..8486fcffd 100644 --- a/fwk/core.go +++ b/fwk/core.go @@ -104,11 +104,11 @@ type App interface { } // Runner runs a fwk App in a batch fashion: -// - Configure -// - Start -// - Run event loop -// - Stop -// - Shutdown +// - Configure +// - Start +// - Run event loop +// - Stop +// - Shutdown type Runner interface { Run() error } diff --git a/fwk/fwk.go b/fwk/fwk.go index b6af58ad6..c6ceb3420 100644 --- a/fwk/fwk.go +++ b/fwk/fwk.go @@ -6,10 +6,10 @@ // fwk is a components-based framework, a-la Gaudi, with builtin support for concurrency. // // A fwk application consists of a set of components (fwk.Task) which are: -// - (optionally) configured -// - started -// - given the chance to process each event -// - stopped +// - (optionally) configured +// - started +// - given the chance to process each event +// - stopped // // Helper components (fwk.Svc) can provide additional features (such as a // whiteboard/event-store service, a data-flow service, ...) but do not @@ -17,31 +17,31 @@ // // Typically, users will implement fwk.Tasks, ie: // -// type MyTask struct { -// fwk.TaskBase -// } +// type MyTask struct { +// fwk.TaskBase +// } // -// // Configure is called once, after having read the properties -// // from the data-cards. -// func (tsk *MyTask) Configure(ctx fwk.Context) error { return nil } +// // Configure is called once, after having read the properties +// // from the data-cards. +// func (tsk *MyTask) Configure(ctx fwk.Context) error { return nil } // -// // StartTask is called once (sequentially), just before -// // the main event-loop processing. -// func (tsk *MyTask) StartTask(ctx fwk.Context) error { return nil } +// // StartTask is called once (sequentially), just before +// // the main event-loop processing. +// func (tsk *MyTask) StartTask(ctx fwk.Context) error { return nil } // -// // Process is called for each event, (quite) possibly concurrently. -// func (tsk *MyTask) Process(ctx fwk.Context) error { return nil } +// // Process is called for each event, (quite) possibly concurrently. +// func (tsk *MyTask) Process(ctx fwk.Context) error { return nil } // -// // StopTask is called once (sequentially), just after the -// // main event-loop processing finished. -// func (tsk *MyTask) StopTask(ctx fwk.Context) error { return nil } +// // StopTask is called once (sequentially), just after the +// // main event-loop processing finished. +// func (tsk *MyTask) StopTask(ctx fwk.Context) error { return nil } // // A fwk application processes data and leverages concurrency at // two different levels: -// - event-level concurrency: multiple events are processed concurrently -// at any given time, during the event loop; -// - task-level concurrency: during the event loop, multiple tasks are -// executing concurrently. +// - event-level concurrency: multiple events are processed concurrently +// at any given time, during the event loop; +// - task-level concurrency: during the event loop, multiple tasks are +// executing concurrently. // // To ensure the proper self-consistency of the global processed event, // components need to express their data dependencies (input(s)) as well @@ -55,35 +55,35 @@ // Components declare INPUT ports and OUTPUT ports during the 'Configure' stage // of a fwk application, like so: // -// t := reflect.TypeOf([]Electron{}) -// err = component.DeclInPort("Electrons", t) -// err = component.DeclOutPort("ReScaledElectrons", t) +// t := reflect.TypeOf([]Electron{}) +// err = component.DeclInPort("Electrons", t) +// err = component.DeclOutPort("ReScaledElectrons", t) // // Then, during the event processing, one gets and puts data from/to the store // like so: // -// func (tsk *MyTask) Process(ctx fwk.Context) error { -// var err error +// func (tsk *MyTask) Process(ctx fwk.Context) error { +// var err error // -// // retrieve the store associated with this event / region-of-interest -// store := ctx.Store() +// // retrieve the store associated with this event / region-of-interest +// store := ctx.Store() // -// v, err := store.Get("Electrons") -// if err != nil { -// return err -// } -// eles := v.([]Electron) // type-cast to the correct (underlying) type +// v, err := store.Get("Electrons") +// if err != nil { +// return err +// } +// eles := v.([]Electron) // type-cast to the correct (underlying) type // -// // create output collection -// out := make([]Electron, 0, len(eles)) +// // create output collection +// out := make([]Electron, 0, len(eles)) // -// // make sure the collection will be put in the store -// defer func() { -// err = store.Put("ReScaledElectrons", out) -// }() +// // make sure the collection will be put in the store +// defer func() { +// err = store.Put("ReScaledElectrons", out) +// }() // -// // ... do some massaging with 'eles' and 'out' +// // ... do some massaging with 'eles' and 'out' // -// return err -// } +// return err +// } package fwk // import "go-hep.org/x/hep/fwk" diff --git a/fwk/hbooksvc/hsvc.go b/fwk/hbooksvc/hsvc.go index f5d6d618f..4dad2f1b2 100644 --- a/fwk/hbooksvc/hsvc.go +++ b/fwk/hbooksvc/hsvc.go @@ -378,10 +378,11 @@ func (svc *hsvc) fullname(stream, hid string) string { // split splits a booking histo name into (stream-name, histo-name). // // eg: "/my-stream/histo" -> ("my-stream", "histo") -// "my-stream/histo" -> ("my-stream", "histo") -// "my-stream/histo/" -> ("my-stream", "histo") -// "/histo" -> ("", "histo") -// "histo" -> ("", "histo") +// +// "my-stream/histo" -> ("my-stream", "histo") +// "my-stream/histo/" -> ("my-stream", "histo") +// "/histo" -> ("", "histo") +// "histo" -> ("", "histo") func (svc *hsvc) split(n string) (string, string) { n = strings.TrimPrefix(n, "/") diff --git a/fwk/utils/builder/builder.go b/fwk/utils/builder/builder.go index 88d021d74..52a978616 100644 --- a/fwk/utils/builder/builder.go +++ b/fwk/utils/builder/builder.go @@ -5,8 +5,8 @@ // package builder builds a fwk-app binary from a list of go files. // // builder's architecture and sources are heavily inspired from golint: -// https://github.com/golang/lint // +// https://github.com/golang/lint package builder // import "go-hep.org/x/hep/fwk/utils/builder" import ( diff --git a/fwk/utils/tarjan/tarjan.go b/fwk/utils/tarjan/tarjan.go index 87fe81d98..a153781ce 100644 --- a/fwk/utils/tarjan/tarjan.go +++ b/fwk/utils/tarjan/tarjan.go @@ -29,7 +29,6 @@ // // Based on an implementation by Gustavo Niemeyer (in mgo/txn): // http://bazaar.launchpad.net/+branch/mgo/v2/view/head:/txn/tarjan.go -// package tarjan // import "go-hep.org/x/hep/fwk/utils/tarjan" // Connections creates a slice where each item is a slice of strongly connected vertices. diff --git a/geo/gdml/gdml.go b/geo/gdml/gdml.go index 2e920725d..82bfeeaf1 100644 --- a/geo/gdml/gdml.go +++ b/geo/gdml/gdml.go @@ -8,8 +8,8 @@ // with physics measurements. // // See: -// http://gdml.web.cern.ch/GDML/doc/GDMLmanual.pdf // +// http://gdml.web.cern.ch/GDML/doc/GDMLmanual.pdf package gdml import "encoding/xml" diff --git a/groot/cmd/root-cp/main.go b/groot/cmd/root-cp/main.go index 5bd42d438..19ab610e0 100644 --- a/groot/cmd/root-cp/main.go +++ b/groot/cmd/root-cp/main.go @@ -8,10 +8,9 @@ // // ex: // -// $> root-cp f.root out.root -// $> root-cp f1.root f2.root f3.root out.root -// $> root-cp f1.root:hist.* f2.root:h2 out.root -// +// $> root-cp f.root out.root +// $> root-cp f1.root f2.root f3.root out.root +// $> root-cp f1.root:hist.* f2.root:h2 out.root package main // import "go-hep.org/x/hep/groot/cmd/root-cp" import ( diff --git a/groot/cmd/root-diff/main.go b/groot/cmd/root-diff/main.go index f8c447e55..afc031fb1 100644 --- a/groot/cmd/root-diff/main.go +++ b/groot/cmd/root-diff/main.go @@ -7,19 +7,18 @@ // // Example: // -// $> root-diff ./ref.root ./chk.root -// $> root-diff -k=key1,tree,my-tree ./ref.root ./chk.root +// $> root-diff ./ref.root ./chk.root +// $> root-diff -k=key1,tree,my-tree ./ref.root ./chk.root // -// $> root-diff -h -// Usage: root-diff [options] a.root b.root +// $> root-diff -h +// Usage: root-diff [options] a.root b.root // -// ex: -// $> root-diff ./testdata/small-flat-tree.root ./testdata/small-flat-tree.root -// -// options: -// -k string -// comma-separated list of keys to inspect and compare (default=all common keys) +// ex: +// $> root-diff ./testdata/small-flat-tree.root ./testdata/small-flat-tree.root // +// options: +// -k string +// comma-separated list of keys to inspect and compare (default=all common keys) package main // import "go-hep.org/x/hep/groot/cmd/root-diff" import ( diff --git a/groot/cmd/root-dump/main.go b/groot/cmd/root-dump/main.go index c7db58602..f1b4a23c1 100644 --- a/groot/cmd/root-dump/main.go +++ b/groot/cmd/root-dump/main.go @@ -7,42 +7,41 @@ // // Example: // -// $> root-dump ./testdata/small-flat-tree.root -// >>> file[./testdata/small-flat-tree.root] -// key[000]: tree;1 "my tree title" (TTree) -// [000][Int32]: 0 -// [000][Int64]: 0 -// [000][UInt32]: 0 -// [000][UInt64]: 0 -// [000][Float32]: 0 -// [000][Float64]: 0 -// [000][Str]: evt-000 -// [000][ArrayInt32]: [0 0 0 0 0 0 0 0 0 0] -// [000][ArrayInt64]: [0 0 0 0 0 0 0 0 0 0] -// [000][ArrayInt32]: [0 0 0 0 0 0 0 0 0 0] -// [000][ArrayInt64]: [0 0 0 0 0 0 0 0 0 0] -// [000][ArrayFloat32]: [0 0 0 0 0 0 0 0 0 0] -// [000][ArrayFloat64]: [0 0 0 0 0 0 0 0 0 0] -// [000][N]: 0 -// [000][SliceInt32]: [] -// [000][SliceInt64]: [] -// [...] +// $> root-dump ./testdata/small-flat-tree.root +// >>> file[./testdata/small-flat-tree.root] +// key[000]: tree;1 "my tree title" (TTree) +// [000][Int32]: 0 +// [000][Int64]: 0 +// [000][UInt32]: 0 +// [000][UInt64]: 0 +// [000][Float32]: 0 +// [000][Float64]: 0 +// [000][Str]: evt-000 +// [000][ArrayInt32]: [0 0 0 0 0 0 0 0 0 0] +// [000][ArrayInt64]: [0 0 0 0 0 0 0 0 0 0] +// [000][ArrayInt32]: [0 0 0 0 0 0 0 0 0 0] +// [000][ArrayInt64]: [0 0 0 0 0 0 0 0 0 0] +// [000][ArrayFloat32]: [0 0 0 0 0 0 0 0 0 0] +// [000][ArrayFloat64]: [0 0 0 0 0 0 0 0 0 0] +// [000][N]: 0 +// [000][SliceInt32]: [] +// [000][SliceInt64]: [] +// [...] // -// $> root-dump -h -// Usage: root-dump [options] f0.root [f1.root [...]] +// $> root-dump -h +// Usage: root-dump [options] f0.root [f1.root [...]] // -// ex: -// $> root-dump ./testdata/small-flat-tree.root -// $> root-dump -deep=0 ./testdata/small-flat-tree.root -// -// options: -// -cpu-profile string -// path to CPU profile output file -// -deep -// enable deep dumping of values (including Trees' entries) (default true) -// -name string -// regex of object names to dump +// ex: +// $> root-dump ./testdata/small-flat-tree.root +// $> root-dump -deep=0 ./testdata/small-flat-tree.root // +// options: +// -cpu-profile string +// path to CPU profile output file +// -deep +// enable deep dumping of values (including Trees' entries) (default true) +// -name string +// regex of object names to dump package main // import "go-hep.org/x/hep/groot/cmd/root-dump" import ( diff --git a/groot/cmd/root-gen-datareader/main.go b/groot/cmd/root-gen-datareader/main.go index 566e91ee1..bc6b61fb4 100644 --- a/groot/cmd/root-gen-datareader/main.go +++ b/groot/cmd/root-gen-datareader/main.go @@ -6,33 +6,34 @@ // event data type stored inside a Tree. // // Example: -// $> root-gen-datareader -t tree testdata/small-flat-tree.root -// // automatically generated by root-gen-datareader. -// // DO NOT EDIT. // -// package event +// $> root-gen-datareader -t tree testdata/small-flat-tree.root +// // automatically generated by root-gen-datareader. +// // DO NOT EDIT. // -// type Data struct { -// ROOT_Int32 int32 `groot:"Int32"` -// ROOT_Int64 int64 `groot:"Int64"` -// ROOT_UInt32 int32 `groot:"UInt32"` -// ROOT_UInt64 int64 `groot:"UInt64"` -// ROOT_Float32 float32 `groot:"Float32"` -// ROOT_Float64 float64 `groot:"Float64"` -// ROOT_ArrayInt32 [10]int32 `groot:"ArrayInt32[10]"` -// ROOT_ArrayInt64 [10]int64 `groot:"ArrayInt64[10]"` -// ROOT_ArrayInt32 [10]int32 `groot:"ArrayInt32[10]"` -// ROOT_ArrayInt64 [10]int64 `groot:"ArrayInt64[10]"` -// ROOT_ArrayFloat32 [10]float32 `groot:"ArrayFloat32[10]"` -// ROOT_ArrayFloat64 [10]float64 `groot:"ArrayFloat64[10]"` -// ROOT_N int32 `groot:"N"` -// ROOT_SliceInt32 []int32 `groot:"SliceInt32[N]"` -// ROOT_SliceInt64 []int64 `groot:"SliceInt64[N]"` -// ROOT_SliceInt32 []int32 `groot:"SliceInt32[N]"` -// ROOT_SliceInt64 []int64 `groot:"SliceInt64[N]"` -// ROOT_SliceFloat32 []float32 `groot:"SliceFloat32[N]"` -// ROOT_SliceFloat64 []float64 `groot:"SliceFloat64[N]"` -// } +// package event +// +// type Data struct { +// ROOT_Int32 int32 `groot:"Int32"` +// ROOT_Int64 int64 `groot:"Int64"` +// ROOT_UInt32 int32 `groot:"UInt32"` +// ROOT_UInt64 int64 `groot:"UInt64"` +// ROOT_Float32 float32 `groot:"Float32"` +// ROOT_Float64 float64 `groot:"Float64"` +// ROOT_ArrayInt32 [10]int32 `groot:"ArrayInt32[10]"` +// ROOT_ArrayInt64 [10]int64 `groot:"ArrayInt64[10]"` +// ROOT_ArrayInt32 [10]int32 `groot:"ArrayInt32[10]"` +// ROOT_ArrayInt64 [10]int64 `groot:"ArrayInt64[10]"` +// ROOT_ArrayFloat32 [10]float32 `groot:"ArrayFloat32[10]"` +// ROOT_ArrayFloat64 [10]float64 `groot:"ArrayFloat64[10]"` +// ROOT_N int32 `groot:"N"` +// ROOT_SliceInt32 []int32 `groot:"SliceInt32[N]"` +// ROOT_SliceInt64 []int64 `groot:"SliceInt64[N]"` +// ROOT_SliceInt32 []int32 `groot:"SliceInt32[N]"` +// ROOT_SliceInt64 []int64 `groot:"SliceInt64[N]"` +// ROOT_SliceFloat32 []float32 `groot:"SliceFloat32[N]"` +// ROOT_SliceFloat64 []float64 `groot:"SliceFloat64[N]"` +// } package main // import "go-hep.org/x/hep/groot/cmd/root-gen-datareader" import ( diff --git a/groot/cmd/root-ls/main.go b/groot/cmd/root-ls/main.go index 9bbcfab1e..db7d932c7 100644 --- a/groot/cmd/root-ls/main.go +++ b/groot/cmd/root-ls/main.go @@ -8,36 +8,35 @@ // // ex: // -// $> root-ls -t ./testdata/graphs.root ./testdata/small-flat-tree.root -// === [./testdata/graphs.root] === -// version: 60806 -// TGraph tg graph without errors (cycle=1) -// TGraphErrors tge graph with errors (cycle=1) -// TGraphAsymmErrors tgae graph with asymmetric errors (cycle=1) -// -// === [./testdata/small-flat-tree.root] === -// version: 60804 -// TTree tree my tree title (entries=100) -// Int32 "Int32/I" TBranch -// Int64 "Int64/L" TBranch -// UInt32 "UInt32/i" TBranch -// UInt64 "UInt64/l" TBranch -// Float32 "Float32/F" TBranch -// Float64 "Float64/D" TBranch -// ArrayInt32 "ArrayInt32[10]/I" TBranch -// ArrayInt64 "ArrayInt64[10]/L" TBranch -// ArrayUInt32 "ArrayInt32[10]/i" TBranch -// ArrayUInt64 "ArrayInt64[10]/l" TBranch -// ArrayFloat32 "ArrayFloat32[10]/F" TBranch -// ArrayFloat64 "ArrayFloat64[10]/D" TBranch -// N "N/I" TBranch -// SliceInt32 "SliceInt32[N]/I" TBranch -// SliceInt64 "SliceInt64[N]/L" TBranch -// SliceUInt32 "SliceInt32[N]/i" TBranch -// SliceUInt64 "SliceInt64[N]/l" TBranch -// SliceFloat32 "SliceFloat32[N]/F" TBranch -// SliceFloat64 "SliceFloat64[N]/D" TBranch +// $> root-ls -t ./testdata/graphs.root ./testdata/small-flat-tree.root +// === [./testdata/graphs.root] === +// version: 60806 +// TGraph tg graph without errors (cycle=1) +// TGraphErrors tge graph with errors (cycle=1) +// TGraphAsymmErrors tgae graph with asymmetric errors (cycle=1) // +// === [./testdata/small-flat-tree.root] === +// version: 60804 +// TTree tree my tree title (entries=100) +// Int32 "Int32/I" TBranch +// Int64 "Int64/L" TBranch +// UInt32 "UInt32/i" TBranch +// UInt64 "UInt64/l" TBranch +// Float32 "Float32/F" TBranch +// Float64 "Float64/D" TBranch +// ArrayInt32 "ArrayInt32[10]/I" TBranch +// ArrayInt64 "ArrayInt64[10]/L" TBranch +// ArrayUInt32 "ArrayInt32[10]/i" TBranch +// ArrayUInt64 "ArrayInt64[10]/l" TBranch +// ArrayFloat32 "ArrayFloat32[10]/F" TBranch +// ArrayFloat64 "ArrayFloat64[10]/D" TBranch +// N "N/I" TBranch +// SliceInt32 "SliceInt32[N]/I" TBranch +// SliceInt64 "SliceInt64[N]/L" TBranch +// SliceUInt32 "SliceInt32[N]/i" TBranch +// SliceUInt64 "SliceInt64[N]/l" TBranch +// SliceFloat32 "SliceFloat32[N]/F" TBranch +// SliceFloat64 "SliceFloat64[N]/D" TBranch package main // import "go-hep.org/x/hep/groot/cmd/root-ls" import ( diff --git a/groot/cmd/root-merge/main.go b/groot/cmd/root-merge/main.go index cdac2151e..56605ada0 100644 --- a/groot/cmd/root-merge/main.go +++ b/groot/cmd/root-merge/main.go @@ -7,13 +7,14 @@ // Usage: root-merge [options] file1.root [file2.root [file3.root [...]]] // // ex: -// $> root-merge -o out.root ./testdata/chain.flat.1.root ./testdata/chain.flat.2.root +// +// $> root-merge -o out.root ./testdata/chain.flat.1.root ./testdata/chain.flat.2.root // // options: -// -o string -// path to merged output ROOT file (default "out.root") -// -v enable verbose mode // +// -o string +// path to merged output ROOT file (default "out.root") +// -v enable verbose mode package main // import "go-hep.org/x/hep/groot/cmd/root-merge" import ( diff --git a/groot/cmd/root-print/main.go b/groot/cmd/root-print/main.go index 6cc6f4f6c..61e17bc4e 100644 --- a/groot/cmd/root-print/main.go +++ b/groot/cmd/root-print/main.go @@ -6,21 +6,20 @@ // // Examples: // -// $> root-print -f pdf ./testdata/histos.root -// $> root-print -f pdf ./testdata/histos.root:h1 -// $> root-print -f pdf ./testdata/histos.root:h.* -// $> root-print -f pdf -o output ./testdata/histos.root:h1 +// $> root-print -f pdf ./testdata/histos.root +// $> root-print -f pdf ./testdata/histos.root:h1 +// $> root-print -f pdf ./testdata/histos.root:h.* +// $> root-print -f pdf -o output ./testdata/histos.root:h1 // -// $> root-print -h -// Usage: root-print [options] file.root [file.root [...]] -// -// options: -// -f string -// output format for plots (pdf, png, svg, ...) (default "pdf") -// -o string -// output directory for plots -// -v enable verbose mode +// $> root-print -h +// Usage: root-print [options] file.root [file.root [...]] // +// options: +// -f string +// output format for plots (pdf, png, svg, ...) (default "pdf") +// -o string +// output directory for plots +// -v enable verbose mode package main // import "go-hep.org/x/hep/groot/cmd/root-print" import ( diff --git a/groot/cmd/root-split/main.go b/groot/cmd/root-split/main.go index 660b4a247..66cdc83f0 100644 --- a/groot/cmd/root-split/main.go +++ b/groot/cmd/root-split/main.go @@ -8,16 +8,18 @@ // Usage: root-split [options] file.root // // ex: -// $> root-split -o out.root -n 10 ./testdata/chain.flat.1.root +// +// $> root-split -o out.root -n 10 ./testdata/chain.flat.1.root // // options: -// -n int -// number of events to split into (default 100) -// -o string -// path to output ROOT files (default "out.root") -// -t string -// input tree name to split (default "tree") -// -v enable verbose mode +// +// -n int +// number of events to split into (default 100) +// -o string +// path to output ROOT files (default "out.root") +// -t string +// input tree name to split (default "tree") +// -v enable verbose mode package main // import "go-hep.org/x/hep/groot/cmd/root-split" import ( diff --git a/groot/cmd/root-srv/main.go b/groot/cmd/root-srv/main.go index 314e23be4..674c8d281 100644 --- a/groot/cmd/root-srv/main.go +++ b/groot/cmd/root-srv/main.go @@ -10,13 +10,13 @@ // // ex: // -// $> root-srv -addr=:8080 & -// 2017/04/06 15:13:59 server listening on :8080 +// $> root-srv -addr=:8080 & +// 2017/04/06 15:13:59 server listening on :8080 // -// $> open localhost:8080 +// $> open localhost:8080 // -// $> root-srv -addr :8080 -serv https -host example.com -// 2017/04/06 15:13:59 https server listening on :8080 at example.com +// $> root-srv -addr :8080 -serv https -host example.com +// 2017/04/06 15:13:59 https server listening on :8080 at example.com package main // import "go-hep.org/x/hep/groot/cmd/root-srv" import ( diff --git a/groot/doc.go b/groot/doc.go index 9524f0a12..11973616b 100644 --- a/groot/doc.go +++ b/groot/doc.go @@ -6,18 +6,18 @@ // // A typical usage is as follows: // -// f, err := groot.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.(rtree.Tree) -// fmt.Printf("entries= %v\n", tree.Entries()) +// f, err := groot.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.(rtree.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 groot.TreeScanner and groot.Scanner: @@ -27,8 +27,7 @@ // https://godoc.org/go-hep.org/x/hep/groot/cmd/root-ls, // a command that inspects the content of ROOT files. // -// -// File layout +// # 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 @@ -40,93 +39,92 @@ // // 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 -// =================+=============+=========================================== +// 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 -// ===============+=============+=========================================== +// 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 +// +===============+ -- 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 // // Data records' payloads may be compressed. // Detecting whether a payload is compressed is usually done by comparing @@ -139,16 +137,16 @@ // size 16*1024*1024 bytes. // Each chunk consists of: // -// - the chunk header, -// - the chunk compressed payload. +// - 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. +// - 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 +// # Streamer informations // // Streamers describe how a given type, for a given version of that type, is // written on disk. diff --git a/groot/rdict/gen.go b/groot/rdict/gen.go index 089557675..8a832429b 100644 --- a/groot/rdict/gen.go +++ b/groot/rdict/gen.go @@ -61,7 +61,7 @@ func gotype2RMeta(t types.Type) rmeta.Enum { // GoName2Cxx translates a fully-qualified Go type name to a C++ one. // e.g.: -// - go-hep.org/x/hep/hbook.H1D -> go_hep_org::x::hep::hbook::H1D +// - go-hep.org/x/hep/hbook.H1D -> go_hep_org::x::hep::hbook::H1D func GoName2Cxx(name string) string { repl := strings.NewReplacer( "-", "_", diff --git a/groot/rdict/object.go b/groot/rdict/object.go index 9319b91e3..06dc760dd 100644 --- a/groot/rdict/object.go +++ b/groot/rdict/object.go @@ -30,10 +30,10 @@ func ObjectFrom(si rbytes.StreamerInfo, sictx rbytes.StreamerInfoContext) *Objec // Object wraps a type created from a Streamer and implements the // following interfaces: -// - root.Object -// - rbytes.RVersioner -// - rbytes.Marshaler -// - rbytes.Unmarshaler +// - root.Object +// - rbytes.RVersioner +// - rbytes.Marshaler +// - rbytes.Unmarshaler type Object struct { v interface{} diff --git a/groot/riofs/dir.go b/groot/riofs/dir.go index 8ff143c8a..9b81a31f8 100644 --- a/groot/riofs/dir.go +++ b/groot/riofs/dir.go @@ -350,14 +350,15 @@ func (dir *tdirectoryFile) writeHeader() 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 +// 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 (dir *tdirectoryFile) Get(namecycle string) (root.Object, error) { var keys []*Key name, cycle := decodeNameCycle(namecycle) diff --git a/groot/riofs/file.go b/groot/riofs/file.go index 891901467..66766de67 100644 --- a/groot/riofs/file.go +++ b/groot/riofs/file.go @@ -57,39 +57,41 @@ type FileOption func(f *File) error // 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 +// +// 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 +// +// 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 type File struct { r Reader w Writer @@ -850,14 +852,15 @@ func (f *File) addStreamer(streamer rbytes.StreamerInfo) { } // 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 +// 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 (f *File) Get(namecycle string) (root.Object, error) { return f.dir.Get(namecycle) } diff --git a/groot/riofs/key.go b/groot/riofs/key.go index 4bf94233b..e09cc3383 100644 --- a/groot/riofs/key.go +++ b/groot/riofs/key.go @@ -41,16 +41,16 @@ func (err keyTypeError) Error() string { // 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. +// 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 +// 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 type Key struct { f *File // underlying file diff --git a/groot/riofs/walk.go b/groot/riofs/walk.go index dcfd41020..6f9af9821 100644 --- a/groot/riofs/walk.go +++ b/groot/riofs/walk.go @@ -204,8 +204,9 @@ func (rd *recDir) walk(dir Directory, path []string, cycle int16) (root.Object, } // Dir wraps the given directory to handle fully specified directory names: -// rdir := Dir(dir) -// obj, err := rdir.Get("some/dir/object/name;1") +// +// rdir := Dir(dir) +// obj, err := rdir.Get("some/dir/object/name;1") func Dir(dir Directory) Directory { return &recDir{dir} } diff --git a/groot/rmeta/rmeta.go b/groot/rmeta/rmeta.go index 5dc915cff..c524b11ac 100644 --- a/groot/rmeta/rmeta.go +++ b/groot/rmeta/rmeta.go @@ -18,9 +18,10 @@ type CxxTemplate struct { // CxxTemplateOf extracts the typenames of a C++ templated typename. // Ex: -// std::map -> []string{"K", "V"} -// std::vector -> []string{"T"} -// Foo> -> []string{"T1", "T2", "std::map"} +// +// std::map -> []string{"K", "V"} +// std::vector -> []string{"T"} +// Foo> -> []string{"T1", "T2", "std::map"} func CxxTemplateFrom(typename string) CxxTemplate { var ( name = strings.TrimSpace(typename) diff --git a/groot/rnpy/arrow.go b/groot/rnpy/arrow.go index f1a5191ab..3d3c57423 100644 --- a/groot/rnpy/arrow.go +++ b/groot/rnpy/arrow.go @@ -30,8 +30,8 @@ var ( float32Type = reflect.TypeOf((*float32)(nil)).Elem() float64Type = reflect.TypeOf((*float64)(nil)).Elem() -// complex64Type = reflect.TypeOf((*complex64)(nil)).Elem() -// complex128Type = reflect.TypeOf((*complex128)(nil)).Elem() +// complex64Type = reflect.TypeOf((*complex64)(nil)).Elem() +// complex128Type = reflect.TypeOf((*complex128)(nil)).Elem() ) // Record is an in-memory Arrow Record backed by a NumPy data file. diff --git a/groot/rsrv/endpoints.go b/groot/rsrv/endpoints.go index 2ecdb37fb..3493ecd8a 100644 --- a/groot/rsrv/endpoints.go +++ b/groot/rsrv/endpoints.go @@ -41,8 +41,9 @@ func (srv *Server) handlePing(w http.ResponseWriter, r *http.Request) error { // OpenFile opens a ROOT file located at the provided URI. // OpenFile expects an OpenFileRequest payload as JSON: -// {"uri": "file:///some/file.root"} -// {"uri": "root://example.org/some/file.root"} +// +// {"uri": "file:///some/file.root"} +// {"uri": "root://example.org/some/file.root"} // // OpenFile replies with a STATUS/OK or STATUS/NotFound if no such file exist. func (srv *Server) OpenFile(w http.ResponseWriter, r *http.Request) { @@ -156,7 +157,8 @@ func (srv *Server) handleUpload(w http.ResponseWriter, r *http.Request) error { } // CloseFile closes a file specified by the CloseFileRequest: -// {"uri": "file:///some/file.root"} +// +// {"uri": "file:///some/file.root"} func (srv *Server) CloseFile(w http.ResponseWriter, r *http.Request) { srv.wrap(srv.handleCloseFile)(w, r) } @@ -184,8 +186,9 @@ func (srv *Server) handleCloseFile(w http.ResponseWriter, r *http.Request) error // ListFiles lists all the files currently known to the server. // ListFiles replies with a StatusOK and a ListResponse: -// [{"uri": "file:///some/file.root"}, -// {"uri": "root://example.org/file.root"}] +// +// [{"uri": "file:///some/file.root"}, +// {"uri": "root://example.org/file.root"}] func (srv *Server) ListFiles(w http.ResponseWriter, r *http.Request) { srv.wrap(srv.handleListFiles)(w, r) } @@ -214,15 +217,18 @@ func (srv *Server) handleListFiles(w http.ResponseWriter, r *http.Request) error // Dirent lists the content of a ROOT directory inside a ROOT file. // Dirent expects a DirentRequest: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "recursive": true} -// {"uri": "root://example.org/some/file.root", "dir": "/some/dir"} +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "recursive": true} +// {"uri": "root://example.org/some/file.root", "dir": "/some/dir"} +// // Dirent replies with a DirentResponse: -// {"uri": "file:///some/file.root", "content": [ -// {"path": "/dir", "type": "TDirectoryFile", "name": "dir", "title": "my title"}, -// {"path": "/dir/obj", "type": "TObjString", "name": "obj", "title": "obj string"}, -// {"path": "/dir/sub", "type": "TDirectoryFile", "name": "sub", "title": "my sub dir"}, -// {"path": "/dir/sub/obj", "type": "TObjString", "name": "obj", "title": "my sub obj string"} -// ]} +// +// {"uri": "file:///some/file.root", "content": [ +// {"path": "/dir", "type": "TDirectoryFile", "name": "dir", "title": "my title"}, +// {"path": "/dir/obj", "type": "TObjString", "name": "obj", "title": "obj string"}, +// {"path": "/dir/sub", "type": "TDirectoryFile", "name": "sub", "title": "my sub dir"}, +// {"path": "/dir/sub/obj", "type": "TObjString", "name": "obj", "title": "my sub obj string"} +// ]} func (srv *Server) Dirent(w http.ResponseWriter, r *http.Request) { srv.wrap(srv.handleDirent)(w, r) } @@ -335,16 +341,19 @@ func (srv *Server) handleDirent(w http.ResponseWriter, r *http.Request) error { } // Tree returns the structure of a TTree specified by the TreeRequest: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "myTree"} +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "myTree"} +// // Tree replies with a TreeResponse: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "myTree", -// "tree": { -// "type": "TTree", "name": "myTree", "title": "my title", "cycle": 1, -// "entries": 42, -// "branches": [{"type": "TBranch", "name": "Int64"}, ...], -// "leaves": [{"type": "TLeafL", "name": "Int64"}, ...] -// } -// } +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "myTree", +// "tree": { +// "type": "TTree", "name": "myTree", "title": "my title", "cycle": 1, +// "entries": 42, +// "branches": [{"type": "TBranch", "name": "Int64"}, ...], +// "leaves": [{"type": "TLeafL", "name": "Int64"}, ...] +// } +// } func (srv *Server) Tree(w http.ResponseWriter, r *http.Request) { srv.wrap(srv.handleTree)(w, r) } @@ -437,13 +446,15 @@ func (srv *Server) handleTree(w http.ResponseWriter, r *http.Request) error { } // PlotH1 plots the 1-dim histogram specified by the PlotH1Request: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h1", "type": "png"} -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h1", "type": "svg", -// "options": { -// "title": "my histo title", "x": "my x-axis", "y": "my y-axis", -// "line": {"color": "#ff0000ff", ...}, -// "fill_color": "#00ff00ff"} -// }} +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h1", "type": "png"} +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h1", "type": "svg", +// "options": { +// "title": "my histo title", "x": "my x-axis", "y": "my y-axis", +// "line": {"color": "#ff0000ff", ...}, +// "fill_color": "#00ff00ff"} +// }} +// // PlotH1 replies with a PlotResponse, where "data" contains the base64 encoded representation of // the plot. func (srv *Server) PlotH1(w http.ResponseWriter, r *http.Request) { @@ -533,11 +544,13 @@ func (srv *Server) handlePlotH1(w http.ResponseWriter, r *http.Request) error { } // PlotH2 plots the 2-dim histogram specified by the PlotH2Request: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h2", "type": "png"} -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h2", "type": "svg", -// "options": { -// "title": "my histo title", "x": "my x-axis", "y": "my y-axis" -// }} +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h2", "type": "png"} +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "h2", "type": "svg", +// "options": { +// "title": "my histo title", "x": "my x-axis", "y": "my y-axis" +// }} +// // PlotH2 replies with a PlotResponse, where "data" contains the base64 encoded representation of // the plot. func (srv *Server) PlotH2(w http.ResponseWriter, r *http.Request) { @@ -625,12 +638,14 @@ func (srv *Server) handlePlotH2(w http.ResponseWriter, r *http.Request) error { } // PlotS2 plots the 2-dim scatter specified by the PlotS2Request: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "png"} -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "svg", -// "options": { -// "title": "my scatter title", "x": "my x-axis", "y": "my y-axis", -// "line": {"color": "#ff0000ff", ...} -// }} +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "png"} +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "svg", +// "options": { +// "title": "my scatter title", "x": "my x-axis", "y": "my y-axis", +// "line": {"color": "#ff0000ff", ...} +// }} +// // PlotS2 replies with a PlotResponse, where "data" contains the base64 encoded representation of // the plot. func (srv *Server) PlotS2(w http.ResponseWriter, r *http.Request) { @@ -725,12 +740,14 @@ func (srv *Server) handlePlotS2(w http.ResponseWriter, r *http.Request) error { } // PlotTree plots the Tree branch(es) specified by the PlotBranchRequest: -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "png", "vars": ["pt"]} -// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "svg", "vars": ["pt", "eta"], -// "options": { -// "title": "my plot title", "x": "my x-axis", "y": "my y-axis", -// "line": {"color": "#ff0000ff", ...} -// }} +// +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "png", "vars": ["pt"]} +// {"uri": "file:///some/file.root", "dir": "/some/dir", "obj": "gr", "type": "svg", "vars": ["pt", "eta"], +// "options": { +// "title": "my plot title", "x": "my x-axis", "y": "my y-axis", +// "line": {"color": "#ff0000ff", ...} +// }} +// // PlotBranch replies with a PlotResponse, where "data" contains the base64 encoded representation of // the plot. func (srv *Server) PlotTree(w http.ResponseWriter, r *http.Request) { diff --git a/groot/rtree/tree.go b/groot/rtree/tree.go index 3f58f6347..c9c06cdee 100644 --- a/groot/rtree/tree.go +++ b/groot/rtree/tree.go @@ -21,12 +21,13 @@ import ( ) // A ttree object is a list of Branch. -// To Create a TTree object one must: -// - Create the TTree header via the TTree constructor -// - Call the TBranch constructor for every branch. // -// To Fill this object, use member function Fill with no parameters -// The Fill function loops on all defined TBranch +// To Create a TTree object one must: +// - Create the TTree header via the TTree constructor +// - Call the TBranch constructor for every branch. +// +// To Fill this object, use member function Fill with no parameters +// The Fill function loops on all defined TBranch type ttree struct { f *riofs.File // underlying file dir riofs.Directory // directory holding this tree diff --git a/hbook/dist.go b/hbook/dist.go index 583cb483d..0f03ce4f0 100644 --- a/hbook/dist.go +++ b/hbook/dist.go @@ -28,7 +28,8 @@ func (d *Dist0D) Entries() int64 { } // EffEntries returns the number of weighted entries, such as: -// (\sum w)^2 / \sum w^2 +// +// (\sum w)^2 / \sum w^2 func (d *Dist0D) EffEntries() float64 { if d.SumW2 == 0 { return 0 @@ -132,7 +133,9 @@ func (d *Dist1D) mean() float64 { } // variance returns the weighted variance of the distribution, defined as: -// sig2 = ( \sum(wx^2) * \sum(w) - \sum(wx)^2 ) / ( \sum(w)^2 - \sum(w^2) ) +// +// sig2 = ( \sum(wx^2) * \sum(w) - \sum(wx)^2 ) / ( \sum(w)^2 - \sum(w^2) ) +// // see: https://en.wikipedia.org/wiki/Weighted_arithmetic_mean func (d *Dist1D) variance() float64 { // FIXME(sbinet): check for low stats? @@ -156,7 +159,8 @@ func (d *Dist1D) stdErr() float64 { } // rms returns the weighted RMS of the distribution, defined as: -// rms = \sqrt{\sum{w . x^2} / \sum{w}} +// +// rms = \sqrt{\sum{w . x^2} / \sum{w}} func (d *Dist1D) rms() float64 { // FIXME(sbinet): check for low stats? meansq := d.SumWX2() / d.SumW() diff --git a/hbook/h1d.go b/hbook/h1d.go index fe21f61a7..8851a88c9 100644 --- a/hbook/h1d.go +++ b/hbook/h1d.go @@ -207,17 +207,17 @@ func (h *H1D) Scale(factor float64) { // // Examples: // -// // integral of all in-range bins + overflows -// v := h.Integral() +// // integral of all in-range bins + overflows +// v := h.Integral() // -// // integral of all in-range bins, underflow and overflow bins included. -// v := h.Integral(math.Inf(-1), math.Inf(+1)) +// // integral of all in-range bins, underflow and overflow bins included. +// v := h.Integral(math.Inf(-1), math.Inf(+1)) // -// // integrall of all in-range bins, overflow bin included -// v := h.Integral(h.Binning.XRange.Min, math.Inf(+1)) +// // integrall of all in-range bins, overflow bin included +// v := h.Integral(h.Binning.XRange.Min, math.Inf(+1)) // -// // integrall of all bins for which the lower edge is in [0.5, 5.5) -// v := h.Integral(0.5, 5.5) +// // integrall of all bins for which the lower edge is in [0.5, 5.5) +// v := h.Integral(0.5, 5.5) func (h *H1D) Integral(args ...float64) float64 { min, max := 0., 0. switch len(args) { diff --git a/hbook/ntup/ntcsv/ntcsv.go b/hbook/ntup/ntcsv/ntcsv.go index f9b63a38d..70bd4542f 100644 --- a/hbook/ntup/ntcsv/ntcsv.go +++ b/hbook/ntup/ntcsv/ntcsv.go @@ -6,31 +6,31 @@ // // Examples: // -// nt, err := ntcsv.Open("testdata/simple.csv") -// if err != nil { -// log.Fatal(err) -// } -// defer nt.DB().Close() +// nt, err := ntcsv.Open("testdata/simple.csv") +// if err != nil { +// log.Fatal(err) +// } +// defer nt.DB().Close() // // or, with a different configuration for the comma/comment runes: // -// nt, err := ntcsv.Open("testdata/simple.csv", ntcsv.Comma(' '), ntcsv.Comment('#')) -// if err != nil { -// log.Fatal(err) -// } -// defer nt.DB().Close() +// nt, err := ntcsv.Open("testdata/simple.csv", ntcsv.Comma(' '), ntcsv.Comment('#')) +// if err != nil { +// log.Fatal(err) +// } +// defer nt.DB().Close() // // Give our own names to the CSV columns (default: "var1", "var2", ...): // -// nt, err := ntcsv.Open("testdata/simple.csv", ntcsv.Columns("var1", "i64", "foo")) +// nt, err := ntcsv.Open("testdata/simple.csv", ntcsv.Columns("var1", "i64", "foo")) // // Take the names from the CSV header (note that the header *must* exist): // -// nt, err := ntcsv.Open("testdata/simple-with-header.csv", ntcsv.Header()) +// nt, err := ntcsv.Open("testdata/simple-with-header.csv", ntcsv.Header()) // // Override the names from the CSV header with our own: // -// nt, err := ntcsv.Open("testdata/simple-with-header.csv", ntcsv.Header(), ntcsv.Columns("v1", "v2", "v3") +// nt, err := ntcsv.Open("testdata/simple-with-header.csv", ntcsv.Header(), ntcsv.Columns("v1", "v2", "v3") package ntcsv // import "go-hep.org/x/hep/hbook/ntup/ntcsv" import ( diff --git a/hbook/ntup/ntroot/ntroot.go b/hbook/ntup/ntroot/ntroot.go index 37c1eabeb..239b20352 100644 --- a/hbook/ntup/ntroot/ntroot.go +++ b/hbook/ntup/ntroot/ntroot.go @@ -7,11 +7,11 @@ // // Example: // -// nt, err := ntroot.Open("testdata/simple.root", "mytree") -// if err != nil { -// log.Fatalf("%+v", err) -// } -// defer nt.DB().Close() +// nt, err := ntroot.Open("testdata/simple.root", "mytree") +// if err != nil { +// log.Fatalf("%+v", err) +// } +// defer nt.DB().Close() package ntroot // import "go-hep.org/x/hep/hbook/ntup/ntroot" import ( diff --git a/hbook/ntup/ntuple.go b/hbook/ntup/ntuple.go index b206ac6b5..59ed2a2a8 100644 --- a/hbook/ntup/ntuple.go +++ b/hbook/ntup/ntuple.go @@ -46,8 +46,9 @@ type Ntuple struct { // If name is "", Open will connect to the one-and-only table in the db. // // e.g.: -// db, err := sql.Open("csv", "file.csv") -// nt, err := ntup.Open(db, "ntup") +// +// db, err := sql.Open("csv", "file.csv") +// nt, err := ntup.Open(db, "ntup") func Open(db *sql.DB, name string) (*Ntuple, error) { nt := &Ntuple{ db: db, @@ -60,13 +61,14 @@ func Open(db *sql.DB, name string) (*Ntuple, error) { // Create creates a new ntuple with the given name inside the given database handle. // The n-tuple schema is inferred from the cols argument. cols can be: -// - a single struct value (columns are inferred from the names+types of the exported fields) -// - a list of builtin values (the columns names are varX where X=[1-len(cols)]) -// - a list of ntup.Descriptors +// - a single struct value (columns are inferred from the names+types of the exported fields) +// - a list of builtin values (the columns names are varX where X=[1-len(cols)]) +// - a list of ntup.Descriptors // // e.g.: -// nt, err := ntup.Create(db, "nt", struct{X float64 `hbook:"x"`}{}) -// nt, err := ntup.Create(db, "nt", int64(0), float64(0)) +// +// nt, err := ntup.Create(db, "nt", struct{X float64 `hbook:"x"`}{}) +// nt, err := ntup.Create(db, "nt", int64(0), float64(0)) func Create(db *sql.DB, name string, cols ...interface{}) (*Ntuple, error) { var err error nt := &Ntuple{ @@ -196,11 +198,12 @@ func getTag(tag reflect.StructTag, keys ...string) string { // Scan executes a query against the ntuple and runs the function f against that context. // // e.g. -// err = nt.Scan("x,y where z>10", func(x,y float64) error { -// h1.Fill(x, 1) -// h2.Fill(y, 1) -// return nil -// }) +// +// err = nt.Scan("x,y where z>10", func(x,y float64) error { +// h1.Fill(x, 1) +// h2.Fill(y, 1) +// return nil +// }) func (nt *Ntuple) Scan(query string, f interface{}) error { if f == nil { return fmt.Errorf("hbook/ntup: nil func") diff --git a/hepevt/hepevt.go b/hepevt/hepevt.go index d738e4b84..a8783f759 100644 --- a/hepevt/hepevt.go +++ b/hepevt/hepevt.go @@ -7,9 +7,9 @@ package hepevt // import "go-hep.org/x/hep/hepevt" // Event is the Go representation of the FORTRAN-77 HEPEVT common block: // -// PARAMETER (NMXHEP=2000) -// COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP), -// & JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP) +// PARAMETER (NMXHEP=2000) +// COMMON/HEPEVT/NEVHEP,NHEP,ISTHEP(NMXHEP),IDHEP(NMXHEP), +// & JMOHEP(2,NMXHEP),JDAHEP(2,NMXHEP),PHEP(5,NMXHEP),VHEP(4,NMXHEP) type Event struct { Nevhep int // event number (or some special meaning, see doc for details) Nhep int // actual number of entries in current event diff --git a/hepmc/go-hepmc-dump/main.go b/hepmc/go-hepmc-dump/main.go index dba0640dd..d0471665a 100644 --- a/hepmc/go-hepmc-dump/main.go +++ b/hepmc/go-hepmc-dump/main.go @@ -5,27 +5,33 @@ // go-hepmc-dump is a simple command to dump in an almost human-friendly format // the content of a hepmc file. // ex: -// $ go-hepmc-dump foo.hepmc | head -n20 +// +// $ go-hepmc-dump foo.hepmc | head -n20 +// // ________________________________________________________________________________ // GenEvent: #0000 ID= 111 SignalProcessGenVertex Barcode: 0 -// Momentum units: GEV Position units: MM -// Cross Section: 2.666668e+12 +/- 2.666668e+12 -// Entries this event: 129 vertices, 241 particles. -// Beam Particle barcodes: 1 2 -// RndmState(0)= -// Wgts(1)=(0,1.000000) -// EventScale 1.438780e+00 [energy] alphaQCD=4.519907e-01 alphaQED=7.472465e-03 -// GenParticle Legend -// Barcode PDG ID ( Px, Py, Pz, E ) Stat DecayVtx +// +// Momentum units: GEV Position units: MM +// Cross Section: 2.666668e+12 +/- 2.666668e+12 +// Entries this event: 129 vertices, 241 particles. +// Beam Particle barcodes: 1 2 +// RndmState(0)= +// Wgts(1)=(0,1.000000) +// EventScale 1.438780e+00 [energy] alphaQCD=4.519907e-01 alphaQED=7.472465e-03 +// GenParticle Legend +// Barcode PDG ID ( Px, Py, Pz, E ) Stat DecayVtx +// // ________________________________________________________________________________ // GenVertex: -1 ID: 0 (X,cT):0 -// I: 1 7 21 -5.87e-14, 9.60e-15, 3.41e+01, 3.41e+01 42 -1 -// O: 1 3 21 0.00e+00, 0.00e+00, 3.41e+01, 3.41e+01 21 -3 +// +// I: 1 7 21 -5.87e-14, 9.60e-15, 3.41e+01, 3.41e+01 42 -1 +// O: 1 3 21 0.00e+00, 0.00e+00, 3.41e+01, 3.41e+01 21 -3 +// // GenVertex: -2 ID: 0 (X,cT):0 -// I: 1 8 21 3.20e-14, 0.00e+00,-7.23e+01, 7.23e+01 41 -2 -// O: 2 4 21 0.00e+00, 0.00e+00,-1.19e+00, 1.19e+00 21 -3 -// 11 21 9.42e-01,-1.56e-01,-7.11e+01, 7.11e+01 43 -12 // +// I: 1 8 21 3.20e-14, 0.00e+00,-7.23e+01, 7.23e+01 41 -2 +// O: 2 4 21 0.00e+00, 0.00e+00,-1.19e+00, 1.19e+00 21 -3 +// 11 21 9.42e-01,-1.56e-01,-7.11e+01, 7.11e+01 43 -12 package main import ( diff --git a/hepmc/hepmc.go b/hepmc/hepmc.go index 1c97eb1c9..5be8934e0 100644 --- a/hepmc/hepmc.go +++ b/hepmc/hepmc.go @@ -53,9 +53,10 @@ func Delete(evt *Event) error { // Event represents a record for MC generators (for use at any stage of generation) // // This type is intended as both a "container class" ( to store a MC -// event for interface between MC generators and detector simulation ) -// and also as a "work in progress class" ( that could be used inside -// a generator and modified as the event is built ). +// +// event for interface between MC generators and detector simulation ) +// and also as a "work in progress class" ( that could be used inside +// a generator and modified as the event is built ). type Event struct { SignalProcessID int // id of the signal process EventNumber int // event number @@ -352,7 +353,8 @@ func (ps Vertices) Swap(i, j int) { // Vertex represents a generator vertex within an event // A vertex is indirectly (via particle "edges") linked to other -// vertices ("nodes") to form a composite "graph" +// +// vertices ("nodes") to form a composite "graph" type Vertex struct { Position fmom.PxPyPzE // 4-vector of vertex [mm] ParticlesIn []*Particle // all incoming particles @@ -668,37 +670,39 @@ type PdfInfo struct { // // Flow patterns are coded with an integer, in the same manner as in Herwig. // Note: 0 is NOT allowed as code index nor as flow code since it -// is used to indicate null. +// +// is used to indicate null. // // This class can be used to keep track of flow patterns within -// a graph. An example is color flow. If we have two quarks going through -// an s-channel gluon to form two more quarks: // -// \q1 /q3 then we can keep track of the color flow with the -// \_______/ HepMC::Flow class as follows: -// / g \. -// /q2 \q4 +// a graph. An example is color flow. If we have two quarks going through +// an s-channel gluon to form two more quarks: +// +// \q1 /q3 then we can keep track of the color flow with the +// \_______/ HepMC::Flow class as follows: +// / g \. +// /q2 \q4 // -// lets say the color flows from q2-->g-->q3 and q1-->g-->q4 -// the individual colors are unimportant, but the flow pattern is. -// We can capture this flow by assigning the first pattern (q2-->g-->q3) -// a unique (arbitrary) flow code 678 and the second pattern (q1-->g-->q4) -// flow code 269 ( you can ask HepMC::Flow to choose -// a unique code for you using Flow::set_unique_icode() ). -// these codes with the particles as follows: -// q2->flow().set_icode(1,678); -// g->flow().set_icode(1,678); -// q3->flow().set_icode(1,678); -// q1->flow().set_icode(1,269); -// g->flow().set_icode(2,269); -// q4->flow().set_icode(1,269); -// later on if we wish to know the color partner of q1 we can ask for a list -// of all particles connected via this code to q1 which do have less than -// 2 color partners using: -// vector result=q1->dangling_connected_partners(q1->icode(1),1,2); -// this will return a list containing q1 and q4. -// vector result=q1->connected_partners(q1->icode(1),1,2); -// would return a list containing q1, g, and q4. +// lets say the color flows from q2-->g-->q3 and q1-->g-->q4 +// the individual colors are unimportant, but the flow pattern is. +// We can capture this flow by assigning the first pattern (q2-->g-->q3) +// a unique (arbitrary) flow code 678 and the second pattern (q1-->g-->q4) +// flow code 269 ( you can ask HepMC::Flow to choose +// a unique code for you using Flow::set_unique_icode() ). +// these codes with the particles as follows: +// q2->flow().set_icode(1,678); +// g->flow().set_icode(1,678); +// q3->flow().set_icode(1,678); +// q1->flow().set_icode(1,269); +// g->flow().set_icode(2,269); +// q4->flow().set_icode(1,269); +// later on if we wish to know the color partner of q1 we can ask for a list +// of all particles connected via this code to q1 which do have less than +// 2 color partners using: +// vector result=q1->dangling_connected_partners(q1->icode(1),1,2); +// this will return a list containing q1 and q4. +// vector result=q1->connected_partners(q1->icode(1),1,2); +// would return a list containing q1, g, and q4. type Flow struct { Particle *Particle // the particle this flow describes Icode map[int]int // flow patterns as (code_index, icode) diff --git a/hepmc/hepmc_test.go b/hepmc/hepmc_test.go index cbf73e3f5..533d8a77d 100644 --- a/hepmc/hepmc_test.go +++ b/hepmc/hepmc_test.go @@ -237,27 +237,30 @@ func BenchmarkDecode(b *testing.B) { // This example will place the following event into HepMC "by hand" // -// name status pdg_id parent Px Py Pz Energy Mass -// 1 !p+! 3 2212 0,0 0.000 0.000 7000.000 7000.000 0.938 -// 2 !p+! 3 2212 0,0 0.000 0.000-7000.000 7000.000 0.938 -//========================================================================= -// 3 !d! 3 1 1,1 0.750 -1.569 32.191 32.238 0.000 -// 4 !u~! 3 -2 2,2 -3.047 -19.000 -54.629 57.920 0.000 -// 5 !W-! 3 -24 1,2 1.517 -20.68 -20.605 85.925 80.799 -// 6 !gamma! 1 22 1,2 -3.813 0.113 -1.833 4.233 0.000 -// 7 !d! 1 1 5,5 -2.445 28.816 6.082 29.552 0.010 -// 8 !u~! 1 -2 5,5 3.962 -49.498 -26.687 56.373 0.006 +// name status pdg_id parent Px Py Pz Energy Mass +// 1 !p+! 3 2212 0,0 0.000 0.000 7000.000 7000.000 0.938 +// 2 !p+! 3 2212 0,0 0.000 0.000-7000.000 7000.000 0.938 +// +// ========================================================================= +// +// 3 !d! 3 1 1,1 0.750 -1.569 32.191 32.238 0.000 +// 4 !u~! 3 -2 2,2 -3.047 -19.000 -54.629 57.920 0.000 +// 5 !W-! 3 -24 1,2 1.517 -20.68 -20.605 85.925 80.799 +// 6 !gamma! 1 22 1,2 -3.813 0.113 -1.833 4.233 0.000 +// 7 !d! 1 1 5,5 -2.445 28.816 6.082 29.552 0.010 +// 8 !u~! 1 -2 5,5 3.962 -49.498 -26.687 56.373 0.006 // // now we build the graph, which will look like -// # p7 # -// # p1 / # -// # \v1__p3 p5---v4 # -// # \_v3_/ \ # -// # / \ p8 # -// # v2__p4 \ # -// # / p6 # -// # p2 # -// # # +// +// # p7 # +// # p1 / # +// # \v1__p3 p5---v4 # +// # \_v3_/ \ # +// # / \ p8 # +// # v2__p4 \ # +// # / p6 # +// # p2 # +// # # func ExampleEvent_buildFromScratch() { var err error diff --git a/heppdt/pid.go b/heppdt/pid.go index b4036040a..fa666e1b8 100644 --- a/heppdt/pid.go +++ b/heppdt/pid.go @@ -10,8 +10,8 @@ import ( type location int -// PID digits (base 10) are: n Nr Nl Nq1 Nq2 Nq3 Nj -// The location enum provides a convenient index into the PID. +// PID digits (base 10) are: n Nr Nl Nq1 Nq2 Nq3 Nj +// The location enum provides a convenient index into the PID. const ( _ location = iota Nj @@ -35,7 +35,9 @@ type Quarks struct { // Particle Identification number // In the standard numbering scheme, the PID digits (base 10) are: -// +/- n Nr Nl Nq1 Nq2 Nq3 Nj +// +// +/- n Nr Nl Nq1 Nq2 Nq3 Nj +// // It is expected that any 7 digit number used as a PID will adhere to // the Monte Carlo numbering scheme documented by the PDG. // Note that particles not already explicitly defined diff --git a/hplot/figure.go b/hplot/figure.go index fe0c24dc8..a9038fc8b 100644 --- a/hplot/figure.go +++ b/hplot/figure.go @@ -47,7 +47,8 @@ func WithBorder(b Border) FigOption { // WithLatexHandler allows to enable the automatic generation of PDFs from .tex files. // To enable the automatic generation of PDFs, use DefaultHandler: -// WithLatexHandler(htex.DefaultHandler) +// +// WithLatexHandler(htex.DefaultHandler) func WithLatexHandler(h htex.Handler) FigOption { return func(fig *Fig) { fig.Latex = h diff --git a/hplot/io.go b/hplot/io.go index 964dfc772..70e70c7cd 100644 --- a/hplot/io.go +++ b/hplot/io.go @@ -32,7 +32,7 @@ type Drawer interface { // // Supported extensions are: // -// .eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff. +// .eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff. // // If w or h are <= 0, the value is chosen such that it follows the Golden Ratio. // If w and h are <= 0, the values are chosen such that they follow the Golden Ratio @@ -95,7 +95,7 @@ func Save(p Drawer, w, h vg.Length, fnames ...string) (err error) { // WriterTo returns an io.WriterTo that will write the plots as // the specified image format. // -// Supported formats are the same ones than hplot.Plot.WriterTo +// # Supported formats are the same ones than hplot.Plot.WriterTo // // If w or h are <= 0, the value is chosen such that it follows the Golden Ratio. // If w and h are <= 0, the values are chosen such that they follow the Golden Ratio @@ -122,7 +122,7 @@ func WriterTo(p Drawer, w, h vg.Length, format string) (io.WriterTo, error) { // // Supported formats are: // -// eps, jpg|jpeg, pdf, png, svg, tex and tif|tiff. +// eps, jpg|jpeg, pdf, png, svg, tex and tif|tiff. func newFormattedCanvas(w, h vg.Length, format string, dpi float64) (vg.CanvasWriterTo, error) { var c vg.CanvasWriterTo switch format { diff --git a/hplot/plot.go b/hplot/plot.go index 686916bd0..744fb63eb 100644 --- a/hplot/plot.go +++ b/hplot/plot.go @@ -69,7 +69,7 @@ func (p *Plot) Add(ps ...plot.Plotter) { // // Supported extensions are: // -// .eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff. +// .eps, .jpg, .jpeg, .pdf, .png, .svg, .tex, .tif and .tiff. // // If w or h are <= 0, the value is chosen such that it follows the Golden Ratio. // If w and h are <= 0, the values are chosen such that they follow the Golden Ratio @@ -83,7 +83,7 @@ func (p *Plot) Save(w, h vg.Length, file string) error { // // Supported formats are: // -// eps, jpg|jpeg, pdf, png, svg, tex and tif|tiff. +// eps, jpg|jpeg, pdf, png, svg, tex and tif|tiff. func (p *Plot) WriterTo(w, h vg.Length, format string) (io.WriterTo, error) { return WriterTo(p, w, h, format) } diff --git a/lcio/example/lcio-ex-read-event/main.go b/lcio/example/lcio-ex-read-event/main.go index 89f3de661..2acb4e487 100644 --- a/lcio/example/lcio-ex-read-event/main.go +++ b/lcio/example/lcio-ex-read-event/main.go @@ -3,14 +3,14 @@ // license that can be found in the LICENSE file. // lcio-ex-read-event is the hep/x/lcio example equivalent to: -// https://github.com/iLCSoft/LCIO/blob/master/examples/cpp/rootDict/readEventTree.C // -// example: +// https://github.com/iLCSoft/LCIO/blob/master/examples/cpp/rootDict/readEventTree.C // -// $> lcio-ex-read-event ./DST01-06_ppr004_bbcsdu.slcio -// lcio-ex-read-event: read 50 events from file "./DST01-06_ppr004_bbcsdu.slcio" -// $> open out.png +// example: // +// $> lcio-ex-read-event ./DST01-06_ppr004_bbcsdu.slcio +// lcio-ex-read-event: read 50 events from file "./DST01-06_ppr004_bbcsdu.slcio" +// $> open out.png package main import ( diff --git a/pawgo/main.go b/pawgo/main.go index 34f261d15..df001d949 100644 --- a/pawgo/main.go +++ b/pawgo/main.go @@ -7,28 +7,28 @@ // // Example: // -// $> pawgo -// paw> /file/open f testdata/issue-120.rio -// paw> /file/ls f -// /file/id/f name=testdata/issue-120.rio -// - MonoH_Truth/jets (type="*go-hep.org/x/hep/hbook.H1D") +// $> pawgo +// paw> /file/open f testdata/issue-120.rio +// paw> /file/ls f +// /file/id/f name=testdata/issue-120.rio +// - MonoH_Truth/jets (type="*go-hep.org/x/hep/hbook.H1D") // -// paw> /hist/open h /file/id/f/MonoH_Truth/jets -// paw> /hist/plot h -// == h1d: name="MonoH_Truth/jets" -// entries=20000 -// mean= +2.554 -// RMS= +2.891 -// paw> /? -// /! -- run a shell command -// /? -- print help -// /file/close -- close a file -// /file/create -- create file for write access -// /file/list -- list a file's content -// /file/open -- open file for read access -// /hist/open -- open a histogram -// /hist/plot -- plot a histogram -// /quit -- quit PAW-Go +// paw> /hist/open h /file/id/f/MonoH_Truth/jets +// paw> /hist/plot h +// == h1d: name="MonoH_Truth/jets" +// entries=20000 +// mean= +2.554 +// RMS= +2.891 +// paw> /? +// /! -- run a shell command +// /? -- print help +// /file/close -- close a file +// /file/create -- create file for write access +// /file/list -- list a file's content +// /file/open -- open file for read access +// /hist/open -- open a histogram +// /hist/plot -- plot a histogram +// /quit -- quit PAW-Go package main // import "go-hep.org/x/hep/pawgo" //go:generate go run ./gen.hsimple.go diff --git a/sio/stream.go b/sio/stream.go index deec2e628..10c49d926 100644 --- a/sio/stream.go +++ b/sio/stream.go @@ -118,7 +118,8 @@ func (stream *Stream) SetCompressionLevel(lvl int) { } // CurPos returns the current position in the file -// -1 if error +// +// -1 if error func (stream *Stream) CurPos() int64 { pos, err := stream.f.Seek(0, 1) if err != nil { diff --git a/xrootd/cmd/xrd-cp/main.go b/xrootd/cmd/xrd-cp/main.go index b5afa7fee..4ea246fad 100644 --- a/xrootd/cmd/xrd-cp/main.go +++ b/xrootd/cmd/xrd-cp/main.go @@ -7,20 +7,21 @@ // // Usage: // -// $> xrd-cp [OPTIONS] [ [...]] +// $> xrd-cp [OPTIONS] [ [...]] // // Example: // -// $> xrd-cp root://server.example.com/some/file1.txt . -// $> xrd-cp root://gopher@server.example.com/some/file1.txt . -// $> xrd-cp root://server.example.com/some/file1.txt foo.txt -// $> xrd-cp root://server.example.com/some/file1.txt - > foo.txt -// $> xrd-cp -r root://server.example.com/some/dir . -// $> xrd-cp -r root://server.example.com/some/dir outdir +// $> xrd-cp root://server.example.com/some/file1.txt . +// $> xrd-cp root://gopher@server.example.com/some/file1.txt . +// $> xrd-cp root://server.example.com/some/file1.txt foo.txt +// $> xrd-cp root://server.example.com/some/file1.txt - > foo.txt +// $> xrd-cp -r root://server.example.com/some/dir . +// $> xrd-cp -r root://server.example.com/some/dir outdir // // Options: -// -r copy directories recursively -// -v enable verbose mode +// +// -r copy directories recursively +// -v enable verbose mode package main import ( diff --git a/xrootd/cmd/xrd-ls/main.go b/xrootd/cmd/xrd-ls/main.go index da4dca2eb..33308e33b 100644 --- a/xrootd/cmd/xrd-ls/main.go +++ b/xrootd/cmd/xrd-ls/main.go @@ -6,18 +6,19 @@ // // Usage: // -// $> xrd-ls [OPTIONS] [ [...]] +// $> xrd-ls [OPTIONS] [ [...]] // // Example: // -// $> xrd-ls root://server.example.com/some/dir -// $> xrd-ls -l root://server.example.com/some/dir -// $> xrd-ls -R root://server.example.com/some/dir -// $> xrd-ls -l -R root://server.example.com/some/dir +// $> xrd-ls root://server.example.com/some/dir +// $> xrd-ls -l root://server.example.com/some/dir +// $> xrd-ls -R root://server.example.com/some/dir +// $> xrd-ls -l -R root://server.example.com/some/dir // // Options: -// -R list subdirectories recursively -// -l use a long listing format +// +// -R list subdirectories recursively +// -l use a long listing format package main import ( diff --git a/xrootd/xrdio/xrdio.go b/xrootd/xrdio/xrdio.go index 073a91939..3d87d0685 100644 --- a/xrootd/xrdio/xrdio.go +++ b/xrootd/xrdio/xrdio.go @@ -16,12 +16,12 @@ import ( ) // File wraps a xrdfs.File and implements the following interfaces: -// - io.Closer -// - io.Reader -// - io.Writer -// - io.ReaderAt -// - io.WriterAt -// - io.Seeker +// - io.Closer +// - io.Reader +// - io.Writer +// - io.ReaderAt +// - io.WriterAt +// - io.Seeker type File struct { cli *xrootd.Client fs xrdfs.FileSystem @@ -37,7 +37,7 @@ type File struct { // // Example: // -// f, err := xrdio.Open("root://server.example.com:1094//some/path/to/file") +// f, err := xrdio.Open("root://server.example.com:1094//some/path/to/file") func Open(name string) (*File, error) { urn, err := Parse(name) if err != nil { @@ -72,7 +72,7 @@ func Open(name string) (*File, error) { // // Example: // -// f, err := xrdio.OpenFrom(fs, "/some/path/to/file") +// f, err := xrdio.OpenFrom(fs, "/some/path/to/file") func OpenFrom(fs xrdfs.FileSystem, name string) (*File, error) { f, err := fs.Open(context.Background(), name, xrdfs.OpenModeOwnerRead, xrdfs.OpenOptionsOpenRead) if err != nil { diff --git a/xrootd/xrdproto/dirlist/dirlist.go b/xrootd/xrdproto/dirlist/dirlist.go index 23ec70903..fa7e76e96 100644 --- a/xrootd/xrdproto/dirlist/dirlist.go +++ b/xrootd/xrdproto/dirlist/dirlist.go @@ -81,16 +81,20 @@ func (o Response) MarshalXrd(wBuffer *xrdenc.WBuffer) error { // UnmarshalXrd implements xrdproto.Unmarshaler // When stat information is supported by the server, the format is -// ".\n" -// "0 0 0 0\n" -// "dirname\n" -// "id size flags modtime\n" -// ... -// 0 +// +// ".\n" +// "0 0 0 0\n" +// "dirname\n" +// "id size flags modtime\n" +// ... +// 0 +// // Otherwise, the format is the following: -// "dirname\n" -// ... -// 0 +// +// "dirname\n" +// ... +// 0 +// // See xrootd protocol specification, page 45 for further details. func (o *Response) UnmarshalXrd(rBuffer *xrdenc.RBuffer) error { if rBuffer.Len() == 0 { diff --git a/xrootd/xrdproto/xrdproto.go b/xrootd/xrdproto/xrdproto.go index 225c0c85f..02d6d8f44 100644 --- a/xrootd/xrdproto/xrdproto.go +++ b/xrootd/xrdproto/xrdproto.go @@ -288,7 +288,9 @@ const SecurityOverrideLength = 2 // SecurityOverride is an alteration needed to the specified predefined security level. // It consists of the request index and the security requirement the associated request should have. // Request index is calculated as: -// (request code) - (request code of Auth request) +// +// (request code) - (request code of Auth request) +// // according to xrootd protocol specification. type SecurityOverride struct { RequestIndex byte diff --git a/xrootd/xrootd.go b/xrootd/xrootd.go index ee4a30dfe..8c6ec7637 100644 --- a/xrootd/xrootd.go +++ b/xrootd/xrootd.go @@ -3,7 +3,8 @@ // license that can be found in the LICENSE file. // Package xrootd implements the XRootD protocol from -// http://xrootd.org +// +// http://xrootd.org // // Package xrootd provides a Client and a Server. // @@ -24,6 +25,6 @@ // // The NewServer function creates a server: // -// srv := xrootd.NewServer(xrootd.Default(), nil) -// err := srv.Serve(listener) +// srv := xrootd.NewServer(xrootd.Default(), nil) +// err := srv.Serve(listener) package xrootd // import "go-hep.org/x/hep/xrootd"