1 import FWCore.ParameterSet.Config
as cms
4 from PhysicsTools.PatAlgos.slimming.extraJets_MuEGFixMoriond2017
import backupJetsFirstStep, backupJetsSecondStep
13 process.load(
"RecoMET.METFilters.badGlobalMuonTaggersAOD_cff")
14 task.add(process.badGlobalMuonTagger)
15 task.add(process.cloneGlobalMuonTagger)
16 process.Flag_noBadMuons = cms.Path(process.noBadGlobalMuons)
17 process.Flag_badMuons = cms.Path(process.badGlobalMuonTagger)
18 process.Flag_duplicateMuons = cms.Path(process.cloneGlobalMuonTagger)
19 for P
in process.Flag_noBadMuons, process.Flag_badMuons, process.Flag_duplicateMuons:
20 process.schedule.insert(0, P)
26 process.load(
"CommonTools.ParticleFlow.muonsCleaned_cfi")
27 task.add(process.muonsCleaned)
28 process.patMuons.userData.userInts.src = [ cms.InputTag(
"muonsCleaned:oldPF") ]
30 process.load(
"CommonTools.ParticleFlow.pfCandidatesBadMuonsCleaned_cfi")
31 task.add(process.pfCandidatesBadMuonsCleaned)
32 process.muonsCleaned.badmuons = badMuons
33 replaceMuons = MassSearchReplaceAnyInputTagVisitor(
"muons",
"muonsCleaned", verbose=verbose)
34 needOriginalMuons = [ process.muonsCleaned ] + [ getattr(process,l.moduleLabel)
for l
in badMuons ]
35 replacePFCandidates = MassSearchReplaceAnyInputTagVisitor(
"particleFlow",
"pfCandidatesBadMuonsCleaned", verbose=verbose)
36 for everywhere
in [ process.producers, process.filters, process.analyzers, process.psets, process.vpsets ]:
37 for name,obj
in everywhere.items():
38 if obj
not in needOriginalMuons:
39 replaceMuons.doIt(obj, name)
40 if obj != process.pfCandidatesBadMuonsCleaned:
41 replacePFCandidates.doIt(obj, name)
43 process.load(
"CommonTools.ParticleFlow.pfEGammaToCandidateRemapper_cfi")
44 task.add(process.pfEGammaToCandidateRemapper)
45 process.pfEGammaToCandidateRemapper.pf2pf = cms.InputTag(
"pfCandidatesBadMuonsCleaned")
46 process.reducedEgamma.gsfElectronsPFValMap = cms.InputTag(
"pfEGammaToCandidateRemapper",
"electrons")
47 process.reducedEgamma.photonsPFValMap = cms.InputTag(
"pfEGammaToCandidateRemapper",
"photons")
48 if hasattr(process,
"gedGsfElectronsFixed"):
51 process.pfEGammaToCandidateRemapperBeforeGSFix = process.pfEGammaToCandidateRemapper.clone()
52 task.add(process.pfEGammaToCandidateRemapperBeforeGSFix)
53 process.reducedEgammaBeforeGSFix.gsfElectronsPFValMap = cms.InputTag(
"pfEGammaToCandidateRemapperBeforeGSFix",
"electrons")
54 process.reducedEgammaBeforeGSFix.photonsPFValMap = cms.InputTag(
"pfEGammaToCandidateRemapperBeforeGSFix",
"photons")
56 process.pfEGammaToCandidateRemapper.electrons = cms.InputTag(
"gedGsfElectronsFixed")
57 process.pfEGammaToCandidateRemapper.photons = cms.InputTag(
"gedPhotonsFixed")
58 process.pfEGammaToCandidateRemapper.electron2pf = cms.InputTag(
"particleBasedIsolationGSFixed",
"gedGsfElectrons")
59 process.pfEGammaToCandidateRemapper.photon2pf = cms.InputTag(
"particleBasedIsolationGSFixed",
"gedPhotons")
61 sys.stderr.write(
"WARNING : attempt to use gain switch corrected electron/photon collection gedGsfElectronsFixed, but the current process does not contain such collection")
67 process.primaryVertexAssociationDiscardedCandidates = process.primaryVertexAssociation.clone(
68 particles = inputCollection,
70 task.add(process.primaryVertexAssociationDiscardedCandidates)
71 process.packedPFCandidatesDiscarded = process.packedPFCandidates.clone(
72 inputCollection = inputCollection,
73 PuppiNoLepSrc = cms.InputTag(
""),
74 PuppiSrc = cms.InputTag(
""),
75 secondaryVerticesForWhiteList = cms.VInputTag(),
76 vertexAssociator = cms.InputTag(
"primaryVertexAssociationDiscardedCandidates",
"original")
78 task.add(process.packedPFCandidatesDiscarded)
80 [
"keep patPackedCandidates_packedPFCandidatesDiscarded_*_*"],
83 from PhysicsTools.PatAlgos.slimming.packedPFCandidateRefMixer_cfi
import packedPFCandidateRefMixer
84 process.oldPFCandToPackedOrDiscarded = packedPFCandidateRefMixer.clone(
85 pf2pf = cms.InputTag(inputCollection.moduleLabel),
86 pf2packed = cms.VInputTag(cms.InputTag(
"packedPFCandidates"), cms.InputTag(
"packedPFCandidatesDiscarded"))
88 task.add(process.oldPFCandToPackedOrDiscarded)
90 process.slimmedMuons.pfCandidates = cms.VInputTag(cms.InputTag(inputCollection.moduleLabel), inputCollection)
91 process.slimmedMuons.packedPFCandidates = cms.VInputTag(cms.InputTag(
"packedPFCandidates"), cms.InputTag(
"packedPFCandidatesDiscarded"))
95 process.slimmedTaus.packedPFCandidates=cms.InputTag(
"packedPFCandidatesBackup")
102 process.ak4PFJetsCHS = RecoJets.Configuration.RecoPFJets_cff.ak4PFJetsCHS.clone()
103 task.add(process.ak4PFJetsCHS)
104 process.ak8PFJetsCHS = RecoJets.Configuration.RecoPFJets_cff.ak8PFJetsCHS.clone()
105 task.add(process.ak8PFJetsCHS)
106 process.load(
"RecoMET.METProducers.pfMet_cfi")
107 task.add(process.pfMet)
108 process.load(
"RecoBTag.ImpactParameter.impactParameter_cff")
109 task.add(process.impactParameterTask)
110 process.load(
"RecoBTag.SecondaryVertex.secondaryVertex_cff")
111 task.add(process.secondaryVertexTask)
112 process.load(
"RecoBTag.SoftLepton.softLepton_cff")
113 task.add(process.softLeptonTask)
114 process.load(
"RecoBTag.Combined.combinedMVA_cff")
115 task.add(process.combinedMVATask)
116 process.load(
"RecoBTag.CTagging.cTagging_cff")
117 task.add(process.cTaggingTask)
118 process.load(
"RecoVertex.AdaptiveVertexFinder.inclusiveVertexing_cff")
119 task.add(process.inclusiveVertexingTask)
120 task.add(process.inclusiveCandidateVertexingTask)
121 task.add(process.inclusiveCandidateVertexingCvsLTask)
132 badMuons = cms.VInputTag( cms.InputTag(
"badGlobalMuonTagger",
"bad"), cms.InputTag(
"cloneGlobalMuonTagger",
"bad") )
142 process.patMuons.embedCaloMETMuonCorrs =
False
144 from PhysicsTools.PatAlgos.slimming.extraSlimmedMETs_MuEGFixMoriond2017
import addExtraMETCollections,addExtraPuppiMETCorrections
149 unCleanPFCandidateCollection=
"particleFlow",
150 cleanElectronCollection=
"slimmedElectrons",
151 cleanPhotonCollection=
"slimmedPhotons",
152 unCleanElectronCollection=
"slimmedElectrons",
153 unCleanPhotonCollection=
"slimmedPhotons")
156 cleanPFCandidateCollection=
"particleFlow",
157 unCleanPFCandidateCollection=
"pfCandidatesBadMuonsCleaned",
158 cleanElectronCollection=
"slimmedElectrons",
159 cleanPhotonCollection=
"slimmedPhotons",
160 unCleanElectronCollection=
"slimmedElectrons",
161 unCleanPhotonCollection=
"slimmedPhotons")
164 "keep *_slimmedMETs_*_*",
165 [
"keep *_slimmedMETsUncorrected_*_*",
166 "keep *_slimmedMETsEGClean_*_*",
167 "keep *_slimmedMETsMuEGClean_*_*"],
170 "keep *_slimmedMETsPuppi_*_*",
171 [
"keep *_puppiMETEGCor_*_*",
172 "keep *_puppiMETMuCor_*_*"],
178 from PhysicsTools.PatAlgos.slimming.miniAOD_tools
import miniAOD_customizeData
def addDiscardedPFCandidates