{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Test Histogramm Fitting in pyROOT" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Welcome to JupyROOT 6.26/06\n" ] } ], "source": [ "import numpy as np\n", "import math\n", "#import ROOT\n", "from ROOT import TCanvas, TFile, TProfile, TNtuple, TH1D, TH2D, TF1 \n", "from ROOT import gROOT, gBenchmark, gRandom, gSystem" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "Read data previously used from text file and put it in a numpy array" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[1856.8 1851.73 1881.17 ... 1866.36 1847.02 1854.15]\n" ] } ], "source": [ "data = np.genfromtxt('D0Mass.txt', dtype='d')\n", "print(data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Create histogramm and draw" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "%jsroot on" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "d0 = TH1D( 'd0', 'D0 Mass ', 200, 1700. , 2000. )\n", "for x in data :\n", " d0.Fill(x)\n", "c = TCanvas( 'myC', 'Dynamic Filling Example',700, 500 )\n", "d0.Draw()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To display the notebook draw the canvas." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "