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 lhcInfoTable = cms.EDProducer(
"LHCInfoProducer")
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
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 , process.patTauMVAIDsTask )
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))
141 for modname
in electron_id_modules_WorkingPoints_nanoAOD.modules:
144 process.electronTask.add( process.egmGsfElectronIDTask )
147 for modname
in photon_id_modules_WorkingPoints_nanoAOD.modules:
150 process.photonTask.add( process.egmPhotonIDTask )
160 addDeepBTag=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepBTag_switch,
161 addDeepFlavour=nanoAOD_addDeepInfoAK4CHS_switch.nanoAOD_addDeepFlavourTag_switch
166 addDeepBTag=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBTag_switch,
167 addDeepBoostedJet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepBoostedJet_switch,
168 addDeepDoubleX=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleX_switch,
169 addDeepDoubleXV2=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addDeepDoubleXV2_switch,
170 addParticleNet=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNet_switch,
171 addParticleNetMass=nanoAOD_addDeepInfoAK8_switch.nanoAOD_addParticleNetMass_switch,
172 jecPayload=nanoAOD_addDeepInfoAK8_switch.jecPayload
175 nanoAOD_tau_switch = cms.PSet(
176 idsToAdd = cms.vstring()
178 (run2_nanoAOD_106Xv2 | run3_nanoAOD_122).toModify(
179 nanoAOD_tau_switch, idsToAdd = [
"deepTau2018v2p5"]
183 nanoAOD_boostedTau_switch = cms.PSet(
184 idsToAdd = cms.vstring()
186 run2_nanoAOD_106Xv2.toModify(
187 nanoAOD_boostedTau_switch, idsToAdd = [
"2017v2",
"dR0p32017v2",
"newDM2017v2",
"againstEle2018"]
196 pdgSelection=
"?(abs(pdgId) == 11|| abs(pdgId)==13 || abs(pdgId)==15 ||abs(pdgId)== 12 || abs(pdgId)== 14 || abs(pdgId)== 16|| abs(pdgId)== 24|| pdgId== 23)" 198 ptPrecision=
"{}?{}:{}".
format(pdgSelection, CandVars.pt.precision.value(),genParticleTable.variables.pt.precision.value())
199 process.genParticleTable.variables.pt.precision=cms.string(ptPrecision)
200 phiPrecision=
"{} ? {} : {}".
format(pdgSelection, CandVars.phi.precision.value(), genParticleTable.variables.phi.precision.value())
201 process.genParticleTable.variables.phi.precision=cms.string(phiPrecision)
202 etaPrecision=
"{} ? {} : {}".
format(pdgSelection, CandVars.eta.precision.value(), genParticleTable.variables.eta.precision.value())
203 process.genParticleTable.variables.eta.precision=cms.string(etaPrecision)
def nanoAOD_addDeepInfoAK8(process, addDeepBTag, addDeepBoostedJet, addDeepDoubleX, addDeepDoubleXV2, addParticleNet, addParticleNetMass, jecPayload)
def nanoAOD_activateVID(process)
def nanoWmassGenCustomize(process)
increasing the precision of selected GenParticles.
def nanoAOD_customizeCommon(process)
def nanoAOD_addTauIds(process, idsToRun=[])
def nanoAOD_addBoostedTauIds(process, idsToRun=[])
def nanoAOD_addDeepInfoAK4CHS(process, addDeepBTag, addDeepFlavour)