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"),
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)
114 patTriggerMatchers1Mu = cms.Sequence(
120 patTriggerMatchers1MuInputTags = [
123 cms.InputTag(
'muonMatchHLTL2'),
124 cms.InputTag(
'muonMatchHLTL3'),
125 cms.InputTag(
'muonMatchHLTL3T'),
128 patTriggerMatchers2Mu = cms.Sequence(
129 muonMatchHLTCtfTrack +
130 muonMatchHLTCtfTrack2 +
133 patTriggerMatchers2MuInputTags = [
134 cms.InputTag(
'muonMatchHLTCtfTrack'),
135 cms.InputTag(
'muonMatchHLTCtfTrack2'),
136 cms.InputTag(
'muonMatchHLTTrackMu'),
140 patMuonsWithTrigger = cms.EDProducer(
"PATTriggerMatchMuonEmbedder",
141 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
142 matches = cms.VInputTag()
144 patMuonsWithTrigger.matches += patTriggerMatchers1MuInputTags
145 patMuonsWithTrigger.matches += patTriggerMatchers2MuInputTags
149 patTriggerMatching = cms.Sequence(
150 patTriggerFull * patTrigger *
151 patTriggerMatchers1Mu *
152 patTriggerMatchers2Mu *
156 patMuonsWithTriggerSequence = cms.Sequence(
158 patMuonsWithoutTrigger *
165 "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon"
166 process.muonMatchHLTL1.resolveAmbiguities =
False
167 process.muonMatchHLTL2.resolveAmbiguities =
False
168 process.muonMatchHLTL3.resolveAmbiguities =
False
169 process.muonMatchHLTCtfTrack.resolveAmbiguities =
False
170 process.muonMatchHLTTrackMu.resolveAmbiguities =
False
173 "Change the process name under which the trigger was run"
174 patTriggerFull.processName = triggerProcessName
177 "Use a different input collection of reco muons"
182 "Start from existing pat Muons instead of producing them"
183 process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
184 process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
185 process.patMuonsWithTrigger.src = newPatMuonTag
189 process.muonL1Info.src = newPatMuonTag.muonSource
190 addL1UserData(getattr(process,newPatMuonTag.moduleLabel),
'muonL1Info')
193 "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!"
194 process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
195 process.globalReplace(
'patMuonsWithoutTrigger', cms.EDFilter(
"PATMuonSelector", src = cms.InputTag(
'patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
196 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
199 "Add MC matching information to the muons"
200 process.load(
"PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
201 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
202 process.patMuonsWithoutTrigger.addGenMatch =
True
203 process.patMuonsWithoutTrigger.embedGenMatch =
True
204 process.patMuonsWithoutTrigger.genParticleMatch =
'muonMatch'
207 print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default"
210 process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
211 getattr(process,embedder).matches += [ cms.InputTag(
'muonMatchHLTL1'), cms.InputTag(
'muonMatchHLTL1',
'propagatedReco') ]
214 process.load(
"MuonAnalysis.MuonAssociators.muonL1MultiMatch_cfi")
215 process.globalReplace(
'muonL1Info', process.muonL1MultiMatch.clone(src = process.muonL1Info.src.value()))
216 pmp = getattr(process, patMuonProd)
218 pmp.userData.userInts.src += [ cms.InputTag(
'muonL1Info',
"quality"+X) ]
219 pmp.userData.userFloats.src += [ cms.InputTag(
'muonL1Info',
"deltaR"+X) ]
220 pmp.userData.userCands.src += [ cms.InputTag(
'muonL1Info', X) ]
223 "Change the L1 trigger matching window to be suitable also for CSC single triggers"
224 if hasattr(process,
'muonL1Info'):
225 process.muonL1Info.maxDeltaR = 0.3
226 process.muonL1Info.maxDeltaEta = 0.2
227 process.muonL1Info.fallbackToME1 =
True
228 if hasattr(process,
'muonMatchHLTL1'):
229 process.muonMatchHLTL1.maxDeltaR = 0.3
230 process.muonMatchHLTL1.maxDeltaEta = 0.2
231 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.