Skip to content

Commit

Permalink
Merge pull request #553 from fwyzard/cachedHlt_53x
Browse files Browse the repository at this point in the history
associate frozen HLT menus to the corresponding run ranges, and select them from cmsDriver.py
ktf committed Aug 16, 2013

Verified

This commit was signed with the committer’s verified signature.
Exirel Florian Strzelecki
2 parents 88db73b + f5ddb37 commit ff6b03e
Showing 2 changed files with 66 additions and 18 deletions.
36 changes: 36 additions & 0 deletions Configuration/HLT/python/cachedHLT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# used by cmsDriver when called like
# cmsDiver.py hlt -s HLT:cached:<runnumber>
# or
# cmsDiver.py hlt -s HLT:cached:fromSource

hltByRun = {
( 190456, 193621 ) : '5E33v4',
( 193834, 196531 ) : '7E33v2',
( 198022, 199608 ) : '7E33v3',
( 199698, 202504 ) : '7E33v4',
( 202970, 203709 ) : '7E33v4',
( 203777, 208686 ) : '8E33v2',
}


def getCachedHLT(run) :
# make sure run is an integer
run = int(run)

# look for a run range that contains the ginven run, and return the associated HLT key
for key in hltByRun:
if key[0] <= run <= key[1]:
return hltByRun[key]

# the given run was not found in any supported run range
raise Exception('The given run number (%d) is not supported' % run)


def loadCachedHltConfiguration(process, run, fastsim = False):
if fastsim:
process.load('HLTrigger/Configuration/HLT_%s_Famos_cff' % getCachedHLT(run))
else:
process.load('HLTrigger/Configuration/HLT_%s_cff' % getCachedHLT(run))

import FWCore.ParameterSet.Config as cms
cms.Process.loadCachedHltConfiguration = loadCachedHltConfiguration
48 changes: 30 additions & 18 deletions Configuration/PyReleaseValidation/python/ConfigBuilder.py
Original file line number Diff line number Diff line change
@@ -1393,32 +1393,44 @@ def prepare_HLT(self, sequence = None):
optionsForHLT['type'] = 'HIon'
else:
optionsForHLT['type'] = 'GRun'
optionsForHLTConfig = ', '.join('%s=%s' % (key, repr(val)) for (key, val) in optionsForHLT.iteritems())
if sequence == 'run,fromSource':
if hasattr(self.process.source,'firstRun'):
self.executeAndRemember('process.loadHltConfiguration("run:%%d"%%(process.source.firstRun.value()),%s)'%(optionsForHLTConfig))
elif hasattr(self.process.source,'setRunNumber'):
self.executeAndRemember('process.loadHltConfiguration("run:%%d"%%(process.source.setRunNumber.value()),%s)'%(optionsForHLTConfig))
else:
raise Exception('Cannot replace menu to load %s'%(sequence))
else:
self.executeAndRemember('process.loadHltConfiguration("%s",%s)'%(sequence.replace(',',':'),optionsForHLTConfig))
optionsForHLTConfig = ', '.join('%s=%s' % (key, repr(val)) for (key, val) in optionsForHLT.iteritems())
if sequence == 'run,fromSource':
if hasattr(self.process.source,'firstRun'):
self.executeAndRemember('process.loadHltConfiguration("run:%%d" %% (process.source.firstRun.value()), %s)' % (optionsForHLTConfig))
elif hasattr(self.process.source,'setRunNumber'):
self.executeAndRemember('process.loadHltConfiguration("run:%%d" %% (process.source.setRunNumber.value()), %s)' % (optionsForHLTConfig))
else:
raise Exception('Cannot replace menu to load %s'%(sequence))
elif sequence == 'cached,fromSource':
self.executeAndRemember('import Configuration.HLT.cachedHLT')
if hasattr(self.process.source,'firstRun'):
self.executeAndRemember('process.loadCachedHltConfiguration( process.source.firstRun.value(), %s )' % ('FASTSIM' in self.stepMap))
elif hasattr(self.process.source,'setRunNumber'):
self.executeAndRemember('process.loadCachedHltConfiguration( process.source.setRunNumber.value(), %s )' % ('FASTSIM' in self.stepMap))
else:
raise Exception('Cannot replace menu to load %s'%(sequence))
elif sequence.startswith( 'cached,' ):
run = int( sequence.split(',')[1] )
self.executeAndRemember('import Configuration.HLT.cachedHLT')
self.executeAndRemember('process.loadCachedHltConfiguration( %d, %s )' % (run, 'FASTSIM' in self.stepMap))
else:
self.executeAndRemember('process.loadHltConfiguration("%s",%s)'%(sequence.replace(',',':'),optionsForHLTConfig))
else:
if 'FASTSIM' in self.stepMap:
self.loadAndRemember('HLTrigger/Configuration/HLT_%s_Famos_cff' % sequence)
else:
self.loadAndRemember('HLTrigger/Configuration/HLT_%s_cff' % sequence)

if self._options.isMC:
self._options.customisation_file+=",HLTrigger/Configuration/customizeHLTforMC.customizeHLTforMC"
if self._options.name != 'HLT':
self.additionalCommands.append('from HLTrigger.Configuration.CustomConfigs import ProcessName')
self.additionalCommands.append('process = ProcessName(process)')
self._options.customisation_file+=",HLTrigger/Configuration/customizeHLTforMC.customizeHLTforMC"
if self._options.name != 'HLT':
self.additionalCommands.append('from HLTrigger.Configuration.CustomConfigs import ProcessName')
self.additionalCommands.append('process = ProcessName(process)')
self.additionalCommands.append('')
from HLTrigger.Configuration.CustomConfigs import ProcessName
self.process = ProcessName(self.process)
from HLTrigger.Configuration.CustomConfigs import ProcessName
self.process = ProcessName(self.process)
self.schedule.append(self.process.HLTSchedule)
[self.blacklist_paths.append(path) for path in self.process.HLTSchedule if isinstance(path,(cms.Path,cms.EndPath))]
if ('FASTSIM' in self.stepMap and 'HLT' in self.stepMap):

0 comments on commit ff6b03e

Please sign in to comment.