![]() |
![]() |
Inherits FWCore::GuiBrowsers::ConfigToolBase::ConfigToolBase.
Public Member Functions | |
def | __call__ |
def | __init__ |
def | getDefaultParameters |
def | toolCode |
Private Attributes | |
_comment | |
_parameters | |
Static Private Attributes | |
tuple | _defaultParameters = dicttypes.SortedKeysDict() |
string | _label = 'switchOnTriggerMatchingStandAlone' |
Enables trigger matching in PAT SwitchOnTriggerMatchingStandAlone( [cms.Process], triggerMatchers = [default list], triggerProducer = 'patTrigger', sequence = 'patDefaultSequence', hltProcess = 'HLT', outputModule = 'out', postfix = '' ) - [cms.Process] : the 'cms.Process' - triggerMatchers: PAT trigger matcher module labels (list) optional; default: defined in 'triggerMatchingDefaultSequence' (s. PhysicsTools/PatAlgos/python/triggerLayer1/triggerMatcher_cfi.py) - triggerProducer: PATTriggerProducer module label; optional, default: 'patTrigger' - sequence : name of sequence to use; optional, default: 'patDefaultSequence' - hltProcess : HLT process name; optional, default: 'HLT' - outputModule : output module label; empty label indicates no output; optional, default: 'out' - postfix : postfix to apply to PAT module labels; optional, default: '' Using None as any argument restores its default value.
Definition at line 440 of file trigTools.py.
def trigTools::SwitchOnTriggerMatchingStandAlone::__init__ | ( | self | ) |
Definition at line 463 of file trigTools.py.
00464 : 00465 ConfigToolBase.__init__( self ) 00466 self.addParameter( self._defaultParameters, 'triggerMatchers', _defaultTriggerMatchers, _defaultTriggerMatchersComment ) 00467 self.addParameter( self._defaultParameters, 'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment ) 00468 self.addParameter( self._defaultParameters, 'sequence' , _defaultSequence , _defaultSequenceComment ) 00469 self.addParameter( self._defaultParameters, 'hltProcess' , _defaultHltProcess , _defaultHltProcessComment ) 00470 self.addParameter( self._defaultParameters, 'outputModule' , _defaultOutputModule , _defaultOutputModuleComment ) 00471 self.addParameter( self._defaultParameters, 'postfix' , _defaultPostfix , _defaultPostfixComment ) 00472 self._parameters = copy.deepcopy( self._defaultParameters ) 00473 self._comment = ""
def trigTools::SwitchOnTriggerMatchingStandAlone::__call__ | ( | self, | |
process, | |||
triggerMatchers = None , |
|||
triggerProducer = None , |
|||
sequence = None , |
|||
hltProcess = None , |
|||
outputModule = None , |
|||
postfix = None |
|||
) |
Definition at line 477 of file trigTools.py.
00485 : 00486 if triggerMatchers is None: 00487 triggerMatchers = self._defaultParameters[ 'triggerMatchers' ].value 00488 if triggerProducer is None: 00489 triggerProducer = self._defaultParameters[ 'triggerProducer' ].value 00490 if sequence is None: 00491 sequence = self._defaultParameters[ 'sequence' ].value 00492 if hltProcess is None: 00493 hltProcess = self._defaultParameters[ 'hltProcess' ].value 00494 if outputModule is None: 00495 outputModule = self._defaultParameters[ 'outputModule' ].value 00496 if postfix is None: 00497 postfix = self._defaultParameters[ 'postfix' ].value 00498 self.setParameter( 'triggerMatchers', triggerMatchers ) 00499 self.setParameter( 'triggerProducer', triggerProducer ) 00500 self.setParameter( 'sequence' , sequence ) 00501 self.setParameter( 'hltProcess' , hltProcess ) 00502 self.setParameter( 'outputModule' , outputModule ) 00503 self.setParameter( 'postfix' , postfix ) 00504 self.apply( process )
def trigTools::SwitchOnTriggerMatchingStandAlone::getDefaultParameters | ( | self | ) |
Definition at line 474 of file trigTools.py.
def trigTools::SwitchOnTriggerMatchingStandAlone::toolCode | ( | self, | |
process | |||
) |
Definition at line 505 of file trigTools.py.
00506 : 00507 triggerMatchers = self._parameters[ 'triggerMatchers' ].value 00508 triggerProducer = self._parameters[ 'triggerProducer' ].value 00509 sequence = self._parameters[ 'sequence' ].value 00510 hltProcess = self._parameters[ 'hltProcess' ].value 00511 outputModule = self._parameters[ 'outputModule' ].value 00512 postfix = self._parameters[ 'postfix' ].value 00513 00514 # Load default producers from existing config file, if needed 00515 if not hasattr( process, 'triggerMatchingDefaultSequence' ): 00516 for matcher in triggerMatchers: 00517 if matcher in self.getDefaultParameters()[ 'triggerMatchers' ].value: 00518 process.load( "PhysicsTools.PatAlgos.triggerLayer1.triggerMatcher_cfi" ) 00519 break 00520 00521 # Switch on PAT trigger information if needed 00522 if triggerProducer not in _modulesInSequence( process, sequence ): 00523 print '%s():'%( self._label ) 00524 print ' PAT trigger production switched on automatically using' 00525 print ' switchOnTriggerStandAlone( process, %s, %s, %s, %s )'%( hltProcess, triggerProducer, sequence, outputModule ) 00526 print _longLine 00527 switchOnTriggerStandAlone( process, triggerProducer, sequence, hltProcess, outputModule ) 00528 00529 # Maintain configurations 00530 for matcher in triggerMatchers: 00531 trigMchMod = getattr( process, matcher ) 00532 trigMchMod.src = cms.InputTag( trigMchMod.src.getModuleLabel() + postfix ) 00533 trigMchMod.matched = triggerProducer 00534 if matcher in _modulesInSequence( process, sequence ): 00535 print '%s():'%( self._label ) 00536 print ' PAT trigger matcher %s exists already in sequence %s'%( matcher, sequence ) 00537 print ' ==> entry re-used' 00538 print _longLine 00539 else: 00540 # Sequence arithmetics for PAT trigger matcher modules 00541 index = len( getattr( process, sequence + 'Trigger' ).moduleNames() ) 00542 getattr( process, sequence + 'Trigger' ).insert( index, trigMchMod ) 00543 00544 # Add event content 00545 if outputModule is not '': 00546 patTriggerEventContent = [] 00547 for matcher in triggerMatchers: 00548 patTriggerEventContent += [ 'keep patTriggerObjectStandAlonesedmAssociation_%s_*_%s'%( matcher, process.name_() ) 00549 , 'keep *_%s_*_*'%( getattr( process, matcher ).src.value() ) 00550 ] 00551 getattr( process, outputModule ).outputCommands = _addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )
Definition at line 463 of file trigTools.py.
tuple trigTools::SwitchOnTriggerMatchingStandAlone::_defaultParameters = dicttypes.SortedKeysDict() [static, private] |
Definition at line 461 of file trigTools.py.
string trigTools::SwitchOnTriggerMatchingStandAlone::_label = 'switchOnTriggerMatchingStandAlone' [static, private] |
Definition at line 460 of file trigTools.py.
Definition at line 463 of file trigTools.py.