{
"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": 3,
"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": 4,
"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": [
"## Exercise: Can You Spot Other Di-Muon Resonances in the Dimuon Spectrum?\n",
"### Plot a Gaussian Curve for Each Resonance "
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"Upsilon = TH1F(\"ϒ\", \"#mu#mu mass;#mu#mu mass [GeV];Events\", 100, 8.0, 12.5)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"for dimu in file.Dimuons:\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",
" Invariant_Mass = (muon1+muon2).M()\n",
" \n",
" if Invariant_Mass > 0.0 and Invariant_Mass < 120.0:\n",
" \n",
" Upsilon.Fill(Invariant_Mass)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from ROOT import TF1, kGreen, kRed, kYellow, kOrange\n",
"\n",
"Canvas = TCanvas()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" FCN=129.611 FROM MIGRAD STATUS=CONVERGED 79 CALLS 80 TOTAL\n",
" EDM=3.72629e-07 STRATEGY= 1 ERROR MATRIX ACCURATE \n",
" EXT PARAMETER STEP FIRST \n",
" NO. NAME VALUE ERROR SIZE DERIVATIVE \n",
" 1 Constant 2.23626e+03 2.67862e+01 1.05039e-01 3.01623e-05\n",
" 2 Mean 9.44597e+00 1.47445e-03 7.95168e-06 -6.01384e-02\n",
" 3 Sigma 1.29456e-01 1.92562e-03 2.21217e-05 2.14839e-01\n",
"\n",
"****************************************\n",
"Minimizer is Linear\n",
"Chi2 = 5823.89\n",
"NDf = 97\n",
"p0 = -11545.9 +/- 169.277 \n",
"p1 = 2289.96 +/- 34.3334 \n",
"p2 = -104.204 +/- 1.7093 \n",
" FCN=92.7142 FROM MIGRAD STATUS=CONVERGED 101 CALLS 102 TOTAL\n",
" EDM=7.87272e-08 STRATEGY= 1 ERROR MATRIX ACCURATE \n",
" EXT PARAMETER STEP FIRST \n",
" NO. NAME VALUE ERROR SIZE DERIVATIVE \n",
" 1 Constant 1.26738e+03 1.67043e+01 5.54257e-02 -1.62258e-05\n",
" 2 Mean 1.00214e+01 5.58077e-03 1.93186e-05 1.64938e-02\n",
" 3 Sigma 2.48927e-01 8.95793e-03 4.57262e-05 6.26346e-03\n",
" FCN=0.83442 FROM MIGRAD STATUS=CONVERGED 131 CALLS 132 TOTAL\n",
" EDM=3.96479e-10 STRATEGY= 1 ERROR MATRIX ACCURATE \n",
" EXT PARAMETER STEP FIRST \n",
" NO. NAME VALUE ERROR SIZE DERIVATIVE \n",
" 1 Constant 1.18081e+03 2.76034e+01 1.15695e-02 -9.96052e-07\n",
" 2 Mean 1.03421e+01 1.03389e-02 6.82040e-06 1.07995e-03\n",
" 3 Sigma 1.85942e-01 4.67600e-02 8.20126e-05 -2.13027e-04\n"
]
},
{
"data": {
"text/html": [
"\n",
"