From f5ddb370954b40b62c32fc022224470bcc2e97ea Mon Sep 17 00:00:00 2001 From: Andrea Bocci Date: Fri, 16 Aug 2013 13:30:25 +0200 Subject: [PATCH] associate frozen HLT menus to the corresponding run ranges, and select them from cmsDriver.py --- Configuration/HLT/python/cachedHLT.py | 36 ++++++++++++++ .../python/ConfigBuilder.py | 48 ++++++++++++------- 2 files changed, 66 insertions(+), 18 deletions(-) create mode 100644 Configuration/HLT/python/cachedHLT.py diff --git a/Configuration/HLT/python/cachedHLT.py b/Configuration/HLT/python/cachedHLT.py new file mode 100644 index 0000000000000..58b35c9724736 --- /dev/null +++ b/Configuration/HLT/python/cachedHLT.py @@ -0,0 +1,36 @@ +# used by cmsDriver when called like +# cmsDiver.py hlt -s HLT:cached: +# 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 diff --git a/Configuration/PyReleaseValidation/python/ConfigBuilder.py b/Configuration/PyReleaseValidation/python/ConfigBuilder.py index f4456b4f008bc..0df66c29ab53a 100644 --- a/Configuration/PyReleaseValidation/python/ConfigBuilder.py +++ b/Configuration/PyReleaseValidation/python/ConfigBuilder.py @@ -1393,16 +1393,28 @@ 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) @@ -1410,15 +1422,15 @@ def prepare_HLT(self, sequence = None): 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):