1 import FWCore.ParameterSet.Config
as cms
3 from Configuration.Eras.Modifier_run2_jme_2016_cff
import run2_jme_2016
4 from Configuration.Eras.Modifier_run2_jme_2017_cff
import run2_jme_2017
15 from PhysicsTools.PatAlgos.tools.jetCollectionTools
import GenJetAdder, RecoJetAdder
21 bTagCSVV2 = [
'pfDeepCSVJetTags:probb',
'pfDeepCSVJetTags:probbb',
'pfDeepCSVJetTags:probc']
22 bTagCMVAV2 = [
'pfCombinedMVAV2BJetTags']
23 bTagDeepCSV = [
'pfCombinedInclusiveSecondaryVertexV2BJetTags']
25 'pfDeepFlavourJetTags:probb',
'pfDeepFlavourJetTags:probbb',
'pfDeepFlavourJetTags:problepb',
26 'pfDeepFlavourJetTags:probc',
'pfDeepFlavourJetTags:probuds',
'pfDeepFlavourJetTags:probg' 28 bTagDiscriminatorsForAK4 = bTagCSVV2+bTagCMVAV2+bTagDeepCSV+bTagDeepJet
42 config_genjets =
list(
filter(
lambda k: k[
'enabled'], config_genjets))
49 "doc" :
"AK8 Gen jets",
63 "inputCollection" :
"slimmedCaloJets",
64 "genJetsCollection":
"AK4GenJetsNoNu",
69 "inputCollection" :
"",
70 "genJetsCollection":
"AK4GenJetsNoNu",
75 "inputCollection" :
"",
76 "genJetsCollection":
"AK4GenJetsNoNu",
77 "bTagDiscriminators": bTagDiscriminatorsForAK4
82 "inputCollection" :
"",
83 "genJetsCollection":
"slimmedGenJetsAK8",
88 "inputCollection" :
"",
89 "genJetsCollection":
"slimmedGenJetsAK8",
92 config_recojets =
list(
filter(
lambda k: k[
'enabled'], config_recojets))
99 "doc" :
"AK4 PF Puppi jets with JECs applied, after basic selection (pt > 2)",
107 "doc" :
"AK4 PF jets with JECs applied, after basic selection (pt > 2)",
112 "doc" :
"AK4 Calo jets with JECs applied",
115 "name" :
"FatJetCHS",
116 "doc" :
"AK8 PF CHS jets with JECs applied, after basic selection (pt > 100)",
121 "doc" :
"AK8 PF jets with JECs applied, after basic selection (pt > 100)",
122 "ptcut" :
"pt > 100",
128 GENJETVARS = cms.PSet(P4Vars,
129 nConstituents = jetTable.variables.nConstituents,
131 PFJETVARS = cms.PSet(P4Vars,
132 rawFactor = jetTable.variables.rawFactor,
133 area = jetTable.variables.area,
134 chHEF = jetTable.variables.chHEF,
135 neHEF = jetTable.variables.neHEF,
136 chEmEF = jetTable.variables.chEmEF,
137 neEmEF = jetTable.variables.neEmEF,
138 muEF = jetTable.variables.muEF,
139 hfHEF =
Var(
"HFHadronEnergyFraction()",float,doc =
"hadronic energy fraction in HF",precision = 6),
140 hfEmEF =
Var(
"HFEMEnergyFraction()",float,doc =
"electromagnetic energy fraction in HF",precision = 6),
141 nMuons = jetTable.variables.nMuons,
142 nElectrons = jetTable.variables.nElectrons,
143 nConstituents = jetTable.variables.nConstituents,
144 nConstChHads =
Var(
"chargedHadronMultiplicity()",int,doc=
"number of charged hadrons in the jet"),
145 nConstNeuHads =
Var(
"neutralHadronMultiplicity()",int,doc=
"number of neutral hadrons in the jet"),
146 nConstHFHads =
Var(
"HFHadronMultiplicity()", int,doc=
"number of HF hadrons in the jet"),
147 nConstHFEMs =
Var(
"HFEMMultiplicity()",int,doc=
"number of HF EMs in the jet"),
148 nConstMuons =
Var(
"muonMultiplicity()",int,doc=
"number of muons in the jet"),
149 nConstElecs =
Var(
"electronMultiplicity()",int,doc=
"number of electrons in the jet"),
150 nConstPhotons =
Var(
"photonMultiplicity()",int,doc=
"number of photons in the jet"),
153 puId_dR2Mean =
Var(
"userFloat('puId_dR2Mean')",float,doc=
"pT^2-weighted average square distance of jet constituents from the jet axis (PileUp ID BDT input variable)", precision= 6),
154 puId_majW =
Var(
"userFloat('puId_majW')",float,doc=
"major axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)", precision= 6) ,
155 puId_minW =
Var(
"userFloat('puId_minW')",float,doc=
"minor axis of jet ellipsoid in eta-phi plane (PileUp ID BDT input variable)", precision= 6) ,
156 puId_frac01 =
Var(
"userFloat('puId_frac01')",float,doc=
"fraction of constituents' pT contained within dR <0.1 (PileUp ID BDT input variable)", precision= 6) ,
157 puId_frac02 =
Var(
"userFloat('puId_frac02')",float,doc=
"fraction of constituents' pT contained within 0.1< dR <0.2 (PileUp ID BDT input variable)", precision= 6) ,
158 puId_frac03 =
Var(
"userFloat('puId_frac03')",float,doc=
"fraction of constituents' pT contained within 0.2< dR <0.3 (PileUp ID BDT input variable)", precision= 6) ,
159 puId_frac04 =
Var(
"userFloat('puId_frac04')",float,doc=
"fraction of constituents' pT contained within 0.3< dR <0.4 (PileUp ID BDT input variable)", precision= 6) ,
160 puId_ptD =
Var(
"userFloat('puId_ptD')",float,doc=
"pT-weighted average pT of constituents (PileUp ID BDT input variable)", precision= 6) ,
161 puId_beta =
Var(
"userFloat('puId_beta')",float,doc=
"fraction of pT of charged constituents associated to PV (PileUp ID BDT input variable)", precision= 6) ,
162 puId_pull =
Var(
"userFloat('puId_pull')",float,doc=
"magnitude of pull vector (PileUp ID BDT input variable)", precision= 6) ,
163 puId_jetR =
Var(
"userFloat('puId_jetR')",float,doc=
"fraction of jet pT carried by the leading constituent (PileUp ID BDT input variable)", precision= 6) ,
164 puId_jetRchg =
Var(
"userFloat('puId_jetRchg')",float,doc=
"fraction of jet pT carried by the leading charged constituent (PileUp ID BDT input variable)", precision= 6) ,
165 puId_nCharged =
Var(
"userInt('puId_nCharged')",int,doc=
"number of charged constituents (PileUp ID BDT input variable)"),
168 qgl_axis2 =
Var(
"userFloat('qgl_axis2')",float,doc=
"ellipse minor jet axis (Quark vs Gluon likelihood input variable)", precision= 6),
169 qgl_ptD =
Var(
"userFloat('qgl_ptD')",float,doc=
"pT-weighted average pT of constituents (Quark vs Gluon likelihood input variable)", precision= 6),
170 qgl_mult =
Var(
"userInt('qgl_mult')", int,doc=
"PF candidates multiplicity (Quark vs Gluon likelihood input variable)"),
173 btagCMVA = jetTable.variables.btagCMVA,
174 btagDeepB = jetTable.variables.btagDeepB,
175 btagCSVV2 = jetTable.variables.btagCSVV2,
176 btagDeepC = jetTable.variables.btagDeepC,
178 DEEPJETVARS = cms.PSet(
179 btagDeepFlavB = jetTable.variables.btagDeepFlavB,
180 btagDeepFlavC = jetTable.variables.btagDeepFlavC,
181 btagDeepFlavG =
Var(
"bDiscriminator('pfDeepFlavourJetTags:probg')",float,doc=
"DeepFlavour gluon tag raw score",precision=10),
182 btagDeepFlavUDS =
Var(
"bDiscriminator('pfDeepFlavourJetTags:probuds')",float,doc=
"DeepFlavour uds tag raw score",precision=10)
184 CALOJETVARS = cms.PSet(P4Vars,
185 area = jetTable.variables.area,
186 rawFactor = jetTable.variables.rawFactor,
187 emf =
Var(
"emEnergyFraction()", float, doc =
"electromagnetic energy fraction", precision = 10),
198 def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetSequenceName=""):
200 Setup modules to calculate PF jet ID 203 isPUPPIJet =
True if "Puppi" in jetName
else False 205 looseJetId =
"looseJetId{}".
format(jetName)
206 setattr(proc, looseJetId, proc.looseJetId.clone(
208 filterParams=proc.looseJetId.filterParams.clone(
214 tightJetId =
"tightJetId{}".
format(jetName)
215 setattr(proc, tightJetId, proc.tightJetId.clone(
217 filterParams=proc.tightJetId.filterParams.clone(
218 version =
"SUMMER18{}".
format(
"PUPPI" if isPUPPIJet
else "")
223 tightJetIdLepVeto =
"tightJetIdLepVeto{}".
format(jetName)
224 setattr(proc, tightJetIdLepVeto, proc.tightJetIdLepVeto.clone(
226 filterParams=proc.tightJetIdLepVeto.filterParams.clone(
227 version =
"SUMMER18{}".
format(
"PUPPI" if isPUPPIJet
else "")
231 run2_jme_2016.toModify(getattr(proc, tightJetId) .filterParams, version =
"WINTER16" )
232 run2_jme_2016.toModify(getattr(proc, tightJetIdLepVeto) .filterParams, version =
"WINTER16" )
233 run2_jme_2017.toModify(getattr(proc, tightJetId) .filterParams, version =
"WINTER17{}".
format(
"PUPPI" if isPUPPIJet
else ""))
234 run2_jme_2017.toModify(getattr(proc, tightJetIdLepVeto) .filterParams, version =
"WINTER17{}".
format(
"PUPPI" if isPUPPIJet
else ""))
239 patJetWithUserData =
"{}WithUserData".
format(jetSrc)
240 getattr(proc, patJetWithUserData).userInts.tightId = cms.InputTag(tightJetId)
241 getattr(proc, patJetWithUserData).userInts.tightIdLepVeto = cms.InputTag(tightJetIdLepVeto)
242 run2_jme_2016.toModify(getattr(proc, patJetWithUserData).userInts, looseId = cms.InputTag(looseJetId))
247 getattr(proc, jetTableName).variables.jetId =
Var(
"userInt('tightId')*2+4*userInt('tightIdLepVeto')",int,doc=
"Jet ID flags bit1 is loose (always false in 2017 since it does not exist), bit2 is tight, bit3 is tightLepVeto")
248 run2_jme_2016.toModify(getattr(proc, jetTableName).variables, jetId =
Var(
"userInt('tightIdLepVeto')*4+userInt('tightId')*2+userInt('looseId')",int, doc=
"Jet ID flags bit1 is loose, bit2 is tight, bit3 is tightLepVeto"))
250 getattr(proc,jetSequenceName).
insert(getattr(proc,jetSequenceName).
index(getattr(proc, jetSrc))+1, getattr(proc, tightJetId))
251 getattr(proc,jetSequenceName).
insert(getattr(proc,jetSequenceName).
index(getattr(proc, tightJetId))+1, getattr(proc, tightJetIdLepVeto))
253 setattr(proc,
"_"+jetSequenceName+
"_2016", getattr(proc,jetSequenceName).
copy())
254 getattr(proc,
"_"+jetSequenceName+
"_2016").
insert(getattr(proc,
"_"+jetSequenceName+
"_2016").
index(getattr(proc, tightJetId)), getattr(proc, looseJetId))
255 run2_jme_2016.toReplaceWith(getattr(proc,jetSequenceName), getattr(proc,
"_"+jetSequenceName+
"_2016"))
261 Setup modules to calculate pileup jet ID input variables for PF jet 267 puJetIdVarsCalculator =
"puJetIdCalculator{}".
format(jetName)
268 setattr(proc, puJetIdVarsCalculator, pileupJetIdCalculator.clone(
270 vertexes =
"offlineSlimmedPrimaryVertices",
271 inputIsCorrected =
True,
273 usePuppi =
True if "Puppi" in jetName
else False 276 getattr(proc,jetSequenceName).
insert(getattr(proc,jetSequenceName).
index(getattr(proc, jetSrc))+1, getattr(proc, puJetIdVarsCalculator))
281 puJetIDVar =
"puJetIDVar{}".
format(jetName)
282 setattr(proc, puJetIDVar, cms.EDProducer(
"PileupJetIDVarProducer",
283 srcJet = cms.InputTag(jetSrc),
284 srcPileupJetId = cms.InputTag(puJetIdVarsCalculator)
287 getattr(proc,jetSequenceName).
insert(getattr(proc,jetSequenceName).
index(getattr(proc, puJetIdVarsCalculator))+1, getattr(proc, puJetIDVar))
292 patJetWithUserData =
"{}WithUserData".
format(jetSrc)
293 getattr(proc,patJetWithUserData).userFloats.puId_dR2Mean = cms.InputTag(
"{}:dR2Mean".
format(puJetIDVar))
294 getattr(proc,patJetWithUserData).userFloats.puId_majW = cms.InputTag(
"{}:majW".
format(puJetIDVar))
295 getattr(proc,patJetWithUserData).userFloats.puId_minW = cms.InputTag(
"{}:minW".
format(puJetIDVar))
296 getattr(proc,patJetWithUserData).userFloats.puId_frac01 = cms.InputTag(
"{}:frac01".
format(puJetIDVar))
297 getattr(proc,patJetWithUserData).userFloats.puId_frac02 = cms.InputTag(
"{}:frac02".
format(puJetIDVar))
298 getattr(proc,patJetWithUserData).userFloats.puId_frac03 = cms.InputTag(
"{}:frac03".
format(puJetIDVar))
299 getattr(proc,patJetWithUserData).userFloats.puId_frac04 = cms.InputTag(
"{}:frac04".
format(puJetIDVar))
300 getattr(proc,patJetWithUserData).userFloats.puId_ptD = cms.InputTag(
"{}:ptD".
format(puJetIDVar))
301 getattr(proc,patJetWithUserData).userFloats.puId_beta = cms.InputTag(
"{}:beta".
format(puJetIDVar))
302 getattr(proc,patJetWithUserData).userFloats.puId_pull = cms.InputTag(
"{}:pull".
format(puJetIDVar))
303 getattr(proc,patJetWithUserData).userFloats.puId_jetR = cms.InputTag(
"{}:jetR".
format(puJetIDVar))
304 getattr(proc,patJetWithUserData).userFloats.puId_jetRchg = cms.InputTag(
"{}:jetRchg".
format(puJetIDVar))
305 getattr(proc,patJetWithUserData).userInts.puId_nCharged = cms.InputTag(
"{}:nCharged".
format(puJetIDVar))
310 getattr(proc,jetTableName).variables.puId_dR2Mean = PUIDVARS.puId_dR2Mean
311 getattr(proc,jetTableName).variables.puId_majW = PUIDVARS.puId_majW
312 getattr(proc,jetTableName).variables.puId_minW = PUIDVARS.puId_minW
313 getattr(proc,jetTableName).variables.puId_frac01 = PUIDVARS.puId_frac01
314 getattr(proc,jetTableName).variables.puId_frac02 = PUIDVARS.puId_frac02
315 getattr(proc,jetTableName).variables.puId_frac03 = PUIDVARS.puId_frac03
316 getattr(proc,jetTableName).variables.puId_frac04 = PUIDVARS.puId_frac04
317 getattr(proc,jetTableName).variables.puId_ptD = PUIDVARS.puId_ptD
318 getattr(proc,jetTableName).variables.puId_beta = PUIDVARS.puId_beta
319 getattr(proc,jetTableName).variables.puId_pull = PUIDVARS.puId_pull
320 getattr(proc,jetTableName).variables.puId_jetR = PUIDVARS.puId_jetR
321 getattr(proc,jetTableName).variables.puId_jetRchg = PUIDVARS.puId_jetRchg
322 getattr(proc,jetTableName).variables.puId_nCharged = PUIDVARS.puId_nCharged
326 def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetSequenceName="", calculateQGLVars=False):
328 Schedule the QGTagger module to calculate input variables to the QG likelihood 331 QGLTagger=
"qgtagger{}".
format(jetName)
332 patJetWithUserData=
"{}WithUserData".
format(jetSrc)
335 setattr(proc, QGLTagger, qgtagger.clone(
343 getattr(proc,patJetWithUserData).userFloats.qgl_axis2 = cms.InputTag(QGLTagger+
":axis2")
344 getattr(proc,patJetWithUserData).userFloats.qgl_ptD = cms.InputTag(QGLTagger+
":ptD")
345 getattr(proc,patJetWithUserData).userInts.qgl_mult = cms.InputTag(QGLTagger+
":mult")
350 getattr(proc,jetTableName).variables.qgl_axis2 = QGLVARS.qgl_axis2
351 getattr(proc,jetTableName).variables.qgl_ptD = QGLVARS.qgl_ptD
352 getattr(proc,jetTableName).variables.qgl_mult = QGLVARS.qgl_mult
355 getattr(proc,jetSequenceName).
insert(getattr(proc,jetSequenceName).
index(getattr(proc, jetSrc))+1, getattr(proc, QGLTagger))
361 Store b-tagging scores from various algortihm 364 getattr(proc, jetTableName).variables.btagCMVA = jetTable.variables.btagCMVA
365 getattr(proc, jetTableName).variables.btagDeepB = jetTable.variables.btagDeepB
366 getattr(proc, jetTableName).variables.btagCSVV2 = jetTable.variables.btagCSVV2
367 getattr(proc, jetTableName).variables.btagDeepC = jetTable.variables.btagDeepC
368 getattr(proc, jetTableName).variables.btagDeepFlavB = jetTable.variables.btagDeepFlavB
369 getattr(proc, jetTableName).variables.btagDeepFlavC = jetTable.variables.btagDeepFlavC
375 Store DeepJet raw score in jetTable for gluon and light quark 378 getattr(proc, jetTableName).variables.btagDeepFlavG = DEEPJETVARS.btagDeepFlavG
379 getattr(proc, jetTableName).variables.btagDeepFlavUDS = DEEPJETVARS.btagDeepFlavUDS
385 Add patJet into custom nanoAOD 388 jetName = recoJetInfo.jetUpper
389 payload = recoJetInfo.jetCorrPayload
390 doPF = recoJetInfo.doPF
391 doCalo = recoJetInfo.doCalo
393 if recoJetInfo.inputCollection !=
"":
394 patJetFinalColl = recoJetInfo.inputCollection
396 patJetFinalColl =
"selectedUpdatedPatJets{}Final".
format(jetName)
399 patJetFinalColl =
"selectedPatJets{}".
format(jetName)
401 nanoInfoForJet = nanoInfo_recojets[recoJetInfo.jet]
402 jetTablePrefix = nanoInfoForJet[
"name"]
403 jetTableDoc = nanoInfoForJet[
"doc"]
404 ptcut = nanoInfoForJet[
"ptcut"]
if "ptcut" in nanoInfoForJet
else "" 405 doPUIDVar = nanoInfoForJet[
"doPUIDVar"]
if "doPUIDVar" in nanoInfoForJet
else False 406 doQGL = nanoInfoForJet[
"doQGL"]
if "doQGL" in nanoInfoForJet
else False 407 doBTag = nanoInfoForJet[
"doBTag"]
if "doBTag" in nanoInfoForJet
else False 410 jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo,
411 ptcut=ptcut, doPUIDVar=doPUIDVar, doQGL=doQGL, doBTag=doBTag, runOnMC=runOnMC
416 def SavePatJets(proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc,
417 doPF, doCalo, ptcut=
"", doPUIDVar=
False, doQGL=
False, doBTag=
False, runOnMC=
False):
419 Schedule modules for a given patJet collection and save its variables into custom NanoAOD 425 jetCorrFactors =
"jetCorrFactorsNano{}".
format(jetName)
426 setattr(proc, jetCorrFactors, jetCorrFactorsNano.clone(
427 src = patJetFinalColl,
435 srcJets =
"updatedJets{}".
format(jetName)
436 setattr(proc, srcJets, updatedJets.clone(
437 jetSource = patJetFinalColl,
438 jetCorrFactorsSource=[jetCorrFactors],
445 srcJetsWithUserData =
"updatedJets{}WithUserData".
format(jetName)
446 setattr(proc, srcJetsWithUserData, cms.EDProducer(
"PATJetUserDataEmbedder",
447 src = cms.InputTag(srcJets),
448 userFloats = cms.PSet(),
449 userInts = cms.PSet(),
456 finalJetsForTable =
"finalJets{}".
format(jetName)
457 setattr(proc, finalJetsForTable, finalJets.clone(
458 src = srcJetsWithUserData,
466 tableContent = PFJETVARS
468 tableContent = CALOJETVARS
470 jetTable =
"jet{}Table".
format(jetName)
471 setattr(proc,jetTable, cms.EDProducer(
"SimpleCandidateFlatTableProducer",
472 src = cms.InputTag(finalJetsForTable),
473 cut = cms.string(
""),
474 name = cms.string(jetTablePrefix),
475 doc = cms.string(jetTableDoc),
476 singleton = cms.bool(
False),
477 extension = cms.bool(
False),
478 variables = cms.PSet(tableContent)
481 getattr(proc,jetTable).variables.pt.precision=10
486 jetMCTable =
"jet{}MCTable".
format(jetName)
487 setattr(proc, jetMCTable, cms.EDProducer(
"SimpleCandidateFlatTableProducer",
488 src = cms.InputTag(finalJetsForTable),
489 cut = getattr(proc,jetTable).cut,
490 name = cms.string(jetTablePrefix),
491 singleton = cms.bool(
False),
492 extension = cms.bool(
True),
493 variables = cms.PSet(
494 partonFlavour =
Var(
"partonFlavour()", int, doc=
"flavour from parton matching"),
495 hadronFlavour =
Var(
"hadronFlavour()", int, doc=
"flavour from hadron ghost clustering"),
496 genJetIdx =
Var(
"?genJetFwdRef().backRef().isNonnull()?genJetFwdRef().backRef().key():-1", int, doc=
"index of matched gen jet"),
504 jetSequenceName =
"jet{}Sequence".
format(jetName)
505 setattr(proc, jetSequenceName, cms.Sequence(
506 getattr(proc,jetCorrFactors)+
507 getattr(proc,srcJets)+
508 getattr(proc,srcJetsWithUserData)+
509 getattr(proc,finalJetsForTable)
516 jetTableSequenceName =
"jet{}TablesSequence".
format(jetName)
517 setattr(proc, jetTableSequenceName, cms.Sequence(getattr(proc,jetTable)))
519 jetTableSequenceMCName =
"jet{}MCTablesSequence".
format(jetName)
520 setattr(proc, jetTableSequenceMCName, cms.Sequence(getattr(proc,jetMCTable)))
523 proc.nanoSequenceMC += getattr(proc,jetSequenceName)
524 proc.nanoSequenceMC += getattr(proc,jetTableSequenceName)
525 proc.nanoSequenceMC += getattr(proc,jetTableSequenceMCName)
527 proc.nanoSequence += getattr(proc,jetSequenceName)
528 proc.nanoSequence += getattr(proc,jetTableSequenceName)
534 proc =
AddJetID(proc, jetName=jetName, jetSrc=srcJets, jetTableName=jetTable, jetSequenceName=jetSequenceName)
536 proc =
AddPileUpJetIDVars(proc, jetName=jetName, jetSrc=srcJets, jetTableName=jetTable, jetSequenceName=jetSequenceName)
538 proc =
AddQGLTaggerVars(proc,jetName=jetName, jetSrc=srcJets, jetTableName=jetTable, jetSequenceName=jetSequenceName, calculateQGLVars=
True)
552 Recluster AK4 CHS jets and replace slimmedJets 553 that is used as default to save AK4 CHS jets 556 print(
"custom_jme_cff::ReclusterAK4CHSJets: Recluster AK4 PF CHS jets")
563 "inputCollection" :
"",
564 "genJetsCollection":
"AK4GenJetsNoNu",
565 "bTagDiscriminators": bTagDiscriminatorsForAK4
567 recoJetInfo = recoJA.addRecoJetCollection(proc, **cfg)
569 jetName = recoJetInfo.jetUpper
570 patJetFinalColl =
"selectedUpdatedPatJets{}Final".
format(jetName)
576 proc.jetCorrFactorsNano.src=patJetFinalColl
577 proc.updatedJets.jetSource=patJetFinalColl
582 proc.finalJets.cut =
"pt > 2" 583 proc.simpleCleanerTable.jetSel =
"pt > 10" 588 proc.jetTable.variables.hfHEF = PFJETVARS.hfHEF
589 proc.jetTable.variables.hfEmEF = PFJETVARS.hfEmEF
590 proc.jetTable.variables.nConstChHads = PFJETVARS.nConstChHads
591 proc.jetTable.variables.nConstNeuHads = PFJETVARS.nConstNeuHads
592 proc.jetTable.variables.nConstHFHads = PFJETVARS.nConstHFHads
593 proc.jetTable.variables.nConstHFEMs = PFJETVARS.nConstHFEMs
594 proc.jetTable.variables.nConstMuons = PFJETVARS.nConstMuons
595 proc.jetTable.variables.nConstElecs = PFJETVARS.nConstElecs
596 proc.jetTable.variables.nConstPhotons = PFJETVARS.nConstPhotons
598 proc.jetTable.doc = cms.string(
"AK4 PF CHS Jets with JECs applied, after basic selection (pt > 2)")
625 jetSrc=
"updatedJets",
626 jetTableName=
"jetTable",
627 jetSequenceName=
"jetSequence" 633 proc.updatedJetsWithUserData.userFloats.qgl_axis2 = cms.InputTag(
"qgtagger:axis2")
634 proc.updatedJetsWithUserData.userFloats.qgl_ptD = cms.InputTag(
"qgtagger:ptD")
635 proc.updatedJetsWithUserData.userInts.qgl_mult = cms.InputTag(
"qgtagger:mult")
639 proc.jetTable.variables.qgl_axis2 = QGLVARS.qgl_axis2
640 proc.jetTable.variables.qgl_ptD = QGLVARS.qgl_ptD
641 proc.jetTable.variables.qgl_mult = QGLVARS.qgl_mult
645 proc.jetTable.variables.btagDeepFlavG = DEEPJETVARS.btagDeepFlavG
646 proc.jetTable.variables.btagDeepFlavUDS = DEEPJETVARS.btagDeepFlavUDS
652 Add more variables for AK8 PFPUPPI jets 659 proc.fatJetTable.variables.chHEF =
Var(
"?isPFJet()?chargedHadronEnergyFraction():-1", float, doc=
"charged Hadron Energy Fraction", precision = 6)
660 proc.fatJetTable.variables.neHEF =
Var(
"?isPFJet()?neutralHadronEnergyFraction():-1", float, doc=
"neutral Hadron Energy Fraction", precision = 6)
661 proc.fatJetTable.variables.chEmEF =
Var(
"?isPFJet()?chargedEmEnergyFraction():-1", float, doc=
"charged Electromagnetic Energy Fraction", precision = 6)
662 proc.fatJetTable.variables.neEmEF =
Var(
"?isPFJet()?neutralEmEnergyFraction():-1", float, doc=
"neutral Electromagnetic Energy Fraction", precision = 6)
663 proc.fatJetTable.variables.muEF =
Var(
"?isPFJet()?muonEnergyFraction():-1", float, doc=
"muon Energy Fraction", precision = 6)
664 proc.fatJetTable.variables.hfHEF =
Var(
"?isPFJet()?HFHadronEnergyFraction():-1", float, doc=
"energy fraction in forward hadronic calorimeter", precision = 6)
665 proc.fatJetTable.variables.hfEmEF =
Var(
"?isPFJet()?HFEMEnergyFraction():-1", float, doc=
"energy fraction in forward EM calorimeter", precision = 6)
666 proc.fatJetTable.variables.nConstChHads =
Var(
"?isPFJet()?chargedHadronMultiplicity():-1",int, doc=
"number of charged hadrons in the jet")
667 proc.fatJetTable.variables.nConstNeuHads =
Var(
"?isPFJet()?neutralHadronMultiplicity():-1",int, doc=
"number of neutral hadrons in the jet")
668 proc.fatJetTable.variables.nConstHFHads =
Var(
"?isPFJet()?HFHadronMultiplicity():-1", int, doc=
"number of HF Hadrons in the jet")
669 proc.fatJetTable.variables.nConstHFEMs =
Var(
"?isPFJet()?HFEMMultiplicity():-1", int, doc=
"number of HF EMs in the jet")
670 proc.fatJetTable.variables.nConstMuons =
Var(
"?isPFJet()?muonMultiplicity():-1", int, doc=
"number of muons in the jet")
671 proc.fatJetTable.variables.nConstElecs =
Var(
"?isPFJet()?electronMultiplicity():-1", int, doc=
"number of electrons in the jet")
672 proc.fatJetTable.variables.nConstPhotons =
Var(
"?isPFJet()?photonMultiplicity():-1", int, doc=
"number of photons in the jet")
684 Add genJet into custom nanoAOD 687 genJetName = genJetInfo.jetUpper
688 genJetAlgo = genJetInfo.jetAlgo
689 genJetSize = genJetInfo.jetSize
690 genJetSizeNr = genJetInfo.jetSizeNr
691 genJetFinalColl =
"{}{}{}".
format(genJetAlgo.upper(), genJetSize,
"GenJetsNoNu")
692 genJetTablePrefix = nanoInfo_genjets[genJetInfo.jet][
"name"]
693 genJetTableDoc = nanoInfo_genjets[genJetInfo.jet][
"doc"]
695 SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=
False)
699 def SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False):
701 Schedule modules for a given genJet collection and save its variables into custom NanoAOD 704 genJetTableThisJet =
"jet{}Table".
format(genJetName)
705 setattr(proc, genJetTableThisJet, genJetTable.clone(
706 src = genJetFinalColl,
708 name = genJetTablePrefix,
709 doc = genJetTableDoc,
710 variables = GENJETVARS
714 genJetFlavourAssociationThisJet =
"genJet{}FlavourAssociation".
format(genJetName)
715 setattr(proc, genJetFlavourAssociationThisJet, genJetFlavourAssociation.clone(
716 jets = getattr(proc,genJetTableThisJet).src,
717 jetAlgorithm = supportedJetAlgos[genJetAlgo],
718 rParam = genJetSizeNr,
722 genJetFlavourTableThisJet =
"genJet{}FlavourTable".
format(genJetName)
723 setattr(proc, genJetFlavourTableThisJet, genJetFlavourTable.clone(
724 name = getattr(proc,genJetTableThisJet).name,
725 src = getattr(proc,genJetTableThisJet).src,
726 cut = getattr(proc,genJetTableThisJet).cut,
727 jetFlavourInfos = genJetFlavourAssociationThisJet,
731 genJetSequenceName =
"genJet{}Sequence".
format(genJetName)
732 setattr(proc, genJetSequenceName, cms.Sequence(
733 getattr(proc,genJetTableThisJet)+
734 getattr(proc,genJetFlavourAssociationThisJet)+
735 getattr(proc,genJetFlavourTableThisJet)
738 proc.nanoSequenceMC.insert(proc.nanoSequenceMC.index(proc.jetMC)+1, getattr(proc,genJetSequenceName))
744 Recluster AK4 Gen jets and replace 745 slimmedGenJets that is used as default 746 to save AK4 Gen jets in NanoAODs. 748 print(
"custom_jme_cff::ReclusterAK4GenJets: Recluster AK4 Gen jets")
756 genJetInfo = genJA.addGenJetCollection(proc, **cfg)
758 genJetName = genJetInfo.jetUpper
759 genJetAlgo = genJetInfo.jetAlgo
760 genJetSize = genJetInfo.jetSize
761 genJetSizeNr = genJetInfo.jetSizeNr
762 selectedPatGenJets =
"{}{}{}".
format(genJetAlgo.upper(), genJetSize,
"GenJetsNoNu")
768 proc.genJetTable.src = selectedPatGenJets
769 proc.genJetTable.cut =
"pt > 1" 770 proc.genJetTable.doc =
"AK4 Gen jets (made with visible genparticles)" 772 genJetFlavourAssociationThisJet =
"genJet{}FlavourAssociation".
format(genJetName)
773 setattr(proc, genJetFlavourAssociationThisJet, genJetFlavourAssociation.clone(
774 jets = proc.genJetTable.src,
775 jetAlgorithm = supportedJetAlgos[genJetAlgo],
776 rParam = genJetSizeNr,
779 proc.jetMC.insert(proc.jetMC.index(proc.genJetFlavourTable), getattr(proc, genJetFlavourAssociationThisJet))
783 proc.genJetTable.variables.nConstituents = GENJETVARS.nConstituents
787 proc.genJetAK8Table.variables.nConstituents = GENJETVARS.nConstituents
797 Remove default pt cuts for all jets set in jets_cff.py 800 proc.finalJets.cut =
"" 801 proc.finalJetsAK8.cut =
"" 802 proc.genJetTable.cut =
"" 803 proc.genJetFlavourTable.cut =
"" 804 proc.genJetAK8Table.cut =
"" 805 proc.genJetAK8FlavourTable.cut =
"" 826 genJA = GenJetAdder()
840 for jetConfig
in config_genjets:
841 cfg = { k : v
for k, v
in jetConfig.items()
if k !=
"enabled"}
842 genJetInfo = genJA.addGenJetCollection(process, **cfg)
850 recoJA = RecoJetAdder(runOnMC=runOnMC)
862 for jetConfig
in config_recojets:
863 cfg = { k : v
for k, v
in jetConfig.items()
if k !=
"enabled"}
864 recoJetInfo = recoJA.addRecoJetCollection(process, **cfg)
def AddBTaggingScores(proc, jetTableName="")
def ReclusterAK4CHSJets(proc, recoJA, runOnMC)
def AddJetID(proc, jetName="", jetSrc="", jetTableName="", jetSequenceName="")
def AddQGLTaggerVars(proc, jetName="", jetSrc="", jetTableName="", jetSequenceName="", calculateQGLVars=False)
def RemoveAllJetPtCuts(proc)
def PrepJMECustomNanoAOD(process, runOnMC)
def AddNewPatJets(proc, recoJetInfo, runOnMC)
S & print(S &os, JobReport::InputFile const &f)
def Var(expr, valtype, compression=None, doc=None, mcOnly=False, precision=-1)
def ReclusterAK4GenJets(proc, genJA)
def AddDeepJetGluonLQuarkScores(proc, jetTableName="")
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
def SavePatJets(proc, jetName, payload, patJetFinalColl, jetTablePrefix, jetTableDoc, doPF, doCalo, ptcut="", doPUIDVar=False, doQGL=False, doBTag=False, runOnMC=False)
def AddPileUpJetIDVars(proc, jetName="", jetSrc="", jetTableName="", jetSequenceName="")
def AddNewGenJets(proc, genJetInfo)
def SaveGenJets(proc, genJetName, genJetAlgo, genJetSizeNr, genJetFinalColl, genJetTablePrefix, genJetTableDoc, runOnMC=False)
def AddVariablesForAK4GenJets(proc)
def AddVariablesForAK8PuppiJets(proc)
def AddVariablesForAK8GenJets(proc)
def PrepJMECustomNanoAOD_MC(process)
def PrepJMECustomNanoAOD_Data(process)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run