CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
Muon.Muon Class Reference
Inheritance diagram for Muon.Muon:

Public Member Functions

def __init__
 
def absIsoWithFSR
 
def chargedAllIso
 
def chargedAllIsoR
 
def chargedHadronIsoR
 
def dxy
 
def dz
 
def edxy
 
def edz
 
def looseId
 
def muonID
 
def mvaId
 
def neutralHadronIsoR
 
def photonIsoR
 
def puChargedHadronIsoR
 
def setTrackForDxyDz
 
def tightId
 

Private Attributes

 _trackForDxyDz
 

Detailed Description

Definition at line 4 of file Muon.py.

Constructor & Destructor Documentation

def Muon.Muon.__init__ (   self,
  args,
  kwargs 
)

Definition at line 5 of file Muon.py.

5 
6  def __init__(self, *args, **kwargs):
7  super(Muon, self).__init__(*args, **kwargs)
8  self._trackForDxyDz = "muonBestTrack"
def __init__
Definition: Muon.py:5
_trackForDxyDz
Definition: Muon.py:7

Member Function Documentation

def Muon.Muon.absIsoWithFSR (   self,
  R = 0.4,
  puCorr = "deltaBeta",
  dBetaFactor = 0.5 
)
Calculate Isolation, subtract FSR, apply specific PU corrections" 

Definition at line 108 of file Muon.py.

References Muon.Muon.chargedHadronIsoR(), Electron.Electron.chargedHadronIsoR(), deltaR(), bookConverter.max, Muon.Muon.neutralHadronIsoR(), Electron.Electron.neutralHadronIsoR(), Muon.Muon.photonIsoR(), Electron.Electron.photonIsoR(), Muon.Muon.puChargedHadronIsoR(), Electron.Electron.puChargedHadronIsoR(), python.rootplot.root2matplotlib.replace(), Photon.Photon.rho, Electron.Electron.rho, BinomialProbHelper.rho(), CalorimeterProperties.rho(), PreshowerProperties.rho(), ECALProperties.rho(), TauValidation.rho, TangentCircle.rho(), HCALProperties.rho(), TangentHelix.rho(), MaterialEffectsSimulator.rho(), QcdLowPtDQM::Pixel.rho(), FastCircle.rho(), reco::GhostTrackPrediction.rho(), StoredPileupJetIdentifier.rho(), fastjet::BackgroundEstimator.rho(), reco::CastorCell.rho(), CylindricalState.rho(), reco::CastorJet.rho(), reco::CastorEgamma.rho(), reco::CastorTower.rho(), reco::CastorCluster.rho(), GeometricDet.rho(), AlignmentMonitorMuonSystemMap1D::MyResidual.rho, and objects.JetAnalyzer.JetAnalyzer.rho.

109  def absIsoWithFSR(self, R=0.4, puCorr="deltaBeta", dBetaFactor=0.5):
110  '''
111  Calculate Isolation, subtract FSR, apply specific PU corrections"
112  '''
113  photonIso = self.photonIsoR(R)
114  if hasattr(self,'fsrPhotons'):
115  for gamma in self.fsrPhotons:
116  dr = deltaR(gamma.eta(), gamma.phi(), self.physObj.eta(), self.physObj.phi())
117  if dr > 0.01 and dr < R:
118  photonIso = max(photonIso-gamma.pt(),0.0)
119  if puCorr == "deltaBeta":
120  offset = dBetaFactor * self.puChargedHadronIsoR(R)
121  elif puCorr == "rhoArea":
122  offset = self.rho*getattr(self,"EffectiveArea"+(str(R).replace(".","")))
123  elif puCorr in ["none","None",None]:
124  offset = 0
125  else:
126  raise RuntimeError("Unsupported PU correction scheme %s" % puCorr)
127  return self.chargedHadronIsoR(R)+max(0.,photonIso+self.neutralHadronIsoR(R)-offset)
def chargedHadronIsoR
Definition: Muon.py:79
def absIsoWithFSR
Definition: Muon.py:108
def neutralHadronIsoR
Definition: Muon.py:84
def photonIsoR
Definition: Muon.py:89
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
def puChargedHadronIsoR
Definition: Muon.py:102
def Muon.Muon.chargedAllIso (   self)

Definition at line 99 of file Muon.py.

References Muon.Muon.chargedAllIsoR(), and Electron.Electron.chargedAllIsoR().

99 
100  def chargedAllIso(self):
101  return self.chargedAllIsoR()
def chargedAllIso
Definition: Muon.py:99
def chargedAllIsoR
Definition: Muon.py:94
def Muon.Muon.chargedAllIsoR (   self,
  R = 0.4 
)

Definition at line 94 of file Muon.py.

Referenced by Lepton.Lepton.absIsoR(), and Muon.Muon.chargedAllIso().

94 
95  def chargedAllIsoR(self,R=0.4):
96  if R == 0.3: return self.physObj.pfIsolationR03().sumChargedParticlePt
97  elif R == 0.4: return self.physObj.pfIsolationR04().sumChargedParticlePt
98  raise RuntimeError("Muon chargedAllIso missing for R=%s" % R)
def chargedAllIsoR
Definition: Muon.py:94
def Muon.Muon.chargedHadronIsoR (   self,
  R = 0.4 
)

