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', path = '', hltProcess = 'HLT', outputModule = 'out' )
- [cms.Process]       : the 'cms.Process'
- triggerProducer     : PATTriggerProducer module label;
                        optional, default: 'patTrigger'
- path                : name of path to use;
                        optional, default: ''
- 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 187 of file trigTools.py.


Constructor & Destructor Documentation

def trigTools::SwitchOnTriggerStandAlone::__init__ (   self)

Definition at line 205 of file trigTools.py.

00206                         :
00207         ConfigToolBase.__init__( self )
00208         self.addParameter( self._defaultParameters, 'triggerProducer', _defaultTriggerProducer, _defaultTriggerProducerComment )
00209         self.addParameter( self._defaultParameters, 'path'           , _defaultPath           , _defaultPathComment )
00210         self.addParameter( self._defaultParameters, 'hltProcess'     , _defaultHltProcess     , _defaultHltProcessComment )
00211         self.addParameter( self._defaultParameters, 'outputModule'   , _defaultOutputModule   , _defaultOutputModuleComment )
00212         self._parameters = copy.deepcopy( self._defaultParameters )
00213         self._comment = ""


Member Function Documentation

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

Definition at line 217 of file trigTools.py.

00223                  :
00224         if triggerProducer is None:
00225             triggerProducer = self._defaultParameters[ 'triggerProducer' ].value
00226         if path is None:
00227             path = self._defaultParameters[ 'path' ].value
00228         if hltProcess is None:
00229             hltProcess = self._defaultParameters[ 'hltProcess' ].value
00230         if outputModule is None:
00231             outputModule = self._defaultParameters[ 'outputModule' ].value
00232         self.setParameter( 'triggerProducer', triggerProducer )
00233         self.setParameter( 'path'           , path )
00234         self.setParameter( 'hltProcess'     , hltProcess )
00235         self.setParameter( 'outputModule'   , outputModule )
00236         self.apply( process )

def trigTools::SwitchOnTriggerStandAlone::getDefaultParameters (   self)

Definition at line 214 of file trigTools.py.

00215                                     :
00216         return self._defaultParameters

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

Definition at line 237 of file trigTools.py.

00238                                  :
00239         triggerProducer = self._parameters[ 'triggerProducer' ].value
00240         path            = self._parameters[ 'path' ].value
00241         hltProcess      = self._parameters[ 'hltProcess' ].value
00242         outputModule    = self._parameters[ 'outputModule' ].value
00243 
00244         # Load default producer from existing config file, if needed
00245         if not hasattr( process, triggerProducer ):
00246             from PhysicsTools.PatAlgos.triggerLayer1.triggerProducer_cfi import patTrigger
00247             setattr( process, triggerProducer, patTrigger.clone( onlyStandAlone = True ) )
00248         else:
00249             print '%s():'%( self._label )
00250             print '    PATTriggerProducer module \'%s\' exists already in process'%( triggerProducer )
00251             print '    ==> entry re-used'
00252             print _longLine
00253 
00254         # Maintain configuration
00255         trigProdMod             = getattr( process, triggerProducer )
00256         trigProdMod.processName = hltProcess
00257         if not path is '':
00258             if not hasattr( process, path ):
00259                 prodPath = cms.Path( trigProdMod )
00260                 setattr( process, path, prodPath )
00261                 print '%s():'%( self._label )
00262                 print '    Path \'%s\' does not exist in process'%( path )
00263                 print '    ==> created'
00264                 print _longLine
00265             elif not triggerProducer in _modulesInPath( process, path ):
00266                 prodPath = getattr( process, path )
00267                 prodPath += trigProdMod
00268 
00269         # Add event content
00270         if outputModule is not '':
00271             patTriggerEventContent = [ 'keep patTriggerObjectStandAlones_%s_*_%s'%( triggerProducer, process.name_() )
00272                                      ]
00273             if ( hasattr( trigProdMod, 'saveL1Refs' ) and trigProdMod.saveL1Refs.value() is True ):
00274                 patTriggerEventContent += patTriggerL1RefsEventContent
00275             getattr( process, outputModule ).outputCommands = _addEventContent( getattr( process, outputModule ).outputCommands, patTriggerEventContent )


Member Data Documentation

Definition at line 205 of file trigTools.py.

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

Definition at line 203 of file trigTools.py.

Definition at line 202 of file trigTools.py.

Definition at line 205 of file trigTools.py.