Skip to content

Commit

Permalink
Merge pull request cms-sw#227 from pandolf/photonfix
Browse files Browse the repository at this point in the history
Heppy - implemented full5x5 photon clustershape methods
  • Loading branch information
gpetruc committed Feb 11, 2015
2 parents 71d0757 + 9e02d58 commit 17cd775
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
8 changes: 4 additions & 4 deletions PhysicsTools/Heppy/python/analyzers/objects/PhotonAnalyzer.py
Expand Up @@ -76,9 +76,9 @@ def idWP(gamma,X):
gamma.idCutBased = keepThisPhoton
# we're keeing sigmaietaieta sidebands, but the id is false for them:

if abs(gamma.eta())< 1.479 and gamma.sigmaIetaIeta()>0.010 :
if abs(gamma.eta())< 1.479 and gamma.full5x5_sigmaIetaIeta()>0.010 :
gamma.idCutBased = False
if abs(gamma.eta())>=1.479 and gamma.sigmaIetaIeta()>0.0321 :
if abs(gamma.eta())>=1.479 and gamma.full5x5_sigmaIetaIeta()>0.0321 :
gamma.idCutBased = False
else:
keepThisPhoton = gamma.photonID(self.cfg_ana.gammaID)
Expand Down Expand Up @@ -152,8 +152,8 @@ def printInfo(self, event):
print 'gamma candidate phi: ',event.selectedPhotons[0].phi()
print 'gamma candidate mass: ',event.selectedPhotons[0].mass()
print 'gamma candidate HoE: ',event.selectedPhotons[0].hOVERe()
print 'gamma candidate r9: ',event.selectedPhotons[0].r9()
print 'gamma candidate sigmaIetaIeta: ',event.selectedPhotons[0].sigmaIetaIeta()
print 'gamma candidate r9: ',event.selectedPhotons[0].full5x5_r9()
print 'gamma candidate sigmaIetaIeta: ',event.selectedPhotons[0].full5x5_sigmaIetaIeta()
print 'gamma candidate had iso: ',event.selectedPhotons[0].chargedHadronIso()
print 'gamma candidate neu iso: ',event.selectedPhotons[0].neutralHadronIso()
print 'gamma candidate gamma iso: ',event.selectedPhotons[0].photonIso()
Expand Down
4 changes: 2 additions & 2 deletions PhysicsTools/Heppy/python/analyzers/objects/autophobj.py
Expand Up @@ -132,8 +132,8 @@
photonType = NTupleObjectType("gamma", baseObjectTypes = [ particleType ], variables = [
NTupleVariable("idCutBased", lambda x : x.idCutBased, int, help="1,2,3 if the gamma passes the loose, medium, tight WP of PhotonCutBasedID"),
NTupleVariable("hOverE", lambda x : x.hOVERe(), float, help="hoverE for photons"),
NTupleVariable("r9", lambda x : x.r9(), float, help="r9 for photons"),
NTupleVariable("sigmaIetaIeta", lambda x : x.sigmaIetaIeta(), float, help="sigmaIetaIeta for photons"),
NTupleVariable("r9", lambda x : x.full5x5_r9(), float, help="r9 for photons"),
NTupleVariable("sigmaIetaIeta", lambda x : x.full5x5_sigmaIetaIeta(), float, help="sigmaIetaIeta for photons"),
NTupleVariable("chHadIso", lambda x : x.chargedHadronIso(), float, help="chargedHadronIsolation for photons"),
NTupleVariable("neuHadIso", lambda x : x.neutralHadronIso(), float, help="neutralHadronIsolation for photons"),
NTupleVariable("phIso", lambda x : x.photonIso(), float, help="gammaIsolation for photons"),
Expand Down
16 changes: 11 additions & 5 deletions PhysicsTools/Heppy/python/physicsobjects/Photon.py
Expand Up @@ -5,9 +5,9 @@ class Photon(PhysicsObject ):
''' return object from the photon
'''
def hOVERe(self):
# return self.physObj.full5x5_hadTowOverEm()
hadTowDepth1O = self.physObj.hadTowDepth1OverEm() * (self.physObj.superCluster().energy()/self.physObj.e5x5() if self.physObj.e5x5() else 1)
hadTowDepth2O = self.physObj.hadTowDepth2OverEm() * (self.physObj.superCluster().energy()/self.physObj.e5x5() if self.physObj.e5x5() else 1)
#return self.physObj.hadronicOverEm()
hadTowDepth1O = self.physObj.hadTowDepth1OverEm() * (self.physObj.superCluster().energy()/self.physObj.full5x5_e5x5() if self.physObj.full5x5_e5x5() else 1)
hadTowDepth2O = self.physObj.hadTowDepth2OverEm() * (self.physObj.superCluster().energy()/self.physObj.full5x5_e5x5() if self.physObj.full5x5_e5x5() else 1)
return hadTowDepth1O + hadTowDepth2O

def r9(self):
Expand All @@ -16,6 +16,12 @@ def r9(self):
def sigmaIetaIeta(self):
return self.physObj.sigmaIetaIeta()

def full5x5_r9(self):
return self.physObj.full5x5_r9()

def full5x5_sigmaIetaIeta(self):
return self.physObj.full5x5_sigmaIetaIeta()

def chargedHadronIso(self):
return self.physObj.chargedHadronIso()

Expand All @@ -29,10 +35,10 @@ def photonIDCSA14(self, name):
keepThisPhoton = True
if name == "PhotonCutBasedIDLoose_CSA14":
if abs(self.physObj.eta())<1.479 :
if self.physObj.sigmaIetaIeta() > 0.012 : keepThisPhoton = False
if self.full5x5_sigmaIetaIeta() > 0.012 : keepThisPhoton = False
if self.hOVERe() > 0.0559 : keepThisPhoton = False
else :
if self.physObj.sigmaIetaIeta() > 0.035 : keepThisPhoton = False
if self.full5x5_sigmaIetaIeta() > 0.035 : keepThisPhoton = False
if self.hOVERe() > 0.049 : keepThisPhoton = False
return keepThisPhoton

Expand Down

0 comments on commit 17cd775

Please sign in to comment.