go-hep.org/x/hep@v0.38.1/groot/rhist/rhist.go (about) 1 // Copyright ©2018 The go-hep Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Package rhist contains the interfaces and definitions of ROOT types related 6 // to histograms and graphs. 7 package rhist // import "go-hep.org/x/hep/groot/rhist" 8 9 import ( 10 "go-hep.org/x/hep/groot/root" 11 ) 12 13 // Axis describes a ROOT TAxis. 14 type Axis interface { 15 root.Named 16 17 XMin() float64 18 XMax() float64 19 NBins() int 20 XBins() []float64 21 BinCenter(int) float64 22 BinLowEdge(int) float64 23 BinWidth(int) float64 24 } 25 26 // H1 is a 1-dim ROOT histogram 27 type H1 interface { 28 root.Named 29 30 isH1() 31 32 // Entries returns the number of entries for this histogram. 33 Entries() float64 34 // SumW returns the total sum of weights 35 SumW() float64 36 // SumW2 returns the total sum of squares of weights 37 SumW2() float64 38 // SumWX returns the total sum of weights*x 39 SumWX() float64 40 // SumWX2 returns the total sum of weights*x*x 41 SumWX2() float64 42 // SumW2s returns the array of sum of squares of weights 43 SumW2s() []float64 44 } 45 46 // H2 is a 2-dim ROOT histogram 47 type H2 interface { 48 root.Named 49 50 isH2() 51 52 // Entries returns the number of entries for this histogram. 53 Entries() float64 54 // SumW returns the total sum of weights 55 SumW() float64 56 // SumW2 returns the total sum of squares of weights 57 SumW2() float64 58 // SumWX returns the total sum of weights*x 59 SumWX() float64 60 // SumWX2 returns the total sum of weights*x*x 61 SumWX2() float64 62 // SumW2s returns the array of sum of squares of weights 63 SumW2s() []float64 64 // SumWY returns the total sum of weights*y 65 SumWY() float64 66 // SumWY2 returns the total sum of weights*y*y 67 SumWY2() float64 68 // SumWXY returns the total sum of weights*x*y 69 SumWXY() float64 70 } 71 72 // Graph describes a ROOT TGraph 73 type Graph interface { 74 root.Named 75 76 Len() int 77 XY(i int) (float64, float64) 78 } 79 80 // GraphErrors describes a ROOT TGraphErrors 81 type GraphErrors interface { 82 Graph 83 // XError returns two error values for X data. 84 XError(i int) (float64, float64) 85 // YError returns two error values for Y data. 86 YError(i int) (float64, float64) 87 } 88 89 // F1Composition describes a 1-dim functions composition. 90 type F1Composition interface { 91 root.Object 92 93 isF1Composition() // FIXME(sbinet): have a more useful interface? 94 // Eval(xs, ps []float64) float64 95 } 96 97 // MultiGraph describes a ROOT TMultiGraph 98 type MultiGraph interface { 99 root.Named 100 101 Graphs() []Graph 102 }