1 import FWCore.ParameterSet.Config
as cms
14 process.load(
'PhysicsTools.PatAlgos.producersLayer1.tauProducer_cff')
15 process.load(
'PhysicsTools.PatAlgos.selectionLayer1.tauSelector_cfi')
16 process.selectedPatTaus.cut=
"pt > 18. && tauID(\'decayModeFindingNewDMs\')> 0.5"
18 process.load(
"RecoTauTag.Configuration.RecoPFTauTag_cff")
20 process.miniAODTausTask = cms.Task(
22 process.makePatTausTask,
23 process.selectedPatTaus
25 process.miniAODTausSequence = cms.Sequence(process.miniAODTausTask)
27 process.TauReco = cms.Path(process.miniAODTausSequence)
31 module = getattr(process, name)
32 if hasattr(module,
'particleFlowSrc'):
33 module.particleFlowSrc = cms.InputTag(
"packedPFCandidates",
"",
"")
34 if hasattr(module,
'vertexSrc'):
35 module.vertexSrc = cms.InputTag(
'offlineSlimmedPrimaryVertices')
36 if hasattr(module,
'qualityCuts')
and hasattr(module.qualityCuts,
'primaryVertexSrc'):
37 module.qualityCuts.primaryVertexSrc = cms.InputTag(
'offlineSlimmedPrimaryVertices')
44 jetCollection =
'slimmedJets'
47 jetCollection =
'patJetsPAT'
49 process.ak4PFJetsPAT = ak4PFJets.clone(
50 src=cms.InputTag(
"packedPFCandidates")
54 process.patJetsPAT = _patJets.clone(
55 jetSource = cms.InputTag(
"ak4PFJetsPAT"),
56 addJetCorrFactors = cms.bool(
False),
57 jetCorrFactorsSource = cms.VInputTag(),
58 addBTagInfo = cms.bool(
False),
59 addDiscriminators = cms.bool(
False),
60 discriminatorSources = cms.VInputTag(),
61 addAssociatedTracks = cms.bool(
False),
62 addJetCharge = cms.bool(
False),
63 addGenPartonMatch = cms.bool(
False),
64 embedGenPartonMatch = cms.bool(
False),
65 addGenJetMatch = cms.bool(
False),
66 getJetMCFlavour = cms.bool(
False),
67 addJetFlavourInfo = cms.bool(
False),
69 process.miniAODTausTask.add(process.ak4PFJetsPAT)
70 process.miniAODTausTask.add(process.patJetsPAT)
80 process.recoTauAK4Jets08RegionPAT = cms.EDProducer(
"RecoTauPatJetRegionProducer",
81 deltaR = process.recoTauAK4PFJets08Region.deltaR,
82 maxJetAbsEta = process.recoTauAK4PFJets08Region.maxJetAbsEta,
83 minJetPt = process.recoTauAK4PFJets08Region.minJetPt,
84 pfCandAssocMapSrc = cms.InputTag(
""),
85 pfCandSrc = cms.InputTag(
"packedPFCandidates"),
86 src = cms.InputTag(jetCollection)
89 process.recoTauPileUpVertices.src = cms.InputTag(
"offlineSlimmedPrimaryVertices")
92 process.recoTauCommonTask = cms.Task(
93 process.recoTauAK4Jets08RegionPAT,
94 process.recoTauPileUpVertices
97 for moduleName
in process.TauReco.moduleNames():
102 process.ak4PFJetsLegacyHPSPiZeros.builders[0].qualityCuts.primaryVertexSrc = cms.InputTag(
"offlineSlimmedPrimaryVertices")
103 process.ak4PFJetsLegacyHPSPiZeros.jetSrc = cms.InputTag(jetCollection)
106 for builder
in process.ak4PFJetsRecoTauChargedHadrons.builders:
107 builder.qualityCuts.primaryVertexSrc = cms.InputTag(
"offlineSlimmedPrimaryVertices")
108 if builder.name.value() ==
'tracks':
109 builder.name =
'lostTracks'
110 builder.plugin =
'PFRecoTauChargedHadronFromLostTrackPlugin'
111 builder.srcTracks = cms.InputTag(
"lostTracks")
112 process.ak4PFJetsRecoTauChargedHadrons.jetSrc = cms.InputTag(jetCollection)
115 process.combinatoricRecoTaus.jetRegionSrc =
'recoTauAK4Jets08RegionPAT'
116 process.combinatoricRecoTaus.jetSrc = jetCollection
118 for builder
in process.combinatoricRecoTaus.builders:
119 for name,value
in six.iteritems(builder.parameters_()):
120 if name ==
'qualityCuts':
121 builder.qualityCuts.primaryVertexSrc =
'offlineSlimmedPrimaryVertices'
122 elif name ==
'pfCandSrc':
123 builder.pfCandSrc =
'packedPFCandidates'
125 modifiersToRemove_ = cms.VPSet()
126 for mod
in process.combinatoricRecoTaus.modifiers:
127 if mod.name.value() ==
'elec_rej':
128 modifiersToRemove_.append(mod)
130 elif mod.name.value() ==
'TTIworkaround':
131 modifiersToRemove_.append(mod)
133 for name,value
in six.iteritems(mod.parameters_()):
134 if name ==
'qualityCuts':
135 mod.qualityCuts.primaryVertexSrc =
'offlineSlimmedPrimaryVertices'
136 for mod
in modifiersToRemove_:
137 process.combinatoricRecoTaus.modifiers.remove(mod)
141 process.hpsPFTauPrimaryVertexProducer.__dict__[
'_TypedParameterizable__type'] =
'PFTauMiniAODPrimaryVertexProducer'
142 process.hpsPFTauPrimaryVertexProducer.PVTag =
'offlineSlimmedPrimaryVertices'
143 process.hpsPFTauPrimaryVertexProducer.packedCandidatesTag = cms.InputTag(
"packedPFCandidates")
144 process.hpsPFTauPrimaryVertexProducer.lostCandidatesTag = cms.InputTag(
"lostTracks")
147 process.hpsPFTauSecondaryVertexProducer = cms.EDProducer(
"PFTauSecondaryVertexProducer",
148 PFTauTag = cms.InputTag(
"hpsPFTauProducer")
152 for moduleName
in process.TauReco.moduleNames():
153 if 'ElectronRejection' in moduleName
or 'MuonRejection' in moduleName:
154 process.miniAODTausTask.remove(getattr(process, moduleName))
157 from RecoTauTag.RecoTau.hpsPFTauDiscriminationByAMuonRejectionSimple_cff
import hpsPFTauDiscriminationByLooseMuonRejectionSimple, hpsPFTauDiscriminationByTightMuonRejectionSimple
159 process.hpsPFTauDiscriminationByLooseMuonRejectionSimple = hpsPFTauDiscriminationByLooseMuonRejectionSimple
160 process.hpsPFTauDiscriminationByTightMuonRejectionSimple = hpsPFTauDiscriminationByTightMuonRejectionSimple
161 process.miniAODTausTask.add(process.hpsPFTauDiscriminationByLooseMuonRejectionSimple)
162 process.miniAODTausTask.add(process.hpsPFTauDiscriminationByTightMuonRejectionSimple)
167 process.tauGenJets.GenParticles = cms.InputTag(
"prunedGenParticles")
168 process.tauMatch.matched = cms.InputTag(
"prunedGenParticles")
171 for name, src
in six.iteritems(process.patTaus.tauIDSources.parameters_()):
172 if name.find(
'againstElectron') > -1
or name.find(
'againstMuon') > -1:
173 delattr(process.patTaus.tauIDSources,name)
175 setattr(process.patTaus.tauIDSources,
'againstMuonLooseSimple',cms.InputTag(
'hpsPFTauDiscriminationByLooseMuonRejectionSimple'))
176 setattr(process.patTaus.tauIDSources,
'againstMuonTightSimple',cms.InputTag(
'hpsPFTauDiscriminationByTightMuonRejectionSimple'))
186 output = cms.OutputModule(
188 fileName=cms.untracked.string(
'miniAOD_TauReco.root'),
189 fastCloning=cms.untracked.bool(
False),
190 dataset=cms.untracked.PSet(
191 dataTier=cms.untracked.string(
'MINIAODSIM'),
192 filterName=cms.untracked.string(
'')
194 outputCommands = evtContent.MINIAODSIMEventContent.outputCommands,
195 SelectEvents=cms.untracked.PSet(
196 SelectEvents=cms.vstring(
'*',)
199 output.outputCommands.append(
'keep *_selectedPatTaus_*_*')
201 for prod
in evtContent.RecoTauTagAOD.outputCommands:
202 if prod.find(
'ElectronRejection') > -1:
204 if prod.find(
'MuonRejection') > -1:
206 output.outputCommands.append(prod)
207 output.outputCommands.append(
'keep *_hpsPFTauDiscriminationByLooseMuonRejectionSimple_*_*')
208 output.outputCommands.append(
'keep *_hpsPFTauDiscriminationByTightMuonRejectionSimple_*_*')
209 output.outputCommands.append(
'keep *_combinatoricReco*_*_*')
210 output.outputCommands.append(
'keep *_ak4PFJetsRecoTauChargedHadrons_*_*')
211 output.outputCommands.append(
'keep *_ak4PFJetsLegacyHPSPiZeros_*_*')
212 output.outputCommands.append(
'keep *_patJetsPAT_*_*')