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
123 if not hasattr( process, triggerProducer ):
125 setattr( process, triggerProducer, patTrigger.clone() )
127 print '%s():'%( self.
_label )
128 print ' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer )
129 print ' ==> entry re-used'
131 if not hasattr( process, triggerEventProducer ):
133 setattr( process, triggerEventProducer, patTriggerEvent.clone() )
135 print '%s():'%( self.
_label )
136 print ' PATTriggerEventProducer module \'%s\' exists already in process'%( triggerEventProducer )
137 print ' ==> entry re-used'
141 trigProdMod = getattr( process, triggerProducer )
142 trigProdMod.processName = hltProcess
143 if trigProdMod.onlyStandAlone.value()
is True:
144 trigProdMod.onlyStandAlone =
False
145 print ' configuration parameter automatically changed'
146 print ' PATTriggerProducer %s.onlyStandAlone --> %s'%( triggerProducer, trigProdMod.onlyStandAlone )
148 trigEvtProdMod = getattr( process, triggerEventProducer )
149 trigEvtProdMod.processName = hltProcess
150 trigEvtProdMod.patTriggerProducer = cms.InputTag( triggerProducer )
152 if not hasattr( process, path ):
153 prodPath = cms.Path( trigProdMod + trigEvtProdMod )
154 setattr( process, path, prodPath )
155 print '%s():'%( self.
_label )
156 print ' Path \'%s\' does not exist in process'%( path )
163 prodPath = getattr( process, path )
164 prodPath += trigProdMod
166 prodPath = getattr( process, path )
167 prodPath += trigEvtProdMod
170 if outputModule
is not '':
171 patTriggerEventContent = [
'keep patTriggerObjects_%s_*_%s'%( triggerProducer, process.name_() )
172 ,
'keep patTriggerFilters_%s_*_%s'%( triggerProducer, process.name_() )
173 ,
'keep patTriggerPaths_%s_*_%s'%( triggerProducer, process.name_() )
174 ,
'keep patTriggerEvent_%s_*_%s'%( triggerEventProducer, process.name_() )
176 if ( hasattr( trigProdMod,
'addL1Algos' )
and trigProdMod.addL1Algos.value()
is True ):
177 patTriggerEventContent += [
'keep patTriggerConditions_%s_*_%s'%( triggerProducer, process.name_() )
178 ,
'keep patTriggerAlgorithms_%s_*_%s'%( triggerProducer, process.name_() )
180 if ( hasattr( trigProdMod,
'saveL1Refs' )
and trigProdMod.saveL1Refs.value()
is True ):
181 patTriggerEventContent += patTriggerL1RefsEventContent
182 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
188 """ Enables trigger information in PAT, limited to stand-alone trigger objects
189 SwitchOnTriggerStandAlone( [cms.Process], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out' )
190 - [cms.Process] : the 'cms.Process'
191 - triggerProducer : PATTriggerProducer module label;
192 optional, default: 'patTrigger'
193 - path : name of path to use;
194 optional, default: ''
195 - hltProcess : HLT process name;
196 optional, default: 'HLT'
197 - outputModule : output module label;
198 empty label indicates no output;
199 optional, default: 'out'
200 Using None as any argument restores its default value.
202 _label =
'switchOnTriggerStandAlone'
203 _defaultParameters = dicttypes.SortedKeysDict()
206 ConfigToolBase.__init__( self )
207 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
208 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
209 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
210 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
218 , triggerProducer =
None
221 , outputModule =
None
223 if triggerProducer
is None:
227 if hltProcess
is None:
229 if outputModule
is None:
231 self.setParameter(
'triggerProducer', triggerProducer )
232 self.setParameter(
'path' , path )
233 self.setParameter(
'hltProcess' , hltProcess )
234 self.setParameter(
'outputModule' , outputModule )
235 self.apply( process )
238 triggerProducer = self.
_parameters[
'triggerProducer' ].value
240 hltProcess = self.
_parameters[
'hltProcess' ].value
241 outputModule = self.
_parameters[
'outputModule' ].value
244 if not hasattr( process, triggerProducer ):
246 setattr( process, triggerProducer, patTrigger.clone( onlyStandAlone =
True ) )
248 print '%s():'%( self.
_label )
249 print ' PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer )
250 print ' ==> entry re-used'
254 trigProdMod = getattr( process, triggerProducer )
255 trigProdMod.processName = hltProcess
257 if not hasattr( process, path ):
258 prodPath = cms.Path( trigProdMod )
259 setattr( process, path, prodPath )
260 print '%s():'%( self.
_label )
261 print ' Path \'%s\' does not exist in process'%( path )
265 prodPath = getattr( process, path )
266 prodPath += trigProdMod
269 if outputModule
is not '':
270 patTriggerEventContent = [
'keep patTriggerObjectStandAlones_%s_*_%s'%( triggerProducer, process.name_() )
272 if ( hasattr( trigProdMod,
'saveL1Refs' )
and trigProdMod.saveL1Refs.value()
is True ):
273 patTriggerEventContent += patTriggerL1RefsEventContent
274 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
280 """ Enables trigger matching in PAT
281 SwitchOnTriggerMatching( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', triggerEventProducer = 'patTriggerEvent', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' )
282 - [cms.Process] : the 'cms.Process'
283 - triggerMatchers : PAT trigger matcher module labels (list)
284 optional; default: defined in '_exampleTriggerMatchers'
285 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py)
286 - triggerProducer : PATTriggerProducer module label;
287 optional, default: 'patTrigger'
288 - triggerEventProducer: PATTriggerEventProducer module label;
289 optional, default: 'patTriggerEvent'
290 - path : name of path to use;
291 optional, default: 'patDefaultSequence'
292 - hltProcess : HLT process name;
293 optional, default: 'HLT'
294 - outputModule : output module label;
295 empty label indicates no output;
296 optional, default: 'out'
297 - postfix : postfix to apply to PAT module labels;
298 optional, default: ''
299 Using None as any argument restores its default value.
301 _label =
'switchOnTriggerMatching'
302 _defaultParameters = dicttypes.SortedKeysDict()
305 ConfigToolBase.__init__( self )
306 self.addParameter( self.
_defaultParameters,
'triggerMatchers' , _exampleTriggerMatchers , _defaultTriggerMatchersComment )
308 self.addParameter( self.
_defaultParameters,
'triggerProducer' , _defaultTriggerProducer , _defaultTriggerProducerComment )
309 self.addParameter( self.
_defaultParameters,
'triggerEventProducer', _defaultTriggerEventProducer, _defaultTriggerEventProducerComment )
310 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
311 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
312 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
313 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
321 , triggerMatchers =
None
322 , triggerProducer =
None
323 , triggerEventProducer =
None
326 , outputModule =
None
329 if triggerMatchers
is None:
331 self.setParameter(
'exampleMatchers',
True )
332 if triggerProducer
is None:
334 if triggerEventProducer
is None:
338 if hltProcess
is None:
340 if outputModule
is None:
344 self.setParameter(
'triggerMatchers' , triggerMatchers )
345 self.setParameter(
'triggerProducer' , triggerProducer )
346 self.setParameter(
'triggerEventProducer', triggerEventProducer )
347 self.setParameter(
'path' , path )
348 self.setParameter(
'hltProcess' , hltProcess )
349 self.setParameter(
'outputModule' , outputModule )
350 self.setParameter(
'postfix' , postfix )
351 self.apply( process )
354 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
355 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
356 triggerProducer = self.
_parameters[
'triggerProducer' ].value
357 triggerEventProducer = self.
_parameters[
'triggerEventProducer' ].value
359 hltProcess = self.
_parameters[
'hltProcess' ].value
360 outputModule = self.
_parameters[
'outputModule' ].value
365 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
368 if not hasattr( process, triggerEventProducer ):
369 print '%s():'%( self.
_label )
370 print ' PAT trigger production switched on automatically using'
371 print ' switchOnTrigger( process, \'%s\', \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, triggerEventProducer, path, outputModule )
373 switchOnTrigger( process, triggerProducer, triggerEventProducer, path, hltProcess, outputModule )
376 trigEvtProdMod = getattr( process, triggerEventProducer )
377 triggerMatchersKnown = []
378 for matcher
in triggerMatchers:
379 if not hasattr( process, matcher ):
380 print '%s():'%( self.
_label )
381 print ' Matcher \'%s\' not known to process'%( matcher )
385 triggerMatchersKnown.append( matcher )
386 trigMchMod = getattr( process, matcher )
387 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
388 trigMchMod.matched = triggerProducer
389 matchers = getattr( trigEvtProdMod,
'patTriggerMatches' )
390 if len( matchers ) > 0:
391 print '%s():'%( self.
_label )
392 print ' PAT trigger matchers already attached to existing PATTriggerEventProducer \'%s\''%( triggerEventProducer )
393 print ' configuration parameters automatically changed'
394 for matcher
in matchers:
395 trigMchMod = getattr( process, matcher )
396 if trigMchMod.matched.value()
is not triggerProducer:
397 trigMchMod.matched = triggerProducer
398 print ' PAT trigger matcher %s.matched --> %s'%( matcher, trigMchMod.matched )
401 trigEvtProdMod.patTriggerMatches = cms.VInputTag()
402 for matcher
in triggerMatchersKnown:
403 trigEvtProdMod.patTriggerMatches.append( cms.InputTag( matcher ) )
406 if outputModule
is not '':
407 patTriggerEventContent = []
408 for matcher
in triggerMatchersKnown:
409 patTriggerEventContent += [
'keep patTriggerObjectsedmAssociation_%s_%s_%s'%( triggerEventProducer, matcher, process.name_() )
410 ,
'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
412 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
418 """ Enables trigger matching in PAT
419 SwitchOnTriggerMatchingStandAlone( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' )
420 - [cms.Process] : the 'cms.Process'
421 - triggerMatchers: PAT trigger matcher module labels (list)
422 optional; default: defined in 'triggerMatchingDefaultSequence'
423 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py)
424 - triggerProducer: PATTriggerProducer module label;
425 optional, default: 'patTrigger'
426 - path : name of path to use;
427 optional, default: ''
428 - hltProcess : HLT process name;
429 optional, default: 'HLT'
430 - outputModule : output module label;
431 empty label indicates no output;
432 optional, default: 'out'
433 - postfix : postfix to apply to PAT module labels;
434 optional, default: ''
435 Using None as any argument restores its default value.
437 _label =
'switchOnTriggerMatchingStandAlone'
438 _defaultParameters = dicttypes.SortedKeysDict()
441 ConfigToolBase.__init__( self )
442 self.addParameter( self.
_defaultParameters,
'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
444 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
445 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
446 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
447 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
448 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
456 , triggerMatchers =
None
457 , triggerProducer =
None
460 , outputModule =
None
463 if triggerMatchers
is None:
465 self.setParameter(
'exampleMatchers',
True )
466 if triggerProducer
is None:
470 if hltProcess
is None:
472 if outputModule
is None:
476 self.setParameter(
'triggerMatchers', triggerMatchers )
477 self.setParameter(
'triggerProducer', triggerProducer )
478 self.setParameter(
'path' , path )
479 self.setParameter(
'hltProcess' , hltProcess )
480 self.setParameter(
'outputModule' , outputModule )
481 self.setParameter(
'postfix' , postfix )
482 self.apply( process )
485 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
486 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
487 triggerProducer = self.
_parameters[
'triggerProducer' ].value
489 hltProcess = self.
_parameters[
'hltProcess' ].value
490 outputModule = self.
_parameters[
'outputModule' ].value
495 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
498 if not hasattr( process, triggerProducer ):
499 print '%s():'%( self.
_label )
500 print ' PAT trigger production switched on automatically using'
501 print ' switchOnTriggerStandAlone( process, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule )
506 triggerMatchersKnown = []
507 for matcher
in triggerMatchers:
508 if not hasattr( process, matcher ):
509 print '%s():'%( self.
_label )
510 print ' Matcher \'%s\' not known to process'%( matcher )
514 triggerMatchersKnown.append( matcher )
515 trigMchMod = getattr( process, matcher )
516 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix )
517 trigMchMod.matched = triggerProducer
520 if outputModule
is not '':
521 patTriggerEventContent = []
522 for matcher
in triggerMatchersKnown:
523 patTriggerEventContent += [
'keep patTriggerObjectStandAlonesedmAssociation_%s_*_%s'%( matcher, process.name_() )
524 ,
'keep *_%s_*_*'%( getattr( process, matcher ).src.value() )
526 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
532 """ Enables embedding of trigger matches into PAT objects
533 SwitchOnTriggerMatchEmbedding( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', path = '', hltProcess = 'HLT', outputModule = 'out', postfix = '' )
534 - [cms.Process] : the 'cms.Process'
535 - triggerMatchers: PAT trigger matcher module labels (list)
536 optional; default: defined in 'triggerMatchingDefaultSequence'
537 (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcherExamples_cfi.py)
538 - triggerProducer: PATTriggerProducer module label;
539 optional, default: 'patTrigger'
540 - path : name of path to use;
541 optional, default: ''
542 - hltProcess : HLT process name;
543 optional, default: 'HLT'
544 - outputModule : output module label;
545 empty label indicates no output;
546 optional, default: 'out'
547 - postfix : postfix to apply to PAT module labels;
548 optional, default: ''
549 Using None as any argument restores its default value.
551 _label =
'switchOnTriggerMatchEmbedding'
552 _defaultParameters = dicttypes.SortedKeysDict()
555 ConfigToolBase.__init__( self )
556 self.addParameter( self.
_defaultParameters,
'triggerMatchers', _exampleTriggerMatchers, _defaultTriggerMatchersComment )
558 self.addParameter( self.
_defaultParameters,
'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
559 self.addParameter( self.
_defaultParameters,
'path' , _defaultPath , _defaultPathComment )
560 self.addParameter( self.
_defaultParameters,
'hltProcess' , _defaultHltProcess , _defaultHltProcessComment )
561 self.addParameter( self.
_defaultParameters,
'outputModule' , _defaultOutputModule , _defaultOutputModuleComment )
562 self.addParameter( self.
_defaultParameters,
'postfix' , _defaultPostfix , _defaultPostfixComment )
570 , triggerMatchers =
None
571 , triggerProducer =
None
574 , outputModule =
None
577 if triggerMatchers
is None:
579 self.setParameter(
'exampleMatchers',
True )
580 if triggerProducer
is None:
584 if hltProcess
is None:
586 if outputModule
is None:
590 self.setParameter(
'triggerMatchers', triggerMatchers )
591 self.setParameter(
'triggerProducer', triggerProducer )
592 self.setParameter(
'path' , path )
593 self.setParameter(
'hltProcess' , hltProcess )
594 self.setParameter(
'outputModule' , outputModule )
595 self.setParameter(
'postfix' , postfix )
596 self.apply( process )
599 triggerMatchers = self.
_parameters[
'triggerMatchers' ].value
600 exampleMatchers = self.
_parameters[
'exampleMatchers' ].value
601 triggerProducer = self.
_parameters[
'triggerProducer' ].value
603 hltProcess = self.
_parameters[
'hltProcess' ].value
604 outputModule = self.
_parameters[
'outputModule' ].value
609 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
612 dictPatProducers = {
'PATPhotonCleaner' :
'PATTriggerMatchPhotonEmbedder'
613 ,
'PATElectronCleaner':
'PATTriggerMatchElectronEmbedder'
614 ,
'PATMuonCleaner' :
'PATTriggerMatchMuonEmbedder'
615 ,
'PATTauCleaner' :
'PATTriggerMatchTauEmbedder'
616 ,
'PATJetCleaner' :
'PATTriggerMatchJetEmbedder'
617 ,
'PATMETCleaner' :
'PATTriggerMatchMETEmbedder'
620 ,
'PATPhotonSelector' :
'PATTriggerMatchPhotonEmbedder'
621 ,
'PATElectronSelector':
'PATTriggerMatchElectronEmbedder'
622 ,
'PATMuonSelector' :
'PATTriggerMatchMuonEmbedder'
623 ,
'PATTauSelector' :
'PATTriggerMatchTauEmbedder'
624 ,
'PATJetSelector' :
'PATTriggerMatchJetEmbedder'
625 ,
'PATMETSelector' :
'PATTriggerMatchMETEmbedder'
629 ,
'PATPhotonRefSelector' :
'PATTriggerMatchPhotonEmbedder'
630 ,
'PATElectronRefSelector':
'PATTriggerMatchElectronEmbedder'
631 ,
'PATMuonRefSelector' :
'PATTriggerMatchMuonEmbedder'
632 ,
'PATTauRefSelector' :
'PATTriggerMatchTauEmbedder'
633 ,
'PATJetRefSelector' :
'PATTriggerMatchJetEmbedder'
634 ,
'PATMETRefSelector' :
'PATTriggerMatchMETEmbedder'
638 ,
'PATPhotonProducer' :
'PATTriggerMatchPhotonEmbedder'
639 ,
'PATElectronProducer':
'PATTriggerMatchElectronEmbedder'
640 ,
'PATMuonProducer' :
'PATTriggerMatchMuonEmbedder'
641 ,
'PATTauProducer' :
'PATTriggerMatchTauEmbedder'
642 ,
'PATJetProducer' :
'PATTriggerMatchJetEmbedder'
643 ,
'PATMETProducer' :
'PATTriggerMatchMETEmbedder'
647 ,
'MuonSelectorVertex':
'PATTriggerMatchMuonEmbedder'
652 if not hasattr( process, triggerProducer ):
654 print '%s():'%( self.
_label )
655 print ' PAT trigger matching switched on automatically using'
656 print ' switchOnTriggerMatchingStandAlone( process, \'%s\', None, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerProducer, path, outputModule, postfix )
660 print '%s():'%( self.
_label )
661 print ' PAT trigger matching switched on automatically using'
662 print ' switchOnTriggerMatchingStandAlone( process, \'%s\', %s, \'%s\', \'%s\', \'%s\', \'%s\' )'%( hltProcess, triggerMatchers, triggerProducer, path, outputModule, postfix )
665 elif exampleMatchers:
666 process.load(
"PhysicsTools.PatAlgos.triggerLayer1.triggerMatcherExamples_cfi" )
669 for matcher
in triggerMatchers:
670 if not hasattr( process, matcher ):
671 print '%s():'%( self.
_label )
672 print ' PAT trigger matcher \'%s\' not known to process'%( matcher )
676 trigMchMod = getattr( process, matcher )
677 patObjProd = getattr( process, trigMchMod.src.value() + postfix )
678 if trigMchMod.src.value()
in dictConfig:
679 dictConfig[ patObjProd.type_() ] += [ matcher ]
681 dictConfig[ patObjProd.type_() ] = [ matcher ]
684 patTriggerEventContent = []
685 for patObjProdType
in dictConfig.keys():
686 if dictPatProducers.has_key( patObjProdType ):
687 for matcher
in dictConfig[ patObjProdType ]:
688 trigMchMod = getattr( process, matcher )
689 patObjProd = getattr( process, trigMchMod.src.value() + postfix )
691 label = patObjProd.label_() +
'TriggerMatch'
692 if hasattr( process, label ):
693 print '%s():'%( self.
_label )
694 print ' PAT trigger match embedder \'%s\' exists already in process'%( label )
695 print ' ==> entry re-used'
697 module = getattr( process, label )
698 if not module.type_()
is dictPatProducers[ patObjProdType ]:
699 print '%s():'%( self.
_label )
700 print ' Configuration conflict for PAT trigger match embedder \'%s\''%( label )
701 print ' - exists as %s'%( module.type_() )
702 print ' - requested as %s by \'%s\''%( dictPatProducers[ patObjProdType ], matcher )
706 if not module.src.value()
is trigMchMod.src.value() + postfix:
707 print '%s():'%( self.
_label )
708 print ' Configuration conflict for PAT trigger match embedder \'%s\''%( label )
709 print ' - exists for input %s'%( module.src.value() )
710 print ' - requested for input %s by \'%s\''%( trigMchMod.src.value() + postfix, matcher )
714 module.matches.append( cms.InputTag( matcher ) )
716 module = cms.EDProducer( dictPatProducers[ patObjProdType ] )
717 module.src = cms.InputTag( patObjProd.label_() )
718 module.matches = cms.VInputTag( matcher )
719 setattr( process, label, module )
721 patTriggerEventContent += [
'drop *_%s_*_*'%( patObjProd.label_() )
722 ,
'keep *_%s_*_%s'%( label, process.name_() )
725 print '%s():'%( self.
_label )
726 print ' Invalid input source for trigger match embedding'
727 print ' ==> %s with matchers \'%s\' is skipped'%( patObjProdType, dictConfig[ patObjProdType ] )
729 if outputModule
is not '':
730 getattr( process, outputModule ).outputCommands =
_addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )