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