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
6 
8 
9 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff as ele_spring16_gp_v1
10 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff as ele_spring16_hzz_v1
11 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff as ele_fall17_iso_v1
12 import RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff as ele_fall17_noIso_v1
13 
14 #photon mva ids
17 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( phoChargedIsolation = cms.InputTag('photonIDValueMapProducer:phoChargedIsolation'),
35  phoNeutralHadronIsolation = cms.InputTag('photonIDValueMapProducer:phoNeutralHadronIsolation'),
36  phoPhotonIsolation = cms.InputTag('photonIDValueMapProducer:phoPhotonIsolation'),
37  phoWorstChargedIsolation = cms.InputTag('photonIDValueMapProducer:phoWorstChargedIsolation')
38  )
39  ),
40  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromIntValueMaps'),
41  electron_config = cms.PSet( ),
42  photon_config = cms.PSet( )
43  )
44 )
45 
46 #setup the mva value maps to embed
47 setup_mva(egamma_modifications[0].electron_config,
48  egamma_modifications[1].electron_config,
49  ele_mva_prod_name,
50  ele_spring15_nt.mvaSpring15NonTrigClassName+ele_spring15_nt.mvaTag)
51 
52 setup_mva(egamma_modifications[0].electron_config,
53  egamma_modifications[1].electron_config,
54  ele_mva_prod_name,
55  ele_spring15_50_t.mvaSpring15TrigClassName+ele_spring15_50_t.mvaTag)
56 
57 setup_mva(egamma_modifications[0].electron_config,
58  egamma_modifications[1].electron_config,
59  ele_mva_prod_name,
60  ele_spring15_25_t.mvaSpring15TrigClassName+ele_spring15_25_t.mvaTag)
61 
62 setup_mva(egamma_modifications[0].electron_config,
63  egamma_modifications[1].electron_config,
64  ele_mva_prod_name,
65  ele_spring16_gp_v1.mvaSpring16ClassName+ele_spring16_gp_v1.mvaTag)
66 
67 setup_mva(egamma_modifications[0].electron_config,
68  egamma_modifications[1].electron_config,
69  ele_mva_prod_name,
70  ele_spring16_hzz_v1.mvaSpring16ClassName+ele_spring16_hzz_v1.mvaTag)
71 
72 setup_mva(egamma_modifications[0].electron_config,
73  egamma_modifications[1].electron_config,
74  ele_mva_prod_name,
75  ele_fall17_iso_v1.mvaFall17ClassName+ele_fall17_iso_v1.mvaTag)
76 
77 setup_mva(egamma_modifications[0].electron_config,
78  egamma_modifications[1].electron_config,
79  ele_mva_prod_name,
80  ele_fall17_noIso_v1.mvaFall17ClassName+ele_fall17_noIso_v1.mvaTag)
81 
82 setup_mva(egamma_modifications[0].photon_config,
83  egamma_modifications[1].photon_config,
84  pho_mva_prod_name,
85  pho_spring15_25_nt.mvaSpring15NonTrigClassName+pho_spring15_25_nt.mvaTag)
86 
87 setup_mva(egamma_modifications[0].photon_config,
88  egamma_modifications[1].photon_config,
89  pho_mva_prod_name,
90  pho_spring15_50_nt.mvaSpring15NonTrigClassName+pho_spring15_50_nt.mvaTag)
91 
92 setup_mva(egamma_modifications[0].photon_config,
93  egamma_modifications[1].photon_config,
94  pho_mva_prod_name,
95  pho_spring16_nt_v1.mvaSpring16NonTrigClassName+pho_spring16_nt_v1.mvaTag)
96 
97 setup_mva(egamma_modifications[0].photon_config,
98  egamma_modifications[1].photon_config,
99  pho_mva_prod_name,
100  pho_fall17_94X_v1.mvaFall17v1ClassName+pho_fall17_94X_v1.mvaTag)
101 
102 setup_mva(egamma_modifications[0].photon_config,
103  egamma_modifications[1].photon_config,
104  pho_mva_prod_name,
105  pho_fall17_94X_v1p1.mvaFall17v1p1ClassName+pho_fall17_94X_v1p1.mvaTag)
106 
107 #############################################################
108 # REGRESSION MODIFIERS
109 #############################################################
110 
111 #from RecoEgamma.EgammaTools.regressionModifier_cfi import *
112 
113 #egamma_modifications.append( regressionModifier )
114 
115 #############################################################
116 # Scale and Smearing Modifiers
117 #############################################################
118 reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
119  modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
120  electron_config = cms.PSet(),
121  photon_config = cms.PSet()
122 )
123 from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
124 import RecoEgamma.EgammaTools.calibratedElectronProducerTRecoGsfElectron_cfi
125 for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducerTRecoGsfElectron_cfi.calibratedElectronProducerTRecoGsfElectron.valueMapsStored:
126  setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))
127 
128 import RecoEgamma.EgammaTools.calibratedPhotonProducerTRecoPhoton_cfi
129 for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducerTRecoPhoton_cfi.calibratedPhotonProducerTRecoPhoton.valueMapsStored:
130  setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))
131 
132 #############################################################
133 # 8X to 9X modifiers (fills in variables new to 9X w.r.t 8X)
134 #############################################################
135 egamma8XObjectUpdateModifier = cms.PSet(
136  modifierName = cms.string('EG8XObjectUpdateModifier'),
137  ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
138  ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
139 )
140 
141 #############################################################
142 # 8X legacy needs an extra Et scale systematic
143 # due to an inflection around 45 GeV which is handled as a
144 # patch on top of the standard scale and smearing systematics
145 #############################################################
146 from RecoEgamma.EgammaTools.calibratedEgammas_cff import ecalTrkCombinationRegression
147 egamma8XLegacyEtScaleSysModifier = cms.PSet(
148  modifierName = cms.string('EGEtScaleSysModifier'),
149  epCombConfig = ecalTrkCombinationRegression,
150  uncertFunc = cms.PSet(
151  name = cms.string("UncertFuncV1"),
152  lowEt = cms.double(43.5),
153  highEt = cms.double(46.5),
154  lowEtUncert = cms.double(0.002),
155  highEtUncert = cms.double(-0.002)
156  )
157  )
158 
160  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
161 
163  modifiers.insert(0,egamma8XObjectUpdateModifier)
164 
166  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
167  modifiers.append(egamma8XLegacyEtScaleSysModifier)
168 
169 from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
170 run2_miniAOD_94XFall17.toModify(egamma_modifications,appendReducedEgammaEnergyScaleAndSmearingModifier)
171 
172 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
173 run2_miniAOD_80XLegacy.toModify(egamma_modifications,appendEgamma8XLegacyAppendableModifiers)
174 run2_miniAOD_80XLegacy.toModify(egamma_modifications,prependEgamma8XObjectUpdateModifier)
def prefixName(prefix, name)
def setup_mva(val_pset, cat_pset, prod_name, mva_name)