1 from PhysicsTools.Heppy.physicsobjects.Lepton
import Lepton
6 '''Loose ID as recommended by mu POG.'''
7 return self.physObj.isLooseMuon()
10 '''Tight ID as recommended by mu POG.'''
11 return self.
muonID(
"POG_ID_Tight")
14 if name ==
"" or name
is None:
16 if name.startswith(
"POG_"):
17 if name ==
"POG_ID_Loose":
return self.physObj.isLooseMuon()
19 vertex = getattr(self,
'associatedVertex',
None)
20 if name ==
"POG_ID_Tight":
return self.physObj.isTightMuon(vertex)
21 if name ==
"POG_ID_HighPt":
return self.physObj.isHighPtMuon(vertex)
22 if name ==
"POG_ID_Soft":
return self.physObj.isSoftMuon(vertex)
23 if name ==
"POG_ID_TightNoVtx":
return self.
looseId()
and \
24 self.isGlobalMuon()
and \
25 self.globalTrack().normalizedChi2() < 10
and \
26 self.globalTrack().hitPattern().numberOfValidMuonHits() > 0
and \
27 self.numberOfMatchedStations()>1
and \
28 self.innerTrack().hitPattern().numberOfValidPixelHits()>0
and \
29 self.innerTrack().hitPattern().trackerLayersWithMeasurement() > 5
30 if name ==
"POG_ID_Medium":
31 if not self.
looseId():
return False
32 goodGlb = self.physObj.isGlobalMuon()
and self.physObj.globalTrack().normalizedChi2() < 3
and self.physObj.combinedQuality().chi2LocalPosition < 12
and self.physObj.combinedQuality().trkKink < 20;
33 return self.physObj.innerTrack().validFraction() >= 0.8
and self.physObj.segmentCompatibility() >= (0.303
if goodGlb
else 0.451)
34 return self.physObj.muonID(name)
37 '''For a transparent treatment of electrons and muons. Returns -99'''
43 return self.absIsoFromEA(rho,self.eta(),effectiveAreas.muon)
47 def dxy(self, vertex=None):
48 '''either pass the vertex, or set associatedVertex before calling the function.
49 note: the function does not work with standalone muons as innerTrack
53 vertex = self.associatedVertex
54 return self.innerTrack().
dxy( vertex.position() )
57 def dz(self, vertex=None):
58 '''either pass the vertex, or set associatedVertex before calling the function.
59 note: the function does not work with standalone muons as innerTrack
63 vertex = self.associatedVertex
64 return self.innerTrack().
dz( vertex.position() )
67 if R == 0.3:
return self.physObj.pfIsolationR03().sumChargedHadronPt
68 elif R == 0.4:
return self.physObj.pfIsolationR04().sumChargedHadronPt
69 raise RuntimeError,
"Muon chargedHadronIso missing for R=%s" % R
72 if R == 0.3:
return self.physObj.pfIsolationR03().sumNeutralHadronEt
73 elif R == 0.4:
return self.physObj.pfIsolationR04().sumNeutralHadronEt
74 raise RuntimeError,
"Muon neutralHadronIso missing for R=%s" % R
77 if R == 0.3:
return self.physObj.pfIsolationR03().sumPhotonEt
78 elif R == 0.4:
return self.physObj.pfIsolationR04().sumPhotonEt
79 raise RuntimeError,
"Muon photonIso missing for R=%s" % R
82 if R == 0.3:
return self.physObj.pfIsolationR03().sumChargedParticlePt
83 elif R == 0.4:
return self.physObj.pfIsolationR04().sumChargedParticlePt
84 raise RuntimeError,
"Muon chargedAllIso missing for R=%s" % R
90 if R == 0.3:
return self.physObj.pfIsolationR03().sumPUPt
91 elif R == 0.4:
return self.physObj.pfIsolationR04().sumPUPt
92 raise RuntimeError,
"Muon chargedHadronIso missing for R=%s" % R