CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ZMuMuAnalyzer.py
Go to the documentation of this file.
1 from PhysicsTools.Heppy.analyzers.DiLeptonAnalyzer import DiLeptonAnalyzer
2 from PhysicsTools.Heppy.analyzers.AutoHandle import AutoHandle
3 from PhysicsTools.Heppy.physicsobjects.DiObject import DiMuon
4 from PhysicsTools.Heppy.physicsobjects.PhysicsObjects import Muon
5 
6 
8 
9  DiObjectClass = DiMuon
10  LeptonClass = Muon
11 
12  def declareHandles(self):
13  super(ZMuMuAnalyzer, self).declareHandles()
14  print 'ZMuMuAnalyzer.declareHandles'
15  self.handles['diLeptons'] = AutoHandle(
16  'cmgDiMuonSel',
17  'std::vector<cmg::DiObject<cmg::Muon,cmg::Muon>>'
18  )
19  self.handles['leptons'] = AutoHandle(
20  'cmgMuonSel',
21  'std::vector<cmg::Muon>'
22  )
23  self.handles['otherLeptons'] = AutoHandle(
24  'cmgElectronSel',
25  'std::vector<cmg::Electron>'
26  )
27 
28 
29  def buildDiLeptons(self, cmgDiLeptons, event):
30  '''Build di-leptons, associate best vertex to both legs,
31  select di-leptons with a tight ID muon.
32  The tight ID selection is done so that dxy and dz can be computed
33  (the muon must not be standalone).
34  '''
35  diLeptons = []
36  for index, dil in enumerate(cmgDiLeptons):
37  pydil = self.__class__.DiObjectClass(dil)
38  pydil.leg1().associatedVertex = event.goodVertices[0]
39  pydil.leg2().associatedVertex = event.goodVertices[0]
40  diLeptons.append( pydil )
41  return diLeptons
42 
43 
44  def buildLeptons(self, cmgLeptons, event):
45  return []
46 
47 
48  def buildOtherLeptons(self, cmgLeptons, event):
49  return []
50 
51 
52  def testVertex(self, lepton):
53  '''Tests vertex constraints, for mu and tau'''
54  return abs(lepton.dxy()) < 0.045 and \
55  abs(lepton.dz()) < 0.2
56 
57 
58  def testMuonIso(self, muon, isocut ):
59  '''dbeta corrected pf isolation with all charged particles instead of
60  charged hadrons'''
61  return muon.relIsoAllChargedDB05()<isocut
62 
63  testLeg1Iso = testMuonIso
64  testLeg2Iso = testMuonIso
65 
66  def testMuonID(self, muon):
67  '''Tight muon selection, no isolation requirement'''
68  # import pdb; pdb.set_trace()
69  return muon.tightId() and \
70  self.testVertex( muon )
71 
72 
73  testLeg1ID = testMuonID
74  testLeg2ID = testMuonID
Abs< T >::type abs(const T &t)
Definition: Abs.h:22