CMS 3D CMS Logo

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