CMS 3D CMS Logo

Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions

confdb::HLTProcess Class Reference

List of all members.

Public Member Functions

def __init__
def consolidateNegativeList
def consolidatePositiveList
def customize
def dump
def expandWildcards
def getPathList
def getRawConfigurationFromDB
def releaseSpecificCustomize

Public Attributes

 config
 data
 labels
 options
 parent
 source

Static Public Attributes

tuple fastsimUnsupportedPaths

Private Member Functions

def _build_cmdline
def _build_options
def _build_query

Detailed Description

Definition at line 20 of file confdb.py.


Constructor & Destructor Documentation

def confdb::HLTProcess::__init__ (   self,
  configuration 
)

Definition at line 95 of file confdb.py.

00096                                    :
00097     self.config = configuration
00098     self.data   = None
00099     self.source = None
00100     self.parent = None
00101 
00102     self.options = {
00103       'essources' : [],
00104       'esmodules' : [],
00105       'modules'   : [],
00106       'sequences' : [],
00107       'services'  : [],
00108       'paths'     : [],
00109       'psets'     : [],
00110       'blocks'    : [],
00111     }
00112 
00113     self.labels = {}
00114     if self.config.fragment:
00115       self.labels['process'] = ''
00116       self.labels['dict']    = 'locals()'
00117     else:
00118       self.labels['process'] = 'process.'
00119       self.labels['dict']    = 'process.__dict__'
00120 
00121     if self.config.online:
00122       self.labels['connect'] = 'frontier://(proxyurl=https://localhost:3128)(serverurl=https://localhost:8000/FrontierOnProd)(serverurl=https://localhost:8000/FrontierOnProd)(retrieve-ziplevel=0)'
00123     else:
00124       self.labels['connect'] = 'frontier://FrontierProd'
00125 
00126     # get the configuration from ConfdB
00127     self.buildPathList()
00128     self.buildOptions()
00129     self.getRawConfigurationFromDB()
00130     self.customize()
00131 


Member Function Documentation

def confdb::HLTProcess::_build_cmdline (   self) [private]

Definition at line 141 of file confdb.py.

00142                           :
00143     if not self.config.fragment:
00144       return 'edmConfigFromDB       %s --noedsources %s' % (self._build_query(), self._build_options())
00145     else:
00146       return 'edmConfigFromDB --cff %s --noedsources %s' % (self._build_query(), self._build_options())
00147 

def confdb::HLTProcess::_build_options (   self) [private]

Definition at line 138 of file confdb.py.

00139                           :
00140     return ' '.join(['--%s %s' % (key, ','.join(vals)) for key, vals in self.options.iteritems() if vals])

def confdb::HLTProcess::_build_query (   self) [private]

Definition at line 132 of file confdb.py.

00133                         :
00134     if self.config.menu.run:
00135       return '--runNumber %s' % self.config.menu.run
00136     else:
00137       return '--%s --configName %s' % (self.config.menu.db, self.config.menu.name)

def confdb::HLTProcess::consolidateNegativeList (   elements)

Definition at line 183 of file confdb.py.

00184                                        :
00185     # consolidate a list of path exclusions and re-inclusions
00186     # the result is the list of paths to be removed from the dump
00187     result = set()
00188     for element in elements:
00189       if element[0] == '-':
00190         result.add( element )
00191       else:
00192         result.discard( '-' + element )
00193     return sorted( element for element in result )

def confdb::HLTProcess::consolidatePositiveList (   elements)

Definition at line 195 of file confdb.py.

00196                                        :
00197     # consolidate a list of path selection and re-exclusions
00198     # the result is the list of paths to be included in the dump
00199     result = set()
00200     for element in elements:
00201       if element[0] == '-':
00202         result.discard( element[1:] )
00203       else:
00204         result.add( element )
00205     return sorted( element for element in result )
00206 

def confdb::HLTProcess::customize (   self)

Definition at line 346 of file confdb.py.

00347                      :
00348 
00349     # adapt the source to the current scenario
00350     if not self.config.fragment:
00351       self.build_source()
00352 
00353     # manual override some parameters
00354     if self.config.type in ('GRun', ):
00355       self.data += """
00356 # Enable HF Noise filters in GRun menu
00357 if 'hltHfreco' in %(dict)s:
00358     %(process)shltHfreco.setNoiseFlags = cms.bool( True )
00359 """
00360     if self.config.type in ('HIon', ):
00361       self.data += """
00362 # Disable HF Noise filters in HIon menu
00363 if 'hltHfreco' in %(dict)s:
00364     %(process)shltHfreco.setNoiseFlags = cms.bool( False )
00365 """
00366 
#    self.data += """
def confdb::HLTProcess::dump (   self)

