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",
"hltL3MuonCandidates",
"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("hltL3MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
115 muonMatchHLTL3T = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltGlbTrkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
116 muonMatchHLTTkMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltHighPtTkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
117 muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
118 muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
119 muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
120 muonMatchHLTTrackIt = muonTriggerMatchHLT.clone(matchedCuts = cms.string(
'coll("hltTracksIter")'), maxDeltaR = 0.1, maxDPtRel = 1.0)
122 patTriggerMatchers1Mu = cms.Sequence(
129 patTriggerMatchers1MuInputTags = [
132 cms.InputTag(
'muonMatchHLTL2'),
133 cms.InputTag(
'muonMatchHLTL3'),
134 cms.InputTag(
'muonMatchHLTL3T'),
135 cms.InputTag(
'muonMatchHLTTkMu'),
138 patTriggerMatchers2Mu = cms.Sequence(
139 muonMatchHLTCtfTrack +
140 muonMatchHLTCtfTrack2 +
141 muonMatchHLTTrackMu +
144 patTriggerMatchers2MuInputTags = [
145 cms.InputTag(
'muonMatchHLTCtfTrack'),
146 cms.InputTag(
'muonMatchHLTCtfTrack2'),
147 cms.InputTag(
'muonMatchHLTTrackMu'),
148 cms.InputTag(
'muonMatchHLTTrackIt'),
152 patMuonsWithTrigger = cms.EDProducer(
"PATTriggerMatchMuonEmbedder",
153 src = cms.InputTag(
"patMuonsWithoutTrigger" ),
154 matches = cms.VInputTag()
156 patMuonsWithTrigger.matches += patTriggerMatchers1MuInputTags
157 patMuonsWithTrigger.matches += patTriggerMatchers2MuInputTags
161 patTriggerMatching = cms.Sequence(
162 patTriggerFull * patTrigger *
163 patTriggerMatchers1Mu *
164 patTriggerMatchers2Mu *
168 patMuonsWithTriggerSequence = cms.Sequence(
170 patMuonsWithoutTrigger *
177 "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon" 178 process.muonMatchHLTL1.resolveAmbiguities =
False 179 process.muonMatchHLTL2.resolveAmbiguities =
False 180 process.muonMatchHLTL3.resolveAmbiguities =
False 181 process.muonMatchHLTTkMu.resolveAmbiguities =
False 182 process.muonMatchHLTCtfTrack.resolveAmbiguities =
False 183 process.muonMatchHLTTrackMu.resolveAmbiguities =
False 184 process.muonMatchHLTTrackIt.resolveAmbiguities =
False 187 "Change the process name under which the trigger was run" 188 patTriggerFull.processName = triggerProcessName
191 "Use a different input collection of reco muons" 196 "Start from existing pat Muons instead of producing them" 197 process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
198 process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
199 process.patMuonsWithTrigger.src = newPatMuonTag
203 process.muonL1Info.src = newPatMuonTag.muonSource
204 addL1UserData(getattr(process,newPatMuonTag.moduleLabel),
'muonL1Info')
207 "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!" 208 process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
209 process.globalReplace(
'patMuonsWithoutTrigger', cms.EDFilter(
"PATMuonSelector", src = cms.InputTag(
'patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
210 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
213 "Add MC matching information to the muons" 214 process.load(
"PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
215 process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
216 process.patMuonsWithoutTrigger.addGenMatch =
True 217 process.patMuonsWithoutTrigger.embedGenMatch =
True 218 process.patMuonsWithoutTrigger.genParticleMatch =
'muonMatch' 221 print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default" 224 process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
225 getattr(process,embedder).matches += [ cms.InputTag(
'muonMatchHLTL1'), cms.InputTag(
'muonMatchHLTL1',
'propagatedReco') ]
228 "Change the L1 trigger matching window to be suitable also for CSC single triggers" 229 if hasattr(process,
'muonL1Info'):
230 process.muonL1Info.maxDeltaR = 0.3
231 process.muonL1Info.maxDeltaEta = 0.2
232 process.muonL1Info.fallbackToME1 =
True 233 if hasattr(process,
'muonMatchHLTL1'):
234 process.muonMatchHLTL1.maxDeltaR = 0.3
235 process.muonMatchHLTL1.maxDeltaEta = 0.2
236 process.muonMatchHLTL1.fallbackToME1 =
True 240 if hasattr(process,
'muonL1Info'):
245 process.muonL1Info.useMB2InOverlap = cms.bool(
True)
246 process.muonL1Info.useStage2L1 = cms.bool(
True)
247 process.muonL1Info.preselection = cms.string(
"")
248 process.muonL1Info.matched = cms.InputTag(
"gmtStage2Digis:Muon:")
251 if hasattr(process,
'muonL1Info'):
252 newMuonL1Info = process.muonL1Info.clone(sortBy = cms.string(algo),
253 sortByQuality = cms.bool(algo ==
"quality"),
254 sortByDeltaPhi = cms.bool(algo ==
"deltaEta"),
255 sortByDeltaEta = cms.bool(algo ==
"deltaPhi"),
256 sortByPt = cms.bool(algo ==
"pt"),
257 maxDeltaR = cms.double(0.3))
258 setattr(process,
"muonL1Info" + algo.title(), newMuonL1Info)
259 process.patMuonsWithTriggerSequence.replace(process.muonL1Info, process.muonL1Info + getattr(process,
'muonL1Info' + algo.title()))
260 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)