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",
"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 muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
111 muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
112 muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
113 muonMatchHLTTrackIt = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltTracksIter")'), maxDeltaR = 0.1, maxDPtRel = 1.0)
115 patTriggerMatchers1Mu = cms.Sequence(
121 patTriggerMatchers1MuInputTags = [
124 cms.InputTag(
'muonMatchHLTL2'),
125 cms.InputTag(
'muonMatchHLTL3'),
126 cms.InputTag(
'muonMatchHLTL3T'),
129 patTriggerMatchers2Mu = cms.Sequence(
130 muonMatchHLTCtfTrack +
131 muonMatchHLTCtfTrack2 +
132 muonMatchHLTTrackMu +
135 patTriggerMatchers2MuInputTags = [
136 cms.InputTag(
'muonMatchHLTCtfTrack'),
137 cms.InputTag(
'muonMatchHLTCtfTrack2'),
138 cms.InputTag(
'muonMatchHLTTrackMu'),
139 cms.InputTag(
'muonMatchHLTTrackIt'),
143 patMuonsWithTrigger = cms.EDProducer(
"PATTriggerMatchMuonEmbedder",
144 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
145 matches = cms.VInputTag()
147 patMuonsWithTrigger.matches += patTriggerMatchers1MuInputTags
148 patMuonsWithTrigger.matches += patTriggerMatchers2MuInputTags
152 patTriggerMatching = cms.Sequence(
153 patTriggerFull * patTrigger *
154 patTriggerMatchers1Mu *
155 patTriggerMatchers2Mu *
159 patMuonsWithTriggerSequence = cms.Sequence(
161 patMuonsWithoutTrigger *
168 "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon"
169 process.muonMatchHLTL1.resolveAmbiguities =
False
170 process.muonMatchHLTL2.resolveAmbiguities =
False
171 process.muonMatchHLTL3.resolveAmbiguities =
False
172 process.muonMatchHLTCtfTrack.resolveAmbiguities =
False
173 process.muonMatchHLTTrackMu.resolveAmbiguities =
False
174 process.muonMatchHLTTrackIt.resolveAmbiguities =
False
177 "Change the process name under which the trigger was run"
178 patTriggerFull.processName = triggerProcessName
181 "Use a different input collection of reco muons"
186 "Start from existing pat Muons instead of producing them"
187 process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
188 process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
189 process.patMuonsWithTrigger.src = newPatMuonTag
193 process.muonL1Info.src = newPatMuonTag.muonSource
194 addL1UserData(getattr(process,newPatMuonTag.moduleLabel),
'muonL1Info')
197 "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!"
198 process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
199 process.globalReplace(
'patMuonsWithoutTrigger', cms.EDFilter(
"PATMuonSelector", src = cms.InputTag(
'patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
200 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
203 "Add MC matching information to the muons"
204 process.load(
"PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
205 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
206 process.patMuonsWithoutTrigger.addGenMatch =
True
207 process.patMuonsWithoutTrigger.embedGenMatch =
True
208 process.patMuonsWithoutTrigger.genParticleMatch =
'muonMatch'
211 print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default"
214 process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
215 getattr(process,embedder).matches += [ cms.InputTag(
'muonMatchHLTL1'), cms.InputTag(
'muonMatchHLTL1',
'propagatedReco') ]
218 process.load(
"MuonAnalysis.MuonAssociators.muonL1MultiMatch_cfi")
219 process.globalReplace(
'muonL1Info', process.muonL1MultiMatch.clone(src = process.muonL1Info.src.value()))
220 pmp = getattr(process, patMuonProd)
222 pmp.userData.userInts.src += [ cms.InputTag(
'muonL1Info',
"quality"+X) ]
223 pmp.userData.userFloats.src += [ cms.InputTag(
'muonL1Info',
"deltaR"+X) ]
224 pmp.userData.userCands.src += [ cms.InputTag(
'muonL1Info', X) ]
227 "Change the L1 trigger matching window to be suitable also for CSC single triggers"
228 if hasattr(process,
'muonL1Info'):
229 process.muonL1Info.maxDeltaR = 0.3
230 process.muonL1Info.maxDeltaEta = 0.2
231 process.muonL1Info.fallbackToME1 =
True
232 if hasattr(process,
'muonMatchHLTL1'):
233 process.muonMatchHLTL1.maxDeltaR = 0.3
234 process.muonMatchHLTL1.maxDeltaEta = 0.2
235 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.