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 
9 
10 #photon mva ids
11 import RecoEgamma.PhotonIdentification.Identification.mvaPhotonID_Spring16_nonTrig_V1_cff as pho_spring16_nt_v1
14 
15 
16 ele_mva_prod_name = 'electronMVAValueMapProducer'
17 pho_mva_prod_name = 'photonMVAValueMapProducer'
18 
19 def setup_mva(val_pset,cat_pset,prod_name,mva_name):
20  value_name = '%s:%sValues'%(prod_name,mva_name)
21  cat_name = '%s:%sCategories'%(prod_name,mva_name)
22  setattr( val_pset, '%sValues'%mva_name, cms.InputTag(value_name) )
23  setattr( cat_pset, '%sCategories'%mva_name, cms.InputTag(cat_name) )
24 
25 egamma_modifications = cms.VPSet(
26  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
27  electron_config = cms.PSet( ),
28  photon_config = cms.PSet( phoChargedIsolation = cms.InputTag('photonIDValueMapProducer:phoChargedIsolation'),
29  phoNeutralHadronIsolation = cms.InputTag('photonIDValueMapProducer:phoNeutralHadronIsolation'),
30  phoPhotonIsolation = cms.InputTag('photonIDValueMapProducer:phoPhotonIsolation'),
31  phoWorstChargedIsolation = cms.InputTag('photonIDValueMapProducer:phoWorstChargedIsolation')
32  )
33  ),
34  cms.PSet( modifierName = cms.string('EGExtraInfoModifierFromIntValueMaps'),
35  electron_config = cms.PSet( ),
36  photon_config = cms.PSet( )
37  )
38 )
39 
40 #setup the mva value maps to embed
41 for ele_mva_cff in [
42  ele_spring16_gp_v1,
43  ele_spring16_hzz_v1,
44  ele_fall17_iso_v1,
45  ele_fall17_noIso_v1,
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_v1,
56  pho_fall17_94X_v1p1,
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 #############################################################
65 # REGRESSION MODIFIERS
66 #############################################################
67 
68 #from RecoEgamma.EgammaTools.regressionModifier_cfi import *
69 
70 #egamma_modifications.append( regressionModifier )
71 
72 #############################################################
73 # Scale and Smearing Modifiers
74 #############################################################
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 #############################################################
90 # 8X to 9X modifiers (fills in variables new to 9X w.r.t 8X)
91 #############################################################
92 egamma8XObjectUpdateModifier = cms.PSet(
93  modifierName = cms.string('EG8XObjectUpdateModifier'),
94  ecalRecHitsEB = cms.InputTag("reducedEgamma","reducedEBRecHits"),
95  ecalRecHitsEE = cms.InputTag("reducedEgamma","reducedEERecHits"),
96 )
97 
98 #############################################################
99 # 8X legacy needs an extra Et scale systematic
100 # due to an inflection around 45 GeV which is handled as a
101 # patch on top of the standard scale and smearing systematics
102 #############################################################
103 from RecoEgamma.EgammaTools.calibratedEgammas_cff import ecalTrkCombinationRegression
104 egamma8XLegacyEtScaleSysModifier = cms.PSet(
105  modifierName = cms.string('EGEtScaleSysModifier'),
106  epCombConfig = ecalTrkCombinationRegression,
107  uncertFunc = cms.PSet(
108  name = cms.string("UncertFuncV1"),
109  lowEt = cms.double(43.5),
110  highEt = cms.double(46.5),
111  lowEtUncert = cms.double(0.002),
112  highEtUncert = cms.double(-0.002)
113  )
114  )
115 
117  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
118 
120  modifiers.insert(0,egamma8XObjectUpdateModifier)
121 
123  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
124  modifiers.append(egamma8XLegacyEtScaleSysModifier)
125 
126 from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
127 run2_miniAOD_94XFall17.toModify(egamma_modifications,appendReducedEgammaEnergyScaleAndSmearingModifier)
128 
129 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
130 run2_miniAOD_80XLegacy.toModify(egamma_modifications,appendEgamma8XLegacyAppendableModifiers)
131 run2_miniAOD_80XLegacy.toModify(egamma_modifications,prependEgamma8XObjectUpdateModifier)
def prefixName(prefix, name)
def setup_mva(val_pset, cat_pset, prod_name, mva_name)