CMS 3D CMS Logo

Functions
patMuonsWithTrigger_cff Namespace Reference

Functions

def addDiMuonTriggers (process)
 
def addHLTL1Passthrough (process, embedder="patMuonsWithTrigger")
 
def addL1UserData (patMuonProducer, l1ModuleLabel="muonL1Info")
 Define a generic function, so that it can be used with existing PAT Muons. More...
 
def addMCinfo (process)
 
def addPreselection (process, cut)
 
def appendL1MatchingAlgo (process, algo="quality")
 
def changeRecoMuonInput (process, recoMuonCollectionTag, oldRecoMuonCollectionTag=cms.InputTag("muons"))
 
def changeTriggerProcessName (process, triggerProcessName, oldProcessName="HLT")
 
def switchOffAmbiguityResolution (process)
 Single Mu L1. More...
 
def useExistingPATMuons (process, newPatMuonTag, addL1Info=False)
 
def useL1MatchingWindowForSinglets (process)
 
def useL1Stage2Candidates (process)
 

Function Documentation

def patMuonsWithTrigger_cff.addDiMuonTriggers (   process)

Definition at line 220 of file patMuonsWithTrigger_cff.py.

220 def addDiMuonTriggers(process):
221  print "[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default"
222 
def patMuonsWithTrigger_cff.addHLTL1Passthrough (   process,
  embedder = "patMuonsWithTrigger" 
)

Definition at line 223 of file patMuonsWithTrigger_cff.py.

223 def addHLTL1Passthrough(process, embedder="patMuonsWithTrigger"):
224  process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
225  getattr(process,embedder).matches += [ cms.InputTag('muonMatchHLTL1'), cms.InputTag('muonMatchHLTL1','propagatedReco') ]
226 
def addHLTL1Passthrough(process, embedder="patMuonsWithTrigger")
def patMuonsWithTrigger_cff.addL1UserData (   patMuonProducer,
  l1ModuleLabel = "muonL1Info" 
)

Define a generic function, so that it can be used with existing PAT Muons.

Definition at line 46 of file patMuonsWithTrigger_cff.py.

Referenced by appendL1MatchingAlgo(), and useExistingPATMuons().

46 def addL1UserData(patMuonProducer, l1ModuleLabel = "muonL1Info"):
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"), # will be -999 in case of no match
50  ]
51  patMuonProducer.userData.userFloats.src += [
52  cms.InputTag(l1ModuleLabel, "deltaR"), # will be 999 in case of no match
53  ]
54  patMuonProducer.userData.userFloats.src += [
55  cms.InputTag(l1ModuleLabel, "deltaPhi"), # will be 999 in case of no match
56  ]
57  patMuonProducer.userData.userInts.src += [
58  cms.InputTag(l1ModuleLabel, "bx"), # will be -999 in case of no match
59  ]
60  patMuonProducer.userData.userCands.src += [
61  cms.InputTag(l1ModuleLabel)
62  ]
63 
def addL1UserData(patMuonProducer, l1ModuleLabel="muonL1Info")
Define a generic function, so that it can be used with existing PAT Muons.
def patMuonsWithTrigger_cff.addMCinfo (   process)

Definition at line 212 of file patMuonsWithTrigger_cff.py.

212 def addMCinfo(process):
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'
219 
def patMuonsWithTrigger_cff.addPreselection (   process,
  cut 
)

Definition at line 206 of file patMuonsWithTrigger_cff.py.

206 def addPreselection(process, cut):
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)
211 
def patMuonsWithTrigger_cff.appendL1MatchingAlgo (   process,
  algo = "quality" 
)

Definition at line 250 of file patMuonsWithTrigger_cff.py.

References addL1UserData().

250 def appendL1MatchingAlgo(process, algo = "quality"):
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())
261 
262 
def addL1UserData(patMuonProducer, l1ModuleLabel="muonL1Info")
Define a generic function, so that it can be used with existing PAT Muons.
def appendL1MatchingAlgo(process, algo="quality")
def patMuonsWithTrigger_cff.changeRecoMuonInput (   process,
  recoMuonCollectionTag,
  oldRecoMuonCollectionTag = cms.InputTag("muons") 
)

Definition at line 190 of file patMuonsWithTrigger_cff.py.

References MassReplace.massSearchReplaceAnyInputTag().

190 def changeRecoMuonInput(process, recoMuonCollectionTag, oldRecoMuonCollectionTag=cms.InputTag("muons")):
191  "Use a different input collection of reco muons"
192  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
193  massSearchReplaceAnyInputTag(process.patMuonsWithTriggerSequence, oldRecoMuonCollectionTag, recoMuonCollectionTag)
194 
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:71
def changeRecoMuonInput(process, recoMuonCollectionTag, oldRecoMuonCollectionTag=cms.InputTag("muons"))
def patMuonsWithTrigger_cff.changeTriggerProcessName (   process,
  triggerProcessName,
  oldProcessName = "HLT" 
)

Definition at line 186 of file patMuonsWithTrigger_cff.py.

186 def changeTriggerProcessName(process, triggerProcessName, oldProcessName="HLT"):
187  "Change the process name under which the trigger was run"
188  patTriggerFull.processName = triggerProcessName
189 
def changeTriggerProcessName(process, triggerProcessName, oldProcessName="HLT")
def patMuonsWithTrigger_cff.switchOffAmbiguityResolution (   process)

Single Mu L1.

==== Embed ==== ==== Trigger Sequence ====

Definition at line 176 of file patMuonsWithTrigger_cff.py.

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
185 
def switchOffAmbiguityResolution(process)
Single Mu L1.
def patMuonsWithTrigger_cff.useExistingPATMuons (   process,
  newPatMuonTag,
  addL1Info = False 
)

Definition at line 195 of file patMuonsWithTrigger_cff.py.

References addL1UserData(), and MassReplace.massSearchReplaceAnyInputTag().

195 def useExistingPATMuons(process, newPatMuonTag, addL1Info=False):
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
200  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
201  massSearchReplaceAnyInputTag(process.patMuonsWithTriggerSequence, cms.InputTag('patMuonsWithoutTrigger'), newPatMuonTag)
202  if addL1Info:
203  process.muonL1Info.src = newPatMuonTag.muonSource
204  addL1UserData(getattr(process,newPatMuonTag.moduleLabel), 'muonL1Info')
205 
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:71
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 patMuonsWithTrigger_cff.useL1MatchingWindowForSinglets (   process)

Definition at line 227 of file patMuonsWithTrigger_cff.py.

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 #Changed accordingly to Zoltan tuning. It was: 1.2
231  process.muonL1Info.maxDeltaEta = 0.2
232  process.muonL1Info.fallbackToME1 = True
233  if hasattr(process, 'muonMatchHLTL1'):
234  process.muonMatchHLTL1.maxDeltaR = 0.3 #Changed accordingly to Zoltan tuning. It was: 1.2
235  process.muonMatchHLTL1.maxDeltaEta = 0.2
236  process.muonMatchHLTL1.fallbackToME1 = True
237 
238 
def patMuonsWithTrigger_cff.useL1Stage2Candidates (   process)

Definition at line 239 of file patMuonsWithTrigger_cff.py.

240  if hasattr(process, 'muonL1Info'):
241  # l1PhiOffest might need a second look
242  # barrel seems not to requre it, whereas encaps do
243  # anyhow the effect is of the order of 0.02
244  #process.muonL1Info.l1PhiOffset = cms.double()
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:")
249