1 from __future__
import print_function
2 import FWCore.ParameterSet.Config
as cms
31 nanoMetadata = cms.EDProducer(
"UniqueStringProducer",
33 tag = cms.string(
"untagged"),
37 linkedObjects = cms.EDProducer(
"PATObjectCrossLinker",
38 jets=cms.InputTag(
"finalJetsPuppi"),
39 muons=cms.InputTag(
"finalMuons"),
40 electrons=cms.InputTag(
"finalElectrons"),
41 lowPtElectrons=cms.InputTag(
"finalLowPtElectrons"),
42 taus=cms.InputTag(
"finalTaus"),
43 boostedTaus=cms.InputTag(
"finalBoostedTaus"),
44 photons=cms.InputTag(
"finalPhotons"),
45 vertices=cms.InputTag(
"slimmedSecondaryVertices")
49 run2_nanoAOD_ANY.toModify(
50 linkedObjects, jets=
"finalJets" 54 run3_nanoAOD_122.toModify(
55 linkedObjects, boostedTaus=
None,
58 from PhysicsTools.NanoAOD.lhcInfoProducer_cfi
import lhcInfoProducer
59 lhcInfoTable = lhcInfoProducer.clone()
60 (~run3_common).toModify(
61 lhcInfoTable, useNewLHCInfo=
False 64 nanoTableTaskCommon = cms.Task(
65 cms.Task(nanoMetadata),
66 jetPuppiTask, jetPuppiForMETTask, jetAK8Task,
67 extraFlagsProducersTask, muonTask, tauTask, boostedTauTask,
68 electronTask , lowPtElectronTask, photonTask,
69 vertexTask, isoTrackTask, jetAK8LepTask,
71 cms.Task(linkedObjects),
72 jetPuppiTablesTask, jetAK8TablesTask,
73 muonTablesTask, fsrTablesTask, tauTablesTask, boostedTauTablesTask,
74 electronTablesTask, lowPtElectronTablesTask, photonTablesTask,
75 globalTablesTask, vertexTablesTask, metTablesTask, extraFlagsTableTask,
76 isoTrackTablesTask,softActivityTablesTask
80 _nanoTableTaskCommonRun2 = nanoTableTaskCommon.copy()
81 _nanoTableTaskCommonRun2.replace(jetPuppiTask, jetTask)
82 _nanoTableTaskCommonRun2.replace(jetPuppiForMETTask, jetForMETTask)
83 _nanoTableTaskCommonRun2.replace(jetPuppiTablesTask, jetTablesTask)
84 run2_nanoAOD_ANY.toReplaceWith(
85 nanoTableTaskCommon, _nanoTableTaskCommonRun2
88 nanoSequenceCommon = cms.Sequence(nanoTableTaskCommon)
90 nanoSequenceOnlyFullSim = cms.Sequence(triggerObjectTablesTask)
91 nanoSequenceOnlyData = cms.Sequence(cms.Sequence(protonTablesTask) + lhcInfoTable)
93 nanoSequence = cms.Sequence(nanoSequenceCommon + nanoSequenceOnlyData + nanoSequenceOnlyFullSim)
95 nanoTableTaskFS = cms.Task(
96 genParticleTask, particleLevelTask, jetMCTask, muonMCTask, electronMCTask, lowPtElectronMCTask, photonMCTask,
97 tauMCTask, boostedTauMCTask,
98 metMCTable, ttbarCatMCProducersTask, globalTablesMCTask, ttbarCategoryTableTask,
99 genWeightsTableTask, genVertexTablesTask, genParticleTablesTask, genProtonTablesTask, particleLevelTablesTask
102 nanoSequenceFS = cms.Sequence(nanoSequenceCommon + cms.Sequence(nanoTableTaskFS))
105 nanoSequenceMC = nanoSequenceFS.copy()
106 nanoSequenceMC.insert(nanoSequenceFS.index(nanoSequenceCommon)+1,nanoSequenceOnlyFullSim)
109 import RecoTauTag.RecoTau.tools.runTauIdMVA
as tauIdConfig
112 updatedTauName =
"slimmedTausUpdated" 113 tauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug =
False,
114 updatedTauName = updatedTauName,
117 tauIdEmbedder.runTauID()
118 process.finalTaus.src = updatedTauName
121 process.tauTask.add( process.rerunMvaIsolationTaskForNano, getattr(process, updatedTauName) )
127 updatedBoostedTauName =
"slimmedTausBoostedNewID" 128 boostedTauIdEmbedder = tauIdConfig.TauIDEmbedder(process, debug =
False,
129 originalTauName =
"slimmedTausBoosted",
130 updatedTauName = updatedBoostedTauName,
131 postfix =
"BoostedForNano",
133 boostedTauIdEmbedder.runTauID()
134 process.finalBoostedTaus.src = updatedBoostedTauName
137 process.boostedTauTask.add( process.rerunMvaIsolationTaskBoostedForNano, getattr(process, updatedBoostedTauName))
144 originalTauName = process.finalTaus.src.value()
147 jetCollection =
"updatedJetsPuppi" 148 TagName =
"pfUnifiedParticleTransformerAK4JetTags" 149 tag_prefix =
"byUTagPUPPI" 150 updatedTauName = originalTauName+
'WithUTagPUPPI' 152 from RecoBTag.ONNXRuntime.pfUnifiedParticleTransformerAK4JetTags_cfi
import pfUnifiedParticleTransformerAK4JetTags
153 Discriminators = [TagName+
":"+tag
for tag
in pfUnifiedParticleTransformerAK4JetTags.flav_names.value()]
155 jetCollection =
"updatedJets" 156 TagName =
"pfParticleNetFromMiniAODAK4CHSCentralJetTags" 157 tag_prefix =
"byUTagCHS" 158 updatedTauName = originalTauName+
'WithUTagCHS' 160 from RecoBTag.ONNXRuntime.pfParticleNetFromMiniAODAK4_cff
import pfParticleNetFromMiniAODAK4CHSCentralJetTags
161 Discriminators = [TagName+
":"+tag
for tag
in pfParticleNetFromMiniAODAK4CHSCentralJetTags.flav_names.value()]
164 from PhysicsTools.PatAlgos.patTauHybridProducer_cfi
import patTauHybridProducer
165 setattr(process, updatedTauName, patTauHybridProducer.clone(
166 src = originalTauName,
167 jetSource = jetCollection,
172 UTagScoreNames = Discriminators,
173 tagPrefix = tag_prefix,
176 checkTauScoreIsBest =
False,
177 chargeAssignmentProbMin = 0.2,
178 addGenJetMatch =
False,
181 process.finalTaus.src = updatedTauName
185 process.tauTask.add(process.jetTask, getattr(process, updatedTauName))
193 for modname
in electron_id_modules_WorkingPoints_nanoAOD.modules:
196 process.electronTask.add( process.egmGsfElectronIDTask )
199 for modname
in photon_id_modules_WorkingPoints_nanoAOD.modules:
202 process.photonTask.add( process.egmPhotonIDTask )
210 run2_nanoAOD_106Xv2.toModify(
211 nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch=
True,
212 nanoAOD_addRobustParTAK4Tag_switch=
False,
213 nanoAOD_addUnifiedParTAK4Tag_switch=
True,
219 (run3_nanoAOD_122 | run3_nanoAOD_124).toModify(
220 nanoAOD_addDeepInfoAK4CHS_switch, nanoAOD_addParticleNet_switch =
True 225 addParticleNet=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addParticleNet_switch,
226 addRobustParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addRobustParTAK4Tag_switch,
227 addUnifiedParTAK4=nanoAOD_addDeepInfoAK4_switch.nanoAOD_addUnifiedParTAK4Tag_switch
232 addDeepBTag=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepBTag_switch,
233 addDeepFlavour=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepFlavourTag_switch,
234 addParticleNet=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addParticleNet_switch,
235 addRobustParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addRobustParTAK4Tag_switch,
236 addUnifiedParTAK4=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addUnifiedParTAK4Tag_switch
241 addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
242 addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
243 addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
244 addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
245 addParticleNetMassLegacy=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMassLegacy_switch,
246 addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
247 jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload
250 nanoAOD_tau_switch = cms.PSet(
251 idsToAdd = cms.vstring(),
252 addUParTInfo = cms.bool(
True),
253 addPNet = cms.bool(
True)
255 (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(
256 nanoAOD_tau_switch, idsToAdd = [
"deepTau2018v2p5"]
263 (run3_nanoAOD_122 | run3_nanoAOD_124 | run2_nanoAOD_106Xv2).toModify(
264 nanoAOD_tau_switch, addUParTInfo =
False 269 addUTagInfo = nanoAOD_tau_switch.addPNet.value(),
275 addUTagInfo = nanoAOD_tau_switch.addUParTInfo.value(),
279 nanoAOD_boostedTau_switch = cms.PSet(
280 idsToAdd = cms.vstring()
282 run2_nanoAOD_106Xv2.toModify(
283 nanoAOD_boostedTau_switch, idsToAdd = [
"mvaIso",
"mvaIsoNewDM",
"mvaIsoDR0p3",
"againstEle"]
289 from PhysicsTools.NanoAOD.leptonTimeLifeInfo_common_cff
import addTimeLifeInfoBase
296 pdgSelection=
"?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)" 298 ptPrecision=
"{}?{}:{}".
format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
299 process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
300 phiPrecision=
"{} ? {} : {}".
format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
301 process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
302 etaPrecision=
"{} ? {} : {}".
format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
303 process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
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 nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour, addParticleNet, addRobustParTAK4=False, addUnifiedParTAK4=False)