Definition at line 208 of file confdb.py.

00209                 :
00210     return self.data % self.labels
00211 

def confdb::HLTProcess::expandWildcards (   globs,
  collection 
)

Definition at line 167 of file confdb.py.

00168                                         :
00169     # expand a list of unix-style wildcards matching a given collection
00170     # wildcards with no matches are silently discarded
00171     matches = []
00172     for glob in globs:
00173       negate = ''
00174       if glob[0] == '-':
00175         negate = '-'
00176         glob   = glob[1:]
00177       # translate a unix-style glob expression into a regular expression
00178       filter = re.compile(r'^' + glob.replace('?', '.').replace('*', '.*').replace('[!', '[^') + r'$')
00179       matches.extend( negate + element for element in collection if filter.match(element) )
00180     return matches
00181 

def confdb::HLTProcess::getPathList (   self)

Definition at line 156 of file confdb.py.

00157                        :
00158     cmdline = 'edmConfigFromDB --cff %s --noedsources --noes --noservices --nosequences --nomodules' % self._build_query()
00159     data = _pipe(cmdline)
00160     if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00161       raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00162     filter = re.compile(r' *= *cms.(End)?Path.*')
00163     paths  = [ filter.sub('', line) for line in data.splitlines() if filter.search(line) ]
00164     return paths
00165 

def confdb::HLTProcess::getRawConfigurationFromDB (   self)

Definition at line 148 of file confdb.py.

00149                                      :
00150     cmdline = self._build_cmdline()
00151     data = _pipe(cmdline)
00152     if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00153       raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00154     self.data = data
00155 

def confdb::HLTProcess::releaseSpecificCustomize (   self)

Definition at line 213 of file confdb.py.

