1 from __future__
import print_function
5 from PhysicsTools.PatAlgos.patEventContent_cff
import patTriggerL1RefsEventContent
7 from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi
import _exampleTriggerMatchers
8 _defaultTriggerProducer =
'patTrigger' 9 _defaultTriggerEventProducer =
'patTriggerEvent' 11 _defaultHltProcess =
'HLT' 12 _defaultOutputModule =
'out' 15 _defaultTriggerMatchersComment =
"Trigger matcher modules' labels, default: ..." 16 _defaultTriggerProducerComment =
"PATTriggerProducer module label, default: %s"%( _defaultTriggerProducer )
17 _defaultTriggerEventProducerComment =
"PATTriggerEventProducer module label, default: %s"%( _defaultTriggerEventProducer )
18 _defaultPathComment =
"Name of path to use, default: %s"%( _defaultPath )
19 _defaultHltProcessComment =
"HLT process name, default: %s"%( _defaultHltProcess )
20 _defaultOutputModuleComment =
"Output module label, empty label indicates no output, default: %s"%( _defaultOutputModule )
21 _defaultPostfixComment =
"Postfix to apply to PAT module labels, default: %s"%( _defaultPostfix )
23 _longLine =
'---------------------------------------------------------------------' 27 return [ m.label()
for m
in listModules( getattr( process, pathLabel ) ) ]
32 for content
in eventContent:
33 if content
not in outputCommands:
34 outputCommands += [ content ]
37 for i
in range( len( outputCommands ) ):
40 command = outputCommands[ i ]
41 if command[ : 4 ] ==
'keep':
42 dropCommand = command.replace(
'keep ',
'drop ' )
43 for j
in range( i + 1, len( outputCommands ) ):
44 testCommand = outputCommands[ j ]
45 if testCommand == command:
47 elif testCommand == dropCommand:
48 listToRemove += [ i, j ]
51 newOutputCommands = cms.untracked.vstring()
52 for i
in range( len( outputCommands ) ):
53 if i
not in listToRemove:
54 newOutputCommands += [ outputCommands[ i ] ]
56 return newOutputCommands
60 """ Enables trigger information in PAT 61 SwitchOnTrigger( [cms.Process], triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', path = '', hltProcess = 'HLT', outputModule = 'out' ) 62 - [cms.Process] : the 'cms.Process' 63 - triggerProducer : PATTriggerProducer module label; 64 optional, default: 'patTrigger' 65 - triggerEventProducer: PATTriggerEventProducer module label; 66 optional, default: 'patTriggerEvent' 67 - path : name of path to use; 69 - hltProcess : HLT process name; 70 optional, default: 'HLT' 71 - outputModule : output module label; 72 empty label indicates no output; 73 optional, default: 'out' 74 Using None as any argument restores its default value. 76 _label =
'switchOnTrigger' 77 _defaultParameters = dicttypes.SortedKeysDict()
80 ConfigToolBase.__init__( self )
81 self.addParameter( self.
_defaultParameters,
'triggerProducer' , _defaultTriggerProducer , _defaultTriggerProducerComment )
82 self.addParameter( self.
_defaultParameters,
'triggerEventProducer', _defaultTriggerEventProducer, _defaultTriggerEventProducerComment )
83 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
84 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
85 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
93 , triggerProducer =
None 94 , triggerEventProducer =
None 99 if triggerProducer
is None:
101 if triggerEventProducer
is None:
105 if hltProcess
is None:
107 if outputModule
is None:
109 self.setParameter(
'triggerProducer' , triggerProducer )
110 self.setParameter(
'triggerEventProducer', triggerEventProducer )
111 self.setParameter(
'path' , path )
112 self.setParameter(
'hltProcess' , hltProcess )
113 self.setParameter(
'outputModule' , outputModule )
114 self.apply( process )
117 triggerProducer = self.
_parameters[
'triggerProducer' ].value
118 triggerEventProducer = self.
_parameters[
'triggerEventProducer' ].value
120 hltProcess = self.
_parameters[
'hltProcess' ].value
121 outputModule = self.
_parameters[
'outputModule' ].value
126 if not hasattr( process, triggerProducer ):
131 print(
' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer ))
132 print(
' ==> entry re-used')
134 if not hasattr( process, triggerEventProducer ):
139 print(
' PATTriggerEventProducer module \'%s\' exists already in process'%( triggerEventProducer ))
140 print(
' ==> entry re-used')
144 trigProdMod = getattr( process, triggerProducer )
145 trigProdMod.processName = hltProcess
146 if trigProdMod.onlyStandAlone.value()
is True:
147 trigProdMod.onlyStandAlone =
False 148 print(
' configuration parameter automatically changed')
149 print(
' PATTriggerProducer %s.onlyStandAlone --> %s'%( triggerProducer, trigProdMod.onlyStandAlone ))
151 trigEvtProdMod = getattr( process, triggerEventProducer )
152 trigEvtProdMod.processName = hltProcess
153 trigEvtProdMod.patTriggerProducer = cms.InputTag( triggerProducer )
155 if not hasattr( process, path ):
156 prodPath = cms.Path( trigProdMod + trigEvtProdMod )
157 setattr( process, path, prodPath )
159 print(
' Path \'%s\' does not exist in process'%( path ))
160 print(
' ==> created')
166 prodPath = getattr( process, path )
167 prodPath += trigProdMod
169 prodPath = getattr( process, path )
170 prodPath += trigEvtProdMod
173 if outputModule
is not '':
174 patTriggerEventContent = [
'keep patTriggerObjects_%s_*_%s'%( triggerProducer, process.name_() )
175 ,
'keep patTriggerFilters_%s_*_%s'%( triggerProducer, process.name_() )
176 ,
'keep patTriggerPaths_%s_*_%s'%( triggerProducer, process.name_() )
177 ,
'keep patTriggerEvent_%s_*_%s'%( triggerEventProducer, process.name_() )
179 if ( hasattr( trigProdMod,
'addL1Algos' )
and trigProdMod.addL1Algos.value()
is True ):
180 patTriggerEventContent += [
'keep patTriggerConditions_%s_*_%s'%( triggerProducer, process.name_() )
181 ,
'keep patTriggerAlgorithms_%s_*_%s'%( triggerProducer, process.name_() )
183 if ( hasattr( trigProdMod,
'saveL1Refs' )
and trigProdMod.saveL1Refs.value()
is True ):
184 patTriggerEventContent += patTriggerL1RefsEventContent
185 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
191 """ Enables trigger information in PAT, limited to stand-alone trigger objects 192 SwitchOnTriggerStandAlone( [cms.Process], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out' ) 193 - [cms.Process] : the 'cms.Process' 194 - triggerProducer : PATTriggerProducer module label; 195 optional, default: 'patTrigger' 196 - path : name of path to use; 197 optional, default: '' 198 - hltProcess : HLT process name; 199 optional, default: 'HLT' 200 - outputModule : output module label; 201 empty label indicates no output; 202 optional, default: 'out' 203 Using None as any argument restores its default value. 205 _label =
'switchOnTriggerStandAlone' 206 _defaultParameters = dicttypes.SortedKeysDict()
209 ConfigToolBase.__init__( self )
210 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
211 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
212 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
213 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
221 , triggerProducer =
None 224 , outputModule =
None 226 if triggerProducer
is None:
230 if hltProcess
is None:
232 if outputModule
is None:
234 self.setParameter(
'triggerProducer', triggerProducer )
235 self.setParameter(
'path' , path )
236 self.setParameter(
'hltProcess' , hltProcess )
237 self.setParameter(
'outputModule' , outputModule )
238 self.apply( process )
244 triggerProducer = self.
_parameters[
'triggerProducer' ].value
246 hltProcess = self.
_parameters[
'hltProcess' ].value
247 outputModule = self.
_parameters[
'outputModule' ].value
250 if not hasattr( process, triggerProducer ):
252 addToProcessAndTask(triggerProducer, patTrigger.clone( onlyStandAlone =
True ), process, task)
255 print(
' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer ))
256 print(
' ==> entry re-used')
260 trigProdMod = getattr( process, triggerProducer )
261 trigProdMod.processName = hltProcess
263 if not hasattr( process, path ):
264 prodPath = cms.Path( trigProdMod )
265 setattr( process, path, prodPath )
267 print(
' Path \'%s\' does not exist in process'%( path ))
268 print(
' ==> created')
271 prodPath = getattr( process, path )
272 prodPath += trigProdMod
275 if outputModule
is not '':
276 patTriggerEventContent = [
'keep patTriggerObjectStandAlones_%s_*_%s'%( triggerProducer, process.name_() )
278 if ( hasattr( trigProdMod,
'saveL1Refs' )
and trigProdMod.saveL1Refs.value()
is True ):
279 patTriggerEventContent += patTriggerL1RefsEventContent
280 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
286 """ Enables trigger matching in PAT 287 SwitchOnTriggerMatching( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) 288 - [cms.Process] : the 'cms.Process' 289 - triggerMatchers : PAT trigger matcher module labels (list) 290 optional; default: defined in '_exampleTriggerMatchers' 291 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py) 292 - triggerProducer : PATTriggerProducer module label; 293 optional, default: 'patTrigger' 294 - triggerEventProducer: PATTriggerEventProducer module label; 295 optional, default: 'patTriggerEvent' 296 - path : name of path to use; 297 optional, default: 'patDefaultSequence' 298 - hltProcess : HLT process name; 299 optional, default: 'HLT' 300 - outputModule : output module label; 301 empty label indicates no output; 302 optional, default: 'out' 303 - postfix : postfix to apply to PAT module labels; 304 optional, default: '' 305 Using None as any argument restores its default value. 307 _label =
'switchOnTriggerMatching' 308 _defaultParameters = dicttypes.SortedKeysDict()
311 ConfigToolBase.__init__( self )
312 self.addParameter( self.
_defaultParameters,
'triggerMatchers' , _exampleTriggerMatchers , _defaultTriggerMatchersComment )
314 self.addParameter( self.
_defaultParameters,
'triggerProducer' , _defaultTriggerProducer , _defaultTriggerProducerComment )
315 self.addParameter( self.
_defaultParameters,
'triggerEventProducer', _defaultTriggerEventProducer, _defaultTriggerEventProducerComment )
316 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
317 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
318 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
319 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
327 , triggerMatchers =
None 328 , triggerProducer =
None 329 , triggerEventProducer =
None 332 , outputModule =
None 335 if triggerMatchers
is None:
337 self.setParameter(
'exampleMatchers',
True )
338 if triggerProducer
is None:
340 if triggerEventProducer
is None:
344 if hltProcess
is None:
346 if outputModule
is None:
350 self.setParameter(
'triggerMatchers' , triggerMatchers )
351 self.setParameter(
'triggerProducer' , triggerProducer )
352 self.setParameter(
'triggerEventProducer', triggerEventProducer )
353 self.setParameter(
'path' , path )
354 self.setParameter(
'hltProcess' , hltProcess )
355 self.setParameter(
'outputModule' , outputModule )
356 self.setParameter(
'postfix' , postfix )
357 self.apply( process )
360 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
361 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
362 triggerProducer = self.
_parameters[
'triggerProducer' ].value
363 triggerEventProducer = self.
_parameters[
'triggerEventProducer' ].value
365 hltProcess = self.
_parameters[
'hltProcess' ].value
366 outputModule = self.
_parameters[
'outputModule' ].value
372 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
373 task.add(process.triggerMatcherExamplesTask)
375 if not hasattr( process, triggerEventProducer ):
377 print(
' PAT trigger production switched on automatically using')
378 print(
' switchOnTrigger( process, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, triggerEventProducer, path, outputModule ))
380 switchOnTrigger( process, triggerProducer, triggerEventProducer, path, hltProcess, outputModule )
383 trigEvtProdMod = getattr( process, triggerEventProducer )
384 triggerMatchersKnown = []
385 for matcher
in triggerMatchers:
386 if not hasattr( process, matcher ):
388 print(
' Matcher \'%s\' not known to process'%( matcher ))
389 print(
' ==> skipped')
392 triggerMatchersKnown.append( matcher )
393 trigMchMod = getattr( process, matcher )
394 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
395 trigMchMod.matched = triggerProducer
396 matchers = getattr( trigEvtProdMod,
'patTriggerMatches' )
397 if len( matchers ) > 0:
399 print(
' PAT trigger matchers already attached to existing PATTriggerEventProducer \'%s\''%( triggerEventProducer ))
400 print(
' configuration parameters automatically changed')
401 for matcher
in matchers:
402 trigMchMod = getattr( process, matcher )
403 if trigMchMod.matched.value()
is not triggerProducer:
404 trigMchMod.matched = triggerProducer
405 print(
' PAT trigger matcher %s.matched --> %s'%( matcher, trigMchMod.matched ))
408 trigEvtProdMod.patTriggerMatches = cms.VInputTag()
409 for matcher
in triggerMatchersKnown:
410 trigEvtProdMod.patTriggerMatches.append( cms.InputTag( matcher ) )
413 if outputModule
is not '':
414 patTriggerEventContent = []
415 for matcher
in triggerMatchersKnown:
416 patTriggerEventContent += [
'keep patTriggerObjectsedmAssociation_%s_%s_%s'%( triggerEventProducer, matcher, process.name_() )
417 ,
'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
419 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
425 """ Enables trigger matching in PAT 426 SwitchOnTriggerMatchingStandAlone( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) 427 - [cms.Process] : the 'cms.Process' 428 - triggerMatchers: PAT trigger matcher module labels (list) 429 optional; default: defined in 'triggerMatchingDefaultSequence' 430 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py) 431 - triggerProducer: PATTriggerProducer module label; 432 optional, default: 'patTrigger' 433 - path : name of path to use; 434 optional, default: '' 435 - hltProcess : HLT process name; 436 optional, default: 'HLT' 437 - outputModule : output module label; 438 empty label indicates no output; 439 optional, default: 'out' 440 - postfix : postfix to apply to PAT module labels; 441 optional, default: '' 442 Using None as any argument restores its default value. 444 _label =
'switchOnTriggerMatchingStandAlone' 445 _defaultParameters = dicttypes.SortedKeysDict()
448 ConfigToolBase.__init__( self )
449 self.addParameter( self.
_defaultParameters,
'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
451 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
452 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
453 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
454 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
455 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
463 , triggerMatchers =
None 464 , triggerProducer =
None 467 , outputModule =
None 470 if triggerMatchers
is None:
472 self.setParameter(
'exampleMatchers',
True )
473 if triggerProducer
is None:
477 if hltProcess
is None:
479 if outputModule
is None:
483 self.setParameter(
'triggerMatchers', triggerMatchers )
484 self.setParameter(
'triggerProducer', triggerProducer )
485 self.setParameter(
'path' , path )
486 self.setParameter(
'hltProcess' , hltProcess )
487 self.setParameter(
'outputModule' , outputModule )
488 self.setParameter(
'postfix' , postfix )
489 self.apply( process )
492 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
493 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
494 triggerProducer = self.
_parameters[
'triggerProducer' ].value
496 hltProcess = self.
_parameters[
'hltProcess' ].value
497 outputModule = self.
_parameters[
'outputModule' ].value
503 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
504 task.add(process.triggerMatcherExamplesTask)
507 if not hasattr( process, triggerProducer ):
509 print(
' PAT trigger production switched on automatically using')
510 print(
' switchOnTriggerStandAlone( process, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule ))
515 triggerMatchersKnown = []
516 for matcher
in triggerMatchers:
517 if not hasattr( process, matcher ):
519 print(
' Matcher \'%s\' not known to process'%( matcher ))
520 print(
' ==> skipped')
523 triggerMatchersKnown.append( matcher )
524 trigMchMod = getattr( process, matcher )
525 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
526 trigMchMod.matched = triggerProducer
529 if outputModule
is not '':
530 patTriggerEventContent = []
531 for matcher
in triggerMatchersKnown:
532 patTriggerEventContent += [
'keep patTriggerObjectStandAlonesedmAssociation_%s_*_%s'%( matcher, process.name_() )
533 ,
'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
535 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
541 """ Enables embedding of trigger matches into PAT objects 542 SwitchOnTriggerMatchEmbedding( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) 543 - [cms.Process] : the 'cms.Process' 544 - triggerMatchers: PAT trigger matcher module labels (list) 545 optional; default: defined in 'triggerMatchingDefaultSequence' 546 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py) 547 - triggerProducer: PATTriggerProducer module label; 548 optional, default: 'patTrigger' 549 - path : name of path to use; 550 optional, default: '' 551 - hltProcess : HLT process name; 552 optional, default: 'HLT' 553 - outputModule : output module label; 554 empty label indicates no output; 555 optional, default: 'out' 556 - postfix : postfix to apply to PAT module labels; 557 optional, default: '' 558 Using None as any argument restores its default value. 560 _label =
'switchOnTriggerMatchEmbedding' 561 _defaultParameters = dicttypes.SortedKeysDict()
564 ConfigToolBase.__init__( self )
565 self.addParameter( self.
_defaultParameters,
'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
567 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
568 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
569 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
570 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
571 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
579 , triggerMatchers =
None 580 , triggerProducer =
None 583 , outputModule =
None 586 if triggerMatchers
is None:
588 self.setParameter(
'exampleMatchers',
True )
589 if triggerProducer
is None:
593 if hltProcess
is None:
595 if outputModule
is None:
599 self.setParameter(
'triggerMatchers', triggerMatchers )
600 self.setParameter(
'triggerProducer', triggerProducer )
601 self.setParameter(
'path' , path )
602 self.setParameter(
'hltProcess' , hltProcess )
603 self.setParameter(
'outputModule' , outputModule )
604 self.setParameter(
'postfix' , postfix )
605 self.apply( process )
608 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
609 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
610 triggerProducer = self.
_parameters[
'triggerProducer' ].value
612 hltProcess = self.
_parameters[
'hltProcess' ].value
613 outputModule = self.
_parameters[
'outputModule' ].value
619 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
620 task.add(process.triggerMatcherExamplesTask)
623 dictPatProducers = {
'PATPhotonCleaner' :
'PATTriggerMatchPhotonEmbedder' 624 ,
'PATElectronCleaner':
'PATTriggerMatchElectronEmbedder' 625 ,
'PATMuonCleaner' :
'PATTriggerMatchMuonEmbedder' 626 ,
'PATTauCleaner' :
'PATTriggerMatchTauEmbedder' 627 ,
'PATJetCleaner' :
'PATTriggerMatchJetEmbedder' 628 ,
'PATMETCleaner' :
'PATTriggerMatchMETEmbedder' 631 ,
'PATPhotonSelector' :
'PATTriggerMatchPhotonEmbedder' 632 ,
'PATElectronSelector':
'PATTriggerMatchElectronEmbedder' 633 ,
'PATMuonSelector' :
'PATTriggerMatchMuonEmbedder' 634 ,
'PATTauSelector' :
'PATTriggerMatchTauEmbedder' 635 ,
'PATJetSelector' :
'PATTriggerMatchJetEmbedder' 636 ,
'PATMETSelector' :
'PATTriggerMatchMETEmbedder' 640 ,
'PATPhotonRefSelector' :
'PATTriggerMatchPhotonEmbedder' 641 ,
'PATElectronRefSelector':
'PATTriggerMatchElectronEmbedder' 642 ,
'PATMuonRefSelector' :
'PATTriggerMatchMuonEmbedder' 643 ,
'PATTauRefSelector' :
'PATTriggerMatchTauEmbedder' 644 ,
'PATJetRefSelector' :
'PATTriggerMatchJetEmbedder' 645 ,
'PATMETRefSelector' :
'PATTriggerMatchMETEmbedder' 649 ,
'PATPhotonProducer' :
'PATTriggerMatchPhotonEmbedder' 650 ,
'PATElectronProducer':
'PATTriggerMatchElectronEmbedder' 651 ,
'PATMuonProducer' :
'PATTriggerMatchMuonEmbedder' 652 ,
'PATTauProducer' :
'PATTriggerMatchTauEmbedder' 653 ,
'PATJetProducer' :
'PATTriggerMatchJetEmbedder' 654 ,
'PATMETProducer' :
'PATTriggerMatchMETEmbedder' 658 ,
'MuonSelectorVertex':
'PATTriggerMatchMuonEmbedder' 663 if not hasattr( process, triggerProducer ):
666 print(
' PAT trigger matching switched on automatically using')
667 print(
' switchOnTriggerMatchingStandAlone( process, \'%s\', None, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule, postfix ))
672 print(
' PAT trigger matching switched on automatically using')
673 print(
' switchOnTriggerMatchingStandAlone( process, \'%s\', %s, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerMatchers, triggerProducer, path, outputModule, postfix ))
676 elif exampleMatchers:
677 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
678 task.add(process.triggerMatcherExamplesTask)
681 for matcher
in triggerMatchers:
682 if not hasattr( process, matcher ):
684 print(
' PAT trigger matcher \'%s\' not known to process'%( matcher ))
685 print(
' ==> skipped')
688 trigMchMod = getattr( process, matcher )
689 patObjProd = getattr( process, trigMchMod.src.value() + postfix )
690 if trigMchMod.src.value()
in dictConfig:
691 dictConfig[ patObjProd.type_() ] += [ matcher ]
693 dictConfig[ patObjProd.type_() ] = [ matcher ]
696 patTriggerEventContent = []
697 for patObjProdType
in dictConfig.keys():
698 if patObjProdType
in dictPatProducers:
699 for matcher
in dictConfig[ patObjProdType ]:
700 trigMchMod = getattr( process, matcher )
701 patObjProd = getattr( process, trigMchMod.src.value() + postfix )
703 label = patObjProd.label_() +
'TriggerMatch' 704 if hasattr( process, label ):
706 print(
' PAT trigger match embedder \'%s\' exists already in process'%( label ))
707 print(
' ==> entry re-used')
709 module = getattr( process, label )
710 if not module.type_()
is dictPatProducers[ patObjProdType ]:
712 print(
' Configuration conflict for PAT trigger match embedder \'%s\''%( label ))
713 print(
' - exists as %s'%( module.type_() ))
714 print(
' - requested as %s by \'%s\''%( dictPatProducers[ patObjProdType ], matcher ))
715 print(
' ==> skipped')
718 if not module.src.value()
is trigMchMod.src.value() + postfix:
720 print(
' Configuration conflict for PAT trigger match embedder \'%s\''%( label ))
721 print(
' - exists for input %s'%( module.src.value() ))
722 print(
' - requested for input %s by \'%s\''%( trigMchMod.src.value() + postfix, matcher ))
723 print(
' ==> skipped')
726 module.matches.append( cms.InputTag( matcher ) )
728 module = cms.EDProducer( dictPatProducers[ patObjProdType ] )
729 module.src = cms.InputTag( patObjProd.label_() )
730 module.matches = cms.VInputTag( matcher )
733 patTriggerEventContent += [
'drop *_%s_*_*'%( patObjProd.label_() )
734 ,
'keep *_%s_*_%s'%( label, process.name_() )
738 print(
' Invalid input source for trigger match embedding')
739 print(
' ==> %s with matchers \'%s\' is skipped'%( patObjProdType, dictConfig[ patObjProdType ] ))
741 if outputModule
is not '':
742 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
def addToProcessAndTask(label, module, process, task)
S & print(S &os, JobReport::InputFile const &f)
def listModules(sequence)
def getPatAlgosToolsTask(process)