68 event.allphotons =
map( Photon, self.handles[
'photons'].product() )
69 event.allphotons.sort(key =
lambda l : l.pt(), reverse =
True)
71 event.selectedPhotons = []
72 event.selectedPhotonsCentral = []
76 self.IsolationComputer.setPackedCandidates(self.handles[
'packedCandidates'].product(), -1, 0.1, 0.2)
79 if self.cfg_ana.doPhotonScaleCorrections:
80 for gamma
in event.allphotons:
81 self.photonEnergyCalibrator.correct(gamma, event.run)
84 for gamma
in event.allphotons:
85 if gamma.pt() < self.cfg_ana.ptMin:
continue 86 if abs(gamma.eta()) > self.cfg_ana.etaMax:
continue 89 gamma.rho =
float(self.handles[
'rhoPhoton'].product()[0])
91 if abs(gamma.eta()) < 1.0: gamma.EffectiveArea03 = [ 0.0234, 0.0053, 0.078 ]
92 elif abs(gamma.eta()) < 1.479: gamma.EffectiveArea03 = [ 0.0189, 0.0103, 0.0629 ]
93 elif abs(gamma.eta()) < 2.0: gamma.EffectiveArea03 = [ 0.0171, 0.0057, 0.0264 ]
94 elif abs(gamma.eta()) < 2.2: gamma.EffectiveArea03 = [ 0.0129, 0.0070, 0.0462 ]
95 elif abs(gamma.eta()) < 2.3: gamma.EffectiveArea03 = [ 0.0110, 0.0152, 0.0740 ]
96 elif abs(gamma.eta()) < 2.4: gamma.EffectiveArea03 = [ 0.0074, 0.0232, 0.0924 ]
97 else: gamma.EffectiveArea03 = [ 0.0035, 0.1709, 0.1484 ]
102 gamma.relIso = (
max(gamma.chargedHadronIso()-gamma.rho*gamma.EffectiveArea03[0],0) +
max(gamma.neutralHadronIso()-gamma.rho*gamma.EffectiveArea03[1],0) +
max(gamma.photonIso() - gamma.rho*gamma.EffectiveArea03[2],0))/gamma.pt()
105 """Create an integer equal to 1-2-3 for (loose,medium,tight)""" 108 if gamma.photonID(X%
"Loose"):
112 if gamma.photonID(X%
"Tight"):
116 gamma.idCutBased = idWP(gamma,
"PhotonCutBasedID%s")
119 keepThisPhoton =
True 121 if self.cfg_ana.gammaID==
"PhotonCutBasedIDLoose_CSA14" or self.cfg_ana.gammaID==
"PhotonCutBasedIDLoose_PHYS14" :
122 gamma.idCutBased = gamma.photonIDCSA14(self.cfg_ana.gammaID)
124 keepThisPhoton = gamma.photonIDCSA14(self.cfg_ana.gammaID,
True)
126 if gamma.hasPixelSeed():
127 keepThisPhoton =
False 129 elif "NoIso" in self.cfg_ana.gammaID:
130 idName = re.split(
'_NoIso',self.cfg_ana.gammaID)
131 keepThisPhoton = gamma.passPhotonID(idName[0],self.cfg_ana.conversionSafe_eleVeto)
132 basenameID = re.split(
'_looseSieie',idName[0])
133 gamma.idCutBased = gamma.passPhotonID(basenameID[0],self.cfg_ana.conversionSafe_eleVeto)
139 keepThisPhoton = gamma.passPhotonID(self.cfg_ana.gammaID,self.cfg_ana.conversionSafe_eleVeto)
and gamma.passPhotonIso(self.cfg_ana.gammaID,self.cfg_ana.gamma_isoCorr)
142 event.selectedPhotons.append(gamma)
145 event.selectedPhotonsCentral.append(gamma)
147 event.selectedPhotons.sort(key =
lambda l : l.pt(), reverse =
True)
148 event.selectedPhotonsCentral.sort(key =
lambda l : l.pt(), reverse =
True)
150 self.counters.counter(
'events').inc(
'all events')
151 if foundPhoton: self.counters.counter(
'events').inc(
'has >=1 gamma at preselection')
152 if len(event.selectedPhotons): self.counters.counter(
'events').inc(
'has >=1 selected gamma')
def attachFootprintRemovedIsolation(self, gamma)
doFootprintRemovedIsolation
def makePhotons(self, event)
Abs< T >::type abs(const T &t)