CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

trigTools::SwitchOnTriggerStandAlone Class Reference

Inherits FWCore::GuiBrowsers::ConfigToolBase::ConfigToolBase.

List of all members.

Public Member Functions

def __call__
def __init__
def getDefaultParameters
def toolCode

Private Attributes

 _comment
 _parameters

Static Private Attributes

tuple _defaultParameters = dicttypes.SortedKeysDict()
string _label = 'switchOnTriggerStandAlone'

Detailed Description

Enables trigger information in PAT, limited to stand-alone trigger objects
SwitchOnTriggerStandAlone( [cms.Process], triggerProducer = 'patTrigger', sequence = 'patDefaultSequence', hltProcess = 'HLT', outputModule = 'out' )
- [cms.Process]       : the 'cms.Process'
- 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'
Using None as any argument restores its default value.

Definition at line 200 of file trigTools.py.


Constructor & Destructor Documentation

def trigTools::SwitchOnTriggerStandAlone::__init__ (   self)

Definition at line 218 of file trigTools.py.

00219                         :
00220         ConfigToolBase.__init__( self )
00221         self.addParameter( self._defaultParameters, 'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
00222         self.addParameter( self._defaultParameters, 'sequence'       , _defaultSequence       , _defaultSequenceComment )
00223         self.addParameter( self._defaultParameters, 'hltProcess'     , _defaultHltProcess     , _defaultHltProcessComment )
00224         self.addParameter( self._defaultParameters, 'outputModule'   , _defaultOutputModule   , _defaultOutputModuleComment )
00225         self._parameters = copy.deepcopy( self._defaultParameters )
00226         self._comment = ""


Member Function Documentation

def trigTools::SwitchOnTriggerStandAlone::__call__ (   self,
  process,
  triggerProducer = None,
  sequence = None,
  hltProcess = None,
  outputModule = None 
)

Definition at line 230 of file trigTools.py.

00236                  :
00237         if triggerProducer is None:
00238             triggerProducer = self._defaultParameters[ 'triggerProducer' ].value
00239         if sequence is None:
00240             sequence = self._defaultParameters[ 'sequence' ].value
00241         if hltProcess is None:
00242             hltProcess = self._defaultParameters[ 'hltProcess' ].value
00243         if outputModule is None:
00244             outputModule = self._defaultParameters[ 'outputModule' ].value
00245         self.setParameter( 'triggerProducer', triggerProducer )
00246         self.setParameter( 'sequence'       , sequence )
00247         self.setParameter( 'hltProcess'     , hltProcess )
00248         self.setParameter( 'outputModule'   , outputModule )
00249         self.apply( process )

def trigTools::SwitchOnTriggerStandAlone::getDefaultParameters (   self)

Definition at line 227 of file trigTools.py.

00228                                     :
00229         return self._defaultParameters

def trigTools::SwitchOnTriggerStandAlone::toolCode (   self,
  process 
)

Definition at line 250 of file trigTools.py.

00251                                  :
00252         triggerProducer = self._parameters[ 'triggerProducer' ].value
00253         sequence        = self._parameters[ 'sequence' ].value
00254         hltProcess      = self._parameters[ 'hltProcess' ].value
00255         outputModule    = self._parameters[ 'outputModule' ].value
00256 
00257         # Load default producer from existing config file, if needed
00258         if not hasattr( process, triggerProducer ):
00259             if triggerProducer is self.getDefaultParameters()[ 'triggerProducer' ].value:
00260                 process.load( "PhysicsTools.PatAlgos.triggerLayer1.triggerProducer_cfi" )
00261 
00262         # Maintain configuration
00263         prodSequence            = getattr( process, sequence )
00264         trigProdMod             = getattr( process, triggerProducer )
00265         trigProdMod.processName = hltProcess
00266         if triggerProducer in _modulesInSequence( process, sequence ):
00267             print '%s():'%( self._label )
00268             print '    PATTriggerProducer module %s exists already in sequence %s'%( triggerProducer, sequence )
00269             print '    ==> entry re-used'
00270             print _longLine
00271         else:
00272             # Sequence arithmetics for PATTriggerProducer module
00273             if trigProdMod.onlyStandAlone.value() is False:
00274                 trigProdMod.onlyStandAlone = True
00275                 print '%s():'%( self._label )
00276                 print '    configuration parameter automatically changed'
00277                 print '    PATTriggerProducer %s.onlyStandAlone --> %s'%( triggerProducer, trigProdMod.onlyStandAlone )
00278                 print _longLine
00279             if hasattr( process, sequence + 'Trigger' ):
00280                 index = len( getattr( process, sequence + 'Trigger' ).moduleNames() )
00281                 getattr( process, sequence + 'Trigger' ).insert( index, trigProdMod )
00282             else:
00283                 patTriggerSequence = cms.Sequence( trigProdMod )
00284                 setattr( process, sequence + 'Trigger', patTriggerSequence )
00285                 prodSequence *= getattr( process, sequence + 'Trigger' )
00286 
00287         # Add event content
00288         if outputModule is not '':
00289             patTriggerEventContent = [ 'keep patTriggerObjectStandAlones_%s_*_%s'%( triggerProducer, process.name_() )
00290                                      ]
00291             if hasattr( trigProdMod, 'saveL1Refs' ) and trigProdMod.saveL1Refs.value() is True:
00292                 patTriggerEventContent += patTriggerL1RefsEventContent
00293             getattr( process, outputModule ).outputCommands = _addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )


Member Data Documentation

Definition at line 218 of file trigTools.py.

tuple trigTools::SwitchOnTriggerStandAlone::_defaultParameters = dicttypes.SortedKeysDict() [static, private]

Definition at line 216 of file trigTools.py.

Definition at line 215 of file trigTools.py.

Definition at line 218 of file trigTools.py.