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

References edm.print().

225 def addDiMuonTriggers(process):
226  print("[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default")
227 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
def patMuonsWithTrigger_cff.addHLTL1Passthrough (   process,
  embedder = "patMuonsWithTrigger" 
)

Definition at line 228 of file patMuonsWithTrigger_cff.py.

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

Referenced by appendL1MatchingAlgo(), and useExistingPATMuons().

47 def addL1UserData(patMuonProducer, l1ModuleLabel = "muonL1Info"):
48  "Load variables inside PAT muon, from module <l1ModuleLabel> that you must run before it"
49  patMuonProducer.userData.userInts.src += [
50  cms.InputTag(l1ModuleLabel, "quality"), # will be -999 in case of no match
51  ]
52  patMuonProducer.userData.userFloats.src += [
53  cms.InputTag(l1ModuleLabel, "deltaR"), # will be 999 in case of no match
54  ]
55  patMuonProducer.userData.userFloats.src += [
56  cms.InputTag(l1ModuleLabel, "deltaPhi"), # will be 999 in case of no match
57  ]
58  patMuonProducer.userData.userInts.src += [
59  cms.InputTag(l1ModuleLabel, "bx"), # will be -999 in case of no match
60  ]
61  patMuonProducer.userData.userCands.src += [
62  cms.InputTag(l1ModuleLabel)
63  ]
64 
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 217 of file patMuonsWithTrigger_cff.py.

217 def addMCinfo(process):
218  "Add MC matching information to the muons"
219  process.load("PhysicsTools.PatAlgos.mcMatchLayer0.muonMatch_cfi")
220  process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.muonMatch + process.patMuonsWithoutTrigger)
221  process.patMuonsWithoutTrigger.addGenMatch = True
222  process.patMuonsWithoutTrigger.embedGenMatch = True
223  process.patMuonsWithoutTrigger.genParticleMatch = 'muonMatch'
224 
def patMuonsWithTrigger_cff.addPreselection (   process,
  cut 
)

Definition at line 211 of file patMuonsWithTrigger_cff.py.

211 def addPreselection(process, cut):
212  "Add a preselection cut to the muons before matching (might be relevant, due to ambiguity resolution in trigger matching!"
213  process.patMuonsWithoutTriggerUnfiltered = process.patMuonsWithoutTrigger.clone()
214  process.globalReplace('patMuonsWithoutTrigger', cms.EDFilter("PATMuonSelector", src = cms.InputTag('patMuonsWithoutTriggerUnfiltered'), cut = cms.string(cut)))
215  process.patMuonsWithTriggerSequence.replace(process.patMuonsWithoutTrigger, process.patMuonsWithoutTriggerUnfiltered * process.patMuonsWithoutTrigger)
216 
def patMuonsWithTrigger_cff.appendL1MatchingAlgo (   process,
  algo = "quality" 
)

Definition at line 255 of file patMuonsWithTrigger_cff.py.

References addL1UserData().

255 def appendL1MatchingAlgo(process, algo = "quality"):
256  if hasattr(process, 'muonL1Info'):
257  newMuonL1Info = process.muonL1Info.clone(sortBy = cms.string(algo),
258  sortByQuality = cms.bool(algo == "quality"),
259  sortByDeltaPhi = cms.bool(algo == "deltaEta"),
260  sortByDeltaEta = cms.bool(algo == "deltaPhi"),
261  sortByPt = cms.bool(algo == "pt"),
262  maxDeltaR = cms.double(0.3))
263  setattr(process, "muonL1Info" + algo.title(), newMuonL1Info)
264  process.patMuonsWithTriggerSequence.replace(process.muonL1Info, process.muonL1Info + getattr(process, 'muonL1Info' + algo.title()))
265  addL1UserData(patMuonsWithoutTrigger, "muonL1Info" + algo.title())
266 
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 195 of file patMuonsWithTrigger_cff.py.

References MassReplace.massSearchReplaceAnyInputTag().

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

Definition at line 191 of file patMuonsWithTrigger_cff.py.

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

Single Mu L1.

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

Definition at line 180 of file patMuonsWithTrigger_cff.py.

181  "Switch off ambiguity resolution: allow multiple reco muons to match to the same trigger muon"
182  process.muonMatchHLTL1.resolveAmbiguities = False
183  process.muonMatchHLTL2.resolveAmbiguities = False
184  process.muonMatchHLTL3.resolveAmbiguities = False
185  process.muonMatchHLTL3fromL2.resolveAmbiguities = False
186  process.muonMatchHLTTkMu.resolveAmbiguities = False
187  process.muonMatchHLTCtfTrack.resolveAmbiguities = False
188  process.muonMatchHLTTrackMu.resolveAmbiguities = False
189  process.muonMatchHLTTrackIt.resolveAmbiguities = False
190 
def switchOffAmbiguityResolution(process)
Single Mu L1.
def patMuonsWithTrigger_cff.useExistingPATMuons (   process,
  newPatMuonTag,
  addL1Info = False 
)

Definition at line 200 of file patMuonsWithTrigger_cff.py.

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

200 def useExistingPATMuons(process, newPatMuonTag, addL1Info=False):
201  "Start from existing pat Muons instead of producing them"
202  process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
203  process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
204  process.patMuonsWithTrigger.src = newPatMuonTag
205  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
206  massSearchReplaceAnyInputTag(process.patMuonsWithTriggerSequence, cms.InputTag('patMuonsWithoutTrigger'), newPatMuonTag)
207  if addL1Info:
208  process.muonL1Info.src = newPatMuonTag.muonSource
209  addL1UserData(getattr(process,newPatMuonTag.moduleLabel), 'muonL1Info')
210 
def massSearchReplaceAnyInputTag(sequence, oldInputTag, newInputTag, verbose=False, moduleLabelOnly=False, skipLabelTest=False)
Definition: MassReplace.py:73
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 232 of file patMuonsWithTrigger_cff.py.

233  "Change the L1 trigger matching window to be suitable also for CSC single triggers"
234  if hasattr(process, 'muonL1Info'):
235  process.muonL1Info.maxDeltaR = 0.3 #Changed accordingly to Zoltan tuning. It was: 1.2
236  process.muonL1Info.maxDeltaEta = 0.2
237  process.muonL1Info.fallbackToME1 = True
238  if hasattr(process, 'muonMatchHLTL1'):
239  process.muonMatchHLTL1.maxDeltaR = 0.3 #Changed accordingly to Zoltan tuning. It was: 1.2
240  process.muonMatchHLTL1.maxDeltaEta = 0.2
241  process.muonMatchHLTL1.fallbackToME1 = True
242 
243 
def patMuonsWithTrigger_cff.useL1Stage2Candidates (   process)

Definition at line 244 of file patMuonsWithTrigger_cff.py.

245  if hasattr(process, 'muonL1Info'):
246  # l1PhiOffest might need a second look
247  # barrel seems not to requre it, whereas encaps do
248  # anyhow the effect is of the order of 0.02
249  #process.muonL1Info.l1PhiOffset = cms.double()
250  process.muonL1Info.useMB2InOverlap = cms.bool(True)
251  process.muonL1Info.useStage2L1 = cms.bool(True)
252  process.muonL1Info.preselection = cms.string("")
253  process.muonL1Info.matched = cms.InputTag("gmtStage2Digis:Muon:")
254