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 
11 
12 #photon mva ids
13 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff as pho_spring16_nt_v1
16 
17 
18 ele_mva_prod_name = 'electronMVAValueMapProducer'
19 pho_mva_prod_name = 'photonMVAValueMapProducer'
20 
21 def setup_mva(val_pset,cat_pset,prod_name,mva_name):
22  value_name = '%s:%sValues'%(prod_name,mva_name)
23  cat_name = '%s:%sCategories'%(prod_name,mva_name)
24  setattr( val_pset, '%sValues'%mva_name, cms.InputTag(value_name) )
25  setattr( cat_pset, '%sCategories'%mva_name, cms.InputTag(cat_name) )
26 
27 egamma_modifications = cms.VPSet(
28  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
29  electron_config = cms.PSet( ),
30  photon_config = cms.PSet( )
31  ),
32  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromIntValueMaps'),
33  electron_config = cms.PSet( ),
34  photon_config = cms.PSet( )
35  )
36 )
37 
38 #setup the mva value maps to embed
39 for ele_mva_cff in [
40  ele_spring16_gp_v1,
41  ele_spring16_hzz_v1,
42  ele_fall17_iso_v1,
43  ele_fall17_noIso_v1,
44  ele_fall17_iso_v2,
45  ele_fall17_noIso_v2,
46  ]:
47 
48  setup_mva(egamma_modifications[0].electron_config,
49  egamma_modifications[1].electron_config,
50  ele_mva_prod_name,
51  ele_mva_cff.mvaClassName + ele_mva_cff.mvaTag)
52 
53 for pho_mva_cff in [
54  pho_spring16_nt_v1,
55  pho_fall17_94X_v1p1,
56  pho_fall17_94X_v2
57  ]:
58 
59  setup_mva(egamma_modifications[0].photon_config,
60  egamma_modifications[1].photon_config,
61  pho_mva_prod_name,
62  pho_mva_cff.mvaClassName + pho_mva_cff.mvaTag)
63 
64 
67 
68 #from RecoEgamma.EgammaTools.regressionModifier_cfi import *
69 
70 #egamma_modifications.append( regressionModifier )
71 
72 
75 reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
76  modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
77  electron_config = cms.PSet(),
78  photon_config = cms.PSet()
79 )
80 from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
81 import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
82 for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
83  setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))
84 
85 import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
86 for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
87  setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))
88 
89 
92 egamma8XObjectUpdateModifier = cms.PSet(
93  modifierName = cms.string('EG8XObjectUpdateModifier'),
94  ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
95  ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
96 )
97 
98 
101 egamma9X105XUpdateModifier = cms.PSet(
102  modifierName = cms.string('EG9X105XObjectUpdateModifier'),
103  eleCollVMsAreKeyedTo = cms.InputTag("slimmedElectrons",processName=cms.InputTag.skipCurrentProcess()),
104  phoCollVMsAreKeyedTo = cms.InputTag("slimmedPhotons",processName=cms.InputTag.skipCurrentProcess()),
105  conversions = cms.InputTag("reducedEgamma","reducedConversions"),
106  beamspot = cms.InputTag("offlineBeamSpot"),
107  ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
108  ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
109  eleTrkIso = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso"),
110  eleTrkIso04 = cms.InputTag("heepIDVarValueMaps","eleTrkPtIso04"),
111  phoPhotonIso = cms.InputTag("photonIDValueMapProducer","phoPhotonIsolation"),
112  phoNeutralHadIso = cms.InputTag("photonIDValueMapProducer","phoNeutralHadronIsolation"),
113  phoChargedHadIso = cms.InputTag("photonIDValueMapProducer","phoChargedIsolation"),
114  phoChargedHadWorstVtxIso = cms.InputTag("photonIDValueMapProducer","phoWorstChargedIsolation"),
115  phoChargedHadWorstVtxConeVetoIso = cms.InputTag("photonIDValueMapProducer","phoWorstChargedIsolationConeVeto"),
116  phoChargedHadPFPVIso = cms.InputTag("egmPhotonIsolation","h+-DR030-"),
117  allowGsfTrackForConvs = cms.bool(False),
118  updateChargedHadPFPVIso = cms.bool(True)
119 )
120 
121 
126 from RecoEgamma.EgammaTools.calibratedEgammas_cff import ecalTrkCombinationRegression
127 egamma8XLegacyEtScaleSysModifier = cms.PSet(
128  modifierName = cms.string('EGEtScaleSysModifier'),
129  epCombConfig = ecalTrkCombinationRegression,
130  uncertFunc = cms.PSet(
131  name = cms.string("UncertFuncV1"),
132  lowEt = cms.double(43.5),
133  highEt = cms.double(46.5),
134  lowEtUncert = cms.double(0.002),
135  highEtUncert = cms.double(-0.002)
136  )
137  )
138 
139 # modifier for photon isolation used in heavy ions
140 egammaHIPhotonIsolationModifier = cms.PSet(
141  modifierName = cms.string('EGExtraInfoModifierFromHIPhotonIsolationValueMaps'),
142  electron_config = cms.PSet(),
143  photon_config = cms.PSet(
144  photonIsolationHI = cms.InputTag("reducedEgamma:photonIsolationHIProducerppGED")
145  )
146  )
147 
149  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
150 
152  modifiers.insert(0,egamma8XObjectUpdateModifier)
153 
155  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
156  modifiers.append(egamma8XLegacyEtScaleSysModifier)
157 
159  modifiers.append(egammaHIPhotonIsolationModifier)
160 
161 from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
162 from Configuration.ProcessModifiers.run2_miniAOD_UL_cff import run2_miniAOD_UL
163 (run2_miniAOD_94XFall17 | run2_miniAOD_UL).toModify(egamma_modifications,appendReducedEgammaEnergyScaleAndSmearingModifier)
164 
165 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
166 #80X doesnt have the bug which prevents GsfTracks used to match conversions so set true
167 run2_miniAOD_80XLegacy.toModify(egamma9X105XUpdateModifier,allowGsfTrackForConvs = True)
168 run2_miniAOD_80XLegacy.toModify(egamma_modifications,appendEgamma8XLegacyAppendableModifiers)
169 run2_miniAOD_80XLegacy.toModify(egamma_modifications,prependEgamma8XObjectUpdateModifier)
170 
171 from Configuration.ProcessModifiers.pp_on_AA_cff import pp_on_AA
172 pp_on_AA.toModify(egamma_modifications, appendEgammaHIPhotonIsolationModifier)
egammaObjectModificationsInMiniAOD_cff.appendReducedEgammaEnergyScaleAndSmearingModifier
def appendReducedEgammaEnergyScaleAndSmearingModifier(modifiers)
Definition: egammaObjectModificationsInMiniAOD_cff.py:148
egammaObjectModificationsInMiniAOD_cff.setup_mva
def setup_mva(val_pset, cat_pset, prod_name, mva_name)
Definition: egammaObjectModificationsInMiniAOD_cff.py:21
mvaPhotonID_Fall17_94X_V1p1_cff
egammaObjectModificationsInMiniAOD_cff.prependEgamma8XObjectUpdateModifier
def prependEgamma8XObjectUpdateModifier(modifiers)
Definition: egammaObjectModificationsInMiniAOD_cff.py:151
egammaObjectModificationsInMiniAOD_cff.appendEgamma8XLegacyAppendableModifiers
def appendEgamma8XLegacyAppendableModifiers(modifiers)
Definition: egammaObjectModificationsInMiniAOD_cff.py:154
calibratedEgammas_cff.prefixName
def prefixName(prefix, name)
Definition: calibratedEgammas_cff.py:93
mvaPhotonID_Fall17_94X_V2_cff
egammaObjectModificationsInMiniAOD_cff.appendEgammaHIPhotonIsolationModifier
def appendEgammaHIPhotonIsolationModifier(modifiers)
Definition: egammaObjectModificationsInMiniAOD_cff.py:158