go-hep.org/x/hep@v0.38.1/joss-paper/paper.md (about) 1 --- 2 title: 'Go-HEP: libraries for High Energy Physics analyses in Go' 3 tags: 4 - Go 5 - ROOT 6 - CERN 7 - Gonum 8 authors: 9 - name: Sebastien Binet 10 orcid: 0000-0003-4913-6104 11 affiliation: 1 12 - name: Bastian Wieck 13 orcid: 0000-0001-6658-6807 14 affiliation: 3 15 - name: David Blyth 16 orcid: 0000-0001-8452-516X 17 affiliation: 2 18 - name: Emmanuel Busato 19 orcid: 0000-0003-2174-8512 20 affiliation: 1 21 - name: Michaƫl Ughetto 22 orcid: 0000-0002-3814-454X 23 affiliation: 4 24 - name: Peter Waller 25 affiliation: 5 26 affiliations: 27 - name: IN2P3 28 index: 1 29 - name: Argonne National Laboratory 30 index: 2 31 - name: Georgia Southern University 32 index: 3 33 - name: Stockholm University 34 index: 4 35 - name: University of Liverpool 36 index: 5 37 date: 6 September 2017 38 bibliography: paper.bib 39 --- 40 41 # Summary 42 43 Go-HEP provides tools to interface with CERN's ROOT [@ROOT] software 44 framework and carry analyses or data acquisition from within the Go [@Go] 45 programming language. 46 47 Go-HEP exposes libraries to read and write common High Energy Physics (HEP) 48 file formats (HepMC [@HepMC], LHEF [@LHEF], SLHA [@SLHA]) but, at the 49 moment, only read interoperability is achieved with ROOT file format. 50 Go-HEP also provides tools to carry statistical analyses in the form of 51 1-dim and 2-dim histograms, 1-dim and 2-dim scatters and n-tuples. 52 Go-HEP can also graphically represent these results, leveraging the 53 Gonum [@Gonum] plotting library. 54 55 # Motivations 56 57 Writing analyses in HEP involves many steps and one needs a few tools to 58 successfully carry out such an endeavour. 59 But - at minima - one needs to be able to read (and possibly write) ROOT files 60 to be able to interoperate with the rest of the HEP community or to insert 61 one's work into an already existing analysis pipeline. 62 63 Go-HEP provides this necessary interoperability layer, in the Go programming 64 language. 65 This allows physicists to leverage the great concurrency primitives of Go, 66 together with the surrounding tooling and software engineering ecosystem of Go, 67 to implement physics analyses. 68 69 ## Packages 70 71 In this section, we list the packages that Go-HEP provides together with a 72 short description. 73 74 ### `go-hep/groot` 75 76 `go-hep/groot` provides read access to data stored in ROOT files. 77 `groot` is a pure-Go implementation of the ROOT file format, reimplementing 78 from scratch the decoding and interpretation of ROOT's low-level file blocks 79 (`TDirectory`, `TKey`, `TBuffer` and `TFile`) together with file metadata, 80 such as `TStreamerInfo` and `TStreamerElement` that allow to serialize and 81 deserialize C++ class' instances. 82 1- and 2-dimensional histograms (`TH1x` and `TH2x`) can be extracted from 83 ROOT files using `groot`, as well as n-tuple data (`TTree`). 84 Go-HEP can also convert ROOT histograms into YODA's [@YODA] or Go-HEP's native 85 format. 86 87 `go-hep/groot` is the gateway to the wealth of data generated, simulated and 88 acquired by LHC experiments. 89 90 Right now, `go-hep/groot` can only read ROOT data. 91 Work is in progress to also create ROOT-compatible data files. 92 93 ### `go-hep/fmom` 94 95 The `go-hep/fmom` package provides different representations of Lorentz vectors 96 (4-components vectors that represent the momentum and energy of particles.) 97 `go-hep/fmom` currently implements the `(px,py,pz,e)`, `(e,eta,phi,m)`, 98 `(inv-pt, cot-theta, phi, m)` and `(pt, eta, phi, m)` Lorentz vector 99 representations and operations that apply on these 4-vectors. 100 101 ### `go-hep/hbook` and `go-hep/hbook/ntup` 102 103 `go-hep/hbook` provides 1- and 2-dimensional histograms, 1-dim profiles and 104 2-dim scatters, for the statistical representation of variables. 105 Notably, histograms allow to retrieve the mean, standard deviation, 106 standard error and the sum of weights of a given variable. 107 108 `go-hep/hbook/ntup` provides a way to create, open and iterate over n-tuple 109 data: rows of records. 110 `ntup` can be seen as a database of HEP event data. 111 Indeed, `ntup` is built on Go's `database/sql` package that allows to interact 112 with various databases via plugins (`SQLite`, `MySQL`, ...) 113 `go-hep/hbook/ntup/ntupcsv` is a convenience package that allows to load a `CSV` 114 file in memory and work on it as a database. 115 116 ### `go-hep/hepmc`, `go-hep/hepevt`, `go-hep/heppdt`, `go-hep/lhef` and `go-hep/slha` 117 118 `go-hep/hepmc` and `go-hep/hepevt` are packages used to represent HEP event 119 interactions: they carry informations about a fundamental event interaction 120 (incoming partons) and the decay chains, down to the hadronization and stable 121 final particles. 122 `hepevt` is the implementation of the old `FORTRAN` standard, while `hepmc` is 123 the new `C++` representation. 124 `hepmc` files are usually the result of a Monte-Carlo generator where the 125 simulation of physics processes (branching ratios, hadronization, ...) has been 126 implemented. 127 Go-HEP doesn't currently provide Monte-Carlo generators. 128 129 `heppdt` provides access to the HEP particle data table: a catalog of 130 informations (mass, width, ...) about all particles of the Standard Model (and 131 beyond the Standard Model.) 132 133 `lhef` [@LHEF] and `slha` [@SLHA] are exchange format files for Monte-Carlo 134 generators. 135 136 ### `go-hep/fwk` 137 138 `fwk` is a pure-Go, concurrent implementation of a typical HEP control 139 framework. 140 Control frameworks are used in HEP to collect the acquired data from _e.g._ the 141 LHC experiments and channel it through the various reconstruction algorithms. 142 Control frameworks are the angular stone of HEP experiments, allowing to 143 organize and schedule the algorithms that identify and reconstruct electrons, 144 muons, etc.. from electronic signals coming from the detectors. 145 146 `go-hep/fwk` leverages the concurrency primitives of Go to provide an easy 147 to use toolkit, ready to harness the power of multicore machines. 148 `go-hep/fwk` parallelizes work at the event level, allowing to work on multiple 149 events at a time. 150 `go-hep/fwk` also parallelizes work at the sub-event level, scheduling in 151 parallel algorithms that don't need inputs from each other. 152 `go-hep/fwk` doesn't provide extra tools to perform parallel work at the 153 sub-algorithm level, leaving the algorithms' implementors with all the tools 154 from the Go language (_e.g._ `channels`, `goroutines` and `sync.Wait` or 155 `golang.org/x/sync/errgroup`.) 156 157 ### `go-hep/fads` 158 159 `fads` is a Fast Detector Simulation toolkit. 160 It uses `fwk` to provide a concurrency-friendly toolkit that performs so-called 161 fast-simulation of detectors, with components for: 162 163 - particles' isolation 164 - b-tagging, tau-tagging 165 - calorimetry simulation 166 - energy scaling and energy smearing 167 - momentum smearing 168 - particles propagation in a magnetic field 169 - jets finding (using `go-hep/fastjet`) 170 171 `go-hep/fads` is a pure-Go reimplementation of a `C++` program called Delphes [@Delphes]. 172 `go-hep/fastjet` is a pure-Go reimplementation of a `C++` library called FastJet [@FastJet]. 173 174 ### `go-hep/lcio`, `go-hep/sio` and `go-hep/rio` 175 176 `lcio` implements read/write access to the binary file format developed for 177 the Linear Collider community. 178 It is a pure-Go reimplementation of a C++ library of the same name [@LCIO]. 179 `sio` is the low-level access to this binary file format, `lcio` implements 180 the event data model that has been used by the LC community. 181 182 `go-hep/rio` is a fork of `lcio` to provide 64b indexing and thus support >4Gb files. 183 184 ### `go-hep/hplot` 185 186 `hplot` is a package providing building blocks for creating plots. 187 It leverages the Gonum [@Gonum] plotting package to create HEP oriented plots, 188 using `go-hep/hbook` data as input. 189 `hplot` can generate publication quality plots in PNG, SVG, PDF or EPS formats. 190 `hplot` also provides a work-in-progress interactive shell with an OpenGL backend 191 (on Linux or macOS; Windows will use the `win32` API) to display plots. 192 193 ## Commands 194 195 Go-HEP also provides a few commands that use Go-HEP packages. 196 197 ### `cmd/root2npy` 198 199 The command `root2npy` uses the `go-hep/groot` package to convert n-tuple data 200 stored in ROOT files into NumPy [@NPyFormat] array data files. 201 This command does not need any ROOT installation nor any NumPy installation: 202 everything has been implemented in pure-Go from first principles. 203 This is useful to quickly convert data and interoperate with analyses' 204 pipelines that are mostly python based. 205 206 ### `cmd/root2yoda` 207 208 The `root2yoda` command converts ROOT files containing histogram values into 209 their YODA equivalent, saved in a YODA ASCII file. 210 211 ### `go-hep/groot/cmd/root-ls` and `root-srv` 212 213 The `root-ls` command allows to quickly inspect and display the content of a 214 ROOT file from the shell. 215 216 The `root-srv` command launches a local web server that can be used to 217 inspect graphically ROOT files, displaying histograms and n-tuple data. 218 219 # References 220