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),
23 embedPickyMuon =
False,
24 embedTpfmsMuon =
False,
25 userIsolation = cms.PSet(),
26 isoDeposits = cms.PSet(),
30 patMuonsWithoutTrigger.userData.userInts.src = []
31 patMuonsWithoutTrigger.userData.userFloats.src = []
32 patMuonsWithoutTrigger.userData.userCands.src = []
33 patMuonsWithoutTrigger.userData.userClasses.src = []
46 "Load variables inside PAT muon, from module <l1ModuleLabel> that you must run before it"
47 patMuonProducer.userData.userInts.src += [
48 cms.InputTag(l1ModuleLabel,
"quality"),
50 patMuonProducer.userData.userFloats.src += [
51 cms.InputTag(l1ModuleLabel,
"deltaR"),
53 patMuonProducer.userData.userCands.src += [
54 cms.InputTag(l1ModuleLabel)
70 patTriggerFull.onlyStandAlone =
True
71 patTrigger = cms.EDFilter(
"PATTriggerObjectStandAloneSelector",
72 src = cms.InputTag(
"patTriggerFull"),
73 cut = cms.string(
'coll("hltL1extraParticles") || coll("hltL2MuonCandidates") || coll("hltL3MuonCandidates") || coll("hltGlbTrkMuonCands") || coll("hltMuTrackJpsiCtfTrackCands") || coll("hltMuTrackJpsiEffCtfTrackCands") || coll("hltMuTkMuJpsiTrackerMuonCands")'),
77 muonTriggerMatchHLT = cms.EDProducer(
"PATTriggerMatcherDRDPtLessByR",
78 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
79 matched = cms.InputTag(
"patTrigger" ),
80 matchedCuts = cms.string(
""),
87 maxDPtRel = cms.double( 0.5 ),
88 maxDeltaR = cms.double( 0.5 ),
89 resolveAmbiguities = cms.bool(
True ),
90 resolveByMatchQuality = cms.bool(
True )
94 from MuonAnalysis.MuonAssociators.muonHLTL1Match_cfi
import muonHLTL1Match
95 muonMatchL1 = muonHLTL1Match.clone(
96 src = muonTriggerMatchHLT.src,
97 matched = muonTriggerMatchHLT.matched,
101 muonMatchHLTL1 = muonMatchL1.clone(matchedCuts = cms.string(
'coll("hltL1extraParticles")'))
102 muonMatchHLTL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltL2MuonCandidates")'), maxDeltaR = 0.3, maxDPtRel = 10.0)
103 muonMatchHLTL3 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltL3MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
104 muonMatchHLTL3T = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltGlbTrkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
105 muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
106 muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
107 muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
109 patTriggerMatchers1Mu = cms.Sequence(
115 patTriggerMatchers1MuInputTags = [
116 cms.InputTag(
'muonMatchHLTL1',
'propagatedReco'),
117 cms.InputTag(
'muonMatchHLTL1'),
118 cms.InputTag(
'muonMatchHLTL2'),
119 cms.InputTag(
'muonMatchHLTL3'),
120 cms.InputTag(
'muonMatchHLTL3T'),
123 patTriggerMatchers2Mu = cms.Sequence(
124 muonMatchHLTCtfTrack +
125 muonMatchHLTCtfTrack2 +
128 patTriggerMatchers2MuInputTags = [
129 cms.InputTag(
'muonMatchHLTCtfTrack'),
130 cms.InputTag(
'muonMatchHLTCtfTrack2'),
131 cms.InputTag(
'muonMatchHLTTrackMu'),
135 patMuonsWithTrigger = cms.EDProducer(
"PATTriggerMatchMuonEmbedder",
136 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
137 matches = cms.VInputTag()
139 patMuonsWithTrigger.matches += patTriggerMatchers1MuInputTags
140 patMuonsWithTrigger.matches += patTriggerMatchers2MuInputTags
144 patTriggerMatching = cms.Sequence(
145 patTriggerFull * patTrigger *
146 patTriggerMatchers1Mu *
147 patTriggerMatchers2Mu *
151 patMuonsWithTriggerSequence = cms.Sequence(
153 patMuonsWithoutTrigger *
160 "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon"
161 process.muonMatchHLTL1.resolveAmbiguities =
False
162 process.muonMatchHLTL2.resolveAmbiguities =
False
163 process.muonMatchHLTL3.resolveAmbiguities =
False
164 process.muonMatchHLTCtfTrack.resolveAmbiguities =
False
165 process.muonMatchHLTTrackMu.resolveAmbiguities =
False
168 "Change the process name under which the trigger was run"
169 patTriggerFull.processName = triggerProcessName
172 "Use a different input collection of reco muons"
177 "Start from existing pat Muons instead of producing them"
178 process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
179 process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
180 process.patMuonsWithTrigger.src = newPatMuonTag
184 process.muonL1Info.src = newPatMuonTag.muonSource
185 addL1UserData(getattr(process,newPatMuonTag.moduleLabel),
'muonL1Info')
188 "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!"
189 process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
190 process.globalReplace(
'patMuonsWithoutTrigger', cms.EDFilter(
"PATMuonSelector", src = cms.InputTag(
'patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
191 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
194 "Add MC matching information to the muons"
195 process.load(
"PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
196 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
197 process.patMuonsWithoutTrigger.addGenMatch =
True
198 process.patMuonsWithoutTrigger.embedGenMatch =
True
199 process.patMuonsWithoutTrigger.genParticleMatch =
'muonMatch'
202 print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default"
205 "Change the L1 trigger matching window to be suitable also for CSC single triggers"
206 if hasattr(process,
'muonL1Info'):
207 process.muonL1Info.maxDeltaR = 0.3
208 process.muonL1Info.maxDeltaEta = 0.2
209 process.muonL1Info.fallbackToME1 =
True
210 if hasattr(process,
'muonMatchHLTL1'):
211 process.muonMatchHLTL1.maxDeltaR = 0.3
212 process.muonMatchHLTL1.maxDeltaEta = 0.2
213 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.