CMS Open Data Example #4: Di-Electron Resonances


Import Modules and Turn on Javascript

In [12]:
from ROOT import TFile, TCanvas, TH1F, TLorentzVector, TH2F

%jsroot on

Read in Data from Input File

In [2]:
file = TFile("data/Dielectrons.root","READ");

Compute Di-Electron Invariant Mass

Let's calculate the invariant mass $M$ of two electrons

Setup a Canvas

In [3]:
Canvas = TCanvas()

Declare Histograms

In [4]:
histogram = TH1F("Invariant Mass","ee mass; ee mass [GeV];Events", 900, 2, 110)

Loop Over the Events in the Data File

Compute Di-Electron Invariant Mass

In [5]:
for diele in file.Dielectrons:
    
    electron1 = TLorentzVector(diele.Electron1_Px, diele.Electron1_Py, diele.Electron1_Pz, diele.Electron1_Energy)
    
    electron2 = TLorentzVector(diele.Electron2_Px, diele.Electron2_Py, diele.Electron2_Pz, diele.Electron2_Energy)
    
    InvariantMass = (electron1 + electron2).M()
            
    histogram.Fill(InvariantMass)    

Plot the Di-Electron Invariant Mass Spectrum

In [6]:
histogram.Draw()

Canvas.SetLogy()

Canvas.Draw()

Di-Electrons Exercise:

Can You Spot the Di-Electron Resonances?

Make a Histogram For Each One

In [14]:
dielectroncharge = TH2F("dielectroncharge", "charge comparison; electron 1 charge; electron 2 charge", 10, -2, 2, 10, -2, 2)
In [ ]:
 
In [ ]: