CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
photons_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
4 
5 from math import ceil,log
6 
7 
8 photon_id_modules_WorkingPoints_nanoAOD = cms.PSet(
9  modules = cms.vstring(
10  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V1_TrueVtx_cff',
11  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Fall17_94X_V2_cff',
12  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V1p1_cff',
13  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Fall17_94X_V2_cff',
14  'RecoEgamma.PhotonIdentification.Identification.cutBasedPhotonID_Spring16_V2p2_cff',
15  'RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff',
16  ),
17  WorkingPoints = cms.vstring(
18  "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V2-loose",
19  "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V2-medium",
20  "egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V2-tight",
21  )
22 )
23 photon_id_modules_WorkingPoints_nanoAOD_Spring16V2p2 = cms.PSet(
24  modules = photon_id_modules_WorkingPoints_nanoAOD.modules,
25  WorkingPoints = cms.vstring(
26  "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose",
27  "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium",
28  "egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight",
29  )
30 )
31 
32 def make_bitmapVID_docstring(id_modules_working_points_pset):
33  pset = id_modules_working_points_pset
34 
35  for modname in pset.modules:
36  ids = __import__(modname, globals(), locals(), ['idName','cutFlow'])
37  for name in dir(ids):
38  _id = getattr(ids,name)
39  if hasattr(_id,'idName') and hasattr(_id,'cutFlow'):
40  if (len(pset.WorkingPoints)>0 and _id.idName == pset.WorkingPoints[0].split(':')[-1]):
41  cut_names = ','.join([cut.cutName.value() for cut in _id.cutFlow])
42  n_bits_per_cut = int(ceil(log(len(pset.WorkingPoints)+1,2)))
43  return 'VID compressed bitmap (%s), %d bits per cut'%(cut_names, n_bits_per_cut)
44  raise ValueError("Something is wrong in the photon ID modules parameter set!")
45 
46 bitmapVIDForPho = cms.EDProducer("PhoVIDNestedWPBitmapProducer",
47  src = cms.InputTag("slimmedPhotons"),
48  WorkingPoints = photon_id_modules_WorkingPoints_nanoAOD.WorkingPoints,
49 )
50 
51 bitmapVIDForPhoSpring16V2p2 = cms.EDProducer("PhoVIDNestedWPBitmapProducer",
52  src = cms.InputTag("slimmedPhotons"),
53  WorkingPoints = photon_id_modules_WorkingPoints_nanoAOD_Spring16V2p2.WorkingPoints,
54 )
55 
56 isoForPho = cms.EDProducer("PhoIsoValueMapProducer",
57  src = cms.InputTag("slimmedPhotons"),
58  relative = cms.bool(False),
59  rho_PFIso = cms.InputTag("fixedGridRhoFastjetAll"),
60  mapIsoChg = cms.InputTag("photonIDValueMapProducer:phoChargedIsolation"),
61  mapIsoNeu = cms.InputTag("photonIDValueMapProducer:phoNeutralHadronIsolation"),
62  mapIsoPho = cms.InputTag("photonIDValueMapProducer:phoPhotonIsolation"),
63  EAFile_PFIso_Chg = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfChargedHadrons_90percentBased_V2.txt"),
64  EAFile_PFIso_Neu = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased_V2.txt"),
65  EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Fall17/effAreaPhotons_cone03_pfPhotons_90percentBased_V2.txt"),
66 )
67 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
68  modifier.toModify(isoForPho,
69  EAFile_PFIso_Chg = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfChargedHadrons_90percentBased.txt"),
70  EAFile_PFIso_Neu = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfNeutralHadrons_90percentBased.txt"),
71  EAFile_PFIso_Pho = cms.FileInPath("RecoEgamma/PhotonIdentification/data/Spring16/effAreaPhotons_cone03_pfPhotons_90percentBased.txt"),
72  )
73 
74 seedGainPho = cms.EDProducer("PhotonSeedGainProducer", src = cms.InputTag("slimmedPhotons"))
75 
76 import RecoEgamma.EgammaTools.calibratedEgammas_cff
77 
78 calibratedPatPhotonsNano = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatPhotons.clone(
79  produceCalibratedObjs = False,
80  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2016_UltraLegacy_preVFP_RunFineEtaR9Gain"),
81 )
82 
83 (run2_egamma_2016 & tracker_apv_vfp30_2016).toModify(calibratedPatPhotonsNano,
84  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2016_UltraLegacy_preVFP_RunFineEtaR9Gain")
85 )
86 
87 (run2_egamma_2016 & ~tracker_apv_vfp30_2016).toModify(calibratedPatPhotonsNano,
88  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2016_UltraLegacy_postVFP_RunFineEtaR9Gain"),
89 )
90 
91 run2_egamma_2017.toModify(calibratedPatPhotonsNano,
92  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2017_24Feb2020_runEtaR9Gain_v2")
93 )
94 
95 run2_egamma_2018.toModify(calibratedPatPhotonsNano,
96  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2018_29Sep2020_RunFineEtaR9Gain")
97 )
98 
99 run2_nanoAOD_102Xv1.toModify(calibratedPatPhotonsNano,
100  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2018_Step2Closure_CoarseEtaR9Gain_v2")
101 )
102 
103 run2_nanoAOD_94XMiniAODv1.toModify(calibratedPatPhotonsNano,
104  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2017_17Nov2017_v1_ele_unc")
105 )
106 
107 run2_nanoAOD_94XMiniAODv2.toModify(calibratedPatPhotonsNano,
108  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2017_17Nov2017_v1_ele_unc")
109 )
110 
111 
112 run2_miniAOD_80XLegacy.toModify(calibratedPatPhotonsNano,
113  correctionFile = cms.string("EgammaAnalysis/ElectronTools/data/ScalesSmearings/Legacy2016_07Aug2017_FineEtaR9_v3_ele_unc")
114 )
115 
116 
117 slimmedPhotonsWithUserData = cms.EDProducer("PATPhotonUserDataEmbedder",
118  src = cms.InputTag("slimmedPhotons"),
119  userFloats = cms.PSet(
120  mvaID = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRunIIFall17v2Values"),
121  PFIsoChg = cms.InputTag("isoForPho:PFIsoChg"),
122  PFIsoAll = cms.InputTag("isoForPho:PFIsoAll"),
123  ),
124  userIntFromBools = cms.PSet(
125  cutbasedID_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V2-loose"),
126  cutbasedID_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V2-medium"),
127  cutbasedID_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V2-tight"),
128  mvaID_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-RunIIFall17-v2-wp90"),
129  mvaID_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-RunIIFall17-v2-wp80"),
130  cutbasedIDV1_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-loose"),
131  cutbasedIDV1_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-medium"),
132  cutbasedIDV1_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Fall17-94X-V1-tight"),
133  ),
134  userInts = cms.PSet(
135  VIDNestedWPBitmap = cms.InputTag("bitmapVIDForPho"),
136  seedGain = cms.InputTag("seedGainPho"),
137  )
138 )
139 
140 
141 for modifier in run2_egamma_2016, run2_egamma_2017, run2_egamma_2018:
142  modifier.toModify(slimmedPhotonsWithUserData.userFloats,
143  ecalEnergyErrPostCorrNew = cms.InputTag("calibratedPatPhotonsNano","ecalEnergyErrPostCorr"),
144  ecalEnergyPreCorrNew = cms.InputTag("calibratedPatPhotonsNano","ecalEnergyPreCorr"),
145  ecalEnergyPostCorrNew = cms.InputTag("calibratedPatPhotonsNano","ecalEnergyPostCorr"),
146  energyScaleUpNew = cms.InputTag("calibratedPatPhotonsNano","energyScaleUp"),
147  energyScaleDownNew = cms.InputTag("calibratedPatPhotonsNano","energyScaleDown"),
148  energySigmaUpNew = cms.InputTag("calibratedPatPhotonsNano","energySigmaUp"),
149  energySigmaDownNew = cms.InputTag("calibratedPatPhotonsNano","energySigmaDown"),
150  )
151 
152 
153 run2_nanoAOD_94X2016.toModify(slimmedPhotonsWithUserData.userFloats,
154  ecalEnergyErrPostCorrNew = None,
155  ecalEnergyPreCorrNew = None,
156  ecalEnergyPostCorrNew = None,
157  energyScaleUpNew = None,
158  energyScaleDownNew = None,
159  energySigmaUpNew = None,
160  energySigmaDownNew = None
161  )
162 
163 
164 finalPhotons = cms.EDFilter("PATPhotonRefSelector",
165  src = cms.InputTag("slimmedPhotonsWithUserData"),
166  cut = cms.string("pt > 5 ")
167 )
168 
169 photonTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
170  src = cms.InputTag("linkedObjects","photons"),
171  cut = cms.string(""), #we should not filter on cross linked collections
172  name= cms.string("Photon"),
173  doc = cms.string("slimmedPhotons after basic selection (" + finalPhotons.cut.value()+")"),
174  singleton = cms.bool(False), # the number of entries is variable
175  extension = cms.bool(False), # this is the main table for the photons
176  variables = cms.PSet(P3Vars,
177  jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
178  electronIdx = Var("?hasUserCand('electron')?userCand('electron').key():-1", int, doc="index of the associated electron (-1 if none)"),
179  energyErr = Var("getCorrectedEnergyError('regression2')",float,doc="energy error of the cluster from regression",precision=6),
180  energyRaw = Var("superCluster().rawEnergy()",float,doc="raw energy of photon supercluster", precision=10),
181  r9 = Var("full5x5_r9()",float,doc="R9 of the supercluster, calculated with full 5x5 region",precision=8),
182  sieie = Var("full5x5_sigmaIetaIeta()",float,doc="sigma_IetaIeta of the supercluster, calculated with full 5x5 region",precision=8),
183  sipip = Var("showerShapeVariables().sigmaIphiIphi", float, doc="sigmaIphiIphi of the supercluster", precision=8),
184  sieip = Var("full5x5_showerShapeVariables().sigmaIetaIphi",float,doc="sigma_IetaIphi of the supercluster, calculated with full 5x5 region",precision=8),
185  s4 = Var("full5x5_showerShapeVariables().e2x2/full5x5_showerShapeVariables().e5x5",float,doc="e2x2/e5x5 of the supercluster, calculated with full 5x5 region",precision=8),
186  etaWidth = Var("superCluster().etaWidth()",float,doc="Width of the photon supercluster in eta", precision=8),
187  phiWidth = Var("superCluster().phiWidth()",float,doc="Width of the photon supercluster in phi", precision=8),
188  cutBased = Var(
189  "userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",
190  int,
191  doc="cut-based ID bitmap, Fall17V2, (0:fail, 1:loose, 2:medium, 3:tight)",
192  ),
193  cutBased_Fall17V1Bitmap = Var(
194  "userInt('cutbasedIDV1_loose')+2*userInt('cutbasedIDV1_medium')+4*userInt('cutbasedIDV1_tight')",
195  int,
196  doc="cut-based ID bitmap, Fall17V1, 2^(0:loose, 1:medium, 2:tight).",
197  ),
198  vidNestedWPBitmap = Var(
199  "userInt('VIDNestedWPBitmap')",
200  int,
201  doc="Fall17V2 " + make_bitmapVID_docstring(photon_id_modules_WorkingPoints_nanoAOD),
202  ),
203  electronVeto = Var("passElectronVeto()",bool,doc="pass electron veto"),
204  pixelSeed = Var("hasPixelSeed()",bool,doc="has pixel seed"),
205  mvaID = Var("userFloat('mvaID')",float,doc="MVA ID score, Fall17V2",precision=10),
206  mvaID_WP90 = Var("userInt('mvaID_WP90')",bool,doc="MVA ID WP90, Fall17V2"),
207  mvaID_WP80 = Var("userInt('mvaID_WP80')",bool,doc="MVA ID WP80, Fall17V2"),
208  pfPhoIso03 = Var("photonIso()",float,doc="PF absolute isolation dR=0.3, photon component (uncorrected)"),
209  pfChargedIsoPFPV = Var("chargedHadronPFPVIso()",float,doc="PF absolute isolation dR=0.3, charged component (PF PV only)"),
210  pfChargedIsoWorstVtx = Var("chargedHadronWorstVtxIso()",float,doc="PF absolute isolation dR=0.3, charged component (Vertex with largest isolation)"),
211  pfRelIso03_chg = Var("userFloat('PFIsoChg')/pt",float,doc="PF relative isolation dR=0.3, charged component (with rho*EA PU corrections)"),
212  pfRelIso03_all = Var("userFloat('PFIsoAll')/pt",float,doc="PF relative isolation dR=0.3, total (with rho*EA PU corrections)"),
213  hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8),
214  isScEtaEB = Var("abs(superCluster().eta()) < 1.4442",bool,doc="is supercluster eta within barrel acceptance"),
215  isScEtaEE = Var("abs(superCluster().eta()) > 1.566 && abs(superCluster().eta()) < 2.5",bool,doc="is supercluster eta within endcap acceptance"),
216  seedGain = Var("userInt('seedGain')","uint8",doc="Gain of the seed crystal"),
217  # position of photon is best approximated by position of seed cluster, not the SC centroid
218  x_calo = Var("superCluster().seed().position().x()",float,doc="photon supercluster position on calorimeter, x coordinate (cm)",precision=10),
219  y_calo = Var("superCluster().seed().position().y()",float,doc="photon supercluster position on calorimeter, y coordinate (cm)",precision=10),
220  z_calo = Var("superCluster().seed().position().z()",float,doc="photon supercluster position on calorimeter, z coordinate (cm)",precision=10),
221  # ES variables
222  esEffSigmaRR = Var("full5x5_showerShapeVariables().effSigmaRR()", float, doc="preshower sigmaRR"),
223  esEnergyOverRawE = Var("superCluster().preshowerEnergy()/superCluster().rawEnergy()", float, doc="ratio of preshower energy to raw supercluster energy"),
224  )
225 )
226 
227 
228 #these eras need to make the energy correction, hence the "New"
229 for modifier in run2_egamma_2016, run2_egamma_2017, run2_egamma_2018 :
230  modifier.toModify(photonTable.variables,
231  pt = Var("pt*userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')", float, precision=-1, doc="p_{T}"),
232  energyErr = Var("userFloat('ecalEnergyErrPostCorrNew')",float,doc="energy error of the cluster from regression",precision=6),
233  eCorr = Var("userFloat('ecalEnergyPostCorrNew')/userFloat('ecalEnergyPreCorrNew')",float,doc="ratio of the calibrated energy/miniaod energy"),
234  hoe = Var("hadTowOverEm()",float,doc="H over E (Run2)",precision=8),
235  )
236 
237 #these eras have the energy correction in the mini
238 for modifier in run2_nanoAOD_94X2016,:
239  modifier.toModify(photonTable.variables,
240  pt = Var("pt*userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')", float, precision=-1, doc="p_{T}"),
241  energyErr = Var("userFloat('ecalEnergyErrPostCorr')",float,doc="energy error of the cluster from regression",precision=6),
242  eCorr = Var("userFloat('ecalEnergyPostCorr')/userFloat('ecalEnergyPreCorr')",float,doc="ratio of the calibrated energy/miniaod energy"),
243 
244  )
245 
246 for modifier in run2_nanoAOD_94X2016, run2_miniAOD_80XLegacy:
247  modifier.toModify(slimmedPhotonsWithUserData.userFloats,
248  mvaID_Spring16nonTrigV1 = cms.InputTag("photonMVAValueMapProducer:PhotonMVAEstimatorRun2Spring16NonTrigV1Values"),
249  )
250  modifier.toModify(slimmedPhotonsWithUserData.userIntFromBools,
251  cutID_Spring16_loose = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-loose"),
252  cutID_Spring16_medium = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-medium"),
253  cutID_Spring16_tight = cms.InputTag("egmPhotonIDs:cutBasedPhotonID-Spring16-V2p2-tight"),
254  mvaID_Spring16nonTrigV1_WP90 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp90"),
255  mvaID_Spring16nonTrigV1_WP80 = cms.InputTag("egmPhotonIDs:mvaPhoID-Spring16-nonTrig-V1-wp80"),
256 
257  )
258  modifier.toModify(slimmedPhotonsWithUserData.userInts,
259  VIDNestedWPBitmap_Spring16V2p2 = cms.InputTag("bitmapVIDForPhoSpring16V2p2"),
260  )
261 
262 for modifier in run2_nanoAOD_94X2016, run2_miniAOD_80XLegacy:
263  modifier.toModify(photonTable.variables,
264  cutBased_Spring16V2p2 = Var(
265  "userInt('cutID_Spring16_loose')+userInt('cutID_Spring16_medium')+userInt('cutID_Spring16_tight')",
266  int,
267  doc="cut-based ID bitmap, Spring16V2p2, (0:fail, 1:loose, 2:medium, 3:tight)"
268  ),
269  vidNestedWPBitmap_Spring16V2p2 = Var(
270  "userInt('VIDNestedWPBitmap_Spring16V2p2')",
271  int,
272  doc="Spring16V2p2 " + make_bitmapVID_docstring(photon_id_modules_WorkingPoints_nanoAOD_Spring16V2p2)
273  ),
274  mvaID_Spring16nonTrigV1 = Var(
275  "userFloat('mvaID_Spring16nonTrigV1')",
276  float,
277  doc="MVA ID score, Spring16nonTrigV1",
278  precision=10
279  ),
280  )
281 
282 photonsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR
283  src = photonTable.src, # final reco collection
284  matched = cms.InputTag("finalGenParticles"), # final mc-truth particle collection
285  mcPdgId = cms.vint32(11,22), # one or more PDG ID (11 = el, 22 = pho); absolute values (see below)
286  checkCharge = cms.bool(False), # True = require RECO and MC objects to have the same charge
287  mcStatus = cms.vint32(1), # PYTHIA status code (1 = stable, 2 = shower, 3 = hard scattering)
288  maxDeltaR = cms.double(0.3), # Minimum deltaR for the match
289  maxDPtRel = cms.double(0.5), # Minimum deltaPt/Pt for the match
290  resolveAmbiguities = cms.bool(True), # Forbid two RECO objects to match to the same GEN object
291  resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first
292 )
293 
294 photonMCTable = cms.EDProducer("CandMCMatchTableProducer",
295  src = photonTable.src,
296  mcMap = cms.InputTag("photonsMCMatchForTable"),
297  objName = photonTable.name,
298  objType = photonTable.name, #cms.string("Photon"),
299  branchName = cms.string("genPart"),
300  docString = cms.string("MC matching to status==1 photons or electrons"),
301 )
302 
303 from RecoEgamma.EgammaTools.egammaObjectModificationsInMiniAOD_cff import egamma8XObjectUpdateModifier,egamma9X105XUpdateModifier,prependEgamma8XObjectUpdateModifier
304 #we have dataformat changes to 106X so to read older releases we use egamma updators
305 slimmedPhotonsTo106X = cms.EDProducer("ModifiedPhotonProducer",
306  src = cms.InputTag("slimmedPhotons"),
307  modifierConfig = cms.PSet( modifications = cms.VPSet(egamma9X105XUpdateModifier) )
308 )
309 #might as well fix 80X while we're at it although the differences are not so relavent for nano
310 run2_miniAOD_80XLegacy.toModify( slimmedPhotonsTo106X.modifierConfig.modifications, prependEgamma8XObjectUpdateModifier )
311 
312 for modifier in run2_miniAOD_80XLegacy,run2_nanoAOD_94XMiniAODv1,run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016 ,run2_nanoAOD_102Xv1:
313  modifier.toModify(bitmapVIDForPho, src = "slimmedPhotonsTo106X")
314  modifier.toModify(bitmapVIDForPhoSpring16V2p2, src = "slimmedPhotonsTo106X")
315  modifier.toModify(isoForPho, src = "slimmedPhotonsTo106X")
316  modifier.toModify(calibratedPatPhotonsNano, src = "slimmedPhotonsTo106X")
317  modifier.toModify(slimmedPhotonsWithUserData, src = "slimmedPhotonsTo106X")
318  modifier.toModify(seedGainPho, src = "slimmedPhotonsTo106X")
319 
320 
321 ##adding 4 most imp scale & smearing variables to table
322 for modifier in run2_egamma_2016, run2_egamma_2017, run2_egamma_2018:
323  modifier.toModify(photonTable.variables,
324  dEscaleUp=Var("userFloat('ecalEnergyPostCorrNew') - userFloat('energyScaleUpNew')", float, doc="ecal energy scale shifted 1 sigma up (adding gain/stat/syst in quadrature)", precision=8),
325  dEscaleDown=Var("userFloat('ecalEnergyPostCorrNew') - userFloat('energyScaleDownNew')", float, doc="ecal energy scale shifted 1 sigma down (adding gain/stat/syst in quadrature)", precision=8),
326  dEsigmaUp=Var("userFloat('ecalEnergyPostCorrNew') - userFloat('energySigmaUpNew')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8),
327  dEsigmaDown=Var("userFloat('ecalEnergyPostCorrNew') - userFloat('energySigmaDownNew')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8),
328  )
329 
330 for modifier in run2_nanoAOD_94X2016,:
331  modifier.toModify(photonTable.variables,
332  dEscaleUp=Var("userFloat('ecalEnergyPostCorr') - userFloat('energyScaleUp')", float, doc="ecal energy scale shifted 1 sigma up (adding gain/stat/syst in quadrature)", precision=8),
333  dEscaleDown=Var("userFloat('ecalEnergyPostCorr') - userFloat('energyScaleDown')", float, doc="ecal energy scale shifted 1 sigma down (adding gain/stat/syst in quadrature)", precision=8),
334  dEsigmaUp=Var("userFloat('ecalEnergyPostCorr') - userFloat('energySigmaUp')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8),
335  dEsigmaDown=Var("userFloat('ecalEnergyPostCorr') - userFloat('energySigmaDown')", float, doc="ecal energy smearing value shifted 1 sigma up", precision=8),
336  )
337 
338 photonTask = cms.Task(bitmapVIDForPho, isoForPho, seedGainPho, calibratedPatPhotonsNano, slimmedPhotonsWithUserData, finalPhotons)
339 photonTablesTask = cms.Task(photonTable)
340 photonMCTask = cms.Task(photonsMCMatchForTable, photonMCTable)
341 
342 
343 ## TEMPORARY as no ID for Run3 yet
344 (run3_nanoAOD_devel).toReplaceWith(photonTask, photonTask.copyAndExclude([bitmapVIDForPho]))
345 (run3_nanoAOD_devel).toModify(slimmedPhotonsWithUserData, userIntFromBools = cms.PSet())
346 (run3_nanoAOD_devel).toModify(slimmedPhotonsWithUserData.userInts,
347  VIDNestedWPBitmap = None,)
348 (run3_nanoAOD_devel).toModify(slimmedPhotonsWithUserData.userFloats,
349  mvaID = None)
350 (run3_nanoAOD_devel).toModify(photonTable.variables,
351  cutBased = None,
352  cutBased_Fall17V1Bitmap = None,
353  vidNestedWPBitmap = None,
354  mvaID = None,
355  mvaID_WP90 = None,
356  mvaID_WP80 = None,
357 )
358 #### end TEMPORARY Run3
359 
360 from RecoEgamma.EgammaIsolationAlgos.egmPhotonIsolationMiniAOD_cff import egmPhotonIsolation
361 from RecoEgamma.PhotonIdentification.photonIDValueMapProducer_cff import photonIDValueMapProducer
362 
363 _withUpdatePho_Task = cms.Task(egmPhotonIsolation,photonIDValueMapProducer,slimmedPhotonsTo106X)
364 _withUpdatePho_Task.add(photonTask.copy())
365 
366 for modifier in run2_nanoAOD_94XMiniAODv2,run2_nanoAOD_94X2016 ,run2_nanoAOD_102Xv1,run2_nanoAOD_94XMiniAODv1:
367  modifier.toReplaceWith(photonTask, _withUpdatePho_Task)
368 
369 for modifier in run2_miniAOD_80XLegacy, run2_nanoAOD_94X2016:
370  _withSpring16V2p2_Task = cms.Task(bitmapVIDForPhoSpring16V2p2)
371  _withSpring16V2p2_Task.add(_withUpdatePho_Task.copy())
372  modifier.toReplaceWith(photonTask, _withSpring16V2p2_Task)
constexpr int32_t ceil(float num)
static std::vector< std::string > checklist log
def make_bitmapVID_docstring
Definition: photons_cff.py:32
static std::string join(char **cmd)
Definition: RemoteFile.cc:19