CMS 3D CMS Logo

electrons_cff.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 from Configuration.Eras.Modifier_run2_miniAOD_80XLegacy_cff import run2_miniAOD_80XLegacy
3 from Configuration.Eras.Modifier_run2_nanoAOD_92X_cff import run2_nanoAOD_92X
6 from math import ceil,log
7 
8 # this below is used only in some eras
9 slimmedElectronsUpdated = cms.EDProducer("PATElectronUpdater",
10  src = cms.InputTag("slimmedElectrons"),
11  vertices = cms.InputTag("offlineSlimmedPrimaryVertices"),
12  computeMiniIso = cms.bool(False),
13  pfCandsForMiniIso = cms.InputTag("packedPFCandidates"),
14  miniIsoParamsB = PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi.patElectrons.miniIsoParamsB, # so they're in sync
15  miniIsoParamsE = PhysicsTools.PatAlgos.producersLayer1.electronProducer_cfi.patElectrons.miniIsoParamsE, # so they're in sync
16 )
17 run2_miniAOD_80XLegacy.toModify( slimmedElectronsUpdated, computeMiniIso = True )
18 
19 from PhysicsTools.SelectorUtils.tools.vid_id_tools import setupVIDSelection
22 
23 electronMVAValueMapProducer.srcMiniAOD = cms.InputTag("slimmedElectrons")
24 run2_miniAOD_80XLegacy.toModify(electronMVAValueMapProducer, srcMiniAOD = "slimmedElectronsUpdated")
25 run2_nanoAOD_92X.toModify(electronMVAValueMapProducer, srcMiniAOD = "slimmedElectronsUpdated")
26 
27 egmGsfElectronIDs.physicsObjectIDs = cms.VPSet()
28 egmGsfElectronIDs.physicsObjectSrc = cms.InputTag('slimmedElectrons')
29 run2_miniAOD_80XLegacy.toModify(egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated")
30 run2_nanoAOD_92X.toModify(egmGsfElectronIDs, physicsObjectSrc = "slimmedElectronsUpdated")
31 
32 heepIDVarValueMaps.elesMiniAOD = cms.InputTag('slimmedElectrons')
33 run2_miniAOD_80XLegacy.toModify(heepIDVarValueMaps, elesMiniAOD = "slimmedElectronsUpdated")
34 run2_nanoAOD_92X.toModify(heepIDVarValueMaps, elesMiniAOD = "slimmedElectronsUpdated")
35 
36 _electron_id_modules_WorkingPoints = cms.PSet(
37  modules = cms.vstring(
38  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Fall17_94X_V1_cff',
39  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
40  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_iso_V1_cff',
41  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Fall17_noIso_V1_cff',
42  ),
43  WorkingPoints = cms.vstring(
44  "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-veto",
45  "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-loose",
46  "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-medium",
47  "egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-tight",
48  )
49 )
50 run2_miniAOD_80XLegacy.toModify(_electron_id_modules_WorkingPoints,
51  modules = cms.vstring(
52  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronID_Summer16_80X_V1_cff',
53  'RecoEgamma.ElectronIdentification.Identification.cutBasedElectronHLTPreselecition_Summer16_V1_cff',
54  'RecoEgamma.ElectronIdentification.Identification.heepElectronID_HEEPV70_cff',
55  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_GeneralPurpose_V1_cff',
56  'RecoEgamma.ElectronIdentification.Identification.mvaElectronID_Spring16_HZZ_V1_cff',
57  ),
58  WorkingPoints = cms.vstring(
59  "egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-loose",
60  "egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-medium",
61  "egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-tight",
62  )
63 )
64 
65 _bitmapVIDForEle_docstring = ''
66 for modname in _electron_id_modules_WorkingPoints.modules:
67  ids= __import__(modname, globals(), locals(), ['idName','cutFlow'])
68  for name in dir(ids):
69  _id = getattr(ids,name)
70  if hasattr(_id,'idName') and hasattr(_id,'cutFlow'):
71  setupVIDSelection(egmGsfElectronIDs,_id)
72  if (len(_electron_id_modules_WorkingPoints.WorkingPoints)>0 and _id.idName==_electron_id_modules_WorkingPoints.WorkingPoints[0].split(':')[-1]):
73  _bitmapVIDForEle_docstring = 'VID compressed bitmap (%s), %d bits per cut'%(','.join([cut.cutName.value() for cut in _id.cutFlow]),int(ceil(log(len(_electron_id_modules_WorkingPoints.WorkingPoints)+1,2))))
74 
75 bitmapVIDForEle = cms.EDProducer("EleVIDNestedWPBitmapProducer",
76  src = cms.InputTag("slimmedElectrons"),
77  WorkingPoints = _electron_id_modules_WorkingPoints.WorkingPoints,
78 )
79 run2_miniAOD_80XLegacy.toModify(bitmapVIDForEle, src = "slimmedElectronsUpdated")
80 run2_nanoAOD_92X.toModify(bitmapVIDForEle, src = "slimmedElectronsUpdated")
81 
82 isoForEle = cms.EDProducer("EleIsoValueMapProducer",
83  src = cms.InputTag("slimmedElectrons"),
84  relative = cms.bool(False),
85  rho_MiniIso = cms.InputTag("fixedGridRhoFastjetAll"),
86  rho_PFIso = cms.InputTag("fixedGridRhoFastjetAll"),
87  EAFile_MiniIso = cms.FileInPath("RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_92X.txt"),
88  EAFile_PFIso = cms.FileInPath("RecoEgamma/ElectronIdentification/data/Fall17/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_92X.txt"),
89 )
90 run2_miniAOD_80XLegacy.toModify(isoForEle, src = "slimmedElectronsUpdated",
91  EAFile_MiniIso = "RecoEgamma/ElectronIdentification/data/Spring15/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_25ns.txt",
92  EAFile_PFIso = "RecoEgamma/ElectronIdentification/data/Summer16/effAreaElectrons_cone03_pfNeuHadronsAndPhotons_80X.txt")
93 run2_nanoAOD_92X.toModify(isoForEle, src = "slimmedElectronsUpdated")
94 
95 ptRatioRelForEle = cms.EDProducer("ElectronJetVarProducer",
96  srcJet = cms.InputTag("slimmedJets"),
97  srcLep = cms.InputTag("slimmedElectrons"),
98  srcVtx = cms.InputTag("offlineSlimmedPrimaryVertices"),
99 )
100 run2_miniAOD_80XLegacy.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated")
101 run2_nanoAOD_92X.toModify(ptRatioRelForEle, srcLep = "slimmedElectronsUpdated")
102 
103 from EgammaAnalysis.ElectronTools.calibratedElectronsRun2_cfi import calibratedPatElectrons
104 calibratedPatElectrons.correctionFile = cms.string("PhysicsTools/NanoAOD/data/80X_ichepV1_2016_ele") # hack, should go somewhere in EgammaAnalysis
105 calibratedPatElectrons.semiDeterministic = cms.bool(True)
106 run2_miniAOD_80XLegacy.toModify(calibratedPatElectrons, electrons = "slimmedElectronsUpdated")
107 run2_nanoAOD_92X.toModify(calibratedPatElectrons, electrons = "slimmedElectronsUpdated")
108 
109 energyCorrForEle = cms.EDProducer("ElectronEnergyVarProducer",
110  srcRaw = cms.InputTag("slimmedElectrons"),
111  srcCorr = cms.InputTag("calibratedPatElectrons"),
112 )
113 run2_miniAOD_80XLegacy.toModify(energyCorrForEle, srcRaw = "slimmedElectronsUpdated")
114 run2_nanoAOD_92X.toModify(energyCorrForEle, srcRaw = "slimmedElectronsUpdated")
115 
116 
117 slimmedElectronsWithUserData = cms.EDProducer("PATElectronUserDataEmbedder",
118  src = cms.InputTag("slimmedElectrons"),
119  userFloats = cms.PSet(
120  mvaFall17Iso = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17IsoV1Values"),
121  mvaFall17noIso = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Fall17NoIsoV1Values"),
122  miniIsoChg = cms.InputTag("isoForEle:miniIsoChg"),
123  miniIsoAll = cms.InputTag("isoForEle:miniIsoAll"),
124  PFIsoChg = cms.InputTag("isoForEle:PFIsoChg"),
125  PFIsoAll = cms.InputTag("isoForEle:PFIsoAll"),
126  PFIsoAll04 = cms.InputTag("isoForEle:PFIsoAll04"),
127  ptRatio = cms.InputTag("ptRatioRelForEle:ptRatio"),
128  ptRel = cms.InputTag("ptRatioRelForEle:ptRel"),
129  jetNDauChargedMVASel = cms.InputTag("ptRatioRelForEle:jetNDauChargedMVASel"),
130  eCorr = cms.InputTag("energyCorrForEle:eCorr"),
131  ),
132  userIntFromBools = cms.PSet(
133  mvaFall17Iso_WP90 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V1-wp90"),
134  mvaFall17Iso_WP80 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V1-wp80"),
135  mvaFall17Iso_WPL = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-iso-V1-wpLoose"),
136  mvaFall17noIso_WP90 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V1-wp90"),
137  mvaFall17noIso_WP80 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V1-wp80"),
138  mvaFall17noIso_WPL = cms.InputTag("egmGsfElectronIDs:mvaEleID-Fall17-noIso-V1-wpLoose"),
139  cutbasedID_veto = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-veto"),
140  cutbasedID_loose = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-loose"),
141  cutbasedID_medium = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-medium"),
142  cutbasedID_tight = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Fall17-94X-V1-tight"),
143  cutbasedID_HEEP = cms.InputTag("egmGsfElectronIDs:heepElectronID-HEEPV70"),
144  ),
145  userInts = cms.PSet(
146  VIDNestedWPBitmap = cms.InputTag("bitmapVIDForEle"),
147  ),
148  userCands = cms.PSet(
149  jetForLepJetVar = cms.InputTag("ptRatioRelForEle:jetForLepJetVar") # warning: Ptr is null if no match is found
150  ),
151 )
152 run2_miniAOD_80XLegacy.toModify(slimmedElectronsWithUserData, src = "slimmedElectronsUpdated")
153 run2_nanoAOD_92X.toModify(slimmedElectronsWithUserData, src = "slimmedElectronsUpdated")
154 run2_miniAOD_80XLegacy.toModify(slimmedElectronsWithUserData.userFloats,
155  mvaSpring16GP = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring16GeneralPurposeV1Values"),
156  mvaSpring16HZZ = cms.InputTag("electronMVAValueMapProducer:ElectronMVAEstimatorRun2Spring16HZZV1Values"),
157  mvaFall17Iso = None,
158  mvaFall17noIso = None,
159 )
160 run2_miniAOD_80XLegacy.toReplaceWith(slimmedElectronsWithUserData.userIntFromBools,
161  cms.PSet(
162  mvaSpring16GP_WP90 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Spring16-GeneralPurpose-V1-wp90"),
163  mvaSpring16GP_WP80 = cms.InputTag("egmGsfElectronIDs:mvaEleID-Spring16-GeneralPurpose-V1-wp80"),
164  mvaSpring16HZZ_WPL = cms.InputTag("egmGsfElectronIDs:mvaEleID-Spring16-HZZ-V1-wpLoose"),
165  cutbasedID_veto = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-veto"),
166  cutbasedID_loose = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-loose"),
167  cutbasedID_medium = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-medium"),
168  cutbasedID_tight = cms.InputTag("egmGsfElectronIDs:cutBasedElectronID-Summer16-80X-V1-tight"),
169  cutbasedID_HLT = cms.InputTag("egmGsfElectronIDs:cutBasedElectronHLTPreselection-Summer16-V1"),
170  cutbasedID_HEEP = cms.InputTag("egmGsfElectronIDs:heepElectronID-HEEPV70"),
171  )
172 )
173 
174 finalElectrons = cms.EDFilter("PATElectronRefSelector",
175  src = cms.InputTag("slimmedElectronsWithUserData"),
176  cut = cms.string("pt > 5 ")
177 )
178 
179 electronMVATTH= cms.EDProducer("EleBaseMVAValueMapProducer",
180  src = cms.InputTag("linkedObjects","electrons"),
181  weightFile = cms.FileInPath("PhysicsTools/NanoAOD/data/el_BDTG_94X.weights.xml"),
182  name = cms.string("electronMVATTH"),
183  isClassifier = cms.bool(True),
184  variablesOrder = cms.vstring(["LepGood_pt","LepGood_eta","LepGood_jetNDauChargedMVASel","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetPtRelv2","LepGood_jetBTagCSV","LepGood_jetPtRatio","LepGood_sip3d","LepGood_dxy","LepGood_dz","LepGood_mvaIdFall17noIso"]),
185  variables = cms.PSet(
186  LepGood_pt = cms.string("pt"),
187  LepGood_eta = cms.string("eta"),
188  LepGood_jetNDauChargedMVASel = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('jetNDauChargedMVASel'):0"),
189  LepGood_miniRelIsoCharged = cms.string("userFloat('miniIsoChg')/pt"),
190  LepGood_miniRelIsoNeutral = cms.string("(userFloat('miniIsoAll')-userFloat('miniIsoChg'))/pt"),
191  LepGood_jetPtRelv2 = cms.string("?userCand('jetForLepJetVar').isNonnull()?userFloat('ptRel'):0"),
192  LepGood_jetPtRatio = cms.string("?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1.0/(1.0+userFloat('PFIsoAll04')/pt)"),
193  LepGood_jetBTagCSV = cms.string("?userCand('jetForLepJetVar').isNonnull()?max(userCand('jetForLepJetVar').bDiscriminator('pfCombinedInclusiveSecondaryVertexV2BJetTags'),0.0):0.0"),
194  LepGood_sip3d = cms.string("abs(dB('PV3D')/edB('PV3D'))"),
195  LepGood_dxy = cms.string("log(abs(dB('PV2D')))"),
196  LepGood_dz = cms.string("log(abs(dB('PVDZ')))"),
197  LepGood_mvaIdFall17noIso = cms.string("userFloat('mvaFall17noIso')"),
198  )
199 )
200 run2_miniAOD_80XLegacy.toModify(electronMVATTH.variables,
201  LepGood_jetPtRatio = cms.string("?userCand('jetForLepJetVar').isNonnull()?min(userFloat('ptRatio'),1.5):1"),
202  LepGood_mvaIdSpring16HZZ = cms.string("userFloat('mvaSpring16HZZ')"),
203  LepGood_mvaIdFall17noIso = None)
204 run2_miniAOD_80XLegacy.toModify(electronMVATTH,
205  weightFile = "PhysicsTools/NanoAOD/data/el_BDTG.weights.xml",
206  variablesOrder = ["LepGood_pt","LepGood_eta","LepGood_jetNDauChargedMVASel","LepGood_miniRelIsoCharged","LepGood_miniRelIsoNeutral","LepGood_jetPtRelv2","LepGood_jetPtRatio","LepGood_jetBTagCSV","LepGood_sip3d","LepGood_dxy","LepGood_dz","LepGood_mvaIdSpring16HZZ"])
207 
208 electronTable = cms.EDProducer("SimpleCandidateFlatTableProducer",
209  src = cms.InputTag("linkedObjects","electrons"),
210  cut = cms.string(""), #we should not filter on cross linked collections
211  name= cms.string("Electron"),
212  doc = cms.string("slimmedElectrons after basic selection (" + finalElectrons.cut.value()+")"),
213  singleton = cms.bool(False), # the number of entries is variable
214  extension = cms.bool(False), # this is the main table for the electrons
215  variables = cms.PSet(CandVars,
216  jetIdx = Var("?hasUserCand('jet')?userCand('jet').key():-1", int, doc="index of the associated jet (-1 if none)"),
217  photonIdx = Var("?overlaps('photons').size()>0?overlaps('photons')[0].key():-1", int, doc="index of the associated photon (-1 if none)"),
218  energyErr = Var("p4Error('P4_COMBINATION')*userFloat('eCorr')",float,doc="energy error of the cluster-track combination",precision=6),
219  eCorr = Var("userFloat('eCorr')",float,doc="ratio of the calibrated energy/miniaod energy"),
220  dz = Var("dB('PVDZ')",float,doc="dz (with sign) wrt first PV, in cm",precision=10),
221  dzErr = Var("abs(edB('PVDZ'))",float,doc="dz uncertainty, in cm",precision=6),
222  dxy = Var("dB('PV2D')",float,doc="dxy (with sign) wrt first PV, in cm",precision=10),
223  dxyErr = Var("edB('PV2D')",float,doc="dxy uncertainty, in cm",precision=6),
224  ip3d = Var("abs(dB('PV3D'))",float,doc="3D impact parameter wrt first PV, in cm",precision=10),
225  sip3d = Var("abs(dB('PV3D')/edB('PV3D'))",float,doc="3D impact parameter significance wrt first PV, in cm",precision=10),
226  deltaEtaSC = Var("superCluster().eta()-eta()",float,doc="delta eta (SC,ele) with sign",precision=10),
227  r9 = Var("full5x5_r9()",float,doc="R9 of the supercluster, calculated with full 5x5 region",precision=10),
228  sieie = Var("full5x5_sigmaIetaIeta()",float,doc="sigma_IetaIeta of the supercluster, calculated with full 5x5 region",precision=10),
229  eInvMinusPInv = Var("(1-eSuperClusterOverP())/ecalEnergy()",float,doc="1/E_SC - 1/p_trk",precision=10),
230  mvaFall17Iso = Var("userFloat('mvaFall17Iso')",float,doc="MVA Iso ID score"),
231  mvaFall17Iso_WP80 = Var("userInt('mvaFall17Iso_WP80')",bool,doc="MVA Iso ID WP80"),
232  mvaFall17Iso_WP90 = Var("userInt('mvaFall17Iso_WP90')",bool,doc="MVA Iso ID WP90"),
233  mvaFall17Iso_WPL = Var("userInt('mvaFall17Iso_WPL')",bool,doc="MVA Iso ID loose WP"),
234  mvaFall17noIso = Var("userFloat('mvaFall17noIso')",float,doc="MVA noIso ID score"),
235  mvaFall17noIso_WP80 = Var("userInt('mvaFall17noIso_WP80')",bool,doc="MVA noIso ID WP80"),
236  mvaFall17noIso_WP90 = Var("userInt('mvaFall17noIso_WP90')",bool,doc="MVA noIso ID WP90"),
237  mvaFall17noIso_WPL = Var("userInt('mvaFall17noIso_WPL')",bool,doc="MVA noIso ID loose WP"),
238  cutBased = Var("userInt('cutbasedID_veto')+userInt('cutbasedID_loose')+userInt('cutbasedID_medium')+userInt('cutbasedID_tight')",int,doc="cut-based ID (0:fail, 1:veto, 2:loose, 3:medium, 4:tight)"),
239  vidNestedWPBitmap = Var("userInt('VIDNestedWPBitmap')",int,doc=_bitmapVIDForEle_docstring),
240  cutBased_HEEP = Var("userInt('cutbasedID_HEEP')",bool,doc="cut-based HEEP ID"),
241  miniPFRelIso_chg = Var("userFloat('miniIsoChg')/pt",float,doc="mini PF relative isolation, charged component"),
242  miniPFRelIso_all = Var("userFloat('miniIsoAll')/pt",float,doc="mini PF relative isolation, total (with scaled rho*EA PU corrections)"),
243  pfRelIso03_chg = Var("userFloat('PFIsoChg')/pt",float,doc="PF relative isolation dR=0.3, charged component"),
244  pfRelIso03_all = Var("userFloat('PFIsoAll')/pt",float,doc="PF relative isolation dR=0.3, total (with rho*EA PU corrections)"),
245  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),
246  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),
247  dr03HcalDepth1TowerSumEt = Var("?pt>35?dr03HcalDepth1TowerSumEt():0",float,doc="Non-PF Hcal isolation within a delta R cone of 0.3 with electron pt > 35 GeV",precision=8),
248  hoe = Var("hadronicOverEm()",float,doc="H over E",precision=8),
249  tightCharge = Var("isGsfCtfScPixChargeConsistent() + isGsfScPixChargeConsistent()",int,doc="Tight charge criteria (0:none, 1:isGsfScPixChargeConsistent, 2:isGsfCtfScPixChargeConsistent)"),
250  convVeto = Var("passConversionVeto()",bool,doc="pass conversion veto"),
251  lostHits = Var("gsfTrack.hitPattern.numberOfLostHits('MISSING_INNER_HITS')","uint8",doc="number of missing inner hits"),
252  isPFcand = Var("pfCandidateRef().isNonnull()",bool,doc="electron is PF candidate"),
253  ),
254  externalVariables = cms.PSet(
255  mvaTTH = ExtVar(cms.InputTag("electronMVATTH"),float, doc="TTH MVA lepton ID score",precision=14),
256  ),
257 )
258 electronTable.variables.pt = Var("pt*userFloat('eCorr')", float, precision=-1, doc="p_{T} after energy correction & smearing")
259 run2_miniAOD_80XLegacy.toModify(electronTable.variables,
260  cutBased_HLTPreSel = Var("userInt('cutbasedID_HLT')",int,doc="cut-based HLT pre-selection ID"),
261  mvaSpring16GP = Var("userFloat('mvaSpring16GP')",float,doc="MVA general-purpose ID score"),
262  mvaSpring16GP_WP80 = Var("userInt('mvaSpring16GP_WP80')",bool,doc="MVA general-purpose ID WP80"),
263  mvaSpring16GP_WP90 = Var("userInt('mvaSpring16GP_WP90')",bool,doc="MVA general-purpose ID WP90"),
264  mvaSpring16HZZ = Var("userFloat('mvaSpring16HZZ')",float,doc="MVA HZZ ID score"),
265  mvaSpring16HZZ_WPL = Var("userInt('mvaSpring16HZZ_WPL')",bool,doc="MVA HZZ ID loose WP"),
266  mvaFall17Iso = None,
267  mvaFall17Iso_WP80 = None,
268  mvaFall17Iso_WP90 = None,
269  mvaFall17Iso_WPL = None,
270  mvaFall17noIso = None,
271  mvaFall17noIso_WP80 = None,
272  mvaFall17noIso_WP90 = None,
273  mvaFall17noIso_WPL = None,
274 )
275 
276 electronsMCMatchForTable = cms.EDProducer("MCMatcher", # cut on deltaR, deltaPt/Pt; pick best by deltaR
277  src = electronTable.src, # final reco collection
278  matched = cms.InputTag("finalGenParticles"), # final mc-truth particle collection
279  mcPdgId = cms.vint32(11,22), # one or more PDG ID (11 = el, 22 = pho); absolute values (see below)
280  checkCharge = cms.bool(False), # True = require RECO and MC objects to have the same charge
281  mcStatus = cms.vint32(1), # PYTHIA status code (1 = stable, 2 = shower, 3 = hard scattering)
282  maxDeltaR = cms.double(0.3), # Minimum deltaR for the match
283  maxDPtRel = cms.double(0.5), # Minimum deltaPt/Pt for the match
284  resolveAmbiguities = cms.bool(True), # Forbid two RECO objects to match to the same GEN object
285  resolveByMatchQuality = cms.bool(True), # False = just match input in order; True = pick lowest deltaR pair first
286 )
287 
288 electronMCTable = cms.EDProducer("CandMCMatchTableProducer",
289  src = electronTable.src,
290  mcMap = cms.InputTag("electronsMCMatchForTable"),
291  objName = electronTable.name,
292  objType = electronTable.name, #cms.string("Electron"),
293  branchName = cms.string("genPart"),
294  docString = cms.string("MC matching to status==1 electrons or photons"),
295 )
296 
297 electronSequence = cms.Sequence(heepIDVarValueMaps + egmGsfElectronIDSequence + bitmapVIDForEle + isoForEle + ptRatioRelForEle + calibratedPatElectrons + energyCorrForEle + slimmedElectronsWithUserData + finalElectrons)
298 electronTables = cms.Sequence (electronMVATTH + electronTable)
299 electronMC = cms.Sequence(electronsMCMatchForTable + electronMCTable)
300 
301 _withUpdate_sequence = cms.Sequence(slimmedElectronsUpdated + electronSequence.copy())
302 run2_nanoAOD_92X.toReplaceWith(electronSequence, _withUpdate_sequence)
303 run2_miniAOD_80XLegacy.toReplaceWith(electronSequence, _withUpdate_sequence)
def ExtVar(tag, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:31
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
Definition: common_cff.py:20
def setupVIDSelection(vidproducer, cutflow)
Definition: vid_id_tools.py:11
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
dbl *** dir
Definition: mlp_gen.cc:35
double split
Definition: MVATrainer.cc:139