Go to the documentation of this file.00001
00002
00003 import ROOT
00004 import sys
00005 from DataFormats.FWLite import Events, Handle
00006
00007
00008
00009 from FWCore.ParameterSet.VarParsing import VarParsing
00010 options = VarParsing ('python')
00011 options.parseArguments()
00012
00013
00014
00015
00016
00017
00018
00019 events = Events (options)
00020
00021
00022 handle = Handle ("std::vector<pat::Muon>")
00023
00024
00025
00026 label = ("selectedLayer1Muons")
00027
00028
00029 ROOT.gROOT.SetBatch()
00030 ROOT.gROOT.SetStyle('Plain')
00031 zmassHist = ROOT.TH1F ("zmass", "Z Candidate Mass", 50, 20, 220)
00032
00033
00034 for event in events:
00035
00036 event.getByLabel (label, handle)
00037
00038 muons = handle.product()
00039
00040 numMuons = len (muons)
00041 if muons < 2: continue
00042 for outer in xrange (numMuons - 1):
00043 outerMuon = muons[outer]
00044 for inner in xrange (outer + 1, numMuons):
00045 innerMuon = muons[inner]
00046 if outerMuon.charge() * innerMuon.charge() >= 0:
00047 continue
00048 inner4v = ROOT.TLorentzVector (innerMuon.px(), innerMuon.py(),
00049 innerMuon.pz(), innerMuon.energy())
00050 outer4v = ROOT.TLorentzVector (outerMuon.px(), outerMuon.py(),
00051 outerMuon.pz(), outerMuon.energy())
00052 zmassHist.Fill( (inner4v + outer4v).M() )
00053
00054
00055 c1 = ROOT.TCanvas()
00056 zmassHist.Draw()
00057 c1.Print ("zmass_py.png")