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" 54 from PhysicsTools.NanoAOD.lhcInfoProducer_cfi
import lhcInfoProducer
55 lhcInfoTable = lhcInfoProducer.clone()
56 (~run3_common).toModify(
57 lhcInfoTable, useNewLHCInfo=
False 60 nanoTableTaskCommon = cms.Task(
61 cms.Task(nanoMetadata),
62 jetPuppiTask, jetPuppiForMETTask, jetAK8Task,
63 extraFlagsProducersTask, muonTask, tauTask, boostedTauTask,
64 electronTask , lowPtElectronTask, photonTask,
65 vertexTask, isoTrackTask, jetAK8LepTask,
67 cms.Task(linkedObjects),
68 jetPuppiTablesTask, jetAK8TablesTask,
69 muonTablesTask, fsrTablesTask, tauTablesTask, boostedTauTablesTask,
70 electronTablesTask, lowPtElectronTablesTask, photonTablesTask,
71 globalTablesTask, vertexTablesTask, metTablesTask, extraFlagsTableTask,
72 isoTrackTablesTask,softActivityTablesTask
76 _nanoTableTaskCommonRun2 = nanoTableTaskCommon.copy()
77 _nanoTableTaskCommonRun2.replace(jetPuppiTask, jetTask)
78 _nanoTableTaskCommonRun2.replace(jetPuppiForMETTask, jetForMETTask)
79 _nanoTableTaskCommonRun2.replace(jetPuppiTablesTask, jetTablesTask)
80 run2_nanoAOD_ANY.toReplaceWith(
81 nanoTableTaskCommon, _nanoTableTaskCommonRun2
84 nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon)
86 nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)
87 nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)
89 nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)
91 nanoTableTaskFS = cms.Task(
92 genParticleTask, particleLevelTask, jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask,
93 tauMCTask, boostedTauMCTask,
94 metMCTable, ttbarCatMCProducersTask, globalTablesMCTask, ttbarCategoryTableTask,
95 genWeightsTableTask, genVertexTablesTask, genParticleTablesTask, genProtonTablesTask, particleLevelTablesTask, tauSpinnerTableTask
98 nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS))
101 nanoSequenceMC = nanoSequenceFS.copy()
102 nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim)
105 import RecoTauTag.RecoTau.tools.runTauIdMVA
as tauIdConfig
108 updatedTauName =
"slimmedTausUpdated" 109 tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug =
False,
110 updatedTauName = updatedTauName,
113 tauIdEmbedder.runTauID()
114 process.finalTaus.src = updatedTauName
117 process.tauTask.add( process.rerunMvaIsolationTaskForNano, getattr(process, updatedTauName) )
123 updatedBoostedTauName =
"slimmedTausBoostedNewID" 124 boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug =
False,
125 originalTauName =
"slimmedTausBoosted",
126 updatedTauName = updatedBoostedTauName,
127 postfix =
"BoostedForNano",
129 boostedTauIdEmbedder.runTauID()
130 process.finalBoostedTaus.src = updatedBoostedTauName
133 process.boostedTauTask.add( process.rerunMvaIsolationTaskBoostedForNano, getattr(process, updatedBoostedTauName))
140 originalTauName = process.finalTaus.src.value()
143 jetCollection =
"updatedJetsPuppi" 144 TagName =
"pfUnifiedParticleTransformerAK4JetTags" 145 tag_prefix =
"byUTagPUPPI" 146 updatedTauName = originalTauName+
'WithUTagPUPPI' 148 from RecoBTag.ONNXRuntime.pfUnifiedParticleTransformerAK4JetTags_cfi
import pfUnifiedParticleTransformerAK4JetTags
149 Discriminators = [TagName+
":"+tag
for tag
in pfUnifiedParticleTransformerAK4JetTags.flav_names.value()]
151 jetCollection =
"updatedJets" 152 TagName =
"pfParticleNetFromMiniAODAK4CHSCentralJetTags" 153 tag_prefix =
"byUTagCHS" 154 updatedTauName = originalTauName+
'WithUTagCHS' 156 from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff
import pfParticleNetFromMiniAODAK4CHSCentralJetTags
157 Discriminators = [TagName+
":"+tag
for tag
in pfParticleNetFromMiniAODAK4CHSCentralJetTags.flav_names.value()]
160 from PhysicsTools.PatAlgos.patTauHybridProducer_cfi
import patTauHybridProducer
161 setattr(process, updatedTauName, patTauHybridProducer.clone(
162 src = originalTauName,
163 jetSource = jetCollection,
168 UTagScoreNames = Discriminators,
169 tagPrefix = tag_prefix,
172 checkTauScoreIsBest =
False,
173 chargeAssignmentProbMin = 0.2,
174 addGenJetMatch =
False,
177 process.finalTaus.src = updatedTauName
181 process.tauTask.add(process.jetTask, getattr(process, updatedTauName))
189 for modname
in electron_id_modules_WorkingPoints_nanoAOD.modules:
192 process.electronTask.add( process.egmGsfElectronIDTask )
195 for modname
in photon_id_modules_WorkingPoints_nanoAOD.modules:
198 process.photonTask.add( process.egmPhotonIDTask )
206 run2_nanoAOD_106Xv2.toModify(
207 nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch=
True,
208 nanoAOD_addRobustParTAK4Tag_switch=
False,
209 nanoAOD_addUnifiedParTAK4Tag_switch=
True,
214 addParticleNet=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addParticleNet_switch,
215 addRobustParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addRobustParTAK4Tag_switch,
216 addUnifiedParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addUnifiedParTAK4Tag_switch
221 addDeepBTag=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepBTag_switch,
222 addDeepFlavour=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepFlavourTag_switch,
223 addParticleNet=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addParticleNet_switch,
224 addRobustParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addRobustParTAK4Tag_switch,
225 addUnifiedParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addUnifiedParTAK4Tag_switch
230 addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
231 addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
232 addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
233 addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
234 addParticleNetMassLegacy=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMassLegacy_switch,
235 addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
236 addGlobalParT=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addGlobalParT_switch,
237 jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload
240 nanoAOD_tau_switch = cms.PSet(
241 idsToAdd = cms.vstring(),
242 addUParTInfo = cms.bool(
False),
243 addPNet = cms.bool(
False)
245 (run2_nanoAOD_106Xv2).toModify(
246 nanoAOD_tau_switch, idsToAdd = [
"deepTau2018v2p5"]
254 (run2_nanoAOD_106Xv2).toModify(
255 nanoAOD_tau_switch, addPNet =
True 259 run3_nanoAOD_pre142X.toModify(
260 nanoAOD_tau_switch, addPNet =
True, addUParTInfo =
True 265 addUTagInfo = nanoAOD_tau_switch.addPNet.value(),
271 addUTagInfo = nanoAOD_tau_switch.addUParTInfo.value(),
275 nanoAOD_boostedTau_switch = cms.PSet(
276 idsToAdd = cms.vstring()
278 run2_nanoAOD_106Xv2.toModify(
279 nanoAOD_boostedTau_switch, idsToAdd = [
"mvaIso",
"mvaIsoNewDM",
"mvaIsoDR0p3",
"againstEle",
"boostedDeepTauRunIIv2p0"]
283 run3_nanoAOD_pre142X.toModify(
284 nanoAOD_boostedTau_switch, idsToAdd = [
"boostedDeepTauRunIIv2p0"]
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)
def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNetMassLegacy, addParticleNet, addGlobalParT, jecPayload)
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_addDeepInfoAK4(process, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)
def nanoAOD_addBoostedTauIds(process, idsToRun=[])
def nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)