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 224 of file patMuonsWithTrigger_cff.py.

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

Definition at line 227 of file patMuonsWithTrigger_cff.py.

227 def addHLTL1Passthrough(process, embedder="patMuonsWithTrigger"):
228  process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
229  getattr(process,embedder).matches += [ cms.InputTag('muonMatchHLTL1'), cms.InputTag('muonMatchHLTL1','propagatedReco') ]
230 
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 216 of file patMuonsWithTrigger_cff.py.

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

Definition at line 210 of file patMuonsWithTrigger_cff.py.

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

Definition at line 254 of file patMuonsWithTrigger_cff.py.

References addL1UserData().

254 def appendL1MatchingAlgo(process, algo = "quality"):
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())
265 
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 194 of file patMuonsWithTrigger_cff.py.

References MassReplace.massSearchReplaceAnyInputTag().

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

Definition at line 190 of file patMuonsWithTrigger_cff.py.

190 def changeTriggerProcessName(process, triggerProcessName, oldProcessName="HLT"):
191  "Change the process name under which the trigger was run"
192  patTriggerFull.processName = triggerProcessName
193 
def changeTriggerProcessName(process, triggerProcessName, oldProcessName="HLT")
def patMuonsWithTrigger_cff.switchOffAmbiguityResolution (   process)

Single Mu L1.

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

Definition at line 179 of file patMuonsWithTrigger_cff.py.

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

Definition at line 199 of file patMuonsWithTrigger_cff.py.

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

199 def useExistingPATMuons(process, newPatMuonTag, addL1Info=False):
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
204  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
205  massSearchReplaceAnyInputTag(process.patMuonsWithTriggerSequence, cms.InputTag('patMuonsWithoutTrigger'), newPatMuonTag)
206  if addL1Info:
207  process.muonL1Info.src = newPatMuonTag.muonSource
208  addL1UserData(getattr(process,newPatMuonTag.moduleLabel), 'muonL1Info')
209 
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:72
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 231 of file patMuonsWithTrigger_cff.py.

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

Definition at line 243 of file patMuonsWithTrigger_cff.py.

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