CMS 3D CMS Logo

egammaObjectModificationsInMiniAOD_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 #electron mva ids
4 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff as ele_spring16_gp_v1
5 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff as ele_spring16_hzz_v1
6 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff as ele_fall17_iso_v1
7 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff as ele_fall17_noIso_v1
8 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff as ele_fall17_iso_v2
9 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff as ele_fall17_noIso_v2
10 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff as ele_summer18UL_hzz
11 
12 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_RunIIIWinter22_iso_V1_cff as ele_RunIIIWinter22_iso_v1
13 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_RunIIIWinter22_noIso_V1_cff as ele_RunIIIWinter22_noIso_v1
14 
15 #photon mva ids
16 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff as pho_spring16_nt_v1
20 
21 
22 ele_mva_prod_name = 'electronMVAValueMapProducer'
23 pho_mva_prod_name = 'photonMVAValueMapProducer'
24 
25 def setup_mva(val_pset,cat_pset,prod_name,mva_name):
26  value_name = '%s:%sValues'%(prod_name,mva_name)
27  cat_name = '%s:%sCategories'%(prod_name,mva_name)
28  setattr( val_pset, '%sValues'%mva_name, cms.InputTag(value_name) )
29  setattr( cat_pset, '%sCategories'%mva_name, cms.InputTag(cat_name) )
30 
31 egamma_modifications = cms.VPSet(
32  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
33  electron_config = cms.PSet( ),
34  photon_config = cms.PSet( )
35  ),
36  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromIntValueMaps'),
37  electron_config = cms.PSet( ),
38  photon_config = cms.PSet( )
39  )
40 )
41 
42 #setup the mva value maps to embed
43 for ele_mva_cff in [
44  ele_spring16_gp_v1,
45  ele_spring16_hzz_v1,
46  ele_fall17_iso_v1,
47  ele_fall17_noIso_v1,
48  ele_fall17_iso_v2,
49  ele_fall17_noIso_v2,
50  ele_summer18UL_hzz,
51  ele_RunIIIWinter22_iso_v1,
52  ele_RunIIIWinter22_noIso_v1
53  ]:
54 
55  setup_mva(egamma_modifications[0].electron_config,
56  egamma_modifications[1].electron_config,
57  ele_mva_prod_name,
58  ele_mva_cff.mvaClassName + ele_mva_cff.mvaTag)
59 
60 for pho_mva_cff in [
61  pho_spring16_nt_v1,
62  pho_fall17_94X_v1p1,
63  pho_fall17_94X_v2,
64  pho_winter22_122X_v1
65  ]:
66 
67  setup_mva(egamma_modifications[0].photon_config,
68  egamma_modifications[1].photon_config,
69  pho_mva_prod_name,
70  pho_mva_cff.mvaClassName + pho_mva_cff.mvaTag)
71 
72 
75 
76 #from RecoEgamma.EgammaTools.regressionModifier_cfi import *
77 
78 #egamma_modifications.append( regressionModifier )
79 
80 
83 reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
84  modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
85  electron_config = cms.PSet(),
86  photon_config = cms.PSet()
87 )
88 from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
89 import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
90 for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
91  setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))
92 
93 import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
94 for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
95  setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))
96 
97 
100 egamma8XObjectUpdateModifier = cms.PSet(
101  modifierName = cms.string('EG8XObjectUpdateModifier'),
102  ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
103  ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
104 )
105 
106 
109 egamma9X105XUpdateModifier = cms.PSet(
110  modifierName = cms.string('EG9X105XObjectUpdateModifier'),
111  eleCollVMsAreKeyedTo = cms.InputTag("slimmedElectrons",processName=cms.InputTag.skipCurrentProcess()),
112  phoCollVMsAreKeyedTo = cms.InputTag("slimmedPhotons",processName=cms.InputTag.skipCurrentProcess()),
113  conversions = cms.InputTag("reducedEgamma","reducedConversions"),
114  beamspot = cms.InputTag("offlineBeamSpot"),
115  ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
116  ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
117  eleTrkIso = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso"),
118  eleTrkIso04 = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso04"),
119  phoPhotonIso = cms.InputTag("photonIDValueMapProducer","phoPhotonIsolation"),
120  phoNeutralHadIso = cms.InputTag("photonIDValueMapProducer","phoNeutralHadronIsolation"),
121  phoChargedHadIso = cms.InputTag("photonIDValueMapProducer","phoChargedIsolation"),
122  phoChargedHadWorstVtxIso = cms.InputTag("photonIDValueMapProducer","phoWorstChargedIsolation"),
123  phoChargedHadWorstVtxConeVetoIso = cms.InputTag("photonIDValueMapProducer","phoWorstChargedIsolationConeVeto"),
124  phoChargedHadPFPVIso = cms.InputTag("egmPhotonIsolation","h+-DR030-"),
125  allowGsfTrackForConvs = cms.bool(False),
126  updateChargedHadPFPVIso = cms.bool(True)
127 )
128 
129 
134 from RecoEgamma.EgammaTools.calibratedEgammas_cff import ecalTrkCombinationRegression
135 egamma8XLegacyEtScaleSysModifier = cms.PSet(
136  modifierName = cms.string('EGEtScaleSysModifier'),
137  epCombConfig = ecalTrkCombinationRegression,
138  uncertFunc = cms.PSet(
139  name = cms.string("UncertFuncV1"),
140  lowEt = cms.double(43.5),
141  highEt = cms.double(46.5),
142  lowEtUncert = cms.double(0.002),
143  highEtUncert = cms.double(-0.002)
144  )
145  )
146 
147 # modifier for photon isolation used in heavy ions
148 egammaHIPhotonIsolationModifier = cms.PSet(
149  modifierName = cms.string('EGExtraInfoModifierFromHIPhotonIsolationValueMaps'),
150  electron_config = cms.PSet(),
151  photon_config = cms.PSet(
152  photonIsolationHI = cms.InputTag("reducedEgamma:photonIsolationHIProducerppGED")
153  )
154  )
155 
156 photonDRNModifier = cms.PSet(
157  modifierName = cms.string("EGRegressionModifierDRN"),
158  patPhotons = cms.PSet(
159  source = cms.InputTag("selectedPatPhotons"),
160  correctionsSource = cms.InputTag('patPhotonsDRN'),
161  energyFloat = cms.string("energyDRN"),
162  resFloat = cms.string("resolutionDRN")
163  )
164  )
165 
167  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
168 
170  modifiers.insert(0,egamma8XObjectUpdateModifier)
171 
173  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
174  modifiers.append(egamma8XLegacyEtScaleSysModifier)
175 
177  modifiers.append(egammaHIPhotonIsolationModifier)
178 
179 def appendPhotonDRNModifier(modifiers):
180  modifiers.append(photonDRNModifier)
181 
182 from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
183 from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
184 (run2_miniAOD_94XFall17 | run2_miniAOD_UL).toModify(egamma_modifications,appendReducedEgammaEnergyScaleAndSmearingModifier)
185 
186 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
187 #80X doesnt have the bug which prevents GsfTracks used to match conversions so set true
188 run2_miniAOD_80XLegacy.toModify(egamma9X105XUpdateModifier,allowGsfTrackForConvs = True)
189 run2_miniAOD_80XLegacy.toModify(egamma_modifications,appendEgamma8XLegacyAppendableModifiers)
190 run2_miniAOD_80XLegacy.toModify(egamma_modifications,prependEgamma8XObjectUpdateModifier)
191 
192 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
193 pp_on_AA.toModify(egamma_modifications, appendEgammaHIPhotonIsolationModifier)
194 
195 from Configuration.ProcessModifiers.photonDRN_cff import _photonDRN
196 _photonDRN.toModify(egamma_modifications, appendPhotonDRNModifier)
def prefixName(prefix, name)
def setup_mva(val_pset, cat_pset, prod_name, mva_name)