Simple pyROOT notebook example using TLorentz Vectors

In [1]:
import ROOT
Welcome to JupyROOT 6.08/04
In [2]:
## f = ROOT.TFile.Open("mc_105986.ZZ.root")
## f = ROOT.TFile.Open("mc_147770.Zee.root")
f = ROOT.TFile.Open("")
In [3]:
c = ROOT.TCanvas("testCanvas","a first way to plot a variable",800,600)
In [4]:
t = f.Get("mini")
In [5]:
h = ROOT.TH1F("variable","Example plot: Number of Leptons",4,0,4)
In [ ]:
h_Mll = ROOT.TH1F("h_Mll","Invariant mass of the two Leptons",50,0,200)
In [ ]:
for event in t:
    """This is the cut #1: request at least 2 leptons"""
    if t.lep_n > 1:
        """Let's define one TLorentz vector for each, e.i. two vectors!"""
        leadingLep = ROOT.TLorentzVector(t.lep_pt[0], t.lep_eta[0], t.lep_phi[0], t.lep_E[0])
        secondLep  = ROOT.TLorentzVector(t.lep_pt[1], t.lep_eta[1], t.lep_phi[1], t.lep_E[1])

        """Next line does the addition of the two TLorentz vectors above and so,
           we can ask the mass very easy"""
        TL_ll = leadingLep + secondLep
        """We devide the value of the combined vector by 1000 to get the value in GeV"""
        mll = TL_ll.M()/1000.

print "Done!"
In [ ]:
"""Now les't plot the mass of the lepton-lepton system"""
In [ ]: