CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions | Variables
patMuonsWithTrigger_cff Namespace Reference

Functions

def addDiMuonTriggers
 
def addHLTL1Passthrough
 
def addL1UserData
 Define a generic function, so that it can be used with existing PAT Muons. More...
 
def addMCinfo
 
def addPreselection
 
def appendL1MatchingAlgo
 
def changeRecoMuonInput
 
def changeTriggerProcessName
 
def switchOffAmbiguityResolution
 
def useExistingPATMuons
 
def useL1MatchingWindowForSinglets
 
def useL1Stage2Candidates
 

Variables

tuple muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchHLTL1 = muonMatchL1.clone(matchedCuts = cms.string('coll("hltL1extraParticles")'))
 Single Mu L1. More...
 
tuple muonMatchHLTL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltL2MuonCandidates")'), maxDeltaR = 0.3, maxDPtRel = 10.0)
 
tuple muonMatchHLTL3 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltIterL3MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchHLTL3fromL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltIterL3FromL2MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchHLTL3T = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltGlbTrkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchHLTTkMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltHighPtTkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchHLTTrackIt = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltTracksIter")'), maxDeltaR = 0.1, maxDPtRel = 1.0)
 
tuple muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)
 
tuple muonMatchL1
 
tuple muonTriggerMatchHLT
 ==== Then perform a match for all HLT triggers of interest More...
 
tuple patMuonsWithoutTrigger
 
tuple patMuonsWithTrigger
 ==== Embed ==== More...
 
tuple patMuonsWithTriggerSequence
 
tuple patTrigger
 
tuple patTriggerMatchers1Mu
 
list patTriggerMatchers1MuInputTags
 
tuple patTriggerMatchers2Mu
 
list patTriggerMatchers2MuInputTags
 
tuple patTriggerMatching
 ==== Trigger Sequence ==== More...
 

Function Documentation

def patMuonsWithTrigger_cff.addDiMuonTriggers (   process)

Definition at line 225 of file patMuonsWithTrigger_cff.py.

References print().

226 def addDiMuonTriggers(process):
227  print("[MuonAnalysis.MuonAssociators.patMuonsWithTrigger_cff] Di-muon triggers are already enabled by default")
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def patMuonsWithTrigger_cff.addHLTL1Passthrough (   process,
  embedder = "patMuonsWithTrigger" 
)

Definition at line 228 of file patMuonsWithTrigger_cff.py.

229 def addHLTL1Passthrough(process, embedder="patMuonsWithTrigger"):
230  process.patMuonsWithTriggerSequence.replace(process.muonMatchHLTL3, process.muonMatchHLTL1 + process.muonMatchHLTL3)
231  getattr(process,embedder).matches += [ cms.InputTag('muonMatchHLTL1'), cms.InputTag('muonMatchHLTL1','propagatedReco') ]
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 
48 def addL1UserData(patMuonProducer, l1ModuleLabel = "muonL1Info"):
49  "Load variables inside PAT muon, from module <l1ModuleLabel> that you must run before it"
50  patMuonProducer.userData.userInts.src += [
51  cms.InputTag(l1ModuleLabel, "quality"), # will be -999 in case of no match
52  ]
53  patMuonProducer.userData.userFloats.src += [
54  cms.InputTag(l1ModuleLabel, "deltaR"), # will be 999 in case of no match
55  ]
56  patMuonProducer.userData.userFloats.src += [
57  cms.InputTag(l1ModuleLabel, "deltaPhi"), # will be 999 in case of no match
58  ]
59  patMuonProducer.userData.userInts.src += [
60  cms.InputTag(l1ModuleLabel, "bx"), # will be -999 in case of no match
61  ]
62  patMuonProducer.userData.userCands.src += [
63  cms.InputTag(l1ModuleLabel)
64  ]
def addL1UserData
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.

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

Definition at line 211 of file patMuonsWithTrigger_cff.py.

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

Definition at line 255 of file patMuonsWithTrigger_cff.py.

References addL1UserData().

256 def appendL1MatchingAlgo(process, algo = "quality"):
257  if hasattr(process, 'muonL1Info'):
258  newMuonL1Info = process.muonL1Info.clone(sortBy = cms.string(algo),
259  sortByQuality = cms.bool(algo == "quality"),
260  sortByDeltaPhi = cms.bool(algo == "deltaEta"),
261  sortByDeltaEta = cms.bool(algo == "deltaPhi"),
262  sortByPt = cms.bool(algo == "pt"),
263  maxDeltaR = cms.double(0.3))
264  setattr(process, "muonL1Info" + algo.title(), newMuonL1Info)
265  process.patMuonsWithTriggerSequence.replace(process.muonL1Info, process.muonL1Info + getattr(process, 'muonL1Info' + algo.title()))
266  addL1UserData(patMuonsWithoutTrigger, "muonL1Info" + algo.title())
def addL1UserData
Define a generic function, so that it can be used with existing PAT Muons.
def patMuonsWithTrigger_cff.changeRecoMuonInput (   process,
  recoMuonCollectionTag,
  oldRecoMuonCollectionTag = cms.InputTag("muons") 
)

Definition at line 195 of file patMuonsWithTrigger_cff.py.

References MassReplace.massSearchReplaceAnyInputTag().

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

Definition at line 191 of file patMuonsWithTrigger_cff.py.

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

Definition at line 180 of file patMuonsWithTrigger_cff.py.

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

Definition at line 200 of file patMuonsWithTrigger_cff.py.

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

201 def useExistingPATMuons(process, newPatMuonTag, addL1Info=False):
202  "Start from existing pat Muons instead of producing them"
203  process.patMuonsWithTriggerSequence.remove(process.patMuonsWithoutTrigger)
204  process.patMuonsWithTriggerSequence.remove(process.muonL1Info)
205  process.patMuonsWithTrigger.src = newPatMuonTag
206  from PhysicsTools.PatAlgos.tools.helpers import massSearchReplaceAnyInputTag
207  massSearchReplaceAnyInputTag(process.patMuonsWithTriggerSequence, cms.InputTag('patMuonsWithoutTrigger'), newPatMuonTag)
208  if addL1Info:
209  process.muonL1Info.src = newPatMuonTag.muonSource
210  addL1UserData(getattr(process,newPatMuonTag.moduleLabel), 'muonL1Info')
def massSearchReplaceAnyInputTag
Definition: MassReplace.py:79
def addL1UserData
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 def useL1MatchingWindowForSinglets(process):
234  "Change the L1 trigger matching window to be suitable also for CSC single triggers"
235  if hasattr(process, 'muonL1Info'):
236  process.muonL1Info.maxDeltaR = 0.3 #Changed accordingly to Zoltan tuning. It was: 1.2
237  process.muonL1Info.maxDeltaEta = 0.2
238  process.muonL1Info.fallbackToME1 = True
239  if hasattr(process, 'muonMatchHLTL1'):
240  process.muonMatchHLTL1.maxDeltaR = 0.3 #Changed accordingly to Zoltan tuning. It was: 1.2
241  process.muonMatchHLTL1.maxDeltaEta = 0.2
242  process.muonMatchHLTL1.fallbackToME1 = True
243 
def patMuonsWithTrigger_cff.useL1Stage2Candidates (   process)

Definition at line 244 of file patMuonsWithTrigger_cff.py.

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

Variable Documentation

tuple patMuonsWithTrigger_cff.muonMatchHLTCtfTrack = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltMuTrackJpsiCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 119 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTCtfTrack2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltMuTrackJpsiEffCtfTrackCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 120 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTL1 = muonMatchL1.clone(matchedCuts = cms.string('coll("hltL1extraParticles")'))

Single Mu L1.

Definition at line 113 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltL2MuonCandidates")'), maxDeltaR = 0.3, maxDPtRel = 10.0)

Definition at line 114 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTL3 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltIterL3MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 115 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTL3fromL2 = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltIterL3FromL2MuonCandidates")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 117 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTL3T = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltGlbTrkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 116 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTTkMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltHighPtTkMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 118 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTTrackIt = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltTracksIter")'), maxDeltaR = 0.1, maxDPtRel = 1.0)

Definition at line 122 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchHLTTrackMu = muonTriggerMatchHLT.clone(matchedCuts = cms.string('coll("hltMuTkMuJpsiTrackerMuonCands")'), maxDeltaR = 0.1, maxDPtRel = 10.0)

Definition at line 121 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonMatchL1
Initial value:
1 = muonHLTL1Match.clone(
2  src = muonTriggerMatchHLT.src,
3  matched = muonTriggerMatchHLT.matched,
4 )

Definition at line 107 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.muonTriggerMatchHLT
Initial value:
1 = cms.EDProducer( "PATTriggerMatcherDRDPtLessByR",
2  src = cms.InputTag( "patMuonsWithoutTrigger" ),
3  matched = cms.InputTag( "patTrigger" ),
4  matchedCuts = cms.string(""),
5 # andOr = cms.bool( False ),
6 # filterIdsEnum = cms.vstring( '*' ),
7 # filterIds = cms.vint32( 0 ),
8 # filterLabels = cms.vstring( '*' ),
9 # pathNames = cms.vstring( '*' ),
10 # collectionTags = cms.vstring( '*' ),
11  maxDPtRel = cms.double( 0.5 ),
12  maxDeltaR = cms.double( 0.5 ),
13  resolveAmbiguities = cms.bool( True ),
14  resolveByMatchQuality = cms.bool( True ) #change with respect to previous tag
15 )

==== Then perform a match for all HLT triggers of interest

Definition at line 89 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patMuonsWithoutTrigger
Initial value:
1 = PhysicsTools.PatAlgos.producersLayer1.muonProducer_cfi.patMuons.clone(
2  muonSource = 'muons',
3  # embed the tracks, so we don't have to carry them around
4  embedTrack = True,
5  embedCombinedMuon = True,
6  embedStandAloneMuon = True,
7  embedPFCandidate = False,
8  embedCaloMETMuonCorrs = cms.bool(False),
9  embedTcMETMuonCorrs = cms.bool(False),
10  embedPfEcalEnergy = cms.bool(False),
11  # then switch off some features we don't need
12  #addTeVRefits = False, ## <<--- this doesn't work. PAT bug ??
13  embedPickyMuon = False,
14  embedTpfmsMuon = False,
15  userIsolation = cms.PSet(), # no extra isolation beyond what's in reco::Muon itself
16  isoDeposits = cms.PSet(), # no heavy isodeposits
17  addGenMatch = False, # no mc: T&P doesn't take it from here anyway.
18 )

Definition at line 13 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patMuonsWithTrigger
Initial value:
1 = cms.EDProducer( "PATTriggerMatchMuonEmbedder",
2  src = cms.InputTag( "patMuonsWithoutTrigger" ),
3  matches = cms.VInputTag()
4 )

==== Embed ====

Definition at line 156 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patMuonsWithTriggerSequence
Initial value:
1 = cms.Sequence(
2  muonL1Info *
3  patMuonsWithoutTrigger *
4  patTriggerMatching
5 )

Definition at line 172 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patTrigger
Initial value:
1 = cms.EDProducer("TriggerObjectFilterByCollection",
2  src = cms.InputTag("patTriggerFull"),
3  collections = cms.vstring("hltL1extraParticles", "hltGmtStage2Digis", "hltL2MuonCandidates", "hltIterL3MuonCandidates","hltIterL3FromL2MuonCandidates","hltHighPtTkMuonCands", "hltGlbTrkMuonCands", "hltMuTrackJpsiCtfTrackCands", "hltMuTrackJpsiEffCtfTrackCands", "hltMuTkMuJpsiTrackerMuonCands","hltTracksIter"),
4 )

Definition at line 79 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patTriggerMatchers1Mu
Initial value:
1 = cms.Sequence(
2  #muonMatchHLTL1 + # keep off by default, since it is slow and usually not needed
3  muonMatchHLTL2 +
4  muonMatchHLTL3 +
5  muonMatchHLTL3T +
6  muonMatchHLTL3fromL2 +
7  muonMatchHLTTkMu
8 )

Definition at line 124 of file patMuonsWithTrigger_cff.py.

list patMuonsWithTrigger_cff.patTriggerMatchers1MuInputTags
Initial value:
1 = [
2  #cms.InputTag('muonMatchHLTL1','propagatedReco'), # fake, will match if and only if he muon did propagate to station 2
3  #cms.InputTag('muonMatchHLTL1'),
4  cms.InputTag('muonMatchHLTL2'),
5  cms.InputTag('muonMatchHLTL3'),
6  cms.InputTag('muonMatchHLTL3T'),
7  cms.InputTag('muonMatchHLTL3fromL2'),
8  cms.InputTag('muonMatchHLTTkMu'),
9 ]

Definition at line 132 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patTriggerMatchers2Mu
Initial value:
1 = cms.Sequence(
2  muonMatchHLTCtfTrack +
3  muonMatchHLTCtfTrack2 +
4  muonMatchHLTTrackMu +
5  muonMatchHLTTrackIt
6 )

Definition at line 142 of file patMuonsWithTrigger_cff.py.

list patMuonsWithTrigger_cff.patTriggerMatchers2MuInputTags
Initial value:
1 = [
2  cms.InputTag('muonMatchHLTCtfTrack'),
3  cms.InputTag('muonMatchHLTCtfTrack2'),
4  cms.InputTag('muonMatchHLTTrackMu'),
5  cms.InputTag('muonMatchHLTTrackIt'),
6 ]

Definition at line 148 of file patMuonsWithTrigger_cff.py.

tuple patMuonsWithTrigger_cff.patTriggerMatching
Initial value:
1 = cms.Sequence(
2  patTriggerFull * patTrigger *
3  patTriggerMatchers1Mu *
4  patTriggerMatchers2Mu *
5  patMuonsWithTrigger
6 )

==== Trigger Sequence ====

Definition at line 165 of file patMuonsWithTrigger_cff.py.