CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
10  def sip3D(self):
11  '''3D impact parameter significance.'''
12  return abs(self.dB(self.PV3D) / self.edB(self.PV3D))
13 
14  def absIsoFromEA(self,rho,eta,effectiveArea1 = None,effectiveArea2 = None):
15  '''
16  Calculate Isolation using the effective area approach. If fsrPhotons is set
17  the list of photons is subtracted from the isolation cone. It works with one or
18  two effective Areas in case one needs to do photon and neutral hadron separately
19  '''
20  photonIso = self.photonIso()
21  if hasattr(self,'fsrPhotons'):
22  for gamma in self.fsrPhotons:
23  photonIso=photonIso-gamma.pt()
24  ea1 = rho
25  ea2 = rho
26  if effectiveArea1 is not None:
27  for element in effectiveArea1:
28  if abs(eta)>= element['etaMin'] and \
29  abs(eta)< element['etaMax']:
30  ea1 = ea1 * element['area']
31  break
32  else:
33  return self.chargedHadronIso()+max(0.,photonIso+self.neutralHadronIso()-ea1)
34  if effectiveArea2 is not None:
35  for element in effectiveArea2:
36  if abs(eta)>= element['etaMin'] and \
37  abs(eta)< element['etaMax']:
38  ea2 = ea2 * element['area']
39  return self.chargedHadronIso()+max(0.,photonIso-ea1)+max(0.,self.neutralHadronIso()-ea2)
40  else:
41  return self.chargedHadronIso()+max(0.,photonIso+self.neutralHadronIso()-ea1)
42 
43 
44  def absIso(self, dBetaFactor=0, allCharged=0):
45  if dBetaFactor>0 and self.puChargedHadronIso()<0:
46  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')
47  neutralIso = self.neutralHadronIso()+self.photonIso()
48  #Recover FSR
49  if hasattr(self,'fsrPhotons'):
50  for gamma in self.fsrPhotons:
51  neutralIso=neutralIso-gamma.pt()
52  corNeutralIso = neutralIso - dBetaFactor * self.puChargedHadronIso()
53  charged = self.chargedHadronIso()
54  if allCharged:
55  charged = self.chargedAllIso()
56  return charged + max(corNeutralIso,0)
57 
58  def relIso(self,dBetaFactor=0, allCharged=0):
59  rel = self.absIso(dBetaFactor, allCharged)/self.pt()
60  return rel
61 
62  def relEffAreaIso(self,rho):
63  '''MIKE, missing doc'''
64  return self.absEffAreaIso(rho)/self.pt()
65 
66  def lostInner(self):
67  if hasattr(self.innerTrack(),"trackerExpectedHitsInner") :
68  return self.innerTrack().trackerExpectedHitsInner().numberOfLostHits()
69  else :
70  return self.innerTrack().hitPattern().numberOfHits(ROOT.reco.HitPattern.MISSING_INNER_HITS)
71 
def relIso
Definition: Lepton.py:58
def lostInner
Definition: Lepton.py:66
def relEffAreaIso
Definition: Lepton.py:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def absIso
Definition: Lepton.py:44
def sip3D
Definition: Lepton.py:10
def ip3D
Definition: Lepton.py:5
def absIsoFromEA
Definition: Lepton.py:14