Go-HEP: libraries for High Energy Physics analyses in Go

Go-HEP exposes libraries to read and write common High Energy Physics (HEP) file formats (HepMC (Dobbs and Hansen 2000), LHEF (Alwall et al. 2007), SLHA (Skands and others 2004)) but, at the moment, only read interoperability is achieved with ROOT file format. Go-HEP also provides tools to carry statistical analyses in the form of 1dim and 2-dim histograms, 1-dim and 2-dim scatters and n-tuples. Go-HEP can also graphically represent these results, leveraging the Gonum (T. G. authors, n.d.) plotting library.


Packages
In this section, we list the packages that Go-HEP provides together with a short description.

go-hep/rootio
go-hep/rootio provides read access to data stored in ROOT files.rootio is a pure-Go implementation of the ROOT file format, reimplementing from scratch the decoding and interpretation of ROOT's low-level file blocks (TDirectory, TKey, TBuffer and TFile) together with file metadata, such as TStreamerInfo and TStreamerElement that allow to serialize and deserialize C++ class' instances.1-and 2-dimensional histograms (TH1x and TH2x) can be extracted from ROOT files using rootio, as well as n-tuple data (TTree).
go-hep/hbook and go-hep/hbook/ntup go-hep/hbook provides 1-and 2-dimensional histograms, 1-dim profiles and 2-dim scatters, for the statistical representation of variables.Notably, histograms allow to retrieve the mean, standard deviation, standard error and the sum of weights of a given variable.
go-hep/hbook/ntup provides a way to create, open and iterate over n-tuple data: rows of records.ntup can be seen as a database of HEP event data.Indeed, ntup is built on Go's database/sql package that allows to interact with various databases via plugins (SQLite, MySQL, …) go-hep/hbook/ntup/ntupcsv is a convenience package that allows to load a CSV file in memory and work on it as a database.

go-hep/hepmc, go-hep/hepevt, go-hep/heppdt, go-hep/lhef and go-hep/slha
go-hep/hepmc and go-hep/hepevt are packages used to represent HEP event interactions: they carry informations about a fundamental event interaction (incoming partons) and the decay chains, down to the hadronization and stable final particles.hepevt is the implementation of the old FORTRAN standard, while hepmc is the new C++ representation.hepmc files are usually the result of a Monte-Carlo generator where the simulation of physics processes (branching ratios, hadronization, …) has been implemented.Go-HEP doesn't currently provide Monte-Carlo generators.
heppdt provides access to the HEP particle data table: a catalog of informations (mass, width, …) about all particles of the Standard Model (and beyond the Standard Model.)lhef (Alwall et al. 2007) and slha (Skands and others 2004) are exchange format files for Monte-Carlo generators.

go-hep/fwk
fwk is a pure-Go, concurrent implementation of a typical HEP control framework.Control frameworks are used in HEP to collect the acquired data from e.g. the LHC experiments and channel it through the various reconstruction algorithms.Control frameworks are the angular stone of HEP experiments, allowing to organize and schedule the algorithms that identify and reconstruct electrons, muons, etc.. from electronic signals coming from the detectors.go-hep/fwk leverages the concurrency primitives of Go to provide an easy to use toolkit, ready to harness the power of multicore machines.go-hep/fwk parallelizes work at the event level, allowing to work on multiple events at a time.go-hep/fwk also parallelizes work at the sub-event level, scheduling in parallel algorithms that don't need inputs from each other.go-hep/fwk doesn't provide extra tools to perform parallel work at the subalgorithm level, leaving the algorithms' implementors with all the tools from the Go language (e.g.channels, goroutines and sync.Wait or golang.org/x/sync/errgroup.)

go-hep/fads
fads is a Fast Detector Simulation toolkit.It uses fwk to provide a concurrency-friendly toolkit that performs so-called fast-simulation of detectors, with components for: • particles' isolation • b-tagging, tau-tagging • calorimetry simulation • energy scaling and energy smearing • momentum smearing • particles propagation in a magnetic field • jets finding (using go-hep/fastjet) go-hep/fads is a pure-Go reimplementation of a C++ program called Delphes (Favereau et al. 2014).go-hep/fastjet is a pure-Go reimplementation of a C++ library called FastJet (Cacciari, Salam, and Soyez 2012).
go-hep/lcio, go-hep/sio and go-hep/rio lcio implements read/write access to the binary file format developed for the Linear Collider community.It is a pure-Go reimplementation of a C++ library of the same name (T.L. authors, n.d.).sio is the low-level access to this binary file format, lcio implements the event data model that has been used by the LC community.
go-hep/rio is a fork of lcio to provide 64b indexing and thus support >4Gb files.

go-hep/hplot
hplot is a package providing building blocks for creating plots.It leverages the Gonum (T.G. authors, n.d.) plotting package to create HEP oriented plots, using go-hep/hbook data as input.hplot can generate publication quality plots in PNG, SVG, PDF or EPS formats.hplot also provides a work-in-progress interactive shell with an OpenGL backend (on Linux or macOS; Windows will use the win32 API) to display plots.

Commands
Go-HEP also provides a few commands that use Go-HEP packages.

cmd/root2npy
The command root2npy uses the go-hep/rootio package to convert n-tuple data stored in ROOT files into NumPy (Kern, n.d.) array data files.This command does not need any ROOT installation nor any NumPy installation: everything has been implemented in pure-Go from first principles.This is useful to quickly convert data and interoperate with analyses' pipelines that are mostly python based.

cmd/root2yoda
The root2yoda command converts ROOT files containing histogram values into their YODA equivalent, saved in a YODA ASCII file.go-hep/rootio/cmd/root-ls and root-srv The root-ls command allows to quickly inspect and display the content of a ROOT file from the shell.
The root-srv command launches a local web server that can be used to inspect graphically ROOT files, displaying histograms and n-tuple data.
Go-HEP can also convert ROOT histograms into YODA's (T.Y. authors, n.d.) or Go-HEP's native format.go-hep/rootio is the gateway to the wealth of data generated, simulated and acquired by LHC experiments.Right now, go-hep/rootio can only read ROOT data.Work is in progress to also create ROOT-compatible data files.