{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import (\n", " \"os\"\n", " \"path/filepath\"\n", " \n", " \"go-hep.org/x/hep/hbook/rootcnv\"\n", " \"go-hep.org/x/hep/rootio\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fname := filepath.Join(os.Getenv(\"GOPATH\"), \"src\", \"go-hep.org/x/hep/hbook/rootcnv/testdata/gauss-h1.root\")\n", "f, err := rootio.Open(fname)\n", "if err != nil {\n", " panic(err)\n", "}\n", "defer f.Close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "printf(\"keys: %v\\n\", f.Keys())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "h1, err := f.Get(\"h1f\")\n", "if err != nil {\n", " panic(err)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "h1f, err := rootcnv.H1D(h1.(rootio.H1))\n", "if err != nil {\n", " panic(err)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import (\n", " \"image/color\"\n", " \"go-hep.org/x/hep/hplot\"\n", ")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "p := hplot.New()\n", "p.Title.Text = \"Histogram 1D\"\n", "hh := hplot.NewH1D(h1f)\n", "hh.Color = color.RGBA{R: 0xff, A: 255}\n", "hh.Infos.Style = hplot.HInfoSummary\n", "p.Add(hh)\n", "p.Add(hplot.NewGrid())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hplot.Show(p, 640, -1, \"png\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "f.Close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "fname = filepath.Join(os.Getenv(\"GOPATH\"), \"src\", \"go-hep.org/x/hep/hbook/rootcnv/testdata/gauss-h2.root\")\n", "f, err = rootio.Open(fname)\n", "if err != nil {\n", " panic(err)\n", "}\n", "defer f.Close()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "printf(\"keys: %v\\n\", f.Keys())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "h2, err := f.Get(\"h2f\")\n", "if err != nil {\n", " panic(err)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "h2f, err := rootcnv.H2D(h2.(rootio.H2))\n", "if err != nil {\n", " panic(err)\n", "}" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "p = hplot.New()\n", "p.Title.Text = \"Histogram 2D\"\n", "p.Add(hplot.NewH2D(h2f, nil))\n", "p.Add(hplot.NewGrid())" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hplot.Show(p, 640, -1, \"png\")" ] } ], "metadata": { "kernelspec": { "display_name": "Neugram", "language": "neugram", "name": "neugram" }, "language_info": { "codemirror_mode": "go", "file_extension": ".ng", "mimetype": "", "name": "neugram", "nbconvert_exporter": "", "pygments_lexer": "go", "version": "unreleased" } }, "nbformat": 4, "nbformat_minor": 2 }