1 import FWCore.ParameterSet.Config
as cms
9 from RecoEgamma.EgammaTools.lowPtElectronModifier_cfi
import lowPtElectronModifier
10 from RecoEgamma.EgammaElectronProducers.lowPtGsfElectrons_cff
import lowPtRegressionModifier
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_cff
import lowPtGsfElectronID
32 lowPtPATElectronID = lowPtGsfElectronID.clone(
34 electrons =
"updatedLowPtElectrons",
37 'RecoEgamma/ElectronIdentification/data/LowPtElectrons/LowPtElectrons_ID_2020Nov28.root',
39 Version = cms.string(
'V1'),
40 rho =
"fixedGridRhoFastjetAll",
43 isoForLowPtEle = cms.EDProducer(
44 "EleIsoValueMapProducer",
45 src = cms.InputTag(
"updatedLowPtElectrons"),
46 relative = cms.bool(
True),
47 rho_MiniIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
48 rho_PFIso = cms.InputTag(
"fixedGridRhoFastjetAll"),
49 EAFile_MiniIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
50 EAFile_PFIso = cms.FileInPath(
"RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_94X.txt"),
53 updatedLowPtElectronsWithUserData = cms.EDProducer(
54 "PATElectronUserDataEmbedder",
55 src = cms.InputTag(
"updatedLowPtElectrons"),
56 userFloats = cms.PSet(
57 ID = cms.InputTag(
"lowPtPATElectronID"),
58 miniIsoChg = cms.InputTag(
"isoForLowPtEle:miniIsoChg"),
59 miniIsoAll = cms.InputTag(
"isoForLowPtEle:miniIsoAll"),
61 userIntFromBools = cms.PSet(),
62 userInts = cms.PSet(),
63 userCands = cms.PSet(),
66 finalLowPtElectrons = cms.EDFilter(
67 "PATElectronRefSelector",
68 src = cms.InputTag(
"updatedLowPtElectronsWithUserData"),
69 cut = cms.string(
"pt > 1. && userFloat('ID') > -0.25"),
76 lowPtElectronTable = cms.EDProducer(
77 "SimpleCandidateFlatTableProducer",
78 src = cms.InputTag(
"finalLowPtElectrons"),
80 name= cms.string(
"LowPtElectron"),
81 doc = cms.string(
"slimmedLowPtElectrons after basic selection (" + finalLowPtElectrons.cut.value()+
")"),
82 singleton = cms.bool(
False),
83 extension = cms.bool(
False),
88 embeddedID =
Var(
"electronID('ID')",float,doc=
"ID, BDT (raw) score"),
89 ID =
Var(
"userFloat('ID')",float,doc=
"New ID, BDT (raw) score"),
90 unbiased =
Var(
"electronID('unbiased')",float,doc=
"ElectronSeed, pT- and dxy- agnostic BDT (raw) score"),
91 ptbiased =
Var(
"electronID('ptbiased')",float,doc=
"ElectronSeed, pT- and dxy- dependent BDT (raw) score"),
93 miniPFRelIso_chg =
Var(
"userFloat('miniIsoChg')",float,
94 doc=
"mini PF relative isolation, charged component"),
95 miniPFRelIso_all =
Var(
"userFloat('miniIsoAll')",float,
96 doc=
"mini PF relative isolation, total (with scaled rho*EA PU corrections)"),
98 convVeto =
Var(
"passConversionVeto()",bool,doc=
"pass conversion veto"),
99 convWP =
Var(
"userInt('convOpen')*1 + userInt('convLoose')*2 + userInt('convTight')*4",
100 int,doc=
"conversion flag bit map: 1=Veto, 2=Loose, 3=Tight"),
101 convVtxRadius =
Var(
"userFloat('convVtxRadius')",float,doc=
"conversion vertex radius (cm)",precision=7),
103 lostHits =
Var(
"gsfTrack.hitPattern.numberOfLostHits('MISSING_INNER_HITS')",
"uint8",doc=
"number of missing inner hits"),
105 energyErr =
Var(
"p4Error('P4_COMBINATION')",float,doc=
"energy error of the cluster-track combination",precision=6),
106 deltaEtaSC =
Var(
"superCluster().eta()-eta()",float,doc=
"delta eta (SC,ele) with sign",precision=10),
107 r9 =
Var(
"full5x5_r9()",float,doc=
"R9 of the SC, calculated with full 5x5 region",precision=10),
108 sieie =
Var(
"full5x5_sigmaIetaIeta()",float,doc=
"sigma_IetaIeta of the SC, calculated with full 5x5 region",precision=10),
109 eInvMinusPInv =
Var(
"(1-eSuperClusterOverP())/ecalEnergy()",float,doc=
"1/E_SC - 1/p_trk",precision=10),
110 scEtOverPt =
Var(
"(superCluster().energy()/(pt*cosh(superCluster().eta())))-1",float,doc=
"(SC energy)/pt-1",precision=8),
111 hoe =
Var(
"hadronicOverEm()",float,doc=
"H over E",precision=8),
113 dxy =
Var(
"dB('PV2D')",float,doc=
"dxy (with sign) wrt first PV, in cm",precision=10),
114 dxyErr =
Var(
"edB('PV2D')",float,doc=
"dxy uncertainty, in cm",precision=6),
115 dz =
Var(
"dB('PVDZ')",float,doc=
"dz (with sign) wrt first PV, in cm",precision=10),
116 dzErr =
Var(
"abs(edB('PVDZ'))",float,doc=
"dz uncertainty, in cm",precision=6),
128 matchingLowPtElecPhoton = cms.EDProducer(
129 "GenJetGenPartMerger",
130 srcJet =cms.InputTag(
"particleLevel:leptons"),
131 srcPart=cms.InputTag(
"particleLevel:photons"),
132 cut = cms.string(
""),
133 hasTauAnc=cms.InputTag(
"tautaggerForMatching"),
136 lowPtElectronsMCMatchForTableAlt = cms.EDProducer(
137 "GenJetMatcherDRPtByDR",
138 src = lowPtElectronTable.src,
139 matched = cms.InputTag(
"matchingLowPtElecPhoton:merged"),
140 mcPdgId = cms.vint32(11,22),
141 checkCharge = cms.bool(
False),
142 mcStatus = cms.vint32(),
143 maxDeltaR = cms.double(0.3),
144 maxDPtRel = cms.double(0.5),
145 resolveAmbiguities = cms.bool(
True),
146 resolveByMatchQuality = cms.bool(
True),
149 lowPtElectronsMCMatchForTable = cms.EDProducer(
151 src = lowPtElectronTable.src,
152 matched = cms.InputTag(
"finalGenParticles"),
153 mcPdgId = cms.vint32(11),
154 checkCharge = cms.bool(
False),
155 mcStatus = cms.vint32(1),
156 maxDeltaR = cms.double(0.3),
157 maxDPtRel = cms.double(0.5),
158 resolveAmbiguities = cms.bool(
True),
159 resolveByMatchQuality = cms.bool(
True),
163 lowPtElectronMCTable = cms.EDProducer(
164 "CandMCMatchTableProducer",
165 src = lowPtElectronTable.src,
166 mcMapDressedLep = cms.InputTag(
"lowPtElectronsMCMatchForTableAlt"),
167 mcMap = cms.InputTag(
"lowPtElectronsMCMatchForTable"),
168 mapTauAnc = cms.InputTag(
"matchingLowPtElecPhoton:hasTauAnc"),
169 objName = lowPtElectronTable.name,
170 objType = electronMCTable.objType,
171 branchName = cms.string(
"genPart"),
172 docString = cms.string(
"MC matching to status==1 electrons or photons"),
173 genparticles = cms.InputTag(
"finalGenParticles"),
180 lowPtElectronSequence = cms.Sequence(modifiedLowPtElectrons
181 +updatedLowPtElectrons
184 +updatedLowPtElectronsWithUserData
185 +finalLowPtElectrons)
186 lowPtElectronTables = cms.Sequence(lowPtElectronTable)
187 lowPtElectronMC = cms.Sequence(
188 matchingLowPtElecPhoton
189 +lowPtElectronsMCMatchForTable
190 +lowPtElectronsMCMatchForTableAlt
191 +lowPtElectronMCTable)
197 _modifiers = ~(run2_nanoAOD_106Xv2 | run2_nanoAOD_devel)
198 _modifiers.toReplaceWith(lowPtElectronSequence,cms.Sequence())
199 _modifiers.toReplaceWith(lowPtElectronTables,cms.Sequence())
200 _modifiers.toReplaceWith(lowPtElectronMC,cms.Sequence())
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)