CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
Muon.Muon Class Reference
Inheritance diagram for Muon.Muon:

Public Member Functions

def __init__ (self, args, kwargs)
 
def absIsoWithFSR (self, R=0.4, puCorr="deltaBeta", dBetaFactor=0.5)
 
def chargedAllIso (self)
 
def chargedAllIsoR (self, R=0.4)
 
def chargedHadronIsoR (self, R=0.4)
 
def dxy (self, vertex=None)
 
def dz (self, vertex=None)
 
def edxy (self)
 
def edz (self)
 
def looseId (self)
 
def muonID (self, name, vertex=None)
 
def mvaId (self)
 
def neutralHadronIsoR (self, R=0.4)
 
def photonIsoR (self, R=0.4)
 
def ptErr (self)
 
def puChargedHadronIsoR (self, R=0.4)
 
def setTrackForDxyDz (self, what)
 
def tightId (self)
 

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 6 of file Muon.py.

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

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 114 of file Muon.py.

References Muon.Muon.chargedHadronIsoR(), Electron.Electron.chargedHadronIsoR(), deltaR(), SiStripPI.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, CalorimeterProperties.rho(), BinomialProbHelper.rho(), PreshowerProperties.rho(), ECALProperties.rho(), TauValidation.rho, correctionValue_class.rho, TangentCircle.rho(), TangentHelix.rho(), HCALProperties.rho(), MaterialEffectsSimulator.rho(), RhoEtaPhi.rho(), QcdLowPtDQM::Pixel.rho(), FastCircle.rho(), reco::GhostTrackPrediction.rho(), StoredPileupJetIdentifier.rho(), fastjet::BackgroundEstimator.rho(), FastCircleFit.rho(), reco::CastorCell.rho(), CylindricalState.rho(), reco::CastorEgamma.rho(), reco::CastorJet.rho(), reco::CastorTower.rho(), reco::CastorCluster.rho(), GeometricTimingDet.rho(), GeometricDet.rho(), AlignmentMonitorMuonSystemMap1D::MyResidual.rho, HGCalImagingAlgo::Hexel.rho, objects.JetAnalyzer.JetAnalyzer.rho, and str.

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

Definition at line 105 of file Muon.py.

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

105  def chargedAllIso(self):
106  return self.chargedAllIsoR()
107 
def chargedAllIsoR(self, R=0.4)
Definition: Muon.py:100
def chargedAllIso(self)
Definition: Muon.py:105
def Muon.Muon.chargedAllIsoR (   self,
  R = 0.4 
)

Definition at line 100 of file Muon.py.

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

100  def chargedAllIsoR(self,R=0.4):
101  if R == 0.3: return self.physObj.pfIsolationR03().sumChargedParticlePt
102  elif R == 0.4: return self.physObj.pfIsolationR04().sumChargedParticlePt
103  raise RuntimeError("Muon chargedAllIso missing for R=%s" % R)
104 
def chargedAllIsoR(self, R=0.4)
Definition: Muon.py:100
def Muon.Muon.chargedHadronIsoR (   self,
  R = 0.4 
)

Definition at line 85 of file Muon.py.

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

85  def chargedHadronIsoR(self,R=0.4):
86  if R == 0.3: return self.physObj.pfIsolationR03().sumChargedHadronPt
87  elif R == 0.4: return self.physObj.pfIsolationR04().sumChargedHadronPt
88  raise RuntimeError("Muon chargedHadronIso missing for R=%s" % R)
89 
def chargedHadronIsoR(self, R=0.4)
Definition: Muon.py:85
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 58 of file Muon.py.

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

Referenced by ntupleDataFormat.Track.dxyPull().

58  def dxy(self, vertex=None):
59  '''either pass the vertex, or set associatedVertex before calling the function.
60  note: the function does not work with standalone muons as innerTrack
61  is not available.
62  '''
63  if vertex is None:
64  vertex = self.associatedVertex
65  return getattr(self,self._trackForDxyDz)().dxy( vertex.position() )
66 
_trackForDxyDz
Definition: Muon.py:8
def dxy(self, vertex=None)
Definition: Muon.py:58
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 72 of file Muon.py.

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

Referenced by ntupleDataFormat.Track.dzPull().

72  def dz(self, vertex=None):
73  '''either pass the vertex, or set associatedVertex before calling the function.
74  note: the function does not work with standalone muons as innerTrack
75  is not available.
76  '''
77  if vertex is None:
78  vertex = self.associatedVertex
79  return getattr(self,self._trackForDxyDz)().dz( vertex.position() )
80 
def dz(self, vertex=None)
Definition: Muon.py:72
_trackForDxyDz
Definition: Muon.py:8
def Muon.Muon.edxy (   self)
returns the uncertainty on dxy (from gsf track)

