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

◆ __init__()

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 

Member Function Documentation

◆ absIsoWithFSR()

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.

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 

References Muon.Muon.chargedHadronIsoR(), Electron.Electron.chargedHadronIsoR(), PbPb_ZMuSkimMuonDPG_cff.deltaR, PVValHelper.eta, SiStripPI.max, Muon.Muon.neutralHadronIsoR(), Electron.Electron.neutralHadronIsoR(), Muon.Muon.photonIsoR(), Electron.Electron.photonIsoR(), PhysicsObject.PhysicsObject.physObj, Muon.Muon.puChargedHadronIsoR(), Electron.Electron.puChargedHadronIsoR(), python.rootplot.root2matplotlib.replace(), Photon.Photon.rho, Electron.Electron.rho, CaloDetInfo.rho(), CalorimeterProperties.rho(), PreshowerProperties.rho(), TauValidation.rho, ECALProperties.rho(), correctionValue_class.rho, HCALProperties.rho(), ticl::PatternRecognitionbyCLUE3D< TILES >::ClustersOnLayer.rho, MaterialEffectsSimulator.rho(), TangentCircle.rho(), TangentHelix.rho(), FastCircle.rho(), RhoEtaPhi.rho(), reco::GhostTrackPrediction.rho(), fastjet::BackgroundEstimator.rho(), QcdLowPtDQM::Pixel.rho(), FastCircleFit.rho(), StoredPileupJetIdentifier.rho(), reco::CastorCell.rho(), CylindricalState.rho(), reco::CastorJet.rho(), reco::CastorEgamma.rho(), GeometricTimingDet.rho(), GeometricDet.rho(), reco::CastorTower.rho(), reco::CastorCluster.rho(), AlignmentMonitorMuonSystemMap1D::MyResidual.rho, DAClusterizerInZ_vect::vertex_t.rho, HGCalImagingAlgo::Hexel.rho, HGCalCLUEAlgoT< TILE >::CellsOnLayer.rho, DAClusterizerInZT_vect::vertex_t.rho, objects.JetAnalyzer.JetAnalyzer.rho, and str.

◆ chargedAllIso()

def Muon.Muon.chargedAllIso (   self)

Definition at line 105 of file Muon.py.

105  def chargedAllIso(self):
106  return self.chargedAllIsoR()
107 

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

◆ chargedAllIsoR()

def Muon.Muon.chargedAllIsoR (   self,
  R = 0.4 
)

Definition at line 100 of file Muon.py.

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 

References muons_cfi.pfIsolationR03, muons_cfi.pfIsolationR04, and PhysicsObject.PhysicsObject.physObj.

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

◆ chargedHadronIsoR()

def Muon.Muon.chargedHadronIsoR (   self,
  R = 0.4 
)

Definition at line 85 of file Muon.py.

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 

References muons_cfi.pfIsolationR03, muons_cfi.pfIsolationR04, and PhysicsObject.PhysicsObject.physObj.

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

◆ dxy()

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.

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 

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

Referenced by ntupleDataFormat.Track.dxyPull().

◆ dz()

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.

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 

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

Referenced by ntupleDataFormat.Track.dzPull().

◆ edxy()

def Muon.Muon.edxy (   self)
returns the uncertainty on dxy (from gsf track)

Definition at line 67 of file Muon.py.

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

References Muon.Muon._trackForDxyDz.

◆ edz()

def Muon.Muon.edz (   self)
returns the uncertainty on dxz (from gsf track)

Definition at line 81 of file Muon.py.

81  def edz(self):
82  '''returns the uncertainty on dxz (from gsf track)'''
83  return getattr(self,self._trackForDxyDz)().dzError()
84 

References Muon.Muon._trackForDxyDz.

◆ looseId()

def Muon.Muon.looseId (   self)
Loose ID as recommended by mu POG.

Definition at line 15 of file Muon.py.

15  def looseId( self ):
16  '''Loose ID as recommended by mu POG.'''
17  return self.physObj.isLooseMuon()
18 

References muon.isLooseMuon(), and PhysicsObject.PhysicsObject.physObj.

Referenced by Muon.Muon.muonID().

◆ muonID()

def Muon.Muon.muonID (   self,
  name,
  vertex = None 
)

Definition at line 28 of file Muon.py.

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 

References reco::MuonTrackLinks.globalTrack(), reco::Muon.globalTrack(), pat::Muon.globalTrack(), cutBasedMuonId_MuonPOG_V0_cff.globalTrack, susybsm::HSCParticleType.innerTrack, reco::CaloMuon.innerTrack(), reco::Muon.innerTrack(), pat::Muon.innerTrack(), HcalRaddamMuon.innerTrack, reco::ShallowClonePtrCandidate.isGlobalMuon(), reco::ShallowCloneCandidate.isGlobalMuon(), ScoutingMuon.isGlobalMuon(), reco::LeafRefCandidateT.isGlobalMuon(), Run3ScoutingMuon.isGlobalMuon(), reco::Candidate.isGlobalMuon(), reco::LeafCandidate.isGlobalMuon(), HGCalClusterT< C >.isGlobalMuon(), reco::Muon.isGlobalMuon(), pat::PackedGenParticle.isGlobalMuon(), pat::PackedCandidate.isGlobalMuon(), muon.isHighPtMuon(), muon.isLooseMuon(), muon.isSoftMuon(), muon.isTightMuon(), Muon.Muon.looseId(), TrackCollections2monitor_cff.normalizedChi2, L1Analysis::L1AnalysisRecoMuonDataFormat.numberOfMatchedStations, reco::Muon.numberOfMatchedStations(), TrackCollections2monitor_cff.numberOfValidPixelHits, PhysicsObject.PhysicsObject.physObj, and muon.segmentCompatibility().

