1 import FWCore.ParameterSet.Config
as cms
12 patMuonsWithoutTrigger = PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi.patMuons.clone(
16 embedCombinedMuon =
True,
17 embedStandAloneMuon =
True,
18 embedPFCandidate =
False,
19 embedCaloMETMuonCorrs = cms.bool(
False),
20 embedTcMETMuonCorrs = cms.bool(
False),
21 embedPfEcalEnergy = cms.bool(
False),
24 embedPickyMuon =
False,
25 embedTpfmsMuon =
False,
26 userIsolation = cms.PSet(),
27 isoDeposits = cms.PSet(),
31 patMuonsWithoutTrigger.userData.userInts.src = []
32 patMuonsWithoutTrigger.userData.userFloats.src = []
33 patMuonsWithoutTrigger.userData.userCands.src = []
34 patMuonsWithoutTrigger.userData.userClasses.src = []
47 "Load variables inside PAT muon, from module <l1ModuleLabel> that you must run before it"
48 patMuonProducer.userData.userInts.src += [
49 cms.InputTag(l1ModuleLabel,
"quality"),
51 patMuonProducer.userData.userFloats.src += [
52 cms.InputTag(l1ModuleLabel,
"deltaR"),
54 patMuonProducer.userData.userCands.src += [
55 cms.InputTag(l1ModuleLabel)
71 patTriggerFull.onlyStandAlone =
True
72 patTrigger = cms.EDProducer(
"TriggerObjectFilterByCollection",
73 src = cms.InputTag(
"patTriggerFull"),
74 collections = cms.vstring(
"hltL1extraParticles",
"hltL2MuonCandidates",
"hltL3MuonCandidates",
"hltHighPtTkMuonCands",
"hltGlbTrkMuonCands",
"hltMuTrackJpsiCtfTrackCands",
"hltMuTrackJpsiEffCtfTrackCands",
"hltMuTkMuJpsiTrackerMuonCands",
"hltTracksIter"),
82 muonTriggerMatchHLT = cms.EDProducer(
"PATTriggerMatcherDRDPtLessByR",
83 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
84 matched = cms.InputTag(
"patTrigger" ),
85 matchedCuts = cms.string(
""),
92 maxDPtRel = cms.double( 0.5 ),
93 maxDeltaR = cms.double( 0.5 ),
94 resolveAmbiguities = cms.bool(
True ),
95 resolveByMatchQuality = cms.bool(
True )
99 from MuonAnalysis.MuonAssociators.muonHLTL1Match_cfi
import muonHLTL1Match
100 muonMatchL1 = muonHLTL1Match.clone(
101 src = muonTriggerMatchHLT.src,
102 matched = muonTriggerMatchHLT.matched,
106 muonMatchHLTL1 = muonMatchL1.clone(matchedCuts = cms.string(
'coll("hltL1extraParticles")'))
107 muonMatchHLTL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltL2MuonCandidates")'), maxDeltaR = 0.3, maxDPtRel = 10.0)
108 muonMatchHLTL3 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltL3MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
109 muonMatchHLTL3T = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltGlbTrkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
110 muonMatchHLTTkMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltHighPtTkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
111 muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
112 muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
113 muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
114 muonMatchHLTTrackIt = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltTracksIter")'), maxDeltaR = 0.1, maxDPtRel = 1.0)
116 patTriggerMatchers1Mu = cms.Sequence(
123 patTriggerMatchers1MuInputTags = [
126 cms.InputTag(
'muonMatchHLTL2'),
127 cms.InputTag(
'muonMatchHLTL3'),
128 cms.InputTag(
'muonMatchHLTL3T'),
129 cms.InputTag(
'muonMatchHLTTkMu'),
132 patTriggerMatchers2Mu = cms.Sequence(
133 muonMatchHLTCtfTrack +
134 muonMatchHLTCtfTrack2 +
135 muonMatchHLTTrackMu +
138 patTriggerMatchers2MuInputTags = [
139 cms.InputTag(
'muonMatchHLTCtfTrack'),
140 cms.InputTag(
'muonMatchHLTCtfTrack2'),
141 cms.InputTag(
'muonMatchHLTTrackMu'),
142 cms.InputTag(
'muonMatchHLTTrackIt'),
146 patMuonsWithTrigger = cms.EDProducer(
"PATTriggerMatchMuonEmbedder",
147 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
148 matches = cms.VInputTag()
150 patMuonsWithTrigger.matches += patTriggerMatchers1MuInputTags
151 patMuonsWithTrigger.matches += patTriggerMatchers2MuInputTags
155 patTriggerMatching = cms.Sequence(
156 patTriggerFull * patTrigger *
157 patTriggerMatchers1Mu *
158 patTriggerMatchers2Mu *
162 patMuonsWithTriggerSequence = cms.Sequence(
164 patMuonsWithoutTrigger *
171 "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon"
172 process.muonMatchHLTL1.resolveAmbiguities =
False
173 process.muonMatchHLTL2.resolveAmbiguities =
False
174 process.muonMatchHLTL3.resolveAmbiguities =
False
175 process.muonMatchHLTTkMu.resolveAmbiguities =
False
176 process.muonMatchHLTCtfTrack.resolveAmbiguities =
False
177 process.muonMatchHLTTrackMu.resolveAmbiguities =
False
178 process.muonMatchHLTTrackIt.resolveAmbiguities =
False
181 "Change the process name under which the trigger was run"
182 patTriggerFull.processName = triggerProcessName
185 "Use a different input collection of reco muons"
190 "Start from existing pat Muons instead of producing them"
191 process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
192 process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
193 process.patMuonsWithTrigger.src = newPatMuonTag
197 process.muonL1Info.src = newPatMuonTag.muonSource
198 addL1UserData(getattr(process,newPatMuonTag.moduleLabel),
'muonL1Info')
201 "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!"
202 process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
203 process.globalReplace(
'patMuonsWithoutTrigger', cms.EDFilter(
"PATMuonSelector", src = cms.InputTag(
'patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
204 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
207 "Add MC matching information to the muons"
208 process.load(
"PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
209 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
210 process.patMuonsWithoutTrigger.addGenMatch =
True
211 process.patMuonsWithoutTrigger.embedGenMatch =
True
212 process.patMuonsWithoutTrigger.genParticleMatch =
'muonMatch'
215 print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default"
218 process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
219 getattr(process,embedder).matches += [ cms.InputTag(
'muonMatchHLTL1'), cms.InputTag(
'muonMatchHLTL1',
'propagatedReco') ]
222 process.load(
"MuonAnalysis.MuonAssociators.muonL1MultiMatch_cfi")
223 process.globalReplace(
'muonL1Info', process.muonL1MultiMatch.clone(src = process.muonL1Info.src.value()))
224 pmp = getattr(process, patMuonProd)
226 pmp.userData.userInts.src += [ cms.InputTag(
'muonL1Info',
"quality"+X) ]
227 pmp.userData.userFloats.src += [ cms.InputTag(
'muonL1Info',
"deltaR"+X) ]
228 pmp.userData.userCands.src += [ cms.InputTag(
'muonL1Info', X) ]
231 "Change the L1 trigger matching window to be suitable also for CSC single triggers"
232 if hasattr(process,
'muonL1Info'):
233 process.muonL1Info.maxDeltaR = 0.3
234 process.muonL1Info.maxDeltaEta = 0.2
235 process.muonL1Info.fallbackToME1 =
True
236 if hasattr(process,
'muonMatchHLTL1'):
237 process.muonMatchHLTL1.maxDeltaR = 0.3
238 process.muonMatchHLTL1.maxDeltaEta = 0.2
239 process.muonMatchHLTL1.fallbackToME1 =
True
def massSearchReplaceAnyInputTag
def switchOffAmbiguityResolution
def useL1MatchingWindowForSinglets
def changeTriggerProcessName
def addL1UserData
Define a generic function, so that it can be used with existing PAT Muons.