00214                                     :
00215     # version specific customizations
00216     self.data += """
00217 # CMSSW version specific customizations
00218 import os
00219 cmsswVersion = os.environ['CMSSW_VERSION']
00220 
00221 # customization for CMSSW_5_2_X
00222 if cmsswVersion.startswith('CMSSW_5_2_'):
00223 
00224     # force the use of the correct calo jet energy corrections
00225     if 'hltESPL1FastJetCorrectionESProducer' in %(dict)s:
00226         %(process)shltESPL1FastJetCorrectionESProducer.algorithm  = "AK5CaloHLT"
00227 
00228     if 'hltESPL2RelativeCorrectionESProducer' in %(dict)s:
00229         %(process)shltESPL2RelativeCorrectionESProducer.algorithm = "AK5CaloHLT"
00230 
00231     if 'hltESPL3AbsoluteCorrectionESProducer' in %(dict)s:
00232         %(process)shltESPL3AbsoluteCorrectionESProducer.algorithm = "AK5CaloHLT"
00233 
00234 
00235 # customization for CMSSW_5_3_X
00236 if cmsswVersion.startswith('CMSSW_5_3_'):
00237 
00238     # do not override the calo jet energy corrections in 5.3.x for consistency with the current MC samples
00239     pass
00240 
00241 
00242 # customization for CMSSW_6_1_X and 6_2_X
00243 if cmsswVersion.startswith('CMSSW_6_1_') or cmsswVersion.startswith('CMSSW_6_2_'):
00244 
00245     # force the use of the correct calo jet energy corrections
00246     if 'hltESPL1FastJetCorrectionESProducer' in %(dict)s:
00247         %(process)shltESPL1FastJetCorrectionESProducer.algorithm  = "AK5CaloHLT"
00248 
00249     if 'hltESPL2RelativeCorrectionESProducer' in %(dict)s:
00250         %(process)shltESPL2RelativeCorrectionESProducer.algorithm = "AK5CaloHLT"
00251 
00252     if 'hltESPL3AbsoluteCorrectionESProducer' in %(dict)s:
00253         %(process)shltESPL3AbsoluteCorrectionESProducer.algorithm = "AK5CaloHLT"
00254 
00255     # adapt the HLT menu to the "prototype for Event Interpretation" development
00256     if 'hltPFPileUp' in %(dict)s:
00257         # define new PFCandidateFwdPtrProducer module
00258         %(process)shltParticleFlowPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
00259             src = cms.InputTag('hltParticleFlow')
00260         )
00261         # add the new module before the hltPFPileUp module
00262         _sequence = None
00263         for _sequence in [ _sequence for _sequence in %(dict)s.itervalues() if isinstance(_sequence, cms._ModuleSequenceType)]:
00264             try:
00265                 _sequence.insert( _sequence.index(%(process)shltPFPileUp), %(process)shltParticleFlowPtrs )
00266             except ValueError:
00267                 pass
00268         # reconfigure hltPFPileUp and hltPFNoPileUp to use the new module
00269         %(process)shltPFPileUp.PFCandidates       = cms.InputTag( "hltParticleFlowPtrs" )
00270         %(process)shltPFNoPileUp.bottomCollection = cms.InputTag( "hltParticleFlowPtrs" )
00271 
00272 
00273 # customization for CMSSW_6_2_X only
00274 if cmsswVersion.startswith('CMSSW_6_2_'):
00275     # /Geometry/TrackerNumberingBuilder/trackerTopologyConstants_cfi.py
00276     %(process)strackerTopologyConstants = cms.ESProducer('TrackerTopologyEP',
00277       pxb_layerStartBit = cms.uint32(16),
00278       pxb_ladderStartBit = cms.uint32(8),
00279       pxb_moduleStartBit = cms.uint32(2),
00280       pxb_layerMask = cms.uint32(15),
00281       pxb_ladderMask = cms.uint32(255),
00282       pxb_moduleMask = cms.uint32(63),
00283       pxf_sideStartBit = cms.uint32(23),
00284       pxf_diskStartBit = cms.uint32(16),
00285       pxf_bladeStartBit = cms.uint32(10),
00286       pxf_panelStartBit = cms.uint32(8),
00287       pxf_moduleStartBit = cms.uint32(2),
00288       pxf_sideMask = cms.uint32(3),
00289       pxf_diskMask = cms.uint32(15),
00290       pxf_bladeMask = cms.uint32(63),
00291       pxf_panelMask = cms.uint32(3),
00292       pxf_moduleMask = cms.uint32(63),
00293       tec_sideStartBit = cms.uint32(18),
00294       tec_wheelStartBit = cms.uint32(14),
00295       tec_petal_fw_bwStartBit = cms.uint32(12),
00296       tec_petalStartBit = cms.uint32(8),
00297       tec_ringStartBit = cms.uint32(5),
00298       tec_moduleStartBit = cms.uint32(2),
00299       tec_sterStartBit = cms.uint32(0),
00300       tec_sideMask = cms.uint32(3),
00301       tec_wheelMask = cms.uint32(15),
00302       tec_petal_fw_bwMask = cms.uint32(3),
00303       tec_petalMask = cms.uint32(15),
00304       tec_ringMask = cms.uint32(7),
00305       tec_moduleMask = cms.uint32(7),
00306       tec_sterMask = cms.uint32(3),
00307       tib_layerStartBit = cms.uint32(14),
00308       tib_str_fw_bwStartBit = cms.uint32(12),
00309       tib_str_int_extStartBit = cms.uint32(10),
00310       tib_strStartBit = cms.uint32(4),
00311       tib_moduleStartBit = cms.uint32(2),
00312       tib_sterStartBit = cms.uint32(0),
00313       tib_layerMask = cms.uint32(7),
00314       tib_str_fw_bwMask = cms.uint32(3),
00315       tib_str_int_extMask = cms.uint32(3),
00316       tib_strMask = cms.uint32(63),
00317       tib_moduleMask = cms.uint32(3),
00318       tib_sterMask = cms.uint32(3),
00319       tid_sideStartBit = cms.uint32(13),
00320       tid_wheelStartBit = cms.uint32(11),
00321       tid_ringStartBit = cms.uint32(9),
00322       tid_module_fw_bwStartBit = cms.uint32(7),
00323       tid_moduleStartBit = cms.uint32(2),
00324       tid_sterStartBit = cms.uint32(0),
00325       tid_sideMask = cms.uint32(3),
00326       tid_wheelMask = cms.uint32(3),
00327       tid_ringMask = cms.uint32(3),
00328       tid_module_fw_bwMask = cms.uint32(3),
00329       tid_moduleMask = cms.uint32(31),
00330       tid_sterMask = cms.uint32(3),
00331       tob_layerStartBit = cms.uint32(14),
00332       tob_rod_fw_bwStartBit = cms.uint32(12),
00333       tob_rodStartBit = cms.uint32(5),
00334       tob_moduleStartBit = cms.uint32(2),
00335       tob_sterStartBit = cms.uint32(0),
00336       tob_layerMask = cms.uint32(7),
00337       tob_rod_fw_bwMask = cms.uint32(3),
00338       tob_rodMask = cms.uint32(127),
00339       tob_moduleMask = cms.uint32(7),
00340       tob_sterMask = cms.uint32(3),
00341       appendToDataLabel = cms.string('')
00342     )
00343 
00344 """


Member Data Documentation

Definition at line 95 of file confdb.py.

Definition at line 95 of file confdb.py.

Definition at line 22 of file confdb.py.

Definition at line 95 of file confdb.py.

Definition at line 95 of file confdb.py.

Definition at line 95 of file confdb.py.

Definition at line 95 of file confdb.py.