CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HTauTauElectron.py
Go to the documentation of this file.
1 from PhysicsTools.Heppy.physicsobjects.Electron import Electron
2 from ROOT import gSystem, AutoLibraryLoader
3 gSystem.Load("libFWCoreFWLite")
5 gSystem.Load("libDataFormatsRecoCandidate.so")
6 
7 from ROOT import reco
8 
10 
11  def __init__(self, *args, **kwargs):
12  super(HTauTauElectron, self).__init__(*args, **kwargs)
13  self.photonIsoCache = None
14  self.chargedAllIsoCache = None
15 
16  # JAN FIXME - replace our old tau-tau-specific vetoes
17  # I hope they are not needed anymore!
18 
19  # def photonIso(self):
20  # if self.photonIsoCache is None:
21  # myVetoes = reco.IsoDeposit.Vetos()
22  # pfGammaIsoType = 6
23  # iso = self.sourcePtr().isoDeposit(pfGammaIsoType).depositWithin(0.4,myVetoes,True)
24  # iso_veto = self.sourcePtr().isoDeposit(pfGammaIsoType).depositWithin(0.08,myVetoes,True)
25  # iso -= iso_veto
26  # self.photonIsoCache = iso
27  # return self.photonIsoCache
28 
29  def photonIso(self):
30  return super(HTauTauElectron, self).photonIso(0.3)
31 
32  # JAN FIXME - replace our old tau-tau-specific vetoes
33  # I hope they are not needed anymore!
34  # def chargedAllIso(self):
35  # if self.chargedAllIsoCache is None:
36  # # chargedAllIsoType = 13
37  # # myVetoes = reco.IsoDeposit.Vetos()
38  # # iso = self.sourcePtr().isoDeposit(chargedAllIsoType).depositWithin(0.4,
39  # # myVetoes,True)
40  # # vetoSize = 0.01
41  # # if self.sourcePtr().isEE():
42  # # vetoSize = 0.015
43  # # iso_veto = self.sourcePtr().isoDeposit(chargedAllIsoType).depositWithin(vetoSize,
44  # # myVetoes,True)
45  # # iso -= iso_veto
46  # # self.chargedAllIsoCache = iso
47  # return self.chargedAllIsoCache
48 
49  def chargedAllIso(self):
50  return self.physObj.pfIsolationVariables().sumChargedParticlePt
51 
52  def relaxedIdForEleTau(self):
53  """Relaxing conversion cuts for sideband studies
54  """
55  eta = abs( self.superCluster().eta() )
56  if eta<0.8: lmvaID = 0.925
57  elif eta<1.479: lmvaID = 0.975
58  else : lmvaID = 0.985
59  result = self.mvaNonTrigV0() > lmvaID
60  return result
61 
62  def tightIdForEleTau(self):
63  """reference numbers from the Htautau twiki
64 
65  https://twiki.cern.ch/twiki/bin/view/CMS/HiggsToTauTauWorking2012#2012_Baseline_Selection
66  """
67 
68  # JAN FIXME - do we need this cut?
69  # if self.numberOfHits() != 0: return False
70  if not self.passConversionVeto(): return False
71  eta = abs( self.superCluster().eta() )
72 
73  # Update Jan: Deleted the old numbers which are for e-mu, the ones below
74  # are for e-tau starting from pt>20
75  if 1:
76  if eta<0.8: lmvaID = 0.925
77  elif eta<1.479: lmvaID = 0.975
78  else : lmvaID = 0.985
79  result = self.mvaNonTrigV0() > lmvaID
80  #self.tightIdResult = result
81  return result
82 
83 
85  '''To be used in the tri-lepton veto for both the etau and mutau channels.
86  Agreed at the CMS center with Josh, Andrew, Valentina, Jose on the 22nd of October
87  '''
88  # JAN FIXME - do we need this cut?
89  # if self.numberOfHits() != 0: return False
90  if not self.passConversionVeto(): return False
91  eta = abs( self.superCluster().eta() )
92  #Colin no eta cut should be done here.
93  # if eta > 2.1 : return False
94  lmvaID = -99999 # identification
95  if self.pt() < 20 :
96  if eta<0.8: lmvaID = 0.925
97  elif eta<1.479: lmvaID = 0.915
98  else : lmvaID = 0.965
99  else:
100  if eta<0.8: lmvaID = 0.905
101  elif eta<1.479: lmvaID = 0.955
102  else : lmvaID = 0.975
103  result = self.mvaNonTrigV0() > lmvaID
104  return result
105 
106 
107  def tightId( self ):
108  return self.tightIdForEleTau()
109 
110 
111  def looseIdForEleTau(self):
112  """Loose electron selection, for the lepton veto,
113  according to Phil sync prescription for the sync exercise 18/06/12
114  """
115  #COLIN inner hits and conversion veto not on the twiki
116  # nInnerHits = self.numberOfHits()
117  # if nInnerHits != 0 : return False
118  # if self.passConversionVeto() == False : return False
119  #COLIN: we might want to keep the vertex constraints separated
120  #COLIN: in the twiki there is no cut on dxy
121  # if abs(self.dxy()) >= 0.045 : return False
122  if abs(self.dz()) >= 0.2 : return False
123  # Below, part of WP95 without vertex constraints (applied above)
124  hoe = self.hadronicOverEm()
125  deta = abs(self.deltaEtaSuperClusterTrackAtVtx())
126  dphi = abs(self.deltaPhiSuperClusterTrackAtVtx())
127  sihih = self.sigmaIetaIeta()
128  # print sihih
129  if self.isEB() :
130  if sihih >= 0.010 : return False
131  if dphi >= 0.80 : return False
132  if deta >= 0.007 : return False
133  if hoe >= 0.15 : return False
134  elif self.isEE() :
135  if sihih >= 0.030 : return False
136  if dphi >= 0.70 : return False
137  if deta >= 0.010 : return False
138  # if hoe >= 0.07 : return False
139  else : return False #PG is this correct? does this take cracks into consideration?
140  return True
141 
142  def __str__(self):
143  base = [super(HTauTauElectron, self).__str__()]
144  spec = [
145  'vertex : dxy = {dxy}, dz = {dz}'.format(dxy=self.dxy(), dz=self.dz()),
146  # 'mva = {mva}'.format(mva=self.mvaNonTrigV0()),
147  # 'nmisshits = {nhits}'.format(nhits=self.numberOfHits()),
148  'conv veto = {conv}'.format(conv=self.passConversionVeto()),
149  'tight ID = {id}'.format(id=self.tightId()),
150  '3-veto ID = {id}'.format(id=self.looseIdForTriLeptonVeto()),
151  '2-veto ID = {id}'.format(id=self.looseIdForEleTau()),
152  ]
153  return '\n\t'.join( base + spec )
T eta() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
static void enable()
enable automatic library loading