3 from builtins
import range
6 from DataFormats.FWLite
import Events, Handle
10 from FWCore.ParameterSet.VarParsing
import VarParsing
11 options = VarParsing (
'python')
12 options.parseArguments()
20 events = Events (options)
25 handle = Handle (
"std::vector<pat::Muon>")
29 label = (
"slimmedMuons")
33 ROOT.gROOT.SetStyle(
'Plain')
34 zmassHist = ROOT.TH1F (
"zmass",
"Z Candidate Mass", 50, 20, 220)
39 event.getByLabel (label, handle)
41 muons = handle.product()
43 numMuons = len (muons)
44 if numMuons < 2:
continue 45 for outer
in range (numMuons - 1):
46 outerMuon = muons[outer]
47 for inner
in range (outer + 1, numMuons):
48 innerMuon = muons[inner]
49 if outerMuon.charge() * innerMuon.charge() >= 0:
51 inner4v = ROOT.TLorentzVector (innerMuon.px(), innerMuon.py(),
52 innerMuon.pz(), innerMuon.energy())
53 outer4v = ROOT.TLorentzVector (outerMuon.px(), outerMuon.py(),
54 outerMuon.pz(), outerMuon.energy())
55 zmassHist.Fill( (inner4v + outer4v).M() )
60 c1.Print (
"zmass_py.png")