1 import FWCore.ParameterSet.Config
as cms
9 from RecoEgamma.EgammaTools.lowPtElectronModifier_cfi
import lowPtElectronModifier
10 modifiedLowPtElectrons = cms.EDProducer(
11 "ModifiedElectronProducer",
12 src = cms.InputTag(
"slimmedLowPtElectrons"),
13 modifierConfig = cms.PSet(
14 modifications = cms.VPSet(lowPtElectronModifier)
19 updatedLowPtElectrons = cms.EDProducer(
21 src = cms.InputTag(
"modifiedLowPtElectrons"),
22 vertices = cms.InputTag(
"offlineSlimmedPrimaryVertices"),
23 computeMiniIso = cms.bool(
True),
24 fixDxySign = cms.bool(
False),
25 pfCandsForMiniIso = cms.InputTag(
"packedPFCandidates"),
26 miniIsoParamsB = PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi.patElectrons.miniIsoParamsB,
27 miniIsoParamsE = PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi.patElectrons.miniIsoParamsE,
30 isoForLowPtEle = cms.EDProducer(
31 "EleIsoValueMapProducer",
32 src = cms.InputTag(
"updatedLowPtElectrons"),
33 relative = cms.bool(
True),
34 rho_MiniIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
35 rho_PFIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
36 EAFile_MiniIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
37 EAFile_PFIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
40 updatedLowPtElectronsWithUserData = cms.EDProducer(
41 "PATElectronUserDataEmbedder",
42 src = cms.InputTag(
"updatedLowPtElectrons"),
43 userFloats = cms.PSet(
44 miniIsoChg = cms.InputTag(
"isoForLowPtEle:miniIsoChg"),
45 miniIsoAll = cms.InputTag(
"isoForLowPtEle:miniIsoAll"),
47 userIntFromBools = cms.PSet(),
48 userInts = cms.PSet(),
49 userCands = cms.PSet(),
52 finalLowPtElectrons = cms.EDFilter(
53 "PATElectronRefSelector",
54 src = cms.InputTag(
"updatedLowPtElectronsWithUserData"),
55 cut = cms.string(
"pt > 1. && electronID('ID') > -0.25"),
62 lowPtElectronTable = cms.EDProducer(
63 "SimpleCandidateFlatTableProducer",
64 src = cms.InputTag(
"linkedObjects",
"lowPtElectrons"),
66 name= cms.string(
"LowPtElectron"),
67 doc = cms.string(
"slimmedLowPtElectrons after basic selection (" + finalLowPtElectrons.cut.value()+
")"),
68 singleton = cms.bool(
False),
69 extension = cms.bool(
False),
74 electronIdx =
Var(
"?overlaps('electrons').size()>0?overlaps('electrons')[0].key():-1", int, doc=
"index of the overlapping PF electron (-1 if none)"),
76 ID =
Var(
"electronID('ID')",float,doc=
"ID, BDT (raw) score"),
77 unbiased =
Var(
"electronID('unbiased')",float,doc=
"ElectronSeed, pT- and dxy- agnostic BDT (raw) score"),
78 ptbiased =
Var(
"electronID('ptbiased')",float,doc=
"ElectronSeed, pT- and dxy- dependent BDT (raw) score"),
80 miniPFRelIso_chg =
Var(
"userFloat('miniIsoChg')",float,
81 doc=
"mini PF relative isolation, charged component"),
82 miniPFRelIso_all =
Var(
"userFloat('miniIsoAll')",float,
83 doc=
"mini PF relative isolation, total (with scaled rho*EA PU corrections)"),
85 convVeto =
Var(
"passConversionVeto()",bool,doc=
"pass conversion veto"),
86 convWP =
Var(
"userInt('convOpen')*1 + userInt('convLoose')*2 + userInt('convTight')*4",
87 int,doc=
"conversion flag bit map: 1=Veto, 2=Loose, 3=Tight"),
88 convVtxRadius =
Var(
"userFloat('convVtxRadius')",float,doc=
"conversion vertex radius (cm)",precision=7),
90 lostHits =
Var(
"gsfTrack.hitPattern.numberOfLostHits('MISSING_INNER_HITS')",
"uint8",doc=
"number of missing inner hits"),
92 energyErr =
Var(
"p4Error('P4_COMBINATION')",float,doc=
"energy error of the cluster-track combination",precision=6),
93 deltaEtaSC =
Var(
"superCluster().eta()-eta()",float,doc=
"delta eta (SC,ele) with sign",precision=10),
94 r9 =
Var(
"full5x5_r9()",float,doc=
"R9 of the SC, calculated with full 5x5 region",precision=10),
95 sieie =
Var(
"full5x5_sigmaIetaIeta()",float,doc=
"sigma_IetaIeta of the SC, calculated with full 5x5 region",precision=10),
96 eInvMinusPInv =
Var(
"(1-eSuperClusterOverP())/ecalEnergy()",float,doc=
"1/E_SC - 1/p_trk",precision=10),
97 scEtOverPt =
Var(
"(superCluster().energy()/(pt*cosh(superCluster().eta())))-1",float,doc=
"(SC energy)/pt-1",precision=8),
98 hoe =
Var(
"hadronicOverEm()",float,doc=
"H over E",precision=8),
100 dxy =
Var(
"dB('PV2D')",float,doc=
"dxy (with sign) wrt first PV, in cm",precision=10),
101 dxyErr =
Var(
"edB('PV2D')",float,doc=
"dxy uncertainty, in cm",precision=6),
102 dz =
Var(
"dB('PVDZ')",float,doc=
"dz (with sign) wrt first PV, in cm",precision=10),
103 dzErr =
Var(
"abs(edB('PVDZ'))",float,doc=
"dz uncertainty, in cm",precision=6),
115 matchingLowPtElecPhoton = cms.EDProducer(
116 "GenJetGenPartMerger",
117 srcJet =cms.InputTag(
"particleLevel:leptons"),
118 srcPart=cms.InputTag(
"particleLevel:photons"),
119 cut = cms.string(
""),
120 hasTauAnc=cms.InputTag(
"tautaggerForMatching"),
123 lowPtElectronsMCMatchForTableAlt = cms.EDProducer(
124 "GenJetMatcherDRPtByDR",
125 src = lowPtElectronTable.src,
126 matched = cms.InputTag(
"matchingLowPtElecPhoton:merged"),
127 mcPdgId = cms.vint32(11,22),
128 checkCharge = cms.bool(
False),
129 mcStatus = cms.vint32(),
130 maxDeltaR = cms.double(0.3),
131 maxDPtRel = cms.double(0.5),
132 resolveAmbiguities = cms.bool(
True),
133 resolveByMatchQuality = cms.bool(
True),
136 lowPtElectronsMCMatchForTable = cms.EDProducer(
138 src = lowPtElectronTable.src,
139 matched = cms.InputTag(
"finalGenParticles"),
140 mcPdgId = cms.vint32(11),
141 checkCharge = cms.bool(
False),
142 mcStatus = cms.vint32(1),
143 maxDeltaR = cms.double(0.3),
144 maxDPtRel = cms.double(0.5),
145 resolveAmbiguities = cms.bool(
True),
146 resolveByMatchQuality = cms.bool(
True),
150 lowPtElectronMCTable = cms.EDProducer(
151 "CandMCMatchTableProducer",
152 src = lowPtElectronTable.src,
153 mcMapDressedLep = cms.InputTag(
"lowPtElectronsMCMatchForTableAlt"),
154 mcMap = cms.InputTag(
"lowPtElectronsMCMatchForTable"),
155 mapTauAnc = cms.InputTag(
"matchingLowPtElecPhoton:hasTauAnc"),
156 objName = lowPtElectronTable.name,
157 objType = electronMCTable.objType,
158 branchName = cms.string(
"genPart"),
159 docString = cms.string(
"MC matching to status==1 electrons or photons"),
160 genparticles = cms.InputTag(
"finalGenParticles"),
167 lowPtElectronTask = cms.Task(modifiedLowPtElectrons,
168 updatedLowPtElectrons,
170 updatedLowPtElectronsWithUserData,
173 lowPtElectronTablesTask = cms.Task(lowPtElectronTable)
175 lowPtElectronMCTask = cms.Task(
176 matchingLowPtElecPhoton,
177 lowPtElectronsMCMatchForTable,
178 lowPtElectronsMCMatchForTableAlt,
179 lowPtElectronMCTable)
185 _modifiers = ( run2_miniAOD_80XLegacy |
186 run2_nanoAOD_94XMiniAODv1 |
187 run2_nanoAOD_94XMiniAODv2 |
188 run2_nanoAOD_94X2016 |
189 run2_nanoAOD_102Xv1 |
190 run2_nanoAOD_106Xv1 )
191 (_modifiers).toReplaceWith(lowPtElectronTask,cms.Task())
192 (_modifiers).toReplaceWith(lowPtElectronTablesTask,cms.Task())
193 (_modifiers).toReplaceWith(lowPtElectronMCTask,cms.Task())
198 run2_nanoAOD_106Xv2.toModify(modifiedLowPtElectrons.modifierConfig,
199 modifications = cms.VPSet(lowPtElectronModifier,
200 lowPtRegressionModifier))
202 run2_nanoAOD_106Xv2.toModify(updatedLowPtElectronsWithUserData.userFloats,
203 ID = cms.InputTag(
"lowPtPATElectronID"))
205 run2_nanoAOD_106Xv2.toModify(finalLowPtElectrons,
206 cut =
"pt > 1. && userFloat('ID') > -0.25")
208 run2_nanoAOD_106Xv2.toModify(lowPtElectronTable.variables,
209 embeddedID =
Var(
"electronID('ID')",float,doc=
"ID, BDT (raw) score"),
210 ID =
Var(
"userFloat('ID')",float,doc=
"New ID, BDT (raw) score"))
212 from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronID_cfi
import lowPtGsfElectronID
213 lowPtPATElectronID = lowPtGsfElectronID.clone(
215 electrons =
"updatedLowPtElectrons",
218 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Nov28.root',
222 _lowPtElectronTask = cms.Task(lowPtPATElectronID)
223 _lowPtElectronTask.add(lowPtElectronTask.copy())
224 run2_nanoAOD_106Xv2.toReplaceWith(lowPtElectronTask,_lowPtElectronTask)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)