{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# PyROOT Exercise 1: Histogram Drawing" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise\n", "\n", "Write a python macro `ExerciseHist.py`.\n", "\n", "1. Open the `Zmumu.root` file and load the tree called `physics`.\n", "2. Create two histograms with 40 bins ranging from 0 to 0.2 GeV to plot the muon masses.\n", "3. Fill the histograms with leading and subleading muon mass from branches `lep1_m` and `lep2_m`.\n", "4. Calculate the mean values and RMSs.\n", "5. Calculate the integrals.\n", "\n", "Bonus questions:\n", "1. Are the integrals the same and why?\n", "2. Write the histogram to a file." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Solution" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Welcome to JupyROOT 6.28/00\n" ] } ], "source": [ "import ROOT\n", "%jsroot on" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Leading muon mass: mean=0.105476; rms=0.007434\n", "Subleading muon mass: mean=0.105479; rms=0.005120\n", "Leading muon mass integral: 2495706.0\n", "Subleading muon mass integral: 2496792.0\n" ] }, { "data": { "text/html": [ "\n", "\n", "