1 import FWCore.ParameterSet.Config
as cms
2 from PhysicsTools.NanoAOD.simplePATElectronFlatTableProducer_cfi
import simplePATElectronFlatTableProducer
5 from math
import ceil,log
8 electron_id_modules_WorkingPoints_nanoAOD = cms.PSet(
10 'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
12 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer16UL_ID_ISO_cff',
13 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer17UL_ID_ISO_cff',
14 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff',
15 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Winter22_HZZ_V1_cff',
17 'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
18 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff',
19 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff',
21 'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Winter22_122X_V1_cff',
22 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_RunIIIWinter22_iso_V1_cff',
23 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_RunIIIWinter22_noIso_V1_cff',
25 WorkingPoints = cms.vstring(
26 "egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-veto",
27 "egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-loose",
28 "egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-medium",
29 "egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-tight",
34 electron_id_modules_WorkingPoints_nanoAOD_Run2 = cms.PSet(
35 modules = cms.vstring(
36 'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V2_cff',
37 'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
38 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V2_cff',
39 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V2_cff',
41 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer16UL_ID_ISO_cff',
42 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer17UL_ID_ISO_cff',
43 'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Summer18UL_ID_ISO_cff',
45 WorkingPoints = cms.vstring(
46 "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-veto",
47 "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-loose",
48 "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-medium",
49 "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-tight",
54 run2_egamma.toModify(electron_id_modules_WorkingPoints_nanoAOD,
55 modules=electron_id_modules_WorkingPoints_nanoAOD_Run2.modules).\
56 toModify(electron_id_modules_WorkingPoints_nanoAOD,
57 WorkingPoints=electron_id_modules_WorkingPoints_nanoAOD_Run2.WorkingPoints)
61 for modname
in modules:
62 ids= __import__(modname, globals(), locals(), [
'idName',
'cutFlow'])
64 _id = getattr(ids,name)
65 if hasattr(_id,
'idName')
and hasattr(_id,
'cutFlow'):
66 if (len(WorkingPoints)>0
and _id.idName==WorkingPoints[0].
split(
':')[-1]):
67 docstring =
'VID compressed bitmap (%s), %d bits per cut'%(
','.
join([cut.cutName.value()
for cut
in _id.cutFlow]),
int(
ceil(
log(len(WorkingPoints)+1,2))))
70 bitmapVIDForEle = cms.EDProducer(
"EleVIDNestedWPBitmapProducer",
71 src = cms.InputTag(
"slimmedElectrons"),
72 srcForID = cms.InputTag(
"reducedEgamma",
"reducedGedGsfElectrons"),
73 WorkingPoints = electron_id_modules_WorkingPoints_nanoAOD.WorkingPoints,
77 bitmapVIDForEleFall17V2 = bitmapVIDForEle.clone(
78 WorkingPoints = electron_id_modules_WorkingPoints_nanoAOD_Run2.WorkingPoints
80 _bitmapVIDForEleFall17V2_docstring =
_get_bitmapVIDForEle_docstring(electron_id_modules_WorkingPoints_nanoAOD.modules, bitmapVIDForEleFall17V2.WorkingPoints)
82 bitmapVIDForEleHEEP = bitmapVIDForEle.clone(
83 WorkingPoints = cms.vstring(
"egmGsfElectronIDs:heepElectronID-HEEPV70" 91 isoForEle = cms.EDProducer(
"EleIsoValueMapProducer",
92 src = cms.InputTag(
"slimmedElectrons"),
93 relative = cms.bool(
False),
94 rho_MiniIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
95 rho_PFIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
96 EAFile_MiniIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Run3_Winter22/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_122X.txt"),
97 EAFile_PFIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Run3_Winter22/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_122X.txt"),
100 isoForEleFall17V2 = isoForEle.clone(
101 EAFile_MiniIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
102 EAFile_PFIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
108 ptRatioRelForEle = cms.EDProducer(
"ElectronJetVarProducer",
109 srcJet = cms.InputTag(
"updatedJetsPuppi"),
110 srcLep = cms.InputTag(
"slimmedElectrons"),
111 srcVtx = cms.InputTag(
"offlineSlimmedPrimaryVertices"),
116 seedGainEle = cms.EDProducer(
"ElectronSeedGainProducer", src = cms.InputTag(
"slimmedElectrons"))
121 import RecoEgamma.EgammaTools.calibratedEgammas_cff
123 calibratedPatElectronsNano = RecoEgamma.EgammaTools.calibratedEgammas_cff.calibratedPatElectrons.clone(
124 produceCalibratedObjs =
False,
125 src =
"slimmedElectrons" 128 (run2_egamma_2016 & tracker_apv_vfp30_2016).toModify(
129 calibratedPatElectronsNano,
130 correctionFile =
"EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2016_UltraLegacy_preVFP_RunFineEtaR9Gain" 133 (run2_egamma_2016 & ~tracker_apv_vfp30_2016).toModify(
134 calibratedPatElectronsNano,
135 correctionFile =
"EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2016_UltraLegacy_postVFP_RunFineEtaR9Gain" 138 run2_egamma_2017.toModify(
139 calibratedPatElectronsNano,
140 correctionFile =
"EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2017_24Feb2020_runEtaR9Gain_v2" 143 run2_egamma_2018.toModify(
144 calibratedPatElectronsNano,
145 correctionFile =
"EgammaAnalysis/ElectronTools/data/ScalesSmearings/Run2018_29Sep2020_RunFineEtaR9Gain" 151 slimmedElectronsWithUserData = cms.EDProducer(
"PATElectronUserDataEmbedder",
152 src = cms.InputTag(
"slimmedElectrons"),
153 parentSrcs = cms.VInputTag(
"reducedEgamma:reducedGedGsfElectrons"),
154 userFloats = cms.PSet(
155 mvaIso_Fall17V2 = cms.InputTag(
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17IsoV2Values"),
156 mvaNoIso_Fall17V2 = cms.InputTag(
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17NoIsoV2Values"),
157 mvaIso = cms.InputTag(
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2RunIIIWinter22IsoV1Values"),
158 mvaNoIso = cms.InputTag(
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2RunIIIWinter22NoIsoV1Values"),
159 mvaHZZIso = cms.InputTag(
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2Winter22HZZV1Values"),
161 miniIsoChg = cms.InputTag(
"isoForEle:miniIsoChg"),
162 miniIsoAll = cms.InputTag(
"isoForEle:miniIsoAll"),
163 PFIsoChg = cms.InputTag(
"isoForEle:PFIsoChg"),
164 PFIsoAll = cms.InputTag(
"isoForEle:PFIsoAll"),
165 PFIsoAll04 = cms.InputTag(
"isoForEle:PFIsoAll04"),
167 miniIsoChg_Fall17V2 = cms.InputTag(
"isoForEleFall17V2:miniIsoChg"),
168 miniIsoAll_Fall17V2 = cms.InputTag(
"isoForEleFall17V2:miniIsoAll"),
169 PFIsoChg_Fall17V2 = cms.InputTag(
"isoForEleFall17V2:PFIsoChg"),
170 PFIsoAll_Fall17V2 = cms.InputTag(
"isoForEleFall17V2:PFIsoAll"),
171 PFIsoAll04_Fall17V2 = cms.InputTag(
"isoForEleFall17V2:PFIsoAll04"),
173 ptRatio = cms.InputTag(
"ptRatioRelForEle:ptRatio"),
174 ptRel = cms.InputTag(
"ptRatioRelForEle:ptRel"),
175 jetNDauChargedMVASel = cms.InputTag(
"ptRatioRelForEle:jetNDauChargedMVASel"),
177 userIntFromBools = cms.PSet(
178 mvaIso_Fall17V2_WP90 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Fall17-iso-V2-wp90"),
179 mvaIso_Fall17V2_WP80 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Fall17-iso-V2-wp80"),
180 mvaIso_Fall17V2_WPL = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Fall17-iso-V2-wpLoose"),
181 mvaIso_WP90 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-RunIIIWinter22-iso-V1-wp90"),
182 mvaIso_WP80 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-RunIIIWinter22-iso-V1-wp80"),
183 mvaNoIso_Fall17V2_WP90 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wp90"),
184 mvaNoIso_Fall17V2_WP80 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wp80"),
185 mvaNoIso_Fall17V2_WPL = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Fall17-noIso-V2-wpLoose"),
186 mvaNoIso_WP90 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-RunIIIWinter22-noIso-V1-wp90"),
187 mvaNoIso_WP80 = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-RunIIIWinter22-noIso-V1-wp80"),
188 mvaIso_WPHZZ = cms.InputTag(
"egmGsfElectronIDs:mvaEleID-Winter22-HZZ-V1"),
190 cutBasedID_veto = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-veto"),
191 cutBasedID_loose = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-loose"),
192 cutBasedID_medium = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-medium"),
193 cutBasedID_tight = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-RunIIIWinter22-V1-tight"),
194 cutBasedID_Fall17V2_veto = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-veto"),
195 cutBasedID_Fall17V2_loose = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-loose"),
196 cutBasedID_Fall17V2_medium = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-medium"),
197 cutBasedID_Fall17V2_tight = cms.InputTag(
"egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V2-tight"),
198 cutBasedID_HEEP = cms.InputTag(
"egmGsfElectronIDs:heepElectronID-HEEPV70"),
201 VIDNestedWPBitmap = cms.InputTag(
"bitmapVIDForEle"),
202 VIDNestedWPBitmap_Fall17V2 = cms.InputTag(
"bitmapVIDForEleFall17V2"),
203 VIDNestedWPBitmapHEEP = cms.InputTag(
"bitmapVIDForEleHEEP"),
204 seedGain = cms.InputTag(
"seedGainEle"),
207 userCands = cms.PSet(
208 jetForLepJetVar = cms.InputTag(
"ptRatioRelForEle:jetForLepJetVar")
213 run2_egamma.toModify(slimmedElectronsWithUserData.userFloats,
221 toModify(slimmedElectronsWithUserData.userIntFromBools,
225 mvaNoIso_WP90 =
None,
226 mvaNoIso_WP80 =
None,
227 cutBasedID_veto =
None,
228 cutBasedID_loose =
None,
229 cutBasedID_medium =
None,
230 cutBasedID_tight =
None).\
231 toModify(slimmedElectronsWithUserData.userInts,
232 VIDNestedWPBitmap =
None)
234 run2_egamma.toModify(
235 slimmedElectronsWithUserData.userFloats,
236 ecalTrkEnergyErrPostCorrNew = cms.InputTag(
"calibratedPatElectronsNano",
"ecalTrkEnergyErrPostCorr"),
237 ecalTrkEnergyPreCorrNew = cms.InputTag(
"calibratedPatElectronsNano",
"ecalTrkEnergyPreCorr"),
238 ecalTrkEnergyPostCorrNew = cms.InputTag(
"calibratedPatElectronsNano",
"ecalTrkEnergyPostCorr"),
239 energyScaleUpNew = cms.InputTag(
"calibratedPatElectronsNano",
"energyScaleUp"),
240 energyScaleDownNew = cms.InputTag(
"calibratedPatElectronsNano",
"energyScaleDown"),
241 energySigmaUpNew = cms.InputTag(
"calibratedPatElectronsNano",
"energySigmaUp"),
242 energySigmaDownNew = cms.InputTag(
"calibratedPatElectronsNano",
"energySigmaDown")
245 (run2_egamma_2016).toModify(
246 slimmedElectronsWithUserData.userFloats,
247 mvaHZZIso =
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2Summer16ULIdIsoValues" 249 (run2_egamma_2017).toModify(
250 slimmedElectronsWithUserData.userFloats,
251 mvaHZZIso =
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2Summer17ULIdIsoValues" 253 (run2_egamma_2018).toModify(
254 slimmedElectronsWithUserData.userFloats,
255 mvaHZZIso =
"electronMVAValueMapProducer:ElectronMVAEstimatorRun2Summer18ULIdIsoValues" 260 finalElectrons = cms.EDFilter(
"PATElectronRefSelector",
261 src = cms.InputTag(
"slimmedElectronsWithUserData"),
262 cut = cms.string(
"pt > 5 ")
267 electronPROMPTMVA= cms.EDProducer(
"EleBaseMVAValueMapProducer",
268 src = cms.InputTag(
"linkedObjects",
"electrons"),
269 weightFile = cms.FileInPath(
"PhysicsTools/NanoAOD/data/el_BDTG_2017.weights.xml"),
270 name = cms.string(
"electronPROMPTMVA"),
271 backend = cms.string(
"TMVA"),
272 isClassifier = cms.bool(
True),
273 variables = cms.VPSet(
274 cms.PSet( name = cms.string(
"LepGood_pt"), expr = cms.string(
"pt")),
275 cms.PSet( name = cms.string(
"LepGood_eta"), expr = cms.string(
"eta")),
276 cms.PSet( name = cms.string(
"LepGood_jetNDauChargedMVASel"), expr = cms.string(
"?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0")),
277 cms.PSet( name = cms.string(
"LepGood_miniRelIsoCharged"), expr = cms.string(
"userFloat('miniIsoChg_Fall17V2')/pt")),
278 cms.PSet( name = cms.string(
"LepGood_miniRelIsoNeutral"), expr = cms.string(
"(userFloat('miniIsoAll_Fall17V2')-userFloat('miniIsoChg_Fall17V2'))/pt")),
279 cms.PSet( name = cms.string(
"LepGood_jetPtRelv2"), expr = cms.string(
"?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0")),
280 cms.PSet( name = cms.string(
"LepGood_jetDF"), expr = cms.string(
"?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probbb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:probb')+userCand('jetForLepJetVar').bDiscriminator('pfDeepFlavourJetTags:problepb'),0.0):0.0")),
281 cms.PSet( name = cms.string(
"LepGood_jetPtRatio"), expr = cms.string(
"?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1.0/(1.0+userFloat('PFIsoAll04_Fall17V2')/pt)")),
282 cms.PSet( name = cms.string(
"LepGood_dxy"), expr = cms.string(
"log(abs(dB('PV2D')))")),
283 cms.PSet( name = cms.string(
"LepGood_sip3d"), expr = cms.string(
"abs(dB('PV3D')/edB('PV3D'))")),
284 cms.PSet( name = cms.string(
"LepGood_dz"), expr = cms.string(
"log(abs(dB('PVDZ')))")),
285 cms.PSet( name = cms.string(
"LepGood_mvaFall17V2noIso"), expr = cms.string(
"userFloat('mvaNoIso_Fall17V2')")),
288 run2_egamma_2016.toModify(
290 weightFile =
"PhysicsTools/NanoAOD/data/el_BDTG_2016.weights.xml",
295 electronTable = simplePATElectronFlatTableProducer.clone(
296 src = cms.InputTag(
"linkedObjects",
"electrons"),
297 name= cms.string(
"Electron"),
298 doc = cms.string(
"slimmedElectrons after basic selection (" + finalElectrons.cut.value()+
")"),
299 variables = cms.PSet(CandVars,
300 jetIdx =
Var(
"?hasUserCand('jet')?userCand('jet').key():-1",
"int16", doc=
"index of the associated jet (-1 if none)"),
301 photonIdx =
Var(
"?overlaps('photons').size()>0?overlaps('photons')[0].key():-1",
"int16", doc=
"index of the first associated photon (-1 if none)"),
302 svIdx =
Var(
"?hasUserCand('vertex')?userCand('vertex').key():-1",
"int16", doc=
"index of matching secondary vertex"),
303 fbrem =
Var(
"fbrem()",float,doc=
"Fraction of brem",precision=10),
304 rawEnergy =
Var(
"superCluster.rawEnergy",float,doc=
"raw energy of Supercluster",precision=10),
305 PreshowerEnergy =
Var(
"superCluster.preshowerEnergy",float,doc=
"energy deposited in preshower",precision=10),
306 ecalEnergy =
Var(
"ecalEnergy()",float,doc=
"energy after ECAL-only regression applied",precision=10),
307 ecalEnergyError =
Var(
"ecalEnergyError",float,doc=
"ecalEnergy error",precision=10),
308 energyErr =
Var(
"p4Error('P4_COMBINATION')",float,doc=
"energy error of the cluster-track combination",precision=6),
309 gsfTrkpMode =
Var(
"gsfTrack().pMode()",float,doc=
"GSF track pMode",precision=10),
310 gsfTrkpModeErr =
Var(
"abs(gsfTrack().qoverpModeError())*gsfTrack().pMode()*gsfTrack().pMode()",float,doc=
"GSF track pMode error",precision=8),
311 gsfTrketaMode =
Var(
"gsfTrack().etaMode()",float,doc=
"GSF track etaMode",precision=10),
312 gsfTrkphiMode =
Var(
"gsfTrack().phiMode()",float,doc=
"GSF track phiMode",precision=10),
313 isEcalDriven =
Var(
"ecalDrivenSeed",bool,doc=
"is ECAL driven if true"),
314 isEB =
Var(
"isEB",bool,doc=
"object in barrel if true derived from the seedCrystal and detID information"),
315 dz =
Var(
"dB('PVDZ')",float,doc=
"dz (with sign) wrt first PV, in cm",precision=10),
316 dzErr =
Var(
"abs(edB('PVDZ'))",float,doc=
"dz uncertainty, in cm",precision=6),
317 dxy =
Var(
"dB('PV2D')",float,doc=
"dxy (with sign) wrt first PV, in cm",precision=10),
318 dxyErr =
Var(
"edB('PV2D')",float,doc=
"dxy uncertainty, in cm",precision=6),
319 ip3d =
Var(
"abs(dB('PV3D'))",float,doc=
"3D impact parameter wrt first PV, in cm",precision=10),
320 sip3d =
Var(
"abs(dB('PV3D')/edB('PV3D'))",float,doc=
"3D impact parameter significance wrt first PV, in cm",precision=10),
321 deltaEtaSC =
Var(
"superCluster().eta()-eta()",float,doc=
"delta eta (SC,ele) with sign",precision=10),
322 r9 =
Var(
"full5x5_r9()",float,doc=
"R9 of the supercluster, calculated with full 5x5 region",precision=10),
323 sieie =
Var(
"full5x5_sigmaIetaIeta()",float,doc=
"sigma_IetaIeta of the supercluster, calculated with full 5x5 region",precision=10),
324 eInvMinusPInv =
Var(
"(1-eSuperClusterOverP())/ecalEnergy()",float,doc=
"1/E_SC - 1/p_trk",precision=10),
325 scEtOverPt =
Var(
"(superCluster().energy()/(pt*cosh(superCluster().eta())))-1",float,doc=
"(supercluster transverse energy)/pt-1",precision=8),
327 mvaIso =
Var(
"userFloat('mvaIso')",float,doc=
"MVA Iso ID score, Winter22V1"),
328 mvaIso_WP80 =
Var(
"userInt('mvaIso_WP80')",bool,doc=
"MVA Iso ID WP80, Winter22V1"),
329 mvaIso_WP90 =
Var(
"userInt('mvaIso_WP90')",bool,doc=
"MVA Iso ID WP90, Winter22V1"),
330 mvaNoIso =
Var(
"userFloat('mvaNoIso')",float,doc=
"MVA noIso ID score, Winter22V1"),
331 mvaNoIso_WP80 =
Var(
"userInt('mvaNoIso_WP80')",bool,doc=
"MVA noIso ID WP80, Winter22V1"),
332 mvaNoIso_WP90 =
Var(
"userInt('mvaNoIso_WP90')",bool,doc=
"MVA noIso ID WP90, Winter22V1"),
333 mvaHZZIso =
Var(
"userFloat('mvaHZZIso')", float,doc=
"HZZ MVA Iso ID score"),
334 mvaIso_WPHZZ =
Var(
"userInt('mvaIso_WPHZZ')",bool,doc=
"MVA Iso ID WPHZZ, Winter22V1"),
336 cutBased =
Var(
"userInt('cutBasedID_veto')+userInt('cutBasedID_loose')+userInt('cutBasedID_medium')+userInt('cutBasedID_tight')",
"uint8", doc=
"cut-based ID RunIII Winter22 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
337 vidNestedWPBitmap =
Var(
"userInt('VIDNestedWPBitmap')", int, doc=_bitmapVIDForEle_docstring),
338 vidNestedWPBitmapHEEP =
Var(
"userInt('VIDNestedWPBitmapHEEP')", int, doc=_bitmapVIDForEleHEEP_docstring),
339 cutBased_HEEP =
Var(
"userInt('cutBasedID_HEEP')",bool,doc=
"cut-based HEEP ID"),
340 miniPFRelIso_chg =
Var(
"userFloat('miniIsoChg')/pt",float,doc=
"mini PF relative isolation, charged component"),
341 miniPFRelIso_all =
Var(
"userFloat('miniIsoAll')/pt",float,doc=
"mini PF relative isolation, total (with scaled rho*EA PU Winter22V1 corrections)"),
342 pfRelIso03_chg =
Var(
"userFloat('PFIsoChg')/pt",float,doc=
"PF relative isolation dR=0.3, charged component"),
343 pfRelIso03_all =
Var(
"userFloat('PFIsoAll')/pt",float,doc=
"PF relative isolation dR=0.3, total (with rho*EA PU Winter22V1 corrections)"),
344 jetRelIso =
Var(
"?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:userFloat('PFIsoAll04')/pt",float,doc=
"Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet)",precision=8),
345 jetPtRelv2 =
Var(
"?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0",float,doc=
"Relative momentum of the lepton with respect to the closest jet after subtracting the lepton",precision=8),
346 dr03TkSumPt =
Var(
"?pt>35?dr03TkSumPt():0",float,doc=
"Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
347 dr03TkSumPtHEEP =
Var(
"?pt>35?dr03TkSumPtHEEP():0",float,doc=
"Non-PF track isolation within a delta R cone of 0.3 with electron pt > 35 GeV used in HEEP ID",precision=8),
348 dr03EcalRecHitSumEt =
Var(
"?pt>35?dr03EcalRecHitSumEt():0",float,doc=
"Non-PF Ecal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
349 dr03HcalDepth1TowerSumEt =
Var(
"?pt>35?dr03HcalTowerSumEt(1):0",float,doc=
"Non-PF Hcal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
350 hoe =
Var(
"hadronicOverEm()",float,doc=
"H over E",precision=8),
351 tightCharge =
Var(
"isGsfCtfScPixChargeConsistent() + isGsfScPixChargeConsistent()",
"uint8", doc=
"Tight charge criteria (0:none, 1:isGsfScPixChargeConsistent, 2:isGsfCtfScPixChargeConsistent)"),
352 convVeto =
Var(
"passConversionVeto()",bool,doc=
"pass conversion veto"),
353 lostHits =
Var(
"gsfTrack.hitPattern.numberOfLostHits('MISSING_INNER_HITS')",
"uint8",doc=
"number of missing inner hits"),
354 isPFcand =
Var(
"pfCandidateRef().isNonnull()",bool,doc=
"electron is PF candidate"),
355 seedGain =
Var(
"userInt('seedGain')",
"uint8",doc=
"Gain of the seed crystal"),
356 seediEtaOriX =
Var(
"superCluster().seedCrysIEtaOrIx",
"int16",doc=
"iEta or iX of seed crystal. iEta is barrel-only, iX is endcap-only. iEta runs from -85 to +85, with no crystal at iEta=0. iX runs from 1 to 100."),
357 seediPhiOriY =
Var(
"superCluster().seedCrysIPhiOrIy",
"int16",doc=
"iPhi or iY of seed crystal. iPhi is barrel-only, iY is endcap-only. iPhi runs from 1 to 360. iY runs from 1 to 100."),
358 jetNDauCharged =
Var(
"?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0",
"uint8", doc=
"number of charged daughters of the closest jet"),
360 externalVariables = cms.PSet(
361 promptMVA =
ExtVar(cms.InputTag(
"electronPROMPTMVA"),float, doc=
"Prompt MVA lepton ID score. Corresponds to the previous mvaTTH",precision=14),
362 fsrPhotonIdx =
ExtVar(cms.InputTag(
"leptonFSRphotons:eleFsrIndex"),
"int16", doc=
"Index of the lowest-dR/ET2 among associated FSR photons"),
367 _eleVarsExtra = cms.PSet(
368 r9Frac =
Var(
"r9()",float,doc=
"Fractional R9 of the supercluster",precision=10),
369 DeltaEtaInSC =
Var(
"deltaEtaSuperClusterTrackAtVtx",float,doc=
"dEta(Inner track, supercluster)",precision=10),
370 DeltaEtaInSeed =
Var(
"deltaEtaSeedClusterTrackAtCalo",float,doc=
"dEta(Inner track, seedcluster)",precision=10),
371 DeltaPhiInSC =
Var(
"deltaPhiSuperClusterTrackAtVtx",float,doc=
"dPhi(Inner track, supercluster)",precision=10),
372 DeltaPhiInSeed =
Var(
"deltaPhiSeedClusterTrackAtCalo",float,doc=
"dPhi(Inner track, seedcluster)",precision=10),
373 full5x5HoverE =
Var(
"full5x5_hcalOverEcal",float,doc=
"full5x5 H/E",precision=10),
374 eSCOverP =
Var(
"eSuperClusterOverP",float,doc=
"E/P",precision=10),
375 eEleOverPout =
Var(
"eEleClusterOverPout",float,doc=
"EleE/Pouter",precision=10),
376 e1x5 =
Var(
"full5x5_e1x5",float,doc=
"energy in 1x5",precision=10),
377 e2x5max =
Var(
"full5x5_e2x5Max",float,doc=
"energy in 2x5",precision=10),
378 e5x5 =
Var(
"full5x5_e5x5",float,doc=
"energy in 5x5",precision=10),
379 closestKFchi2 =
Var(
"closestCtfTrackNormChi2",float,doc=
"KF track Chi2",precision=10),
380 closestKFNLayers =
Var(
"closestCtfTrackNLayers",int,doc=
"KF track number of layers"),
381 dr03HcalTowerSumEt =
Var(
"dr03HcalTowerSumEt",float,doc=
"HCal isolation",precision=10),
382 GSFchi2 =
Var(
"gsfTrack.normalizedChi2",float,doc=
"GSF track Chi2",precision=10),
383 superclusterEta =
Var(
"superCluster.eta",float,doc=
"supercluster eta",precision=10),
384 ecalPFClusIso =
Var(
"ecalPFClusterIso",float,doc=
"ECAL PF cluster isolation",precision=10),
385 hcalPFClusIso =
Var(
"hcalPFClusterIso",float,doc=
"HCAL PF cluster isolation",precision=10),
386 nBrem =
Var(
"numberOfBrems",int,doc=
"number of brems"),
387 pfPhotonIso =
Var(
"pfIsolationVariables.sumPhotonEt",float,doc=
"PF photon isolation (no PU correction)",precision=10),
388 pfChargedHadIso =
Var(
"pfIsolationVariables.sumChargedHadronPt",float,doc=
"PF charged-hadron isolation (no PU correction)",precision=10),
389 pfNeutralHadIso =
Var(
"pfIsolationVariables.sumNeutralHadronEt",float,doc=
"PF neutral-hadron isolation (no PU correction)",precision=10),
390 sigmaIphiIphiFull5x5 =
Var(
"full5x5_sigmaIphiIphi",float,doc=
"Full5x5 sigmaIPhiIPhi",precision=10),
391 etaWidth =
Var(
"superCluster.etaWidth",float,doc=
"etawidth of supercluster",precision=10),
392 phiWidth =
Var(
"superCluster.phiWidth",float,doc=
"phiwidth of supercluster",precision=10),
393 seedClusEnergy =
Var(
"superCluster.seed.energy",float,doc=
"seed cluster energy",precision=10),
394 hoeSingleTower =
Var(
"hcalOverEcalBc",float,doc=
"Single HCAL tower based H/E",precision=10),
395 hoeFull5x5 =
Var(
"full5x5_hcalOverEcal",float,doc=
"Full5x5 cone-based H/E",precision=10),
396 sigmaIetaIphiFull5x5 =
Var(
"full5x5_showerShape.sigmaIetaIphi",float,doc=
"Full5x5 sigmaIEtaIPhi",precision=10),
397 eMax =
Var(
"full5x5_showerShape.eMax",float,doc=
"Emax",precision=10),
398 e2nd =
Var(
"full5x5_showerShape.e2nd",float,doc=
"E2nd",precision=10),
399 eTop =
Var(
"full5x5_showerShape.eTop",float,doc=
"Etop",precision=10),
400 eBottom =
Var(
"full5x5_showerShape.eBottom",float,doc=
"Ebottom",precision=10),
401 eLeft =
Var(
"full5x5_showerShape.eLeft",float,doc=
"Eleft",precision=10),
402 eRight =
Var(
"full5x5_showerShape.eRight",float,doc=
"Eright",precision=10),
403 e2x5Top =
Var(
"full5x5_showerShape.e2x5Top",float,doc=
"E2x5Top",precision=10),
404 e2x5Bottom =
Var(
"full5x5_showerShape.e2x5Bottom",float,doc=
"E2x5Bottom",precision=10),
405 e2x5Left =
Var(
"full5x5_showerShape.e2x5Left",float,doc=
"E2x5Left",precision=10),
406 e2x5Right =
Var(
"full5x5_showerShape.e2x5Right",float,doc=
"E2x5Right",precision=10),
407 nSaturatedXtals =
Var(
"nSaturatedXtals",int,doc=
"number of saturated crystals"),
408 numberOfClusters =
Var(
"superCluster.clusters.size",int,doc=
"number of clusters"),
409 istrackerDriven =
Var(
"trackerDrivenSeed",bool,doc=
"is tracker driven if true"),
410 superclusterPhi =
Var(
"superCluster().phi()",float,doc=
"supercluster phi",precision=10),
411 seedClusterEta =
Var(
"superCluster().seed().eta()",float,doc=
"seed cluster eta",precision=10),
412 seedClusterPhi =
Var(
"superCluster().seed().phi()",float,doc=
"seed cluster phi",precision=10),
413 superclusterEnergy =
Var(
"superCluster().energy()",float,doc=
"only PF cluster energy is corrected, no object-level regression",precision=10),
414 energy =
Var(
"energy()",float,doc=
"energy after final regression",precision=10),
415 trackMomentumError =
Var(
"trackMomentumError",float,doc=
"trackMomentum error",precision=10),
416 trackMomentum =
Var(
"trackMomentumAtVtx().R()",float,doc=
"trackMomentum at vertex",precision=10),
417 trkLayersWithMeas =
Var(
"gsfTrack.hitPattern.trackerLayersWithMeasurement",int,doc=
"trackerLayersWithMeasurement"),
418 nValidPixBarrelHits =
Var(
"gsfTrack.hitPattern.numberOfValidPixelBarrelHits",int,doc=
"numberOfValidPixelBarrelHits"),
419 nValidPixEndcapHits =
Var(
"gsfTrack.hitPattern.numberOfValidPixelEndcapHits",int,doc=
"numberOfValidPixelEndcapHits"),
420 superClusterFbrem =
Var(
"superClusterFbrem",float,doc=
"superClusterFbrem",precision=10),
421 convVtxFitProb =
Var(
"convVtxFitProb",float,doc=
"convVtxFitProb",precision=10),
422 clustersSize =
Var(
"superCluster.clustersSize",int,doc=
"clustersSize"),
423 iEtaMod5 =
Var(
"?superCluster.seedCrysIEtaOrIx>0?(superCluster.seedCrysIEtaOrIx-1)%5:(superCluster.seedCrysIEtaOrIx+1)%5",int,doc=
"iEtaMod5"),
424 iEtaMod20 =
Var(
"?abs(superCluster.seedCrysIEtaOrIx)<=25?(superCluster.seedCrysIEtaOrIx-(?superCluster.seedCrysIEtaOrIx>0?+1:-1))%20:(superCluster.seedCrysIEtaOrIx-(?superCluster.seedCrysIEtaOrIx>0?+26:-26))%20",int,doc=
"iEtaMod20"),
425 iPhiMod2 =
Var(
"(superCluster.seedCrysIPhiOrIy-1)%2",int,doc=
"iPhiMod2"),
426 iPhiMod20 =
Var(
"(superCluster.seedCrysIPhiOrIy-1)%20",int,doc=
"iPhiMod20"),
429 (run2_egamma).toModify(
431 electronTable.variables,
432 pt =
Var(
"pt*userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')", float, precision=-1, doc=
"p_{T}"),
433 energyErr =
Var(
"userFloat('ecalTrkEnergyErrPostCorrNew')", float, precision=6, doc=
"energy error of the cluster-track combination"),
434 eCorr =
Var(
"userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')", float, doc=
"ratio of the calibrated energy/miniaod energy"),
435 scEtOverPt =
Var(
"(superCluster().energy()/(pt*userFloat('ecalTrkEnergyPostCorrNew')/userFloat('ecalTrkEnergyPreCorrNew')*cosh(superCluster().eta())))-1",float,doc=
"(supercluster transverse energy)/pt-1",precision=8),
436 dEscaleUp=
Var(
"userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energyScaleUpNew')", float, doc=
"ecal energy scale shifted 1 sigma up(adding gain/stat/syst in quadrature)", precision=8),
437 dEscaleDown=
Var(
"userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energyScaleDownNew')", float, doc=
"ecal energy scale shifted 1 sigma down (adding gain/stat/syst in quadrature)", precision=8),
438 dEsigmaUp=
Var(
"userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energySigmaUpNew')", float, doc=
"ecal energy smearing value shifted 1 sigma up", precision=8),
439 dEsigmaDown=
Var(
"userFloat('ecalTrkEnergyPostCorrNew')-userFloat('energySigmaDownNew')", float, doc=
"ecal energy smearing value shifted 1 sigma up", precision=8),
441 mvaIso =
Var(
"userFloat('mvaIso_Fall17V2')",float,doc=
"MVA Iso ID score, Fall17V2"),
442 mvaIso_WP80 =
Var(
"userInt('mvaIso_Fall17V2_WP80')",bool,doc=
"MVA Iso ID WP80, Fall17V2"),
443 mvaIso_WP90 =
Var(
"userInt('mvaIso_Fall17V2_WP90')",bool,doc=
"MVA Iso ID WP90, Fall17V2"),
444 mvaIso_WPL =
Var(
"userInt('mvaIso_Fall17V2_WPL')",bool,doc=
"MVA Iso ID loose WP, Fall17V2"),
445 mvaNoIso =
Var(
"userFloat('mvaNoIso_Fall17V2')",float,doc=
"MVA noIso ID score, Fall17V2"),
446 mvaNoIso_WP80 =
Var(
"userInt('mvaNoIso_Fall17V2_WP80')",bool,doc=
"MVA noIso ID WP80, Fall17V2"),
448 mvaNoIso_WP90 =
Var(
"userInt('mvaNoIso_Fall17V2_WP90')",bool,doc=
"MVA noIso ID WP90, Fall17V2"),
449 mvaNoIso_WPL =
Var(
"userInt('mvaNoIso_Fall17V2_WPL')",bool,doc=
"MVA noIso ID loose WP, Fall17V2"),
450 cutBased =
Var(
"userInt('cutBasedID_Fall17V2_veto')+userInt('cutBasedID_Fall17V2_loose')+userInt('cutBasedID_Fall17V2_medium')+userInt('cutBasedID_Fall17V2_tight')",
"uint8", doc=
"cut-based ID Fall17V2 (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
451 vidNestedWPBitmap =
Var(
"userInt('VIDNestedWPBitmap_Fall17V2')", int, doc=_bitmapVIDForEleFall17V2_docstring),
452 miniPFRelIso_chg =
Var(
"userFloat('miniIsoChg_Fall17V2')/pt",float,doc=
"mini PF relative isolation, charged component in Run2"),
453 miniPFRelIso_all =
Var(
"userFloat('miniIsoAll_Fall17V2')/pt",float,doc=
"mini PF relative isolation, total (with scaled rho*EA Fall17V2 PU corrections) in Run2"),
454 pfRelIso03_chg =
Var(
"userFloat('PFIsoChg_Fall17V2')/pt",float,doc=
"PF relative isolation dR=0.3 with 94 EffArea, charged component in Run2"),
455 pfRelIso03_all =
Var(
"userFloat('PFIsoAll_Fall17V2')/pt",float,doc=
"PF relative isolation dR=0.3 with 94 EffArea, total (with rho*EA Fall17V2 PU corrections) in Run2"),
456 jetRelIso =
Var(
"?userCand('jetForLepJetVar').isNonnull()?(1./userFloat('ptRatio'))-1.:userFloat('PFIsoAll04_Fall17V2')/pt",float,doc=
"Relative isolation in matched jet (1/ptRatio-1, pfRelIso04_all if no matched jet in Run2)",precision=8),
461 tautaggerForMatching = cms.EDProducer(
"GenJetTauTaggerProducer",
462 src = cms.InputTag(
'particleLevel:leptons')
465 matchingElecPhoton = cms.EDProducer(
"GenJetGenPartMerger",
466 srcJet =cms.InputTag(
"particleLevel:leptons"),
467 srcPart=cms.InputTag(
"particleLevel:photons"),
468 cut = cms.string(
"pt > 3"),
469 hasTauAnc=cms.InputTag(
"tautaggerForMatching"),
471 electronsMCMatchForTableAlt = cms.EDProducer(
"GenJetMatcherDRPtByDR",
472 src = electronTable.src,
473 matched = cms.InputTag(
"matchingElecPhoton:merged"),
474 mcPdgId = cms.vint32(11,22),
475 checkCharge = cms.bool(
False),
476 mcStatus = cms.vint32(),
477 maxDeltaR = cms.double(0.3),
478 maxDPtRel = cms.double(0.5),
479 resolveAmbiguities = cms.bool(
True),
480 resolveByMatchQuality = cms.bool(
True),
482 electronsMCMatchForTable = cms.EDProducer(
"MCMatcher",
483 src = electronTable.src,
484 matched = cms.InputTag(
"finalGenParticles"),
485 mcPdgId = cms.vint32(11,22),
486 checkCharge = cms.bool(
False),
487 mcStatus = cms.vint32(1),
488 maxDeltaR = cms.double(0.3),
489 maxDPtRel = cms.double(0.5),
490 resolveAmbiguities = cms.bool(
True),
491 resolveByMatchQuality = cms.bool(
True),
494 electronMCTable = cms.EDProducer(
"CandMCMatchTableProducer",
495 src = electronTable.src,
496 mcMapDressedLep = cms.InputTag(
"electronsMCMatchForTableAlt"),
497 mcMap = cms.InputTag(
"electronsMCMatchForTable"),
498 mapTauAnc = cms.InputTag(
"matchingElecPhoton:hasTauAnc"),
499 objName = electronTable.name,
500 objType = electronTable.name,
501 branchName = cms.string(
"genPart"),
502 docString = cms.string(
"MC matching to status==1 electrons or photons"),
503 genparticles = cms.InputTag(
"finalGenParticles"),
506 electronTask = cms.Task(bitmapVIDForEle,bitmapVIDForEleFall17V2,bitmapVIDForEleHEEP,isoForEle,isoForEleFall17V2,ptRatioRelForEle,seedGainEle,calibratedPatElectronsNano,slimmedElectronsWithUserData,finalElectrons)
507 electronTablesTask = cms.Task(electronPROMPTMVA, electronTable)
508 electronMCTask = cms.Task(tautaggerForMatching, matchingElecPhoton, electronsMCMatchForTable, electronsMCMatchForTableAlt, electronMCTable)
510 _electronTask_Run2 = electronTask.copy()
511 _electronTask_Run2.remove(bitmapVIDForEle)
512 _electronTask_Run2.remove(isoForEle)
513 _electronTask_Run2.add(calibratedPatElectronsNano)
514 run2_egamma.toReplaceWith(electronTask, _electronTask_Run2)
517 run2_nanoAOD_ANY.toModify(
518 ptRatioRelForEle,srcJet=
"updatedJets")
constexpr int32_t ceil(float num)
def Var(expr, valtype, doc=None, precision=-1, lazyEval=False)
def ExtVar(tag, valtype, doc=None, precision=-1)
def _get_bitmapVIDForEle_docstring(modules, WorkingPoints)
def split(sequence, size)
static std::string join(char **cmd)