CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Photon.py
Go to the documentation of this file.
2 
3 import ROOT
4 
6 
7  ''' return object from the photon
8  '''
9  def hOVERe(self):
10  return self.physObj.hadTowOverEm()
11 
12  def r9(self):
13  return self.physObj.r9()
14 
15  def sigmaIetaIeta(self):
16  return self.physObj.sigmaIetaIeta()
17 
18  def full5x5_r9(self):
19  return self.physObj.full5x5_r9()
20 
22  return self.physObj.full5x5_sigmaIetaIeta()
23 
24  def chargedHadronIso(self):
25  return self.physObj.chargedHadronIso()
26 
27  def neutralHadronIso(self):
28  return self.physObj.neutralHadronIso()
29 
30  def photonIso(self):
31  return self.physObj.photonIso()
32 
33  def photonIDCSA14(self, name):
34  keepThisPhoton = True
35  if name == "PhotonCutBasedIDLoose_CSA14":
36  if abs(self.physObj.eta())<1.479 :
37  if self.full5x5_sigmaIetaIeta() > 0.015 : keepThisPhoton = False
38  if self.hOVERe() > 0.0559 : keepThisPhoton = False
39  else :
40  if self.full5x5_sigmaIetaIeta() > 0.035 : keepThisPhoton = False
41  if self.hOVERe() > 0.049 : keepThisPhoton = False
42  return keepThisPhoton
43 
44  def CutBasedIDWP(self,name):
45  # recommeneded PHYS14 working points from POG
46  WPs = {
47  # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CutBasedPhotonIdentificationRun2#Pointers_for_PHYS14_selection_im
48  "POG_PHYS14_25ns_Loose": {"conversionVeto": [True,True], "H/E":[0.048,0.069],"sigmaIEtaIEta":[0.0106,0.0266],
49  "chaHadIso":[2.56,3.12],"neuHadIso":[[3.74,0.0025],[17.11,0.0118]],"phoIso":[[2.68,0.001],[2.70,0.0059]]},
50 
51  "POG_PHYS14_25ns_Medium": {"conversionVeto": [True,True], "H/E":[0.032,0.0166],"sigmaIEtaIEta":[0.0101,0.0264],
52  "chaHadIso":[1.90,1.95],"neuHadIso":[[2.96,0.0025],[4.42,0.0118]],"phoIso":[[1.39,0.001],[1.89,0.0059]]},
53 
54  "POG_PHYS14_25ns_Tight": {"conversionVeto": [True,True], "H/E":[0.011,0.015],"sigmaIEtaIEta":[0.0099,0.0263],
55  "chaHadIso":[1.86,1.68],"neuHadIso":[[2.64,0.0025],[4.42,0.0118]],"phoIso":[[1.39,0.001],[1.03,0.0059]]},
56 
57  # https://twiki.cern.ch/twiki/bin/viewauth/CMS/CutBasedPhotonIdentificationRun2#CSA14_selections_for_20_bx_25_sc
58  "POG_CSA14_25ns_Loose": {"conversionVeto": [True,True], "H/E":[0.553,0.062],"sigmaIEtaIEta":[0.0099,0.0284],
59  "chaHadIso":[2.49,1.04],"neuHadIso":[[15.43,0.007],[19.71,0.0129]],"phoIso":[[9.42,0.0033],[11.88,0.0108]]},
60 
61  "POG_CSA14_25ns_Medium": {"conversionVeto": [True,True], "H/E":[0.058,0.020],"sigmaIEtaIEta":[0.0099,0.0268],
62  "chaHadIso":[1.91,0.82],"neuHadIso":[[4.66,0.007],[14.65,0.0129]],"phoIso":[[4.29,0.0033],[4.06,0.0108]]},
63 
64  "POG_CSA14_25ns_Tight": {"conversionVeto": [True,True], "H/E":[0.019,0.016],"sigmaIEtaIEta":[0.0099,0.0263],
65  "chaHadIso":[1.61,0.69],"neuHadIso":[[3.98,0.007],[4.52,0.0129]],"phoIso":[[3.01,0.0033],[3.61,0.0108]]},
66  }
67  return WPs[name]
68 
69 
70  def etaRegionID(self):
71  #return 0 if the photon is in barrel and 1 if in endcap
72  if abs(self.physObj.eta())<1.479 :
73  idForBarrel = 0
74  else:
75  idForBarrel = 1
76  return idForBarrel
77 
78  def calScaledIsoValue(self,slope,offset):
79  return slope*self.pt()+offset
80 
81 
82  def passPhotonID(self,name):
83 
84  idForBarrel = self.etaRegionID()
85  passPhotonID = True
86 
87  if self.CutBasedIDWP(name)["conversionVeto"][idForBarrel] and self.physObj.hasPixelSeed():
88  passPhotonID = False
89 
90  if self.CutBasedIDWP(name)["H/E"][idForBarrel] < self.hOVERe():
91  passPhotonID = False
92 
93  if self.CutBasedIDWP(name)["sigmaIEtaIEta"][idForBarrel] < self.full5x5_sigmaIetaIeta():
94  passPhotonID = False
95 
96  if self.CutBasedIDWP(name)["chaHadIso"][idForBarrel] < self.chargedHadronIso():
97  passPhotonID = False
98 
99  if self.calScaledIsoValue(*self.CutBasedIDWP(name)["neuHadIso"][idForBarrel]) < self.neutralHadronIso():
100  passPhotonID = False
101 
102  if self.calScaledIsoValue(*self.CutBasedIDWP(name)["phoIso"][idForBarrel]) < self.photonIso():
103  passPhotonID = False
104 
105  return passPhotonID
106 
107 
108 
109  pass
110 
111 setattr(ROOT.pat.Photon, "recoPhotonIso", ROOT.reco.Photon.photonIso)
112 setattr(ROOT.pat.Photon, "recoNeutralHadronIso", ROOT.reco.Photon.neutralHadronIso)
113 setattr(ROOT.pat.Photon, "recoChargedHadronIso", ROOT.reco.Photon.chargedHadronIso)
def neutralHadronIso
Definition: Photon.py:27
def photonIso
Definition: Photon.py:30
def full5x5_r9
Definition: Photon.py:18
def CutBasedIDWP
Definition: Photon.py:44
def calScaledIsoValue
Definition: Photon.py:78
def etaRegionID
Definition: Photon.py:70
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
def sigmaIetaIeta
Definition: Photon.py:15
def hOVERe
Definition: Photon.py:9
def passPhotonID
Definition: Photon.py:82
def photonIDCSA14
Definition: Photon.py:33
def chargedHadronIso
Definition: Photon.py:24
def full5x5_sigmaIetaIeta
Definition: Photon.py:21