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)
23 handle = Handle (
"std::vector<pat::Muon>")
27 label = (
"selectedLayer1Muons")
31 ROOT.gROOT.SetStyle(
'Plain')
32 zmassHist = ROOT.TH1F (
"zmass",
"Z Candidate Mass", 50, 20, 220)
37 event.getByLabel (label, handle)
39 muons = handle.product()
41 numMuons = len (muons)
42 if muons < 2:
continue 43 for outer
in range (numMuons - 1):
44 outerMuon = muons[outer]
45 for inner
in range (outer + 1, numMuons):
46 innerMuon = muons[inner]
47 if outerMuon.charge() * innerMuon.charge() >= 0:
49 inner4v = ROOT.TLorentzVector (innerMuon.px(), innerMuon.py(),
50 innerMuon.pz(), innerMuon.energy())
51 outer4v = ROOT.TLorentzVector (outerMuon.px(), outerMuon.py(),
52 outerMuon.pz(), outerMuon.energy())
53 zmassHist.Fill( (inner4v + outer4v).M() )
58 c1.Print (
"zmass_py.png")