Definition at line 79 of file Muon.py.

Referenced by Lepton.Lepton.absIsoR(), and Muon.Muon.absIsoWithFSR().

79 
80  def chargedHadronIsoR(self,R=0.4):
81  if R == 0.3: return self.physObj.pfIsolationR03().sumChargedHadronPt
82  elif R == 0.4: return self.physObj.pfIsolationR04().sumChargedHadronPt
83  raise RuntimeError("Muon chargedHadronIso missing for R=%s" % R)
def chargedHadronIsoR
Definition: Muon.py:79
def Muon.Muon.dxy (   self,
  vertex = None 
)
either pass the vertex, or set associatedVertex before calling the function.
note: the function does not work with standalone muons as innerTrack
is not available.

Definition at line 52 of file Muon.py.

References Muon.Muon._trackForDxyDz, Electron.Electron.associatedVertex, and reco::tau::RecoTauVertexAssociator.associatedVertex().

52 
53  def dxy(self, vertex=None):
54  '''either pass the vertex, or set associatedVertex before calling the function.
55  note: the function does not work with standalone muons as innerTrack
56  is not available.
57  '''
58  if vertex is None:
59  vertex = self.associatedVertex
60  return getattr(self,self._trackForDxyDz)().dxy( vertex.position() )
def dxy
Definition: Muon.py:52
_trackForDxyDz
Definition: Muon.py:7
def Muon.Muon.dz (   self,
  vertex = None 
)
either pass the vertex, or set associatedVertex before calling the function.
note: the function does not work with standalone muons as innerTrack
is not available.

Definition at line 66 of file Muon.py.

References Muon.Muon._trackForDxyDz, Electron.Electron.associatedVertex, and reco::tau::RecoTauVertexAssociator.associatedVertex().

66 
67  def dz(self, vertex=None):
68  '''either pass the vertex, or set associatedVertex before calling the function.
69  note: the function does not work with standalone muons as innerTrack
70  is not available.
71  '''
72  if vertex is None:
73  vertex = self.associatedVertex
74  return getattr(self,self._trackForDxyDz)().dz( vertex.position() )
_trackForDxyDz
Definition: Muon.py:7
def dz
Definition: Muon.py:66
def Muon.Muon.edxy (   self)
returns the uncertainty on dxy (from gsf track)

Definition at line 61 of file Muon.py.

References Muon.Muon._trackForDxyDz.

61 
62  def edxy(self):
63  '''returns the uncertainty on dxy (from gsf track)'''
64  return getattr(self,self._trackForDxyDz)().dxyError()
65 
def edxy
Definition: Muon.py:61
_trackForDxyDz
Definition: Muon.py:7
def Muon.Muon.edz (   self)
returns the uncertainty on dxz (from gsf track)

Definition at line 75 of file Muon.py.

References Muon.Muon._trackForDxyDz.

75 
76  def edz(self):
77  '''returns the uncertainty on dxz (from gsf track)'''
78  return getattr(self,self._trackForDxyDz)().dzError()
def edz
Definition: Muon.py:75
_trackForDxyDz
Definition: Muon.py:7
def Muon.Muon.looseId (   self)
Loose ID as recommended by mu POG.

Definition at line 14 of file Muon.py.

Referenced by Muon.Muon.muonID().

14 
15  def looseId( self ):
16  '''Loose ID as recommended by mu POG.'''
17  return self.physObj.isLooseMuon()
def looseId
Definition: Muon.py:14
def Muon.Muon.muonID (   self,
  name,
  vertex = None 
)

Definition at line 22 of file Muon.py.

References reco::MuonTrackLinks.globalTrack(), reco::Muon.globalTrack(), pat::Muon.globalTrack(), reco::CaloMuon.innerTrack(), reco::ME0Muon.innerTrack(), reco::Muon.innerTrack(), pat::Muon.innerTrack(), HcalRaddamMuon.innerTrack, HcalHBHEMuonAnalyzer.innerTrack, ScoutingMuon.isGlobalMuon(), reco::ShallowClonePtrCandidate.isGlobalMuon(), reco::ShallowCloneCandidate.isGlobalMuon(), reco::LeafRefCandidateT.isGlobalMuon(), reco::Muon.isGlobalMuon(), CandidateWithRef< Ref >.isGlobalMuon(), reco::LeafCandidate.isGlobalMuon(), reco::Candidate.isGlobalMuon(), pat::PackedGenParticle.isGlobalMuon(), pat::PackedCandidate.isGlobalMuon(), Muon.Muon.looseId(), L1Analysis::L1AnalysisRecoMuonDataFormat.numberOfMatchedStations, and reco::Muon.numberOfMatchedStations().

Referenced by Muon.Muon.tightId().

