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 setup_mva(egamma_modifications[0].electron_config,
42  egamma_modifications[1].electron_config,
43  ele_mva_prod_name,
44  ele_spring16_gp_v1.mvaSpring16ClassName+ele_spring16_gp_v1.mvaTag)
45 
46 setup_mva(egamma_modifications[0].electron_config,
47  egamma_modifications[1].electron_config,
48  ele_mva_prod_name,
49  ele_spring16_hzz_v1.mvaSpring16ClassName+ele_spring16_hzz_v1.mvaTag)
50 
51 setup_mva(egamma_modifications[0].electron_config,
52  egamma_modifications[1].electron_config,
53  ele_mva_prod_name,
54  ele_fall17_iso_v1.mvaFall17ClassName+ele_fall17_iso_v1.mvaTag)
55 
56 setup_mva(egamma_modifications[0].electron_config,
57  egamma_modifications[1].electron_config,
58  ele_mva_prod_name,
59  ele_fall17_noIso_v1.mvaFall17ClassName+ele_fall17_noIso_v1.mvaTag)
60 
61 setup_mva(egamma_modifications[0].photon_config,
62  egamma_modifications[1].photon_config,
63  pho_mva_prod_name,
64  pho_spring16_nt_v1.mvaSpring16NonTrigClassName+pho_spring16_nt_v1.mvaTag)
65 
66 setup_mva(egamma_modifications[0].photon_config,
67  egamma_modifications[1].photon_config,
68  pho_mva_prod_name,
69  pho_fall17_94X_v1.mvaFall17v1ClassName+pho_fall17_94X_v1.mvaTag)
70 
71 setup_mva(egamma_modifications[0].photon_config,
72  egamma_modifications[1].photon_config,
73  pho_mva_prod_name,
74  pho_fall17_94X_v1p1.mvaFall17v1p1ClassName+pho_fall17_94X_v1p1.mvaTag)
75 
76 #############################################################
77 # REGRESSION MODIFIERS
78 #############################################################
79 
80 #from RecoEgamma.EgammaTools.regressionModifier_cfi import *
81 
82 #egamma_modifications.append( regressionModifier )
83 
84 #############################################################
85 # Scale and Smearing Modifiers
86 #############################################################
87 reducedEgammaEnergyScaleAndSmearingModifier = cms.PSet(
88  modifierName = cms.string('EGExtraInfoModifierFromFloatValueMaps'),
89  electron_config = cms.PSet(),
90  photon_config = cms.PSet()
91 )
92 from RecoEgamma.EgammaTools.calibratedEgammas_cff import prefixName
93 import RecoEgamma.EgammaTools.calibratedElectronProducer_cfi
94 for valueMapName in RecoEgamma.EgammaTools.calibratedElectronProducer_cfi.calibratedElectronProducer.valueMapsStored:
95  setattr(reducedEgammaEnergyScaleAndSmearingModifier.electron_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibEle",valueMapName)))
96 
97 import RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi
98 for valueMapName in RecoEgamma.EgammaTools.calibratedPhotonProducer_cfi.calibratedPhotonProducer.valueMapsStored:
99  setattr(reducedEgammaEnergyScaleAndSmearingModifier.photon_config,valueMapName,cms.InputTag("reducedEgamma",prefixName("calibPho",valueMapName)))
100 
101 
103  modifiers.append(reducedEgammaEnergyScaleAndSmearingModifier)
104 
105 from Configuration.Eras.Modifier_run2_miniAOD_94XFall17_cff import run2_miniAOD_94XFall17
106 run2_miniAOD_94XFall17.toModify(egamma_modifications,appendReducedEgammaEnergyScaleAndSmearingModifier)
107 
def prefixName(prefix, name)
def setup_mva(val_pset, cat_pset, prod_name, mva_name)