4 from PhysicsTools.PatAlgos.patEventContent_cff
import patTriggerL1RefsEventContent
6 from PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi
import _exampleTriggerMatchers
7 _defaultTriggerProducer =
'patTrigger' 8 _defaultTriggerEventProducer =
'patTriggerEvent' 10 _defaultHltProcess =
'HLT' 11 _defaultOutputModule =
'out' 14 _defaultTriggerMatchersComment =
"Trigger matcher modules' labels, default: ..." 15 _defaultTriggerProducerComment =
"PATTriggerProducer module label, default: %s"%( _defaultTriggerProducer )
16 _defaultTriggerEventProducerComment =
"PATTriggerEventProducer module label, default: %s"%( _defaultTriggerEventProducer )
17 _defaultPathComment =
"Name of path to use, default: %s"%( _defaultPath )
18 _defaultHltProcessComment =
"HLT process name, default: %s"%( _defaultHltProcess )
19 _defaultOutputModuleComment =
"Output module label, empty label indicates no output, default: %s"%( _defaultOutputModule )
20 _defaultPostfixComment =
"Postfix to apply to PAT module labels, default: %s"%( _defaultPostfix )
22 _longLine =
'---------------------------------------------------------------------' 26 return [ m.label()
for m
in listModules( getattr( process, pathLabel ) ) ]
31 for content
in eventContent:
32 if content
not in outputCommands:
33 outputCommands += [ content ]
36 for i
in range( len( outputCommands ) ):
39 command = outputCommands[ i ]
40 if command[ : 4 ] ==
'keep':
41 dropCommand = command.replace(
'keep ',
'drop ' )
42 for j
in range( i + 1, len( outputCommands ) ):
43 testCommand = outputCommands[ j ]
44 if testCommand == command:
46 elif testCommand == dropCommand:
47 listToRemove += [ i, j ]
50 newOutputCommands = cms.untracked.vstring()
51 for i
in range( len( outputCommands ) ):
52 if i
not in listToRemove:
53 newOutputCommands += [ outputCommands[ i ] ]
55 return newOutputCommands
59 """ Enables trigger information in PAT 60 SwitchOnTrigger( [cms.Process], triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', path = '', hltProcess = 'HLT', outputModule = 'out' ) 61 - [cms.Process] : the 'cms.Process' 62 - triggerProducer : PATTriggerProducer module label; 63 optional, default: 'patTrigger' 64 - triggerEventProducer: PATTriggerEventProducer module label; 65 optional, default: 'patTriggerEvent' 66 - path : name of path to use; 68 - hltProcess : HLT process name; 69 optional, default: 'HLT' 70 - outputModule : output module label; 71 empty label indicates no output; 72 optional, default: 'out' 73 Using None as any argument restores its default value. 75 _label =
'switchOnTrigger' 76 _defaultParameters = dicttypes.SortedKeysDict()
79 ConfigToolBase.__init__( self )
80 self.addParameter( self.
_defaultParameters,
'triggerProducer' , _defaultTriggerProducer , _defaultTriggerProducerComment )
81 self.addParameter( self.
_defaultParameters,
'triggerEventProducer', _defaultTriggerEventProducer, _defaultTriggerEventProducerComment )
82 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
83 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
84 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
92 , triggerProducer =
None 93 , triggerEventProducer =
None 98 if triggerProducer
is None:
100 if triggerEventProducer
is None:
104 if hltProcess
is None:
106 if outputModule
is None:
108 self.setParameter(
'triggerProducer' , triggerProducer )
109 self.setParameter(
'triggerEventProducer', triggerEventProducer )
110 self.setParameter(
'path' , path )
111 self.setParameter(
'hltProcess' , hltProcess )
112 self.setParameter(
'outputModule' , outputModule )
113 self.apply( process )
116 triggerProducer = self.
_parameters[
'triggerProducer' ].value
117 triggerEventProducer = self.
_parameters[
'triggerEventProducer' ].value
119 hltProcess = self.
_parameters[
'hltProcess' ].value
120 outputModule = self.
_parameters[
'outputModule' ].value
125 if not hasattr( process, triggerProducer ):
129 print '%s():'%( self.
_label )
130 print ' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer )
131 print ' ==> entry re-used' 133 if not hasattr( process, triggerEventProducer ):
137 print '%s():'%( self.
_label )
138 print ' PATTriggerEventProducer module \'%s\' exists already in process'%( triggerEventProducer )
139 print ' ==> entry re-used' 143 trigProdMod = getattr( process, triggerProducer )
144 trigProdMod.processName = hltProcess
145 if trigProdMod.onlyStandAlone.value()
is True:
146 trigProdMod.onlyStandAlone =
False 147 print ' configuration parameter automatically changed' 148 print ' PATTriggerProducer %s.onlyStandAlone --> %s'%( triggerProducer, trigProdMod.onlyStandAlone )
150 trigEvtProdMod = getattr( process, triggerEventProducer )
151 trigEvtProdMod.processName = hltProcess
152 trigEvtProdMod.patTriggerProducer = cms.InputTag( triggerProducer )
154 if not hasattr( process, path ):
155 prodPath = cms.Path( trigProdMod + trigEvtProdMod )
156 setattr( process, path, prodPath )
157 print '%s():'%( self.
_label )
158 print ' Path \'%s\' does not exist in process'%( path )
165 prodPath = getattr( process, path )
166 prodPath += trigProdMod
168 prodPath = getattr( process, path )
169 prodPath += trigEvtProdMod
172 if outputModule
is not '':
173 patTriggerEventContent = [
'keep patTriggerObjects_%s_*_%s'%( triggerProducer, process.name_() )
174 ,
'keep patTriggerFilters_%s_*_%s'%( triggerProducer, process.name_() )
175 ,
'keep patTriggerPaths_%s_*_%s'%( triggerProducer, process.name_() )
176 ,
'keep patTriggerEvent_%s_*_%s'%( triggerEventProducer, process.name_() )
178 if ( hasattr( trigProdMod,
'addL1Algos' )
and trigProdMod.addL1Algos.value()
is True ):
179 patTriggerEventContent += [
'keep patTriggerConditions_%s_*_%s'%( triggerProducer, process.name_() )
180 ,
'keep patTriggerAlgorithms_%s_*_%s'%( triggerProducer, process.name_() )
182 if ( hasattr( trigProdMod,
'saveL1Refs' )
and trigProdMod.saveL1Refs.value()
is True ):
183 patTriggerEventContent += patTriggerL1RefsEventContent
184 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
190 """ Enables trigger information in PAT, limited to stand-alone trigger objects 191 SwitchOnTriggerStandAlone( [cms.Process], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out' ) 192 - [cms.Process] : the 'cms.Process' 193 - triggerProducer : PATTriggerProducer module label; 194 optional, default: 'patTrigger' 195 - path : name of path to use; 196 optional, default: '' 197 - hltProcess : HLT process name; 198 optional, default: 'HLT' 199 - outputModule : output module label; 200 empty label indicates no output; 201 optional, default: 'out' 202 Using None as any argument restores its default value. 204 _label =
'switchOnTriggerStandAlone' 205 _defaultParameters = dicttypes.SortedKeysDict()
208 ConfigToolBase.__init__( self )
209 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
210 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
211 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
212 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
220 , triggerProducer =
None 223 , outputModule =
None 225 if triggerProducer
is None:
229 if hltProcess
is None:
231 if outputModule
is None:
233 self.setParameter(
'triggerProducer', triggerProducer )
234 self.setParameter(
'path' , path )
235 self.setParameter(
'hltProcess' , hltProcess )
236 self.setParameter(
'outputModule' , outputModule )
237 self.apply( process )
243 triggerProducer = self.
_parameters[
'triggerProducer' ].value
245 hltProcess = self.
_parameters[
'hltProcess' ].value
246 outputModule = self.
_parameters[
'outputModule' ].value
249 if not hasattr( process, triggerProducer ):
251 addToProcessAndTask(triggerProducer, patTrigger.clone( onlyStandAlone =
True ), process, task)
253 print '%s():'%( self.
_label )
254 print ' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer )
255 print ' ==> entry re-used' 259 trigProdMod = getattr( process, triggerProducer )
260 trigProdMod.processName = hltProcess
262 if not hasattr( process, path ):
263 prodPath = cms.Path( trigProdMod )
264 setattr( process, path, prodPath )
265 print '%s():'%( self.
_label )
266 print ' Path \'%s\' does not exist in process'%( path )
270 prodPath = getattr( process, path )
271 prodPath += trigProdMod
274 if outputModule
is not '':
275 patTriggerEventContent = [
'keep patTriggerObjectStandAlones_%s_*_%s'%( triggerProducer, process.name_() )
277 if ( hasattr( trigProdMod,
'saveL1Refs' )
and trigProdMod.saveL1Refs.value()
is True ):
278 patTriggerEventContent += patTriggerL1RefsEventContent
279 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
285 """ Enables trigger matching in PAT 286 SwitchOnTriggerMatching( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) 287 - [cms.Process] : the 'cms.Process' 288 - triggerMatchers : PAT trigger matcher module labels (list) 289 optional; default: defined in '_exampleTriggerMatchers' 290 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py) 291 - triggerProducer : PATTriggerProducer module label; 292 optional, default: 'patTrigger' 293 - triggerEventProducer: PATTriggerEventProducer module label; 294 optional, default: 'patTriggerEvent' 295 - path : name of path to use; 296 optional, default: 'patDefaultSequence' 297 - hltProcess : HLT process name; 298 optional, default: 'HLT' 299 - outputModule : output module label; 300 empty label indicates no output; 301 optional, default: 'out' 302 - postfix : postfix to apply to PAT module labels; 303 optional, default: '' 304 Using None as any argument restores its default value. 306 _label =
'switchOnTriggerMatching' 307 _defaultParameters = dicttypes.SortedKeysDict()
310 ConfigToolBase.__init__( self )
311 self.addParameter( self.
_defaultParameters,
'triggerMatchers' , _exampleTriggerMatchers , _defaultTriggerMatchersComment )
313 self.addParameter( self.
_defaultParameters,
'triggerProducer' , _defaultTriggerProducer , _defaultTriggerProducerComment )
314 self.addParameter( self.
_defaultParameters,
'triggerEventProducer', _defaultTriggerEventProducer, _defaultTriggerEventProducerComment )
315 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
316 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
317 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
318 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
326 , triggerMatchers =
None 327 , triggerProducer =
None 328 , triggerEventProducer =
None 331 , outputModule =
None 334 if triggerMatchers
is None:
336 self.setParameter(
'exampleMatchers',
True )
337 if triggerProducer
is None:
339 if triggerEventProducer
is None:
343 if hltProcess
is None:
345 if outputModule
is None:
349 self.setParameter(
'triggerMatchers' , triggerMatchers )
350 self.setParameter(
'triggerProducer' , triggerProducer )
351 self.setParameter(
'triggerEventProducer', triggerEventProducer )
352 self.setParameter(
'path' , path )
353 self.setParameter(
'hltProcess' , hltProcess )
354 self.setParameter(
'outputModule' , outputModule )
355 self.setParameter(
'postfix' , postfix )
356 self.apply( process )
359 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
360 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
361 triggerProducer = self.
_parameters[
'triggerProducer' ].value
362 triggerEventProducer = self.
_parameters[
'triggerEventProducer' ].value
364 hltProcess = self.
_parameters[
'hltProcess' ].value
365 outputModule = self.
_parameters[
'outputModule' ].value
371 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
372 task.add(process.triggerMatcherExamplesTask)
374 if not hasattr( process, triggerEventProducer ):
375 print '%s():'%( self.
_label )
376 print ' PAT trigger production switched on automatically using' 377 print ' switchOnTrigger( process, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, triggerEventProducer, path, outputModule )
379 switchOnTrigger( process, triggerProducer, triggerEventProducer, path, hltProcess, outputModule )
382 trigEvtProdMod = getattr( process, triggerEventProducer )
383 triggerMatchersKnown = []
384 for matcher
in triggerMatchers:
385 if not hasattr( process, matcher ):
386 print '%s():'%( self.
_label )
387 print ' Matcher \'%s\' not known to process'%( matcher )
391 triggerMatchersKnown.append( matcher )
392 trigMchMod = getattr( process, matcher )
393 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
394 trigMchMod.matched = triggerProducer
395 matchers = getattr( trigEvtProdMod,
'patTriggerMatches' )
396 if len( matchers ) > 0:
397 print '%s():'%( self.
_label )
398 print ' PAT trigger matchers already attached to existing PATTriggerEventProducer \'%s\''%( triggerEventProducer )
399 print ' configuration parameters automatically changed' 400 for matcher
in matchers:
401 trigMchMod = getattr( process, matcher )
402 if trigMchMod.matched.value()
is not triggerProducer:
403 trigMchMod.matched = triggerProducer
404 print ' PAT trigger matcher %s.matched --> %s'%( matcher, trigMchMod.matched )
407 trigEvtProdMod.patTriggerMatches = cms.VInputTag()
408 for matcher
in triggerMatchersKnown:
409 trigEvtProdMod.patTriggerMatches.append( cms.InputTag( matcher ) )
412 if outputModule
is not '':
413 patTriggerEventContent = []
414 for matcher
in triggerMatchersKnown:
415 patTriggerEventContent += [
'keep patTriggerObjectsedmAssociation_%s_%s_%s'%( triggerEventProducer, matcher, process.name_() )
416 ,
'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
418 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
424 """ Enables trigger matching in PAT 425 SwitchOnTriggerMatchingStandAlone( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) 426 - [cms.Process] : the 'cms.Process' 427 - triggerMatchers: PAT trigger matcher module labels (list) 428 optional; default: defined in 'triggerMatchingDefaultSequence' 429 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py) 430 - triggerProducer: PATTriggerProducer module label; 431 optional, default: 'patTrigger' 432 - path : name of path to use; 433 optional, default: '' 434 - hltProcess : HLT process name; 435 optional, default: 'HLT' 436 - outputModule : output module label; 437 empty label indicates no output; 438 optional, default: 'out' 439 - postfix : postfix to apply to PAT module labels; 440 optional, default: '' 441 Using None as any argument restores its default value. 443 _label =
'switchOnTriggerMatchingStandAlone' 444 _defaultParameters = dicttypes.SortedKeysDict()
447 ConfigToolBase.__init__( self )
448 self.addParameter( self.
_defaultParameters,
'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
450 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
451 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
452 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
453 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
454 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
462 , triggerMatchers =
None 463 , triggerProducer =
None 466 , outputModule =
None 469 if triggerMatchers
is None:
471 self.setParameter(
'exampleMatchers',
True )
472 if triggerProducer
is None:
476 if hltProcess
is None:
478 if outputModule
is None:
482 self.setParameter(
'triggerMatchers', triggerMatchers )
483 self.setParameter(
'triggerProducer', triggerProducer )
484 self.setParameter(
'path' , path )
485 self.setParameter(
'hltProcess' , hltProcess )
486 self.setParameter(
'outputModule' , outputModule )
487 self.setParameter(
'postfix' , postfix )
488 self.apply( process )
491 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
492 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
493 triggerProducer = self.
_parameters[
'triggerProducer' ].value
495 hltProcess = self.
_parameters[
'hltProcess' ].value
496 outputModule = self.
_parameters[
'outputModule' ].value
502 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
503 task.add(process.triggerMatcherExamplesTask)
506 if not hasattr( process, triggerProducer ):
507 print '%s():'%( self.
_label )
508 print ' PAT trigger production switched on automatically using' 509 print ' switchOnTriggerStandAlone( process, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule )
514 triggerMatchersKnown = []
515 for matcher
in triggerMatchers:
516 if not hasattr( process, matcher ):
517 print '%s():'%( self.
_label )
518 print ' Matcher \'%s\' not known to process'%( matcher )
522 triggerMatchersKnown.append( matcher )
523 trigMchMod = getattr( process, matcher )
524 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
525 trigMchMod.matched = triggerProducer
528 if outputModule
is not '':
529 patTriggerEventContent = []
530 for matcher
in triggerMatchersKnown:
531 patTriggerEventContent += [
'keep patTriggerObjectStandAlonesedmAssociation_%s_*_%s'%( matcher, process.name_() )
532 ,
'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
534 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
540 """ Enables embedding of trigger matches into PAT objects 541 SwitchOnTriggerMatchEmbedding( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) 542 - [cms.Process] : the 'cms.Process' 543 - triggerMatchers: PAT trigger matcher module labels (list) 544 optional; default: defined in 'triggerMatchingDefaultSequence' 545 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py) 546 - triggerProducer: PATTriggerProducer module label; 547 optional, default: 'patTrigger' 548 - path : name of path to use; 549 optional, default: '' 550 - hltProcess : HLT process name; 551 optional, default: 'HLT' 552 - outputModule : output module label; 553 empty label indicates no output; 554 optional, default: 'out' 555 - postfix : postfix to apply to PAT module labels; 556 optional, default: '' 557 Using None as any argument restores its default value. 559 _label =
'switchOnTriggerMatchEmbedding' 560 _defaultParameters = dicttypes.SortedKeysDict()
563 ConfigToolBase.__init__( self )
564 self.addParameter( self.
_defaultParameters,
'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
566 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
567 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
568 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
569 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
570 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
578 , triggerMatchers =
None 579 , triggerProducer =
None 582 , outputModule =
None 585 if triggerMatchers
is None:
587 self.setParameter(
'exampleMatchers',
True )
588 if triggerProducer
is None:
592 if hltProcess
is None:
594 if outputModule
is None:
598 self.setParameter(
'triggerMatchers', triggerMatchers )
599 self.setParameter(
'triggerProducer', triggerProducer )
600 self.setParameter(
'path' , path )
601 self.setParameter(
'hltProcess' , hltProcess )
602 self.setParameter(
'outputModule' , outputModule )
603 self.setParameter(
'postfix' , postfix )
604 self.apply( process )
607 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
608 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
609 triggerProducer = self.
_parameters[
'triggerProducer' ].value
611 hltProcess = self.
_parameters[
'hltProcess' ].value
612 outputModule = self.
_parameters[
'outputModule' ].value
618 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
619 task.add(process.triggerMatcherExamplesTask)
622 dictPatProducers = {
'PATPhotonCleaner' :
'PATTriggerMatchPhotonEmbedder' 623 ,
'PATElectronCleaner':
'PATTriggerMatchElectronEmbedder' 624 ,
'PATMuonCleaner' :
'PATTriggerMatchMuonEmbedder' 625 ,
'PATTauCleaner' :
'PATTriggerMatchTauEmbedder' 626 ,
'PATJetCleaner' :
'PATTriggerMatchJetEmbedder' 627 ,
'PATMETCleaner' :
'PATTriggerMatchMETEmbedder' 630 ,
'PATPhotonSelector' :
'PATTriggerMatchPhotonEmbedder' 631 ,
'PATElectronSelector':
'PATTriggerMatchElectronEmbedder' 632 ,
'PATMuonSelector' :
'PATTriggerMatchMuonEmbedder' 633 ,
'PATTauSelector' :
'PATTriggerMatchTauEmbedder' 634 ,
'PATJetSelector' :
'PATTriggerMatchJetEmbedder' 635 ,
'PATMETSelector' :
'PATTriggerMatchMETEmbedder' 639 ,
'PATPhotonRefSelector' :
'PATTriggerMatchPhotonEmbedder' 640 ,
'PATElectronRefSelector':
'PATTriggerMatchElectronEmbedder' 641 ,
'PATMuonRefSelector' :
'PATTriggerMatchMuonEmbedder' 642 ,
'PATTauRefSelector' :
'PATTriggerMatchTauEmbedder' 643 ,
'PATJetRefSelector' :
'PATTriggerMatchJetEmbedder' 644 ,
'PATMETRefSelector' :
'PATTriggerMatchMETEmbedder' 648 ,
'PATPhotonProducer' :
'PATTriggerMatchPhotonEmbedder' 649 ,
'PATElectronProducer':
'PATTriggerMatchElectronEmbedder' 650 ,
'PATMuonProducer' :
'PATTriggerMatchMuonEmbedder' 651 ,
'PATTauProducer' :
'PATTriggerMatchTauEmbedder' 652 ,
'PATJetProducer' :
'PATTriggerMatchJetEmbedder' 653 ,
'PATMETProducer' :
'PATTriggerMatchMETEmbedder' 657 ,
'MuonSelectorVertex':
'PATTriggerMatchMuonEmbedder' 662 if not hasattr( process, triggerProducer ):
664 print '%s():'%( self.
_label )
665 print ' PAT trigger matching switched on automatically using' 666 print ' switchOnTriggerMatchingStandAlone( process, \'%s\', None, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule, postfix )
670 print '%s():'%( self.
_label )
671 print ' PAT trigger matching switched on automatically using' 672 print ' switchOnTriggerMatchingStandAlone( process, \'%s\', %s, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerMatchers, triggerProducer, path, outputModule, postfix )
675 elif exampleMatchers:
676 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
677 task.add(process.triggerMatcherExamplesTask)
680 for matcher
in triggerMatchers:
681 if not hasattr( process, matcher ):
682 print '%s():'%( self.
_label )
683 print ' PAT trigger matcher \'%s\' not known to process'%( matcher )
687 trigMchMod = getattr( process, matcher )
688 patObjProd = getattr( process, trigMchMod.src.value() + postfix )
689 if trigMchMod.src.value()
in dictConfig:
690 dictConfig[ patObjProd.type_() ] += [ matcher ]
692 dictConfig[ patObjProd.type_() ] = [ matcher ]
695 patTriggerEventContent = []
696 for patObjProdType
in dictConfig.keys():
697 if patObjProdType
in dictPatProducers:
698 for matcher
in dictConfig[ patObjProdType ]:
699 trigMchMod = getattr( process, matcher )
700 patObjProd = getattr( process, trigMchMod.src.value() + postfix )
702 label = patObjProd.label_() +
'TriggerMatch' 703 if hasattr( process, label ):
704 print '%s():'%( self.
_label )
705 print ' PAT trigger match embedder \'%s\' exists already in process'%( label )
706 print ' ==> entry re-used' 708 module = getattr( process, label )
709 if not module.type_()
is dictPatProducers[ patObjProdType ]:
710 print '%s():'%( self.
_label )
711 print ' Configuration conflict for PAT trigger match embedder \'%s\''%( label )
712 print ' - exists as %s'%( module.type_() )
713 print ' - requested as %s by \'%s\''%( dictPatProducers[ patObjProdType ], matcher )
717 if not module.src.value()
is trigMchMod.src.value() + postfix:
718 print '%s():'%( self.
_label )
719 print ' Configuration conflict for PAT trigger match embedder \'%s\''%( label )
720 print ' - exists for input %s'%( module.src.value() )
721 print ' - requested for input %s by \'%s\''%( trigMchMod.src.value() + postfix, matcher )
725 module.matches.append( cms.InputTag( matcher ) )
727 module = cms.EDProducer( dictPatProducers[ patObjProdType ] )
728 module.src = cms.InputTag( patObjProd.label_() )
729 module.matches = cms.VInputTag( matcher )
732 patTriggerEventContent += [
'drop *_%s_*_*'%( patObjProd.label_() )
733 ,
'keep *_%s_*_%s'%( label, process.name_() )
736 print '%s():'%( self.
_label )
737 print ' Invalid input source for trigger match embedding' 738 print ' ==> %s with matchers \'%s\' is skipped'%( patObjProdType, dictConfig[ patObjProdType ] )
740 if outputModule
is not '':
741 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
def addToProcessAndTask(label, module, process, task)
def listModules(sequence)
def getPatAlgosToolsTask(process)