Referenced by Muon.Muon.tightId().

◆ mvaId()

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 

◆ neutralHadronIsoR()

def Muon.Muon.neutralHadronIsoR (   self,
  R = 0.4 
)

Definition at line 90 of file Muon.py.

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 

References muons_cfi.pfIsolationR03, muons_cfi.pfIsolationR04, and PhysicsObject.PhysicsObject.physObj.

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

◆ photonIsoR()

def Muon.Muon.photonIsoR (   self,
  R = 0.4 
)

Definition at line 95 of file Muon.py.

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 

References muons_cfi.pfIsolationR03, muons_cfi.pfIsolationR04, and PhysicsObject.PhysicsObject.physObj.

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

◆ ptErr()

def Muon.Muon.ptErr (   self)

Definition at line 134 of file Muon.py.

134  def ptErr(self):
135  if "_ptErr" in self.__dict__: return self.__dict__['_ptErr']
136  return self.bestTrack().ptError()

References reco::RecoChargedRefCandidate.bestTrack(), reco::RecoCandidate.bestTrack(), reco::Muon.bestTrack(), pat::Muon.bestTrack(), reco::PFCandidate.bestTrack(), reco::Candidate.bestTrack(), HGCalClusterT< C >.bestTrack(), and pat::PackedCandidate.bestTrack().

Referenced by ntupleDataFormat.Track.ptPull().

◆ puChargedHadronIsoR()

def Muon.Muon.puChargedHadronIsoR (   self,
  R = 0.4 
)

Definition at line 108 of file Muon.py.

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 

References muons_cfi.pfIsolationR03, muons_cfi.pfIsolationR04, and PhysicsObject.PhysicsObject.physObj.

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

◆ setTrackForDxyDz()

def Muon.Muon.setTrackForDxyDz (   self,
  what 
)

Definition at line 10 of file Muon.py.

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 

References Muon.Muon._trackForDxyDz.

◆ tightId()

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.

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 

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

Member Data Documentation

◆ _trackForDxyDz

Muon.Muon._trackForDxyDz
private
cutBasedMuonId_MuonPOG_V0_cff.globalTrack
globalTrack
Definition: cutBasedMuonId_MuonPOG_V0_cff.py:135
muons_cff.ptErr
ptErr
Definition: muons_cff.py:124
muon::isSoftMuon
bool isSoftMuon(const reco::Muon &, const reco::Vertex &, bool run2016_hip_mitigation=false)
Definition: MuonSelectors.cc:916
muon::segmentCompatibility
float segmentCompatibility(const reco::Muon &muon, reco::Muon::ArbitrationType arbitrationType=reco::Muon::SegmentAndTrackArbitration)
Definition: MuonSelectors.cc:61
TrackCollections2monitor_cff.numberOfValidPixelHits
numberOfValidPixelHits
at most 999 lost hits
Definition: TrackCollections2monitor_cff.py:250
muons_cff.mvaId
mvaId
Definition: muons_cff.py:161
jets_cff.looseId
looseId
Definition: jets_cff.py:173
TopDecayID::muonID
static const int muonID
Definition: TopGenEvent.h:19
muon::isLooseMuon
bool isLooseMuon(const reco::Muon &)
Definition: MuonSelectors.cc:895
PVValHelper::eta
Definition: PVValidationHelpers.h:70
str
#define str(s)
Definition: TestProcessor.cc:53
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
muon::isHighPtMuon
bool isHighPtMuon(const reco::Muon &, const reco::Vertex &)
Definition: MuonSelectors.cc:933
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
muon::isTightMuon
bool isTightMuon(const reco::Muon &, const reco::Vertex &)
Definition: MuonSelectors.cc:880
susybsm::HSCParticleType::innerTrack
Definition: HSCParticle.h:20
TrackCollections2monitor_cff.normalizedChi2
normalizedChi2
Definition: TrackCollections2monitor_cff.py:247
muons_cfi.pfIsolationR04
pfIsolationR04
Definition: muons_cfi.py:31
jets_cff.tightId
tightId
Definition: jets_cff.py:161
PVValHelper::dxy
Definition: PVValidationHelpers.h:48
PVValHelper::dz
Definition: PVValidationHelpers.h:51
muons_cfi.pfIsolationR03
pfIsolationR03
Definition: muons_cfi.py:24
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444