Definition at line 67 of file Muon.py.

References Muon.Muon._trackForDxyDz.

67  def edxy(self):
68  '''returns the uncertainty on dxy (from gsf track)'''
69  return getattr(self,self._trackForDxyDz)().dxyError()
70 
71 
def edxy(self)
Definition: Muon.py:67
_trackForDxyDz
Definition: Muon.py:8
def Muon.Muon.edz (   self)
returns the uncertainty on dxz (from gsf track)

Definition at line 81 of file Muon.py.

References Muon.Muon._trackForDxyDz.

81  def edz(self):
82  '''returns the uncertainty on dxz (from gsf track)'''
83  return getattr(self,self._trackForDxyDz)().dzError()
84 
def edz(self)
Definition: Muon.py:81
_trackForDxyDz
Definition: Muon.py:8
def Muon.Muon.looseId (   self)
Loose ID as recommended by mu POG.

Definition at line 15 of file Muon.py.

Referenced by Muon.Muon.muonID().

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

Definition at line 28 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, ScoutingMuon.isGlobalMuon(), reco::ShallowClonePtrCandidate.isGlobalMuon(), reco::ShallowCloneCandidate.isGlobalMuon(), reco::LeafRefCandidateT.isGlobalMuon(), reco::LeafCandidate.isGlobalMuon(), CompositeRefCandidateT< reco::GenParticleRefVector >.isGlobalMuon(), CandidateWithRef< Ref >.isGlobalMuon(), HGCalClusterT< C >.isGlobalMuon(), reco::Candidate.isGlobalMuon(), reco::Muon.isGlobalMuon(), pat::PackedGenParticle.isGlobalMuon(), pat::PackedCandidate.isGlobalMuon(), Muon.Muon.looseId(), L1Analysis::L1AnalysisRecoMuonDataFormat.numberOfMatchedStations, and reco::Muon.numberOfMatchedStations().

Referenced by Muon.Muon.tightId().

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

Definition at line 53 of file Muon.py.

53  def mvaId(self):
54  '''For a transparent treatment of electrons and muons. Returns -99'''
55  return -99
56 
57 
def mvaId(self)
Definition: Muon.py:53
def Muon.Muon.neutralHadronIsoR (   self,
  R = 0.4 
)

Definition at line 90 of file Muon.py.

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

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

Definition at line 95 of file Muon.py.

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

95  def photonIsoR(self,R=0.4):
96  if R == 0.3: return self.physObj.pfIsolationR03().sumPhotonEt
97  elif R == 0.4: return self.physObj.pfIsolationR04().sumPhotonEt
98  raise RuntimeError("Muon photonIso missing for R=%s" % R)
99 
def photonIsoR(self, R=0.4)
Definition: Muon.py:95
def Muon.Muon.ptErr (   self)
def Muon.Muon.puChargedHadronIsoR (   self,
  R = 0.4 
)

Definition at line 108 of file Muon.py.

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

108  def puChargedHadronIsoR(self,R=0.4):
109  if R == 0.3: return self.physObj.pfIsolationR03().sumPUPt
110  elif R == 0.4: return self.physObj.pfIsolationR04().sumPUPt
111  raise RuntimeError("Muon chargedHadronIso missing for R=%s" % R)
112 
113 
def puChargedHadronIsoR(self, R=0.4)
Definition: Muon.py:108
def Muon.Muon.setTrackForDxyDz (   self,
  what 
)

Definition at line 10 of file Muon.py.

References Muon.Muon._trackForDxyDz.

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
14 
def setTrackForDxyDz(self, what)
Definition: Muon.py:10
_trackForDxyDz
Definition: Muon.py:8
def Muon.Muon.tightId (   self)
Tight ID as recommended by mu POG 
(unless redefined in the lepton analyzer).

If not using the LeptonAnalyzer, make sure to set self.associatedVertex, 
that is necessary for tight muon identification. 

Definition at line 19 of file Muon.py.

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

19  def tightId( self ):
20  '''Tight ID as recommended by mu POG
21  (unless redefined in the lepton analyzer).
22 
23  If not using the LeptonAnalyzer, make sure to set self.associatedVertex,
24  that is necessary for tight muon identification.
25  '''
26  return getattr(self,"tightIdResult",self.muonID("POG_ID_Tight"))
27 
def muonID(self, name, vertex=None)
Definition: Muon.py:28
def tightId(self)
Definition: Muon.py:19

Member Data Documentation

Muon.Muon._trackForDxyDz
private