43 jetCollection =
'slimmedJets'
46 jetCollection =
'patJetsPAT'
48 process.ak4PFJetsPAT = ak4PFJets.clone(
49 src=cms.InputTag(
"packedPFCandidates")
53 process.patJetsPAT = _patJets.clone(
54 jetSource = cms.InputTag(
"ak4PFJetsPAT"),
55 addJetCorrFactors = cms.bool(
False),
56 jetCorrFactorsSource = cms.VInputTag(),
57 addBTagInfo = cms.bool(
False),
58 addDiscriminators = cms.bool(
False),
59 discriminatorSources = cms.VInputTag(),
60 addAssociatedTracks = cms.bool(
False),
61 addJetCharge = cms.bool(
False),
62 addGenPartonMatch = cms.bool(
False),
63 embedGenPartonMatch = cms.bool(
False),
64 addGenJetMatch = cms.bool(
False),
65 getJetMCFlavour = cms.bool(
False),
66 addJetFlavourInfo = cms.bool(
False),
68 process.miniAODTausTask.add(process.ak4PFJetsPAT)
69 process.miniAODTausTask.add(process.patJetsPAT)
79 process.recoTauAK4Jets08RegionPAT = cms.EDProducer(
"RecoTauPatJetRegionProducer",
80 deltaR = process.recoTauAK4PFJets08Region.deltaR,
81 maxJetAbsEta = process.recoTauAK4PFJets08Region.maxJetAbsEta,
82 minJetPt = process.recoTauAK4PFJets08Region.minJetPt,
83 pfCandAssocMapSrc = cms.InputTag(
""),
84 pfCandSrc = cms.InputTag(
"packedPFCandidates"),
85 src = cms.InputTag(jetCollection)
88 process.recoTauPileUpVertices.src = cms.InputTag(
"offlineSlimmedPrimaryVertices")
91 process.recoTauCommonTask = cms.Task(
92 process.recoTauAK4Jets08RegionPAT,
93 process.recoTauPileUpVertices
96 for moduleName
in process.TauReco.moduleNames():
101 process.ak4PFJetsLegacyHPSPiZeros.builders[0].qualityCuts.primaryVertexSrc = cms.InputTag(
"offlineSlimmedPrimaryVertices")
102 process.ak4PFJetsLegacyHPSPiZeros.jetSrc = cms.InputTag(jetCollection)
105 for builder
in process.ak4PFJetsRecoTauChargedHadrons.builders:
106 builder.qualityCuts.primaryVertexSrc = cms.InputTag(
"offlineSlimmedPrimaryVertices")
107 if builder.name.value() ==
'tracks':
108 builder.name =
'lostTracks'
109 builder.plugin =
'PFRecoTauChargedHadronFromLostTrackPlugin'
110 builder.srcTracks = cms.InputTag(
"lostTracks")
111 process.ak4PFJetsRecoTauChargedHadrons.jetSrc = cms.InputTag(jetCollection)
114 process.combinatoricRecoTaus.jetRegionSrc =
'recoTauAK4Jets08RegionPAT'
115 process.combinatoricRecoTaus.jetSrc = jetCollection
117 for builder
in process.combinatoricRecoTaus.builders:
118 for name,value
in builder.parameters_().
items():
119 if name ==
'qualityCuts':
120 builder.qualityCuts.primaryVertexSrc =
'offlineSlimmedPrimaryVertices'
121 elif name ==
'pfCandSrc':
122 builder.pfCandSrc =
'packedPFCandidates'
124 modifiersToRemove_ = cms.VPSet()
125 for mod
in process.combinatoricRecoTaus.modifiers:
126 if mod.name.value() ==
'elec_rej':
127 modifiersToRemove_.append(mod)
129 elif mod.name.value() ==
'TTIworkaround':
130 modifiersToRemove_.append(mod)
132 for name,value
in mod.parameters_().
items():
133 if name ==
'qualityCuts':
134 mod.qualityCuts.primaryVertexSrc =
'offlineSlimmedPrimaryVertices'
135 for mod
in modifiersToRemove_:
136 process.combinatoricRecoTaus.modifiers.remove(mod)
140 process.hpsPFTauPrimaryVertexProducer.__dict__[
'_TypedParameterizable__type'] =
'PFTauMiniAODPrimaryVertexProducer'
141 process.hpsPFTauPrimaryVertexProducer.PVTag =
'offlineSlimmedPrimaryVertices'
142 process.hpsPFTauPrimaryVertexProducer.packedCandidatesTag = cms.InputTag(
"packedPFCandidates")
143 process.hpsPFTauPrimaryVertexProducer.lostCandidatesTag = cms.InputTag(
"lostTracks")
146 process.hpsPFTauSecondaryVertexProducer = cms.EDProducer(
"PFTauSecondaryVertexProducer",
147 PFTauTag = cms.InputTag(
"hpsPFTauProducer")
151 for moduleName
in process.TauReco.moduleNames():
152 if 'ElectronRejection' in moduleName
or 'MuonRejection' in moduleName:
153 if 'ByDeadECALElectronRejection' in moduleName:
continue
154 process.miniAODTausTask.remove(getattr(process, moduleName))
157 from RecoTauTag.RecoTau.hpsPFTauDiscriminationByMuonRejectionSimple_cff
import hpsPFTauDiscriminationByMuonRejectionSimple
159 process.hpsPFTauDiscriminationByMuonRejectionSimple = hpsPFTauDiscriminationByMuonRejectionSimple
160 process.miniAODTausTask.add(process.hpsPFTauDiscriminationByMuonRejectionSimple)
165 process.tauGenJets.GenParticles = cms.InputTag(
"prunedGenParticles")
166 process.tauMatch.matched = cms.InputTag(
"prunedGenParticles")
169 for name, src
in process.patTaus.tauIDSources.parameters_().
items():
170 if name.find(
'againstElectron') > -1
or name.find(
'againstMuon') > -1:
171 if name.find(
'againstElectronDeadECAL') > -1:
continue
172 delattr(process.patTaus.tauIDSources,name)
174 setattr(process.patTaus.tauIDSources,
'againstMuonLooseSimple',
175 cms.PSet(inputTag = cms.InputTag(
'hpsPFTauDiscriminationByMuonRejectionSimple'),
176 provenanceConfigLabel = cms.string(
'IDWPdefinitions'),
177 idLabel = cms.string(
'ByLooseMuonRejectionSimple')
179 setattr(process.patTaus.tauIDSources,
'againstMuonTightSimple',
180 cms.PSet(inputTag = cms.InputTag(
'hpsPFTauDiscriminationByMuonRejectionSimple'),
181 provenanceConfigLabel = cms.string(
'IDWPdefinitions'),
182 idLabel = cms.string(
'ByTightMuonRejectionSimple')
186 _updatedTauName =
'selectedPatTausNewIDs'
187 _noUpdatedTauName =
'selectedPatTausNoNewIDs'
188 import RecoTauTag.RecoTau.tools.runTauIdMVA
as tauIdConfig
189 tauIdEmbedder = tauIdConfig.TauIDEmbedder(
190 process, debug =
False,
191 updatedTauName = _updatedTauName,
192 toKeep = [
'againstEle2018',
'deepTau2017v2p1']
194 tauIdEmbedder.runTauID()
195 setattr(process, _noUpdatedTauName, process.selectedPatTaus.clone())
196 process.miniAODTausTask.add(getattr(process,_noUpdatedTauName))
197 delattr(process,
'selectedPatTaus')
198 process.deepTau2017v2p1.taus = _noUpdatedTauName
199 process.patTauDiscriminationByElectronRejectionMVA62018Raw.PATTauProducer = _noUpdatedTauName
200 process.patTauDiscriminationByElectronRejectionMVA62018.PATTauProducer = _noUpdatedTauName
201 process.selectedPatTaus = getattr(process, _updatedTauName).
clone(
202 src = _noUpdatedTauName
204 process.newTauIDsTask = cms.Task(
205 process.rerunMvaIsolationTask,
206 process.selectedPatTaus
208 process.miniAODTausTask.add(process.newTauIDsTask)