5 from DataFormats.FWLite
import Events, Handle
9 from FWCore.ParameterSet.VarParsing
import VarParsing
10 options = VarParsing (
'python')
11 options.parseArguments()
19 events = Events (options)
22 handle = Handle (
"std::vector<pat::Muon>")
26 label = (
"selectedLayer1Muons")
30 ROOT.gROOT.SetStyle(
'Plain')
31 zmassHist = ROOT.TH1F (
"zmass",
"Z Candidate Mass", 50, 20, 220)
36 event.getByLabel (label, handle)
38 muons = handle.product()
40 numMuons = len (muons)
41 if muons < 2:
continue 42 for outer
in xrange (numMuons - 1):
43 outerMuon = muons[outer]
44 for inner
in xrange (outer + 1, numMuons):
45 innerMuon = muons[inner]
46 if outerMuon.charge() * innerMuon.charge() >= 0:
48 inner4v = ROOT.TLorentzVector (innerMuon.px(), innerMuon.py(),
49 innerMuon.pz(), innerMuon.energy())
50 outer4v = ROOT.TLorentzVector (outerMuon.px(), outerMuon.py(),
51 outerMuon.pz(), outerMuon.energy())
52 zmassHist.Fill( (inner4v + outer4v).M() )
57 c1.Print (
"zmass_py.png")