1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
32 nanoMetadata = cms.EDProducer(
"UniqueStringProducer",
34 tag = cms.string(
"untagged"),
38 linkedObjects = cms.EDProducer(
"PATObjectCrossLinker",
39 jets=cms.InputTag(
"finalJetsPuppi"),
40 muons=cms.InputTag(
"finalMuons"),
41 electrons=cms.InputTag(
"finalElectrons"),
42 lowPtElectrons=cms.InputTag(
"finalLowPtElectrons"),
43 taus=cms.InputTag(
"finalTaus"),
44 boostedTaus=cms.InputTag(
"finalBoostedTaus"),
45 photons=cms.InputTag(
"finalPhotons"),
46 vertices=cms.InputTag(
"slimmedSecondaryVertices")
50 run2_nanoAOD_ANY.toModify(
51 linkedObjects, jets=
"finalJets" 55 run3_nanoAOD_122.toModify(
56 linkedObjects, boostedTaus=
None,
59 from PhysicsTools.NanoAOD.lhcInfoProducer_cfi
import lhcInfoProducer
60 lhcInfoTable = lhcInfoProducer.clone()
61 (~run3_common).toModify(
62 lhcInfoTable, useNewLHCInfo=
False 65 nanoTableTaskCommon = cms.Task(
66 cms.Task(nanoMetadata),
67 jetPuppiTask, jetPuppiForMETTask, jetAK8Task,
68 extraFlagsProducersTask, muonTask, tauTask, boostedTauTask,
69 electronTask , lowPtElectronTask, photonTask,
70 vertexTask, isoTrackTask, jetAK8LepTask,
72 cms.Task(linkedObjects),
73 jetPuppiTablesTask, jetAK8TablesTask,
74 muonTablesTask, fsrTablesTask, tauTablesTask, boostedTauTablesTask,
75 electronTablesTask, lowPtElectronTablesTask, photonTablesTask,
76 globalTablesTask, vertexTablesTask, metTablesTask, extraFlagsTableTask,
77 isoTrackTablesTask,softActivityTablesTask
81 _nanoTableTaskCommonRun2 = nanoTableTaskCommon.copy()
82 _nanoTableTaskCommonRun2.replace(jetPuppiTask, jetTask)
83 _nanoTableTaskCommonRun2.replace(jetPuppiForMETTask, jetForMETTask)
84 _nanoTableTaskCommonRun2.replace(jetPuppiTablesTask, jetTablesTask)
85 run2_nanoAOD_ANY.toReplaceWith(
86 nanoTableTaskCommon, _nanoTableTaskCommonRun2
89 nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon)
91 nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)
92 nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)
94 nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)
96 nanoTableTaskFS = cms.Task(
97 genParticleTask, particleLevelTask, jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask,
98 tauMCTask, boostedTauMCTask,
99 metMCTable, ttbarCatMCProducersTask, globalTablesMCTask, ttbarCategoryTableTask,
100 genWeightsTableTask, genVertexTablesTask, genParticleTablesTask, genProtonTablesTask, particleLevelTablesTask
103 nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS))
106 nanoSequenceMC = nanoSequenceFS.copy()
107 nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim)
110 import RecoTauTag.RecoTau.tools.runTauIdMVA
as tauIdConfig
113 updatedTauName =
"slimmedTausUpdated" 114 tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug =
False,
115 updatedTauName = updatedTauName,
118 tauIdEmbedder.runTauID()
119 process.finalTaus.src = updatedTauName
122 process.tauTask.add( process.rerunMvaIsolationTaskForNano, getattr(process, updatedTauName) )
128 updatedBoostedTauName =
"slimmedTausBoostedNewID" 129 boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug =
False,
130 originalTauName =
"slimmedTausBoosted",
131 updatedTauName = updatedBoostedTauName,
132 postfix =
"BoostedForNano",
134 boostedTauIdEmbedder.runTauID()
135 process.finalBoostedTaus.src = updatedBoostedTauName
138 process.boostedTauTask.add( process.rerunMvaIsolationTaskBoostedForNano, getattr(process, updatedBoostedTauName))
145 originalTauName = process.finalTaus.src.value()
148 jetCollection =
"updatedJetsPuppi" 149 TagName =
"pfUnifiedParticleTransformerAK4JetTags" 150 tag_prefix =
"byUTagPUPPI" 151 updatedTauName = originalTauName+
'WithUTagPUPPI' 153 from RecoBTag.ONNXRuntime.pfUnifiedParticleTransformerAK4JetTags_cfi
import pfUnifiedParticleTransformerAK4JetTags
154 Discriminators = [TagName+
":"+tag
for tag
in pfUnifiedParticleTransformerAK4JetTags.flav_names.value()]
156 jetCollection =
"updatedJets" 157 TagName =
"pfParticleNetFromMiniAODAK4CHSCentralJetTags" 158 tag_prefix =
"byUTagCHS" 159 updatedTauName = originalTauName+
'WithUTagCHS' 161 from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff
import pfParticleNetFromMiniAODAK4CHSCentralJetTags
162 Discriminators = [TagName+
":"+tag
for tag
in pfParticleNetFromMiniAODAK4CHSCentralJetTags.flav_names.value()]
165 from PhysicsTools.PatAlgos.patTauHybridProducer_cfi
import patTauHybridProducer
166 setattr(process, updatedTauName, patTauHybridProducer.clone(
167 src = originalTauName,
168 jetSource = jetCollection,
173 UTagScoreNames = Discriminators,
174 tagPrefix = tag_prefix,
177 checkTauScoreIsBest =
False,
178 chargeAssignmentProbMin = 0.2,
179 addGenJetMatch =
False,
182 process.finalTaus.src = updatedTauName
186 process.tauTask.add(process.jetTask, getattr(process, updatedTauName))
194 for modname
in electron_id_modules_WorkingPoints_nanoAOD.modules:
197 process.electronTask.add( process.egmGsfElectronIDTask )
200 for modname
in photon_id_modules_WorkingPoints_nanoAOD.modules:
203 process.photonTask.add( process.egmPhotonIDTask )
211 run2_nanoAOD_106Xv2.toModify(
212 nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch=
True,
213 nanoAOD_addRobustParTAK4Tag_switch=
False,
214 nanoAOD_addUnifiedParTAK4Tag_switch=
True,
220 (run3_nanoAOD_122 | run3_nanoAOD_124).toModify(
221 nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch =
True 226 addParticleNet=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addParticleNet_switch,
227 addRobustParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addRobustParTAK4Tag_switch,
228 addUnifiedParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addUnifiedParTAK4Tag_switch
233 addDeepBTag=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepBTag_switch,
234 addDeepFlavour=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepFlavourTag_switch,
235 addParticleNet=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addParticleNet_switch,
236 addRobustParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addRobustParTAK4Tag_switch,
237 addUnifiedParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addUnifiedParTAK4Tag_switch
242 addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
243 addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
244 addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
245 addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
246 addParticleNetMassLegacy=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMassLegacy_switch,
247 addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
248 jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload
251 nanoAOD_tau_switch = cms.PSet(
252 idsToAdd = cms.vstring(),
253 addUParTInfo = cms.bool(
True),
254 addPNet = cms.bool(
True)
256 (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(
257 nanoAOD_tau_switch, idsToAdd = [
"deepTau2018v2p5"]
264 (run3_nanoAOD_122 | run3_nanoAOD_124 | run2_nanoAOD_106Xv2).toModify(
265 nanoAOD_tau_switch, addUParTInfo =
False 270 addUTagInfo = nanoAOD_tau_switch.addPNet.value(),
276 addUTagInfo = nanoAOD_tau_switch.addUParTInfo.value(),
280 nanoAOD_boostedTau_switch = cms.PSet(
281 idsToAdd = cms.vstring()
283 run2_nanoAOD_106Xv2.toModify(
284 nanoAOD_boostedTau_switch, idsToAdd = [
"mvaIso",
"mvaIsoNewDM",
"mvaIsoDR0p3",
"againstEle"]
290 from PhysicsTools.NanoAOD.leptonTimeLifeInfo_common_cff
import addTimeLifeInfoBase
297 pdgSelection=
"?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)" 299 ptPrecision=
"{}?{}:{}".
format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
300 process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
301 phiPrecision=
"{} ? {} : {}".
format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
302 process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
303 etaPrecision=
"{} ? {} : {}".
format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
304 process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
308 process.nanoTableTaskCommon.add(process.l1TablesTask)
313 process.nanoTableTaskCommon.add(process.l1TablesTask)
def nanoL1TrigObjCustomizeFull(process)
def addTimeLifeInfoBase(process)
def nanoAOD_activateVID(process)
def nanoWmassGenCustomize(process)
increasing the precision of selected GenParticles.
def nanoAOD_customizeCommon(process)
def nanoAOD_addUTagToTaus(process, addUTagInfo=False, usePUPPIjets=False)
def nanoAOD_addTauIds(process, idsToRun=[])
def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNetMassLegacy, addParticleNet, jecPayload)
def nanoAOD_addDeepInfoAK4(process, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)
def nanoAOD_addBoostedTauIds(process, idsToRun=[])
def nanoL1TrigObjCustomize(process)
def nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)
def setL1NanoToReduced(process)