1 import FWCore.ParameterSet.Config
as cms
9 from RecoEgamma.EgammaTools.lowPtElectronModifier_cfi
import lowPtElectronModifier
11 modifiedLowPtElectrons = cms.EDProducer(
12 "ModifiedElectronProducer",
13 src = cms.InputTag(
"slimmedLowPtElectrons"),
14 modifierConfig = cms.PSet(
15 modifications = cms.VPSet(lowPtElectronModifier,lowPtRegressionModifier)
20 updatedLowPtElectrons = cms.EDProducer(
22 src = cms.InputTag(
"modifiedLowPtElectrons"),
23 vertices = cms.InputTag(
"offlineSlimmedPrimaryVertices"),
24 computeMiniIso = cms.bool(
True),
25 fixDxySign = cms.bool(
False),
26 pfCandsForMiniIso = cms.InputTag(
"packedPFCandidates"),
27 miniIsoParamsB = PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi.patElectrons.miniIsoParamsB,
28 miniIsoParamsE = PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi.patElectrons.miniIsoParamsE,
31 from RecoEgamma.EgammaElectronProducers.lowPtGsfElectronID_cfi
import lowPtGsfElectronID
32 lowPtPATElectronID = lowPtGsfElectronID.clone(
34 electrons =
"updatedLowPtElectrons",
37 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Nov28.root',
41 isoForLowPtEle = cms.EDProducer(
42 "EleIsoValueMapProducer",
43 src = cms.InputTag(
"updatedLowPtElectrons"),
44 relative = cms.bool(
True),
45 rho_MiniIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
46 rho_PFIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
47 EAFile_MiniIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
48 EAFile_PFIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
51 updatedLowPtElectronsWithUserData = cms.EDProducer(
52 "PATElectronUserDataEmbedder",
53 src = cms.InputTag(
"updatedLowPtElectrons"),
54 userFloats = cms.PSet(
55 ID = cms.InputTag(
"lowPtPATElectronID"),
56 miniIsoChg = cms.InputTag(
"isoForLowPtEle:miniIsoChg"),
57 miniIsoAll = cms.InputTag(
"isoForLowPtEle:miniIsoAll"),
59 userIntFromBools = cms.PSet(),
60 userInts = cms.PSet(),
61 userCands = cms.PSet(),
64 finalLowPtElectrons = cms.EDFilter(
65 "PATElectronRefSelector",
66 src = cms.InputTag(
"updatedLowPtElectronsWithUserData"),
67 cut = cms.string(
"pt > 1. && userFloat('ID') > -0.25"),
74 lowPtElectronTable = cms.EDProducer(
75 "SimpleCandidateFlatTableProducer",
76 src = cms.InputTag(
"finalLowPtElectrons"),
78 name= cms.string(
"LowPtElectron"),
79 doc = cms.string(
"slimmedLowPtElectrons after basic selection (" + finalLowPtElectrons.cut.value()+
")"),
80 singleton = cms.bool(
False),
81 extension = cms.bool(
False),
86 embeddedID =
Var(
"electronID('ID')",float,doc=
"ID, BDT (raw) score"),
87 ID =
Var(
"userFloat('ID')",float,doc=
"New ID, BDT (raw) score"),
88 unbiased =
Var(
"electronID('unbiased')",float,doc=
"ElectronSeed, pT- and dxy- agnostic BDT (raw) score"),
89 ptbiased =
Var(
"electronID('ptbiased')",float,doc=
"ElectronSeed, pT- and dxy- dependent BDT (raw) score"),
91 miniPFRelIso_chg =
Var(
"userFloat('miniIsoChg')",float,
92 doc=
"mini PF relative isolation, charged component"),
93 miniPFRelIso_all =
Var(
"userFloat('miniIsoAll')",float,
94 doc=
"mini PF relative isolation, total (with scaled rho*EA PU corrections)"),
96 convVeto =
Var(
"passConversionVeto()",bool,doc=
"pass conversion veto"),
97 convWP =
Var(
"userInt('convOpen')*1 + userInt('convLoose')*2 + userInt('convTight')*4",
98 int,doc=
"conversion flag bit map: 1=Veto, 2=Loose, 3=Tight"),
99 convVtxRadius =
Var(
"userFloat('convVtxRadius')",float,doc=
"conversion vertex radius (cm)",precision=7),
101 lostHits =
Var(
"gsfTrack.hitPattern.numberOfLostHits('MISSING_INNER_HITS')",
"uint8",doc=
"number of missing inner hits"),
103 energyErr =
Var(
"p4Error('P4_COMBINATION')",float,doc=
"energy error of the cluster-track combination",precision=6),
104 deltaEtaSC =
Var(
"superCluster().eta()-eta()",float,doc=
"delta eta (SC,ele) with sign",precision=10),
105 r9 =
Var(
"full5x5_r9()",float,doc=
"R9 of the SC, calculated with full 5x5 region",precision=10),
106 sieie =
Var(
"full5x5_sigmaIetaIeta()",float,doc=
"sigma_IetaIeta of the SC, calculated with full 5x5 region",precision=10),
107 eInvMinusPInv =
Var(
"(1-eSuperClusterOverP())/ecalEnergy()",float,doc=
"1/E_SC - 1/p_trk",precision=10),
108 scEtOverPt =
Var(
"(superCluster().energy()/(pt*cosh(superCluster().eta())))-1",float,doc=
"(SC energy)/pt-1",precision=8),
109 hoe =
Var(
"hadronicOverEm()",float,doc=
"H over E",precision=8),
111 dxy =
Var(
"dB('PV2D')",float,doc=
"dxy (with sign) wrt first PV, in cm",precision=10),
112 dxyErr =
Var(
"edB('PV2D')",float,doc=
"dxy uncertainty, in cm",precision=6),
113 dz =
Var(
"dB('PVDZ')",float,doc=
"dz (with sign) wrt first PV, in cm",precision=10),
114 dzErr =
Var(
"abs(edB('PVDZ'))",float,doc=
"dz uncertainty, in cm",precision=6),
126 matchingLowPtElecPhoton = cms.EDProducer(
127 "GenJetGenPartMerger",
128 srcJet =cms.InputTag(
"particleLevel:leptons"),
129 srcPart=cms.InputTag(
"particleLevel:photons"),
130 cut = cms.string(
""),
131 hasTauAnc=cms.InputTag(
"tautaggerForMatching"),
134 lowPtElectronsMCMatchForTableAlt = cms.EDProducer(
135 "GenJetMatcherDRPtByDR",
136 src = lowPtElectronTable.src,
137 matched = cms.InputTag(
"matchingLowPtElecPhoton:merged"),
138 mcPdgId = cms.vint32(11,22),
139 checkCharge = cms.bool(
False),
140 mcStatus = cms.vint32(),
141 maxDeltaR = cms.double(0.3),
142 maxDPtRel = cms.double(0.5),
143 resolveAmbiguities = cms.bool(
True),
144 resolveByMatchQuality = cms.bool(
True),
147 lowPtElectronsMCMatchForTable = cms.EDProducer(
149 src = lowPtElectronTable.src,
150 matched = cms.InputTag(
"finalGenParticles"),
151 mcPdgId = cms.vint32(11),
152 checkCharge = cms.bool(
False),
153 mcStatus = cms.vint32(1),
154 maxDeltaR = cms.double(0.3),
155 maxDPtRel = cms.double(0.5),
156 resolveAmbiguities = cms.bool(
True),
157 resolveByMatchQuality = cms.bool(
True),
161 lowPtElectronMCTable = cms.EDProducer(
162 "CandMCMatchTableProducer",
163 src = lowPtElectronTable.src,
164 mcMapDressedLep = cms.InputTag(
"lowPtElectronsMCMatchForTableAlt"),
165 mcMap = cms.InputTag(
"lowPtElectronsMCMatchForTable"),
166 mapTauAnc = cms.InputTag(
"matchingLowPtElecPhoton:hasTauAnc"),
167 objName = lowPtElectronTable.name,
168 objType = electronMCTable.objType,
169 branchName = cms.string(
"genPart"),
170 docString = cms.string(
"MC matching to status==1 electrons or photons"),
171 genparticles = cms.InputTag(
"finalGenParticles"),
178 lowPtElectronTask = cms.Task(modifiedLowPtElectrons,
179 updatedLowPtElectrons,
182 updatedLowPtElectronsWithUserData,
185 lowPtElectronTablesTask = cms.Task(lowPtElectronTable)
187 lowPtElectronMCTask = cms.Task(
188 matchingLowPtElecPhoton,
189 lowPtElectronsMCMatchForTable,
190 lowPtElectronsMCMatchForTableAlt,
191 lowPtElectronMCTable)
197 _modifiers = ( run2_miniAOD_80XLegacy |
198 run2_nanoAOD_94XMiniAODv1 |
199 run2_nanoAOD_94XMiniAODv2 |
200 run2_nanoAOD_94X2016 |
201 run2_nanoAOD_102Xv1 |
202 run2_nanoAOD_106Xv1 )
203 (_modifiers).toReplaceWith(lowPtElectronTask,cms.Task())
204 (_modifiers).toReplaceWith(lowPtElectronTablesTask,cms.Task())
205 (_modifiers).toReplaceWith(lowPtElectronMCTask,cms.Task())