{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "\n", "# CMS Open Data Example #3: Di-Muon Resonances\n", "
\n", "## Import Modules and Turn on Javascript" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "data": { "application/javascript": [ "\n", "require(['notebook'],\n", " function() {\n", " IPython.CodeCell.config_defaults.highlight_modes['magic_text/x-c++src'] = {'reg':[/^%%cpp/]};\n", " console.log(\"JupyROOT - %%cpp magic configured\");\n", " }\n", ");\n" ] }, "metadata": {}, "output_type": "display_data" }, { "name": "stdout", "output_type": "stream", "text": [ "Welcome to JupyROOT 6.07/07\n" ] } ], "source": [ "from ROOT import TTree, TFile, TCanvas, TH1F, TLorentzVector\n", "\n", "%jsroot on" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Read in Data from Input File" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "file = TFile(\"data/Dimuons.root\",\"READ\");" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Compute Di-Muon Invariant Mass\n", "Let's calculate again the invariant mass $M$ of two muons and focus on various parts of the dimuon mass spectrum" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Setup a Canvas" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "Canvas = TCanvas()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Declare Histograms\n", "For dimuon mass regions of interest 2.5-3.5 GeV and 80-100 GeV" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "J_psi = TH1F(\"J_psi\", \"#mu#mu mass;#mu#mu mass [GeV];Events\", 100, 2.5, 3.5)\n", "\n", "Z_boson = TH1F(\"Z_Boson\",\"#mu#mu mass;#mu#mu mass [GeV];Events\", 200, 80, 100)" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Loop Over the Events in the Data File\n", "### Compute Di-Muon Invariant Mass and Fill Histograms for Various Resonances" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [], "source": [ "for dimu in file.Dimuons:\n", " \n", " if dimu.Muon1_Global and dimu.Muon2_Global:\n", "\n", " muon1 = TLorentzVector(dimu.Muon1_Px, dimu.Muon1_Py, dimu.Muon1_Pz, dimu.Muon1_Energy)\n", " \n", " muon2 = TLorentzVector(dimu.Muon2_Px, dimu.Muon2_Py, dimu.Muon2_Pz, dimu.Muon2_Energy)\n", " \n", " InvariantMass = (muon1 + muon2).M()\n", " \n", " if InvariantMass > 2.0 and InvariantMass < 3.5:\n", " \n", " J_psi.Fill(InvariantMass)\n", " \n", " if InvariantMass > 60.0 and InvariantMass < 120.0:\n", " \n", " Z_boson.Fill(InvariantMass) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot the J/$\\psi$ Peak (Nobel Prize-Winning Discovery in 1974)\n", "" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "J_psi.Draw()\n", "\n", "Canvas.Draw()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plot the Z Boson Peak (Nobel Prize-Winning Discovery in 1983)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "Canvas.Clear()\n", "\n", "Z_boson.Draw()\n", "\n", "Canvas.Draw()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Compare with the Z boson discovery plot" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise: Can You Spot Other Di-Muon Resonances in the Dimuon Spectrum?\n", "### Make a Separate Histogram For Each One and Plot It" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from ROOT import TTree, TFile, TCanvas, TH1F, TLorentzVector\n", "\n", "%jsroot on\n", "\n", "file = TFile(\"data/Dimuons.root\",\"READ\");\n", "\n", "Canvas = TCanvas()\n", "\n", "Upsilon = TH1F(\"Upsilon\", \"#mu#mu mass;#mu#mu mass [GeV];Events\", 10, 8.5, 11)\n", "\n", "for dimu in file.Dimuons:\n", " \n", " if dimu.Muon1_Global and dimu.Muon2_Global:\n", "\n", " muon1 = TLorentzVector(dimu.Muon1_Px, dimu.Muon1_Py, dimu.Muon1_Pz, dimu.Muon1_Energy)\n", " \n", " muon2 = TLorentzVector(dimu.Muon2_Px, dimu.Muon2_Py, dimu.Muon2_Pz, dimu.Muon2_Energy)\n", " \n", " InvariantMass = (muon1 + muon2).M()\n", " \n", " if InvariantMass > 8.5 and InvariantMass < 11:\n", " \n", " Upsilon.Fill(InvariantMass)\n", " \n", "Upsilon.Draw()\n", "\n", "Canvas.Draw()" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "
\n", "
\n", "\n", "\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from ROOT import TTree, TFile, TCanvas, TH1F, TLorentzVector\n", "\n", "%jsroot on\n", "\n", "file = TFile(\"data/Dimuons.root\",\"READ\");\n", "\n", "Canvas = TCanvas()\n", "\n", "Psi2s = TH1F(\"Psi2s\", \"#mu#mu mass;#mu#mu mass [GeV];Events\", 20, 3.2, 4)\n", "\n", "for dimu in file.Dimuons:\n", " \n", " if dimu.Muon1_Global and dimu.Muon2_Global:\n", "\n", " muon1 = TLorentzVector(dimu.Muon1_Px, dimu.Muon1_Py, dimu.Muon1_Pz, dimu.Muon1_Energy)\n", " \n", " muon2 = TLorentzVector(dimu.Muon2_Px, dimu.Muon2_Py, dimu.Muon2_Pz, dimu.Muon2_Energy)\n", " \n", " InvariantMass = (muon1 + muon2).M()\n", " \n", " if InvariantMass > 3.2 and InvariantMass < 4:\n", " \n", " Psi2s.Fill(InvariantMass)\n", " \n", "Psi2s.Draw()\n", "\n", "Canvas.Draw()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }