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.userFloats.src += [
55 cms.InputTag(l1ModuleLabel,
"deltaPhi"),
57 patMuonProducer.userData.userInts.src += [
58 cms.InputTag(l1ModuleLabel,
"bx"),
60 patMuonProducer.userData.userCands.src += [
61 cms.InputTag(l1ModuleLabel)
77 patTriggerFull.onlyStandAlone =
True 78 patTrigger = cms.EDProducer(
"TriggerObjectFilterByCollection",
79 src = cms.InputTag(
"patTriggerFull"),
80 collections = cms.vstring(
"hltL1extraParticles",
"hltGmtStage2Digis",
"hltL2MuonCandidates",
"hltIterL3MuonCandidates",
"hltIterL3FromL2MuonCandidates",
"hltHighPtTkMuonCands",
"hltGlbTrkMuonCands",
"hltMuTrackJpsiCtfTrackCands",
"hltMuTrackJpsiEffCtfTrackCands",
"hltMuTkMuJpsiTrackerMuonCands",
"hltTracksIter"),
88 muonTriggerMatchHLT = cms.EDProducer(
"PATTriggerMatcherDRDPtLessByR",
89 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
90 matched = cms.InputTag(
"patTrigger" ),
91 matchedCuts = cms.string(
""),
98 maxDPtRel = cms.double( 0.5 ),
99 maxDeltaR = cms.double( 0.5 ),
100 resolveAmbiguities = cms.bool(
True ),
101 resolveByMatchQuality = cms.bool(
True )
105 from MuonAnalysis.MuonAssociators.muonHLTL1Match_cfi
import muonHLTL1Match
106 muonMatchL1 = muonHLTL1Match.clone(
107 src = muonTriggerMatchHLT.src,
108 matched = muonTriggerMatchHLT.matched,
112 muonMatchHLTL1 = muonMatchL1.clone(matchedCuts = cms.string(
'coll("hltL1extraParticles")'))
113 muonMatchHLTL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltL2MuonCandidates")'), maxDeltaR = 0.3, maxDPtRel = 10.0)
114 muonMatchHLTL3 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltIterL3MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
115 muonMatchHLTL3T = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltGlbTrkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
116 muonMatchHLTL3fromL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltIterL3FromL2MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
117 muonMatchHLTTkMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltHighPtTkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
118 muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
119 muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
120 muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
121 muonMatchHLTTrackIt = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltTracksIter")'), maxDeltaR = 0.1, maxDPtRel = 1.0)
123 patTriggerMatchers1Mu = cms.Sequence(
128 muonMatchHLTL3fromL2 +
131 patTriggerMatchers1MuInputTags = [
134 cms.InputTag(
'muonMatchHLTL2'),
135 cms.InputTag(
'muonMatchHLTL3'),
136 cms.InputTag(
'muonMatchHLTL3T'),
137 cms.InputTag(
'muonMatchHLTL3fromL2'),
138 cms.InputTag(
'muonMatchHLTTkMu'),
141 patTriggerMatchers2Mu = cms.Sequence(
142 muonMatchHLTCtfTrack +
143 muonMatchHLTCtfTrack2 +
144 muonMatchHLTTrackMu +
147 patTriggerMatchers2MuInputTags = [
148 cms.InputTag(
'muonMatchHLTCtfTrack'),
149 cms.InputTag(
'muonMatchHLTCtfTrack2'),
150 cms.InputTag(
'muonMatchHLTTrackMu'),
151 cms.InputTag(
'muonMatchHLTTrackIt'),
155 patMuonsWithTrigger = cms.EDProducer(
"PATTriggerMatchMuonEmbedder",
156 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
157 matches = cms.VInputTag()
159 patMuonsWithTrigger.matches += patTriggerMatchers1MuInputTags
160 patMuonsWithTrigger.matches += patTriggerMatchers2MuInputTags
164 patTriggerMatching = cms.Sequence(
165 patTriggerFull * patTrigger *
166 patTriggerMatchers1Mu *
167 patTriggerMatchers2Mu *
171 patMuonsWithTriggerSequence = cms.Sequence(
173 patMuonsWithoutTrigger *
180 "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon" 181 process.muonMatchHLTL1.resolveAmbiguities =
False 182 process.muonMatchHLTL2.resolveAmbiguities =
False 183 process.muonMatchHLTL3.resolveAmbiguities =
False 184 process.muonMatchHLTL3fromL2.resolveAmbiguities =
False 185 process.muonMatchHLTTkMu.resolveAmbiguities =
False 186 process.muonMatchHLTCtfTrack.resolveAmbiguities =
False 187 process.muonMatchHLTTrackMu.resolveAmbiguities =
False 188 process.muonMatchHLTTrackIt.resolveAmbiguities =
False 191 "Change the process name under which the trigger was run" 192 patTriggerFull.processName = triggerProcessName
195 "Use a different input collection of reco muons" 200 "Start from existing pat Muons instead of producing them" 201 process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
202 process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
203 process.patMuonsWithTrigger.src = newPatMuonTag
207 process.muonL1Info.src = newPatMuonTag.muonSource
208 addL1UserData(getattr(process,newPatMuonTag.moduleLabel),
'muonL1Info')
211 "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!" 212 process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
213 process.globalReplace(
'patMuonsWithoutTrigger', cms.EDFilter(
"PATMuonSelector", src = cms.InputTag(
'patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
214 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
217 "Add MC matching information to the muons" 218 process.load(
"PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
219 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
220 process.patMuonsWithoutTrigger.addGenMatch =
True 221 process.patMuonsWithoutTrigger.embedGenMatch =
True 222 process.patMuonsWithoutTrigger.genParticleMatch =
'muonMatch' 225 print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default" 228 process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
229 getattr(process,embedder).matches += [ cms.InputTag(
'muonMatchHLTL1'), cms.InputTag(
'muonMatchHLTL1',
'propagatedReco') ]
232 "Change the L1 trigger matching window to be suitable also for CSC single triggers" 233 if hasattr(process,
'muonL1Info'):
234 process.muonL1Info.maxDeltaR = 0.3
235 process.muonL1Info.maxDeltaEta = 0.2
236 process.muonL1Info.fallbackToME1 =
True 237 if hasattr(process,
'muonMatchHLTL1'):
238 process.muonMatchHLTL1.maxDeltaR = 0.3
239 process.muonMatchHLTL1.maxDeltaEta = 0.2
240 process.muonMatchHLTL1.fallbackToME1 =
True 244 if hasattr(process,
'muonL1Info'):
249 process.muonL1Info.useMB2InOverlap = cms.bool(
True)
250 process.muonL1Info.useStage2L1 = cms.bool(
True)
251 process.muonL1Info.preselection = cms.string(
"")
252 process.muonL1Info.matched = cms.InputTag(
"gmtStage2Digis:Muon:")
255 if hasattr(process,
'muonL1Info'):
256 newMuonL1Info = process.muonL1Info.clone(sortBy = cms.string(algo),
257 sortByQuality = cms.bool(algo ==
"quality"),
258 sortByDeltaPhi = cms.bool(algo ==
"deltaEta"),
259 sortByDeltaEta = cms.bool(algo ==
"deltaPhi"),
260 sortByPt = cms.bool(algo ==
"pt"),
261 maxDeltaR = cms.double(0.3))
262 setattr(process,
"muonL1Info" + algo.title(), newMuonL1Info)
263 process.patMuonsWithTriggerSequence.replace(process.muonL1Info, process.muonL1Info + getattr(process,
'muonL1Info' + algo.title()))
264 addL1UserData(patMuonsWithoutTrigger,
"muonL1Info" + algo.title())
def addHLTL1Passthrough(process, embedder="patMuonsWithTrigger")
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
def changeRecoMuonInput(process, recoMuonCollectionTag, oldRecoMuonCollectionTag=cms.InputTag("muons"))
def useL1Stage2Candidates(process)
def addPreselection(process, cut)
def switchOffAmbiguityResolution(process)
Single Mu L1.
def useExistingPATMuons(process, newPatMuonTag, addL1Info=False)
def addL1UserData(patMuonProducer, l1ModuleLabel="muonL1Info")
Define a generic function, so that it can be used with existing PAT Muons.
def useL1MatchingWindowForSinglets(process)
def appendL1MatchingAlgo(process, algo="quality")
def changeTriggerProcessName(process, triggerProcessName, oldProcessName="HLT")
def addDiMuonTriggers(process)