CMS 3D CMS Logo

Lepton.py
Go to the documentation of this file.
2 import ROOT
3 
5  def ip3D(self):
6  '''3D impact parameter value.'''
7  return abs(self.dB(self.PV3D))
8 
9  def sip3D(self):
10  '''3D impact parameter significance.'''
11  db, edb = self.dB(self.PV3D), self.edB(self.PV3D)
12  return abs(db/edb) if edb > 0 else 999.
13 
14  def absIsoFromEA(self, area='04'):
15  '''Calculate Isolation using the effective area approach.'''
16  photonIso = self.photonIso()
17  offset = self.rho*getattr(self,"EffectiveArea"+area)
18  return self.chargedHadronIso()+max(0.,photonIso+self.neutralHadronIso()-offset)
19 
20  def relIsoFromEA(self, area='04'):
21  return self.absIsoFromEA(area)/self.pt()
22 
23  def relIso(self, dBetaFactor=0, allCharged=0):
24  '''Relative isolation with default cone size of 0.4.'''
25  rel = self.absIsoR(dBetaFactor=dBetaFactor, allCharged=allCharged)/self.pt()
26  return rel
27 
28  def absIsoR(self, R=0.4, dBetaFactor=0, allCharged=False):
29  '''Isolation in given cone with optional delta-beta subtraction.'''
30  if dBetaFactor>0 and self.puChargedHadronIsoR(R)<0:
31  raise ValueError('If you want to use dbeta corrections, you must make sure that the pu charged hadron iso is available. This should never happen')
32  neutralIso = self.neutralHadronIsoR(R) + self.photonIsoR(R)
33  corNeutralIso = neutralIso - dBetaFactor * self.puChargedHadronIsoR(R)
34  charged = self.chargedHadronIsoR(R)
35  if allCharged:
36  charged = self.chargedAllIsoR(R)
37  return charged + max(corNeutralIso, 0.)
38 
39  def relIsoR(self, R=0.4, dBetaFactor=0, allCharged=False):
40  return self.absIsoR(R, dBetaFactor, allCharged)/self.pt()
41 
42  def lostInner(self):
43  if hasattr(self.innerTrack(),"trackerExpectedHitsInner") :
44  return self.innerTrack().trackerExpectedHitsInner().numberOfLostHits()
45  else :
46  return self.innerTrack().hitPattern().numberOfLostHits(ROOT.reco.HitPattern.MISSING_INNER_HITS)
47 
48  def p4WithFSR(self):
49  ret = self.p4()
50  for p in getattr(self, 'ownFsrPhotons', getattr(self, 'fsrPhotons', [])):
51  ret += p.p4()
52  return ret
53 
54  def __str__(self):
55  ptc = super(Lepton, self).__str__()
56  return '{ptc}, iso={iso:5.2f}'.format(ptc=ptc, iso=self.relIso())
PhysicsObject
Lepton.Lepton.absIsoFromEA
def absIsoFromEA(self, area='04')
Definition: Lepton.py:14
Lepton.Lepton.absIsoR
def absIsoR(self, R=0.4, dBetaFactor=0, allCharged=False)
Definition: Lepton.py:28
Lepton.Lepton.p4WithFSR
def p4WithFSR(self)
Definition: Lepton.py:48
Lepton.Lepton.relIso
def relIso(self, dBetaFactor=0, allCharged=0)
Definition: Lepton.py:23
Lepton.Lepton.relIsoFromEA
def relIsoFromEA(self, area='04')
Definition: Lepton.py:20
TrackCollections2monitor_cff.numberOfLostHits
numberOfLostHits
Definition: TrackCollections2monitor_cff.py:249
Lepton.Lepton.lostInner
def lostInner(self)
Definition: Lepton.py:42
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
Lepton.Lepton.ip3D
def ip3D(self)
Definition: Lepton.py:5
Lepton.Lepton.sip3D
def sip3D(self)
Definition: Lepton.py:9
PhysicsObject
Definition: PhysicsObject.py:1
Lepton.Lepton.relIsoR
def relIsoR(self, R=0.4, dBetaFactor=0, allCharged=False)
Definition: Lepton.py:39
Lepton.Lepton
Definition: Lepton.py:4
format
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Lepton.Lepton.__str__
def __str__(self)
Definition: Lepton.py:54