22 
23  def muonID(self, name, vertex=None):
24  if name == "" or name is None:
25  return True
26  if name.startswith("POG_"):
27  if name == "POG_ID_Loose": return self.physObj.isLooseMuon()
28  if vertex is None:
29  vertex = getattr(self, 'associatedVertex', None)
30  if name == "POG_ID_Tight": return self.physObj.isTightMuon(vertex)
31  if name == "POG_ID_HighPt": return self.physObj.isHighPtMuon(vertex)
32  if name == "POG_ID_Soft": return self.physObj.isSoftMuon(vertex)
33  if name == "POG_ID_TightNoVtx": return self.looseId() and \
34  self.isGlobalMuon() and \
35  self.globalTrack().normalizedChi2() < 10 and \
36  self.globalTrack().hitPattern().numberOfValidMuonHits() > 0 and \
37  self.numberOfMatchedStations()>1 and \
38  self.innerTrack().hitPattern().numberOfValidPixelHits()>0 and \
39  self.innerTrack().hitPattern().trackerLayersWithMeasurement() > 5
40  if name == "POG_ID_Medium":
41  if not self.looseId(): return False
42  goodGlb = self.physObj.isGlobalMuon() and self.physObj.globalTrack().normalizedChi2() < 3 and self.physObj.combinedQuality().chi2LocalPosition < 12 and self.physObj.combinedQuality().trkKink < 20;
43  return self.physObj.innerTrack().validFraction() > 0.8 and self.physObj.segmentCompatibility() >= (0.303 if goodGlb else 0.451)
44  if name == "POG_Global_OR_TMArbitrated":
45  return self.physObj.isGlobalMuon() or (self.physObj.isTrackerMuon() and self.physObj.numberOfMatchedStations() > 0)
46  return self.physObj.muonID(name)
def looseId
Definition: Muon.py:14
def muonID
Definition: Muon.py:22
def Muon.Muon.mvaId (   self)
For a transparent treatment of electrons and muons. Returns -99

Definition at line 47 of file Muon.py.

47 
48  def mvaId(self):
49  '''For a transparent treatment of electrons and muons. Returns -99'''
50  return -99
51 
def mvaId
Definition: Muon.py:47
def Muon.Muon.neutralHadronIsoR (   self,
  R = 0.4 
)

Definition at line 84 of file Muon.py.

Referenced by Lepton.Lepton.absIsoR(), and Muon.Muon.absIsoWithFSR().

84 
85  def neutralHadronIsoR(self,R=0.4):
86  if R == 0.3: return self.physObj.pfIsolationR03().sumNeutralHadronEt
87  elif R == 0.4: return self.physObj.pfIsolationR04().sumNeutralHadronEt
88  raise RuntimeError("Muon neutralHadronIso missing for R=%s" % R)
def neutralHadronIsoR
Definition: Muon.py:84
def Muon.Muon.photonIsoR (   self,
  R = 0.4 
)

Definition at line 89 of file Muon.py.

Referenced by Lepton.Lepton.absIsoR(), and Muon.Muon.absIsoWithFSR().

89 
90  def photonIsoR(self,R=0.4):
91  if R == 0.3: return self.physObj.pfIsolationR03().sumPhotonEt
92  elif R == 0.4: return self.physObj.pfIsolationR04().sumPhotonEt
93  raise RuntimeError("Muon photonIso missing for R=%s" % R)
def photonIsoR
Definition: Muon.py:89
def Muon.Muon.puChargedHadronIsoR (   self,
  R = 0.4 
)

Definition at line 102 of file Muon.py.

Referenced by Lepton.Lepton.absIsoR(), and Muon.Muon.absIsoWithFSR().

103  def puChargedHadronIsoR(self,R=0.4):
104  if R == 0.3: return self.physObj.pfIsolationR03().sumPUPt
105  elif R == 0.4: return self.physObj.pfIsolationR04().sumPUPt
106  raise RuntimeError("Muon chargedHadronIso missing for R=%s" % R)
107 
def puChargedHadronIsoR
Definition: Muon.py:102
def Muon.Muon.setTrackForDxyDz (   self,
  what 
)

Definition at line 9 of file Muon.py.

References Muon.Muon._trackForDxyDz.

9 
10  def setTrackForDxyDz(self,what):
11  if not hasattr(self,what):
12  raise RuntimeError("I don't have a track called "+what)
13  self._trackForDxyDz = what
def setTrackForDxyDz
Definition: Muon.py:9
_trackForDxyDz
Definition: Muon.py:7
def Muon.Muon.tightId (   self)
Tight ID as recommended by mu POG (unless redefined in the lepton analyzer).

Definition at line 18 of file Muon.py.

References Muon.Muon.muonID(), and pat::Muon.muonID().

18 
19  def tightId( self ):
20  '''Tight ID as recommended by mu POG (unless redefined in the lepton analyzer).'''
21  return getattr(self,"tightIdResult",self.muonID("POG_ID_Tight"))
def tightId
Definition: Muon.py:18
def muonID
Definition: Muon.py:22

Member Data Documentation

Muon.Muon._trackForDxyDz
private

Definition at line 7 of file Muon.py.

Referenced by Muon.Muon.dxy(), Muon.Muon.dz(), Muon.Muon.edxy(), Muon.Muon.edz(), and Muon.Muon.setTrackForDxyDz().