CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/HLTrigger/Configuration/python/Tools/confdb.py

Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import sys
00004 import re
00005 import os
00006 from pipe import pipe as _pipe
00007 from options import globalTag
00008 from itertools import islice
00009 
00010 def splitter(iterator, n):
00011   i = iterator.__iter__()
00012   while True:
00013     l = list(islice(i, n))
00014     if l:
00015       yield l
00016     else:
00017       break
00018 
00019 
00020 class HLTProcess(object):
00021   # paths not supported by FastSim
00022   fastsimUnsupportedPaths = (
00023 
00024   # paths for which a recovery is not foreseen/possible
00025     "AlCa_EcalEta_v*",
00026     "AlCa_EcalPhiSym_v*",
00027     "AlCa_EcalPi0_v*",
00028     "AlCa_EcalPi0EBonly_v*",
00029     "AlCa_EcalPi0EEonly_v*",
00030     "AlCa_EcalEtaEBonly_v*",
00031     "AlCa_EcalEtaEEonly_v*",
00032     "AlCa_RPCMuonNoHits_v*",
00033     "AlCa_RPCMuonNoTriggers_v*",
00034     "AlCa_RPCMuonNormalisation_v*",
00035     "AlCa_LumiPixels_v*",
00036     "AlCa_LumiPixels_Random_v*",
00037     "AlCa_LumiPixels_ZeroBias_v*",
00038     "DQM_FEDIntegrity_v*",
00039     "HLT_Calibration_v*",
00040     "HLT_EcalCalibration_v*",
00041     "HLT_HcalCalibration_v*",
00042     "HLT_TrackerCalibration_v*",
00043     "HLT_DTErrors_v*",
00044     "HLT_DTCalibration_v*",
00045     "HLT_Random_v*",
00046     "HLT_HcalNZS_v*",
00047     "HLT_HcalPhiSym_v*",
00048     "HLT_IsoTrackHB_v*",
00049     "HLT_IsoTrackHE_v*",
00050     "HLT_L1SingleMuOpen_AntiBPTX_v*",
00051     "HLT_JetE30_NoBPTX*_v*",
00052     "HLT_JetE50_NoBPTX*_v*",
00053     "HLT_JetE50_NoBPTX3BX_NoHalo_v*",
00054     "HLT_JetE70_NoBPTX3BX_NoHalo_v*",
00055     "HLT_L2Mu10_NoVertex_NoBPTX3BX_NoHalo_v*",
00056     "HLT_L2Mu20_NoVertex_NoBPTX3BX_NoHalo_v*",
00057     "HLT_L2Mu30_NoVertex_NoBPTX3BX_NoHalo_v*",
00058     "HLT_JetE30_NoBPTX3BX_v*",
00059     "HLT_JetE50_NoBPTX3BX_v*",
00060     "HLT_JetE70_NoBPTX3BX_v*",
00061     "HLT_L2Mu10_NoVertex_NoBPTX3BX_v*",
00062     "HLT_L2Mu10_NoVertex_NoBPTX3BX_v*",
00063     "HLT_L2Mu10_NoVertex_NoBPTX3BX_v*",
00064     "HLT_L2Mu20_NoVertex_NoBPTX3BX_v*",
00065     "HLT_L2Mu30_NoVertex_NoBPTX3BX_v*",
00066     "HLT_PixelTracks_Multiplicity70_v*",
00067     "HLT_PixelTracks_Multiplicity80_v*",
00068     "HLT_PixelTracks_Multiplicity90_v*",
00069     "HLT_BeamGas_HF_Beam1_v*",
00070     "HLT_BeamGas_HF_Beam2_v*",
00071     "HLT_BeamHalo_v*",
00072     "HLT_L1Tech_CASTOR_HaloMuon_v*",
00073     "HLT_L1Tech_DT_GlobalOR_v*",
00074     "HLT_GlobalRunHPDNoise_v*",
00075     "HLT_L1Tech_HBHEHO_totalOR_v*",
00076     "HLT_L1Tech_HCAL_HF_single_channel_v*",
00077     "HLT_L1TrackerCosmics_v",   
00078     
00079 # TODO: paths not supported by FastSim, but for which a recovery should be attempted
00080   
00081     )
00082 
00083   def __init__(self, configuration):
00084     self.config = configuration
00085     self.data   = None
00086     self.source = None
00087     self.parent = None
00088 
00089     self.options = {
00090       'essources' : [],
00091       'esmodules' : [],
00092       'modules'   : [],
00093       'sequences' : [],
00094       'services'  : [],
00095       'paths'     : [],
00096       'psets'     : [],
00097       'blocks'    : [],
00098     }
00099 
00100     self.labels = {}
00101     if self.config.fragment:
00102       self.labels['process'] = ''
00103       self.labels['dict']    = 'locals()'
00104     else:
00105       self.labels['process'] = 'process.'
00106       self.labels['dict']    = 'process.__dict__'
00107 
00108     if self.config.online:
00109       self.labels['connect'] = 'frontier://(proxyurl=https://localhost:3128)(serverurl=https://localhost:8000/FrontierOnProd)(serverurl=https://localhost:8000/FrontierOnProd)(retrieve-ziplevel=0)'
00110     else:
00111       self.labels['connect'] = 'frontier://FrontierProd'
00112 
00113     # get the configuration from ConfdB
00114     self.buildPathList()
00115     self.buildOptions()
00116     self.getRawConfigurationFromDB()
00117     self.customize()
00118 
00119 
00120   def _build_query(self):
00121     if self.config.menu.run:
00122       return '--runNumber %s' % self.config.menu.run
00123     else:
00124       return '--%s --configName %s' % (self.config.menu.db, self.config.menu.name)
00125 
00126   def _build_options(self):
00127     return ' '.join(['--%s %s' % (key, ','.join(vals)) for key, vals in self.options.iteritems() if vals])
00128 
00129   def _build_cmdline(self):
00130     if not self.config.fragment:
00131       return 'edmConfigFromDB       %s --noedsources %s' % (self._build_query(), self._build_options())
00132     else:
00133       return 'edmConfigFromDB --cff %s --noedsources %s' % (self._build_query(), self._build_options())
00134 
00135 
00136   def getRawConfigurationFromDB(self):
00137     cmdline = self._build_cmdline()
00138     data = _pipe(cmdline)
00139     if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00140       raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00141     self.data = data
00142 
00143 
00144   def getPathList(self):
00145     cmdline = 'edmConfigFromDB --cff %s --noedsources --noes --noservices --nosequences --nomodules' % self._build_query()
00146     data = _pipe(cmdline)
00147     if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00148       raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00149     filter = re.compile(r' *= *cms.(End)?Path.*')
00150     paths  = [ filter.sub('', line) for line in data.splitlines() if filter.search(line) ]
00151     return paths
00152 
00153 
00154   @staticmethod
00155   def expandWildcards(globs, collection):
00156     # expand a list of unix-style wildcards matching a given collection
00157     # wildcards with no matches are silently discarded
00158     matches = []
00159     for glob in globs:
00160       negate = ''
00161       if glob[0] == '-':
00162         negate = '-'
00163         glob   = glob[1:]
00164       # translate a unix-style glob expression into a regular expression
00165       filter = re.compile(r'^' + glob.replace('?', '.').replace('*', '.*').replace('[!', '[^') + r'$')
00166       matches.extend( negate + element for element in collection if filter.match(element) )
00167     return matches
00168 
00169 
00170   @staticmethod
00171   def consolidateNegativeList(elements):
00172     # consolidate a list of path exclusions and re-inclusions
00173     # the result is the list of paths to be removed from the dump
00174     result = set()
00175     for element in elements:
00176       if element[0] == '-':
00177         result.add( element )
00178       else:
00179         result.discard( '-' + element )
00180     return sorted( element for element in result )
00181 
00182   @staticmethod
00183   def consolidatePositiveList(elements):
00184     # consolidate a list of path selection and re-exclusions
00185     # the result is the list of paths to be included in the dump
00186     result = set()
00187     for element in elements:
00188       if element[0] == '-':
00189         result.discard( element[1:] )
00190       else:
00191         result.add( element )
00192     return sorted( element for element in result )
00193 
00194 
00195   # dump the final configuration
00196   def dump(self):
00197     return self.data % self.labels
00198 
00199 
00200   # add release-specific customizations
00201   def releaseSpecificCustomize(self):
00202     # version specific customizations
00203     self.data += """
00204 # CMSSW version specific customizations
00205 import os
00206 cmsswVersion = os.environ['CMSSW_VERSION']
00207 """
00208 
00209   # customize the configuration according to the options
00210   def customize(self):
00211 
00212     # adapt the source to the current scenario
00213     if not self.config.fragment:
00214       self.build_source()
00215 
00216     # manual override some parameters
00217     if self.config.type in ('GRun', ):
00218       self.data += """
00219 # En-able HF Noise filters in GRun menu
00220 if 'hltHfreco' in %(dict)s:
00221     %(process)shltHfreco.setNoiseFlags = cms.bool( True )
00222 """
00223     if self.config.type in ('HIon', ):
00224       self.data += """
00225 # Disable HF Noise filters in HIon menu
00226 if 'hltHfreco' in %(dict)s:
00227     %(process)shltHfreco.setNoiseFlags = cms.bool( False )
00228 """
00229 
00230 #    self.data += """
00231 ## untracked parameters with NO default in the code
00232 #if 'hltHcalDataIntegrityMonitor' in %(dict)s:
00233 #    %(process)shltHcalDataIntegrityMonitor.RawDataLabel = cms.untracked.InputTag("rawDataCollector")
00234 #if 'hltDt4DSegments' in %(dict)s:
00235 #    %(process)shltDt4DSegments.debug = cms.untracked.bool( False )
00236 #"""
00237 
00238     # if requested, override the L1 self from the GlobalTag (Xml)
00239     self.overrideL1MenuXml()
00240 
00241     # if running on MC, adapt the configuration accordingly
00242     self.fixForMC()
00243 
00244     # if requested, remove the HLT prescales
00245     self.fixPrescales()
00246 
00247     # if requested, override all ED/HLTfilters to always pass ("open" mode)
00248     self.instrumentOpenMode()
00249 
00250     # if requested, instrument the self with the modules and EndPath needed for timing studies
00251     self.instrumentTiming()
00252 
00253     # add version-specific customisations
00254     self.releaseSpecificCustomize()
00255 
00256     if self.config.fragment:
00257       
00258 #      self.data += """
00259 ## dummyfy hltGetConditions in cff's
00260 #if 'hltGetConditions' in %(dict)s and 'HLTriggerFirstPath' in %(dict)s :
00261 #    %(process)shltDummyConditions = cms.EDFilter( "HLTBool",
00262 #        result = cms.bool( True )
00263 #    )
00264 #    %(process)sHLTriggerFirstPath.replace(%(process)shltGetConditions,%(process)shltDummyConditions)
00265 #"""
00266 
00267       # if requested, adapt the configuration for FastSim
00268       self.fixForFastSim()
00269 
00270     else:
00271 
00272       # override the process name and adapt the relevant filters
00273       self.overrideProcessName()
00274 
00275       # override the output modules to output root files
00276       self.overrideOutput()
00277 
00278       # add global options
00279       self.addGlobalOptions()
00280 
00281       # if requested or necessary, override the GlobalTag and connection strings
00282       self.overrideGlobalTag()
00283 
00284       # if requested, override the L1 self from the GlobalTag (using the same connect as the GlobalTag itself)
00285       self.overrideL1Menu()
00286 
00287       # if requested, run (part of) the L1 emulator
00288       self.runL1Emulator()
00289 
00290       # request summary informations from the MessageLogger
00291       self.updateMessageLogger()
00292 
00293 
00294 #    # load 4.2.x JECs
00295 #    self.loadAdditionalConditions('load 4.2.x JECs',
00296 #      {
00297 #        'record'  : 'JetCorrectionsRecord',
00298 #        'tag'     : 'JetCorrectorParametersCollection_Jec11_V1_AK5Calo',
00299 #        'label'   : 'AK5Calo',
00300 #        'connect' : 'frontier://PromptProd/CMS_COND_31X_PHYSICSTOOLS'
00301 #      }
00302 #    )
00303 
00304   def addGlobalOptions(self):
00305     # add global options
00306     self.data += """
00307 # limit the number of events to be processed
00308 %(process)smaxEvents = cms.untracked.PSet(
00309     input = cms.untracked.int32( 100 )
00310 )
00311 """
00312     if not self.config.profiling:
00313       self.data += """
00314 # enable the TrigReport and TimeReport
00315 %(process)soptions = cms.untracked.PSet(
00316     wantSummary = cms.untracked.bool( True )
00317 )
00318 """
00319 
00320 
00321   def _fix_parameter(self, **args):
00322     """arguments:
00323         name:     parameter name (optional)
00324         type:     parameter type (look for tracked and untracked variants)
00325         value:    original value
00326         replace:  replacement value
00327     """
00328     if 'name' in args:
00329       self.data = re.sub(
00330           r'%(name)s = cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00331           r'%(name)s = cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00332           self.data)
00333     else:
00334       self.data = re.sub(
00335           r'cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00336           r'cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00337           self.data)
00338 
00339 
00340   def fixForMC(self):
00341     if not self.config.data:
00342       pass # No longer needed!
00343 #      # override the raw data collection label
00344 #      self._fix_parameter(type = 'InputTag', value = 'source', replace = 'rawDataCollector')
00345 #      self._fix_parameter(type = 'string',   value = 'source', replace = 'rawDataCollector')
00346 
00347 
00348   def fixForFastSim(self):
00349     if self.config.fastsim:
00350       # adapt the hle configuration (fragment) to run under fastsim
00351       self.data = re.sub( r'import FWCore.ParameterSet.Config as cms', r'\g<0>\nfrom FastSimulation.HighLevelTrigger.HLTSetup_cff import *', self.data)
00352 
00353       # remove the definition of streams and datasets
00354       self.data = re.compile( r'^streams.*\n(.*\n)*?^\)\s*\n',  re.MULTILINE ).sub( '', self.data )
00355       self.data = re.compile( r'^datasets.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
00356 
00357       # fix the definition of module
00358       # FIXME: this should be updated to take into accout the --l1-emulator option
00359       self._fix_parameter(                               type = 'InputTag', value = 'hltL1extraParticles',  replace = 'l1extraParticles')
00360       self._fix_parameter(name = 'GMTReadoutCollection', type = 'InputTag', value = 'hltGtDigis',           replace = 'gmtDigis')
00361       self._fix_parameter(                               type = 'InputTag', value = 'hltGtDigis',           replace = 'gtDigis')
00362       self._fix_parameter(                               type = 'InputTag', value = 'hltL1GtObjectMap',     replace = 'gtDigis')
00363       self._fix_parameter(name = 'initialSeeds',         type = 'InputTag', value = 'noSeedsHere',          replace = 'globalPixelSeeds:GlobalPixel')
00364       self._fix_parameter(name = 'preFilteredSeeds',     type = 'bool',     value = 'True',                 replace = 'False')
00365       self._fix_parameter(                               type = 'InputTag', value = 'hltOfflineBeamSpot',   replace = 'offlineBeamSpot')
00366       self._fix_parameter(                               type = 'InputTag', value = 'hltOnlineBeamSpot',    replace = 'offlineBeamSpot')
00367       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonCSCDigis',      replace = 'simMuonCSCDigis')
00368       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonDTDigis',       replace = 'simMuonDTDigis')
00369       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonRPCDigis',      replace = 'simMuonRPCDigis')
00370       self._fix_parameter(                               type = 'InputTag', value = 'hltRegionalTracksForL3MuonIsolation', replace = 'hltPixelTracks')
00371       self._fix_parameter(name = 'src',                  type = 'InputTag', value = 'hltHcalTowerNoiseCleaner', replace = 'hltTowerMakerForAll')
00372       self._fix_parameter(name = 'src',                  type = 'InputTag', value = 'hltIter4Tau3MuMerged', replace = 'hltIter4Merged')
00373 
00374       # fix the definition of sequences and paths
00375       self.data = re.sub( r'hltMuonCSCDigis', r'cms.SequencePlaceholder( "simMuonCSCDigis" )',  self.data )
00376       self.data = re.sub( r'hltMuonDTDigis',  r'cms.SequencePlaceholder( "simMuonDTDigis" )',   self.data )
00377       self.data = re.sub( r'hltMuonRPCDigis', r'cms.SequencePlaceholder( "simMuonRPCDigis" )',  self.data )
00378       self.data = re.sub( r'HLTEndSequence',  r'cms.SequencePlaceholder( "HLTEndSequence" )',   self.data )
00379       self.data = re.sub( r'hltGtDigis',      r'HLTBeginSequence',                              self.data )
00380 
00381 
00382   def fixPrescales(self):
00383     # update the PrescaleService to match the new list of paths
00384     if self.options['paths']:
00385       if self.options['paths'][0][0] == '-':
00386         # drop requested paths
00387         for minuspath in self.options['paths']:
00388           path = minuspath[1:]
00389           self.data = re.sub(r'      cms.PSet\(  pathName = cms.string\( "%s" \),\n        prescales = cms.vuint32\( .* \)\n      \),?\n' % path, '', self.data)
00390       else:
00391         # keep requested paths
00392         for path in self.all_paths:
00393           if path not in self.options['paths']:
00394             self.data = re.sub(r'      cms.PSet\(  pathName = cms.string\( "%s" \),\n        prescales = cms.vuint32\( .* \)\n      \),?\n' % path, '', self.data)
00395 
00396     if self.config.unprescale:
00397       self.data += """
00398 # remove the HLT prescales
00399 if 'PrescaleService' in %(dict)s:
00400     %(process)sPrescaleService.lvl1DefaultLabel = cms.string( '0' )
00401     %(process)sPrescaleService.lvl1Labels       = cms.vstring( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' )
00402     %(process)sPrescaleService.prescaleTable    = cms.VPSet( )
00403 """
00404 
00405 
00406   def instrumentOpenMode(self):
00407     if self.config.open:
00408       # find all EDfilters
00409       filters = [ match[1] for match in re.findall(r'(process\.)?\b(\w+) = cms.EDFilter', self.data) ]
00410       re_sequence = re.compile( r'cms\.(Path|Sequence)\((.*)\)' )
00411       # remove existing 'cms.ingore' and '~' modifiers
00412       self.data = re_sequence.sub( lambda line: re.sub( r'cms\.ignore *\( *((process\.)?\b(\w+)) *\)', r'\1', line.group(0) ), self.data )
00413       self.data = re_sequence.sub( lambda line: re.sub( r'~', '', line.group(0) ), self.data )
00414       # wrap all EDfilters with "cms.ignore( ... )", 1000 at a time (python 2.6 complains for too-big regular expressions)
00415       for some in splitter(filters, 1000):
00416         re_filters  = re.compile( r'\b((process\.)?(' + r'|'.join(some) + r'))\b' )
00417         self.data = re_sequence.sub( lambda line: re_filters.sub( r'cms.ignore( \1 )', line.group(0) ), self.data )
00418 
00419 
00420   def overrideGlobalTag(self):
00421     # overwrite GlobalTag
00422     # the logic is:
00423     #   - always set the correct connection string and pfnPrefix
00424     #   - if a GlobalTag is specified on the command line:
00425     #      - override the global tag
00426     #      - if the GT is "auto:...", insert the code to read it from Configuration.AlCa.autoCond
00427     #   - if a GlobalTag is NOT  specified on the command line:
00428     #      - when running on data, do nothing, and keep the global tag in the menu
00429     #      - when running on mc, take the GT from the configuration.type
00430 
00431     # override the GlobalTag connection string and pfnPrefix
00432     text = """
00433 # override the GlobalTag, connection string and pfnPrefix
00434 if 'GlobalTag' in %%(dict)s:
00435     %%(process)sGlobalTag.connect   = '%%(connect)s/CMS_COND_31X_GLOBALTAG'
00436     %%(process)sGlobalTag.pfnPrefix = cms.untracked.string('%%(connect)s/')
00437 """
00438 
00439     # when running on MC, override the global tag even if not specified on the command line
00440     if not self.config.data and not self.config.globaltag:
00441       if self.config.type in globalTag:
00442         self.config.globaltag = globalTag[self.config.type]
00443       else:
00444         self.config.globaltag = globalTag['GRun']
00445 
00446     # check if the GlobalTag is an autoCond or an explicit tag
00447     if not self.config.globaltag:
00448       # skip the cases with no override
00449       pass
00450     elif self.config.globaltag.startswith('auto:'):
00451       self.config.menuGlobalTagAuto = self.config.globaltag[5:]
00452       text += "    from Configuration.AlCa.autoCond import autoCond\n"
00453       text += "    %%(process)sGlobalTag.globaltag = autoCond['%(menuGlobalTagAuto)s'].split(',')[0]\n"
00454     else:
00455       text += "    %%(process)sGlobalTag.globaltag = '%(globaltag)s'\n"
00456 
00457     self.data += text % self.config.__dict__
00458 
00459 
00460   def overrideL1Menu(self):
00461     # if requested, override the L1 menu from the GlobalTag (using the same connect as the GlobalTag itself)
00462     if self.config.l1.override:
00463       self.config.l1.record = 'L1GtTriggerMenuRcd'
00464       self.config.l1.label  = ''
00465       self.config.l1.tag    = self.config.l1.override
00466       if not self.config.l1.connect:
00467         self.config.l1.connect = '%(connect)s/CMS_COND_31X_L1T'
00468       self.loadAdditionalConditions( 'override the L1 menu', self.config.l1.__dict__ )
00469 
00470 
00471   def overrideL1MenuXml(self):
00472     # if requested, override the L1 menu from the GlobalTag (Xml file)
00473     if self.config.l1Xml.XmlFile:
00474       text = """
00475 # override the L1 menu from an Xml file
00476 %%(process)sl1GtTriggerMenuXml = cms.ESProducer("L1GtTriggerMenuXmlProducer",
00477   TriggerMenuLuminosity = cms.string('%(LumiDir)s'),
00478   DefXmlFile = cms.string('%(XmlFile)s'),
00479   VmeXmlFile = cms.string('')
00480 )
00481 %%(process)sL1GtTriggerMenuRcdSource = cms.ESSource("EmptyESSource",
00482   recordName = cms.string('L1GtTriggerMenuRcd'),
00483   iovIsRunNotTime = cms.bool(True),
00484   firstValid = cms.vuint32(1)
00485 )
00486 %%(process)ses_prefer_l1GtParameters = cms.ESPrefer('L1GtTriggerMenuXmlProducer','l1GtTriggerMenuXml') 
00487 """
00488       self.data += text % self.config.l1Xml.__dict__
00489 
00490   def runL1EmulatorGT(self):
00491     # if requested, run (part of) the L1 emulator, then repack the data into a new RAW collection, to be used by the HLT
00492     if not self.config.emulator:
00493       return
00494 
00495     if self.config.emulator != 'gt':
00496       # only the GT emulator is currently supported
00497       return
00498 
00499     # run the L1 GT emulator, then repack the data into a new RAW collection, to be used by the HLT
00500     text = """
00501 # run the L1 GT emulator, then repack the data into a new RAW collection, to be used by the HLT
00502 """
00503     if self.config.fragment:
00504       # FIXME in a cff, should also update the HLTSchedule
00505       text += "import Configuration.StandardSequences.SimL1EmulatorRepack_GT_cff\n"
00506     else:
00507       text += "process.load( 'Configuration.StandardSequences.SimL1EmulatorRepack_GT_cff' )\n"
00508 
00509     if not 'hltBoolFalse' in self.data:
00510       # add hltBoolFalse
00511       text += """
00512 %(process)shltBoolFalse = cms.EDFilter( "HLTBool",
00513     result = cms.bool( False )
00514 )
00515 """
00516     text += "process.L1Emulator = cms.Path( process.SimL1Emulator + process.hltBoolFalse )\n\n"
00517 
00518     self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
00519 
00520 
00521   def runL1Emulator(self):
00522     # if requested, run (part of) the L1 emulator
00523     if self.config.emulator:
00524       # FIXME this fragment used "process" explicitly
00525       emulator = {
00526         'RawToDigi': '',
00527         'CustomL1T': '',
00528         'CustomHLT': ''
00529       }
00530 
00531       if self.config.data:
00532         emulator['RawToDigi'] = 'RawToDigi_Data_cff'
00533       else:
00534         emulator['RawToDigi'] = 'RawToDigi_cff'
00535 
00536       if self.config.emulator == 'gt':
00537         emulator['CustomL1T'] = 'customiseL1GtEmulatorFromRaw'
00538         emulator['CustomHLT'] = 'switchToSimGtDigis'
00539       elif self.config.emulator == 'gct,gt':
00540         emulator['CustomL1T'] = 'customiseL1CaloAndGtEmulatorsFromRaw'
00541         emulator['CustomHLT'] = 'switchToSimGctGtDigis'
00542       elif self.config.emulator == 'gmt,gt':
00543         # XXX currently unsupported
00544         emulator['CustomL1T'] = 'customiseL1MuonAndGtEmulatorsFromRaw'
00545         emulator['CustomHLT'] = 'switchToSimGmtGtDigis'
00546       elif self.config.emulator in ('gmt,gct,gt', 'gct,gmt,gt', 'all'):
00547         emulator['CustomL1T'] = 'customiseL1EmulatorFromRaw'
00548         emulator['CustomHLT'] = 'switchToSimGmtGctGtDigis'
00549       else:
00550         # unsupported argument, default to running the whole emulator
00551         emulator['CustomL1T'] = 'customiseL1EmulatorFromRaw'
00552         emulator['CustomHLT'] = 'switchToSimGmtGctGtDigis'
00553 
00554       self.data += """
00555 # customize the L1 emulator to run %(CustomL1T)s with HLT to %(CustomHLT)s
00556 process.load( 'Configuration.StandardSequences.%(RawToDigi)s' )
00557 process.load( 'Configuration.StandardSequences.SimL1Emulator_cff' )
00558 import L1Trigger.Configuration.L1Trigger_custom
00559 process = L1Trigger.Configuration.L1Trigger_custom.%(CustomL1T)s( process )
00560 process = L1Trigger.Configuration.L1Trigger_custom.customiseResetPrescalesAndMasks( process )
00561 
00562 # customize the HLT to use the emulated results
00563 import HLTrigger.Configuration.customizeHLTforL1Emulator
00564 process = HLTrigger.Configuration.customizeHLTforL1Emulator.switchToL1Emulator( process )
00565 process = HLTrigger.Configuration.customizeHLTforL1Emulator.%(CustomHLT)s( process )
00566 """ % emulator
00567 
00568 
00569   def overrideOutput(self):
00570     # override the "online" ShmStreamConsumer output modules with "offline" PoolOutputModule's
00571     self.data = re.sub(
00572       r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\( *"ShmStreamConsumer" *,',
00573       r'%(process)shltOutput\2 = cms.OutputModule( "PoolOutputModule",\n    fileName = cms.untracked.string( "output\2.root" ),\n    fastCloning = cms.untracked.bool( False ),\n    dataset = cms.untracked.PSet(\n        filterName = cms.untracked.string( "" ),\n        dataTier = cms.untracked.string( "RAW" )\n    ),',
00574       self.data
00575     )
00576 
00577     if not self.config.fragment and self.config.output == 'full':
00578       # add a single "keep *" output
00579       self.data += """
00580 # add a single "keep *" output
00581 %(process)shltOutputFULL = cms.OutputModule( "PoolOutputModule",
00582     fileName = cms.untracked.string( "outputFULL.root" ),
00583     fastCloning = cms.untracked.bool( False ),
00584     dataset = cms.untracked.PSet(
00585         dataTier = cms.untracked.string( 'RECO' ),
00586         filterName = cms.untracked.string( '' )
00587     ),
00588     outputCommands = cms.untracked.vstring( 'keep *' )
00589 )
00590 %(process)sFULLOutput = cms.EndPath( %(process)shltOutputFULL )
00591 """
00592 
00593 
00594   # override the process name and adapt the relevant filters
00595   def overrideProcessName(self):
00596     if self.config.name is None:
00597       return
00598 
00599 # the following was stolen and adapted from HLTrigger.Configuration.customL1THLT_Options
00600     self.data += """
00601 # override the process name
00602 %%(process)ssetName_('%(name)s')
00603 
00604 # adapt HLT modules to the correct process name
00605 if 'hltTrigReport' in %%(dict)s:
00606     %%(process)shltTrigReport.HLTriggerResults                    = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00607 
00608 if 'hltPreExpressCosmicsOutputSmart' in %%(dict)s:
00609     %%(process)shltPreExpressCosmicsOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00610 
00611 if 'hltPreExpressOutputSmart' in %%(dict)s:
00612     %%(process)shltPreExpressOutputSmart.TriggerResultsTag        = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00613 
00614 if 'hltPreDQMForHIOutputSmart' in %%(dict)s:
00615     %%(process)shltPreDQMForHIOutputSmart.TriggerResultsTag       = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00616 
00617 if 'hltPreDQMForPPOutputSmart' in %%(dict)s:
00618     %%(process)shltPreDQMForPPOutputSmart.TriggerResultsTag       = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00619 
00620 if 'hltPreHLTDQMResultsOutputSmart' in %%(dict)s:
00621     %%(process)shltPreHLTDQMResultsOutputSmart.TriggerResultsTag  = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00622 
00623 if 'hltPreHLTDQMOutputSmart' in %%(dict)s:
00624     %%(process)shltPreHLTDQMOutputSmart.TriggerResultsTag         = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00625 
00626 if 'hltPreHLTMONOutputSmart' in %%(dict)s:
00627     %%(process)shltPreHLTMONOutputSmart.TriggerResultsTag         = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00628 
00629 if 'hltDQMHLTScalers' in %%(dict)s:
00630     %%(process)shltDQMHLTScalers.triggerResults                   = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00631     %%(process)shltDQMHLTScalers.processname                      = '%(name)s'
00632 
00633 if 'hltDQML1SeedLogicScalers' in %%(dict)s:
00634     %%(process)shltDQML1SeedLogicScalers.processname              = '%(name)s'
00635 """ % self.config.__dict__
00636 
00637 
00638   def updateMessageLogger(self):
00639     # request summary informations from the MessageLogger
00640     self.data += """
00641 if 'MessageLogger' in %(dict)s:
00642     %(process)sMessageLogger.categories.append('TriggerSummaryProducerAOD')
00643     %(process)sMessageLogger.categories.append('L1GtTrigReport')
00644     %(process)sMessageLogger.categories.append('HLTrigReport')
00645 """
00646 
00647 
00648   def loadAdditionalConditions(self, comment, *conditions):
00649     # load additional conditions
00650     self.data += """
00651 # %s
00652 if 'GlobalTag' in %%(dict)s:
00653 """ % comment
00654     for condition in conditions:
00655       self.data += """    %%(process)sGlobalTag.toGet.append(
00656         cms.PSet(
00657             record  = cms.string( '%(record)s' ),
00658             tag     = cms.string( '%(tag)s' ),
00659             label   = cms.untracked.string( '%(label)s' ),
00660             connect = cms.untracked.string( '%(connect)s' )
00661         )
00662     )
00663 """ % condition
00664 
00665 
00666   def overrideParameters(self, module, parameters):
00667     # override a module's parameter if the module is present in the configuration
00668     self.data += "if '%s' in %%(dict)s:\n" % module
00669     for (parameter, value) in parameters:
00670       self.data += "    %%(process)s%s.%s = %s\n" % (module, parameter, value)
00671     self.data += "\n"
00672 
00673 
00674   def instrumentTiming(self):
00675     if self.config.profiling:
00676       # instrument the menu for profiling: remove the HLTAnalyzerEndpath, add/override the HLTriggerFirstPath, with hltGetRaw and hltGetConditions
00677       text = ''
00678 
00679       if not 'hltGetRaw' in self.data:
00680         # add hltGetRaw
00681         text += """
00682 %(process)shltGetRaw = cms.EDAnalyzer( "HLTGetRaw",
00683     RawDataCollection = cms.InputTag( "rawDataCollector" )
00684 )
00685 """
00686 
00687       if not 'hltGetConditions' in self.data:
00688         # add hltGetConditions
00689         text += """
00690 %(process)shltGetConditions = cms.EDAnalyzer( 'EventSetupRecordDataGetter',
00691     verbose = cms.untracked.bool( False ),
00692     toGet = cms.VPSet( )
00693 )
00694 """
00695 
00696       if not 'hltBoolFalse' in self.data:
00697         # add hltBoolFalse
00698         text += """
00699 %(process)shltBoolFalse = cms.EDFilter( "HLTBool",
00700     result = cms.bool( False )
00701 )
00702 """
00703 
00704       # add the definition of HLTriggerFirstPath
00705       # FIXME in a cff, should also update the HLTSchedule
00706       text += """
00707 %(process)sHLTriggerFirstPath = cms.Path( %(process)shltGetRaw + %(process)shltGetConditions + %(process)shltBoolFalse )
00708 """
00709       self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
00710 
00711       # load additional conditions needed by hltGetConditions
00712       self.loadAdditionalConditions('add XML geometry to keep hltGetConditions happy',
00713         {
00714           'record'  : 'GeometryFileRcd',
00715           'tag'     : 'XMLFILE_Geometry_311YV1_Ideal_mc',
00716           'label'   : 'Ideal',
00717           'connect' : '%(connect)s/CMS_COND_34X_GEOMETRY'
00718         }, {
00719           'record'  : 'GeometryFileRcd',
00720           'tag'     : 'XMLFILE_Geometry_311YV1_Extended_mc',
00721           'label'   : 'Extended',
00722           'connect' : '%(connect)s/CMS_COND_34X_GEOMETRY'
00723         }
00724       )
00725 
00726     # instrument the menu with the Service, EDProducer and EndPath needed for timing studies
00727     # FIXME in a cff, should also update the HLTSchedule
00728     if self.config.timing:
00729       self.data += """
00730 # instrument the menu with the modules and EndPath needed for timing studies
00731 %(process)sPathTimerService = cms.Service( "PathTimerService",
00732 )
00733 %(process)shltTimer = cms.EDProducer( "PathTimerInserter",
00734 )
00735 %(process)shltOutputTiming = cms.OutputModule( "PoolOutputModule",
00736     fileName = cms.untracked.string( "outputTiming.root" ),
00737     fastCloning = cms.untracked.bool( False ),
00738     splitLevel = cms.untracked.int32( 0 ),
00739     dataset = cms.untracked.PSet(
00740         dataTier = cms.untracked.string( 'RECO' ),
00741         filterName = cms.untracked.string( '' )
00742     ),
00743     outputCommands = cms.untracked.vstring( 'drop *',
00744       'keep HLTPerformanceInfo_*_*_*' )
00745 )
00746 
00747 %(process)sTimingOutput = cms.EndPath( %(process)shltTimer + %(process)shltOutputTiming )
00748 """
00749 
00750   @staticmethod
00751   def dumppaths(paths):
00752     sys.stderr.write('Path selection:\n')
00753     for path in paths:
00754       sys.stderr.write('\t%s\n' % path)
00755     sys.stderr.write('\n\n')
00756 
00757   def buildPathList(self):
00758     self.all_paths = self.getPathList()
00759 
00760     if self.config.paths:
00761       # no path list was requested, dump the full table, minus unsupported / unwanted paths
00762       paths = self.config.paths.split(',')
00763     else:
00764       # dump only the requested paths, plus the eventual output endpaths
00765       paths = []
00766 
00767     if self.config.fragment or self.config.output in ('none', 'full'):
00768       # 'full' removes all outputs (same as 'none') and then adds a single "keep *" output (see the overrideOutput method)
00769       if self.config.paths:
00770         # paths are removed by default
00771         pass    
00772       else:
00773         # drop all output endpaths
00774         paths.append( "-*Output" )
00775     elif self.config.output == 'minimal':
00776       # drop all output endpaths but HLTDQMResultsOutput
00777       if self.config.paths:
00778         paths.append( "HLTDQMResultsOutput" )
00779       else:
00780         paths.append( "-*Output" )
00781         paths.append( "HLTDQMResultsOutput" )
00782     else:
00783       # keep / add back all output endpaths
00784       if self.config.paths:
00785         paths.append( "*Output" )
00786       else:
00787         pass    # paths are kepy by default
00788 
00789     # drop paths unsupported by fastsim
00790     if self.config.fastsim:
00791       paths.extend( "-%s" % path for path in self.fastsimUnsupportedPaths )
00792 
00793     # drop unwanted paths for profiling (and timing studies)
00794     if self.config.profiling:
00795       paths.append( "-HLTriggerFirstPath" )
00796       paths.append( "-HLTAnalyzerEndpath" )
00797 
00798     # this should never be in any dump (nor online menu)
00799     paths.append( "-OfflineOutput" )
00800 
00801     # expand all wildcards
00802     paths = self.expandWildcards(paths, self.all_paths)
00803 
00804     if self.config.paths:
00805       # do an "additive" consolidation
00806       self.options['paths'] = self.consolidatePositiveList(paths)
00807       if not self.options['paths']:
00808         raise RuntimeError('Error: option "--paths %s" does not select any valid paths' % self.config.paths)
00809     else:
00810       # do a "subtractive" consolidation
00811       self.options['paths'] = self.consolidateNegativeList(paths)
00812 
00813 
00814   def buildOptions(self):
00815     # common configuration for all scenarios
00816     self.options['services'].append( "-FUShmDQMOutputService" )
00817 
00818     if self.config.fragment:
00819       # extract a configuration file fragment
00820       self.options['essources'].append( "-GlobalTag" )
00821       self.options['essources'].append( "-HepPDTESSource" )
00822       self.options['essources'].append( "-XMLIdealGeometryESSource" )
00823       self.options['essources'].append( "-eegeom" )
00824       self.options['essources'].append( "-es_hardcode" )
00825       self.options['essources'].append( "-magfield" )
00826 
00827       self.options['esmodules'].append( "-AutoMagneticFieldESProducer" )
00828       self.options['esmodules'].append( "-SlaveField0" )
00829       self.options['esmodules'].append( "-SlaveField20" )
00830       self.options['esmodules'].append( "-SlaveField30" )
00831       self.options['esmodules'].append( "-SlaveField35" )
00832       self.options['esmodules'].append( "-SlaveField38" )
00833       self.options['esmodules'].append( "-SlaveField40" )
00834       self.options['esmodules'].append( "-VBF0" )
00835       self.options['esmodules'].append( "-VBF20" )
00836       self.options['esmodules'].append( "-VBF30" )
00837       self.options['esmodules'].append( "-VBF35" )
00838       self.options['esmodules'].append( "-VBF38" )
00839       self.options['esmodules'].append( "-VBF40" )
00840       self.options['esmodules'].append( "-CSCGeometryESModule" )
00841       self.options['esmodules'].append( "-CaloGeometryBuilder" )
00842       self.options['esmodules'].append( "-CaloTowerHardcodeGeometryEP" )
00843       self.options['esmodules'].append( "-CastorHardcodeGeometryEP" )
00844       self.options['esmodules'].append( "-DTGeometryESModule" )
00845       self.options['esmodules'].append( "-EcalBarrelGeometryEP" )
00846       self.options['esmodules'].append( "-EcalElectronicsMappingBuilder" )
00847       self.options['esmodules'].append( "-EcalEndcapGeometryEP" )
00848       self.options['esmodules'].append( "-EcalLaserCorrectionService" )
00849       self.options['esmodules'].append( "-EcalPreshowerGeometryEP" )
00850       self.options['esmodules'].append( "-HcalHardcodeGeometryEP" )
00851       self.options['esmodules'].append( "-HcalTopologyIdealEP" )
00852       self.options['esmodules'].append( "-MuonNumberingInitialization" )
00853       self.options['esmodules'].append( "-ParametrizedMagneticFieldProducer" )
00854       self.options['esmodules'].append( "-RPCGeometryESModule" )
00855       self.options['esmodules'].append( "-SiStripGainESProducer" )
00856       self.options['esmodules'].append( "-SiStripRecHitMatcherESProducer" )
00857       self.options['esmodules'].append( "-SiStripQualityESProducer" )
00858       self.options['esmodules'].append( "-StripCPEfromTrackAngleESProducer" )
00859       self.options['esmodules'].append( "-TrackerDigiGeometryESModule" )
00860       self.options['esmodules'].append( "-TrackerGeometricDetESModule" )
00861       self.options['esmodules'].append( "-VolumeBasedMagneticFieldESProducer" )
00862       self.options['esmodules'].append( "-ZdcHardcodeGeometryEP" )
00863       self.options['esmodules'].append( "-hcal_db_producer" )
00864       self.options['esmodules'].append( "-L1GtTriggerMaskAlgoTrigTrivialProducer" )
00865       self.options['esmodules'].append( "-L1GtTriggerMaskTechTrigTrivialProducer" )
00866       self.options['esmodules'].append( "-hltESPEcalTrigTowerConstituentsMapBuilder" )
00867       self.options['esmodules'].append( "-hltESPGlobalTrackingGeometryESProducer" )
00868       self.options['esmodules'].append( "-hltESPMuonDetLayerGeometryESProducer" )
00869       self.options['esmodules'].append( "-hltESPTrackerRecoGeometryESProducer" )
00870       if not self.config.fastsim:
00871         self.options['esmodules'].append( "-CaloTowerGeometryFromDBEP" )
00872         self.options['esmodules'].append( "-CastorGeometryFromDBEP" )
00873         self.options['esmodules'].append( "-EcalBarrelGeometryFromDBEP" )
00874         self.options['esmodules'].append( "-EcalEndcapGeometryFromDBEP" )
00875         self.options['esmodules'].append( "-EcalPreshowerGeometryFromDBEP" )
00876         self.options['esmodules'].append( "-HcalGeometryFromDBEP" )
00877         self.options['esmodules'].append( "-ZdcGeometryFromDBEP" )
00878         self.options['esmodules'].append( "-XMLFromDBSource" )
00879         self.options['esmodules'].append( "-sistripconn" )
00880 
00881       self.options['services'].append( "-PrescaleService" )
00882       self.options['services'].append( "-MessageLogger" )
00883       self.options['services'].append( "-DQM" )
00884       self.options['services'].append( "-DQMStore" )
00885       self.options['services'].append( "-MicroStateService" )
00886       self.options['services'].append( "-ModuleWebRegistry" )
00887       self.options['services'].append( "-TimeProfilerService" )
00888       self.options['services'].append( "-FastTimerService" )
00889 
00890       self.options['psets'].append( "-maxEvents" )
00891       self.options['psets'].append( "-options" )
00892 
00893     if self.config.fastsim:
00894       # remove components not supported or needed by fastsim
00895       self.options['esmodules'].append( "-navigationSchoolESProducer" )
00896       self.options['esmodules'].append( "-TransientTrackBuilderESProducer" )
00897       self.options['esmodules'].append( "-SteppingHelixPropagatorAny" )
00898       self.options['esmodules'].append( "-OppositeMaterialPropagator" )
00899       self.options['esmodules'].append( "-MaterialPropagator" )
00900       self.options['esmodules'].append( "-CaloTowerConstituentsMapBuilder" )
00901       self.options['esmodules'].append( "-CaloTopologyBuilder" )
00902 
00903       self.options['services'].append( "-UpdaterService" )
00904 
00905       self.options['modules'].append( "hltL3MuonIsolations" )
00906       self.options['modules'].append( "hltPixelVertices" )
00907       self.options['modules'].append( "-hltCkfL1SeededTrackCandidates" )
00908       self.options['modules'].append( "-hltCtfL1SeededithMaterialTracks" )
00909       self.options['modules'].append( "-hltCkf3HitL1SeededTrackCandidates" )
00910       self.options['modules'].append( "-hltCtf3HitL1SeededWithMaterialTracks" )
00911       self.options['modules'].append( "-hltCkf3HitActivityTrackCandidates" )
00912       self.options['modules'].append( "-hltCtf3HitActivityWithMaterialTracks" )
00913       self.options['modules'].append( "-hltActivityCkfTrackCandidatesForGSF" )
00914       self.options['modules'].append( "-hltL1SeededCkfTrackCandidatesForGSF" )
00915       self.options['modules'].append( "-hltMuCkfTrackCandidates" )
00916       self.options['modules'].append( "-hltMuCtfTracks" )
00917       self.options['modules'].append( "-hltTau3MuCkfTrackCandidates" )
00918       self.options['modules'].append( "-hltTau3MuCtfWithMaterialTracks" )
00919       self.options['modules'].append( "-hltMuTrackJpsiCkfTrackCandidates" )
00920       self.options['modules'].append( "-hltMuTrackJpsiCtfTracks" )
00921       self.options['modules'].append( "-hltMuTrackJpsiEffCkfTrackCandidates" )
00922       self.options['modules'].append( "-hltMuTrackJpsiEffCtfTracks" )
00923       self.options['modules'].append( "-hltJpsiTkPixelSeedFromL3Candidate" )
00924       self.options['modules'].append( "-hltCkfTrackCandidatesJpsiTk" )
00925       self.options['modules'].append( "-hltCtfWithMaterialTracksJpsiTk" )
00926       
00927       self.options['modules'].append( "-hltESRegionalEgammaRecHit" )
00928       self.options['modules'].append( "-hltEcalRegionalJetsFEDs" )
00929       self.options['modules'].append( "-hltEcalRegionalMuonsFEDs" )
00930       self.options['modules'].append( "-hltEcalRegionalEgammaFEDs" )
00931       self.options['modules'].append( "-hltFEDSelector" )
00932       self.options['modules'].append( "-hltL3TrajSeedOIHit" )
00933       self.options['modules'].append( "-hltL3TrajSeedIOHit" )
00934       self.options['modules'].append( "-hltL3TrackCandidateFromL2OIState" )
00935       self.options['modules'].append( "-hltL3TrackCandidateFromL2OIHit" )
00936       self.options['modules'].append( "-hltL3TrackCandidateFromL2IOHit" )
00937       self.options['modules'].append( "-hltL3TrackCandidateFromL2NoVtx" )
00938       self.options['modules'].append( "-hltHcalDigis" )
00939       self.options['modules'].append( "-hltHoreco" )
00940       self.options['modules'].append( "-hltHfreco" )
00941       self.options['modules'].append( "-hltHbhereco" )
00942       self.options['modules'].append( "-hltEcalRegionalRestFEDs" )
00943       self.options['modules'].append( "-hltEcalRegionalESRestFEDs" )
00944       self.options['modules'].append( "-hltEcalRawToRecHitFacility" )
00945       self.options['modules'].append( "-hltESRawToRecHitFacility" )
00946       self.options['modules'].append( "-hltEcalRegionalJetsRecHit" )
00947       self.options['modules'].append( "-hltEcalRegionalMuonsRecHit" )
00948       self.options['modules'].append( "-hltEcalRegionalEgammaRecHit" )
00949       self.options['modules'].append( "-hltEcalRecHitAll" )
00950       self.options['modules'].append( "-hltESRecHitAll" )
00951       # === hltPF
00952       self.options['modules'].append( "-hltPFJetCkfTrackCandidates" )
00953       self.options['modules'].append( "-hltPFJetCtfWithMaterialTracks" )
00954       self.options['modules'].append( "-hltPFlowTrackSelectionHighPurity" )
00955       # === hltFastJet
00956       self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalPixelSeedGenerator" )
00957       self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalCkfTrackCandidates" )
00958       self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalCtfWithMaterialTracks" )     
00959       self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalPixelSeedGenerator" )
00960       self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalCkfTrackCandidates" )
00961       self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalCtfWithMaterialTracks" )     
00962       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhiL1FastJet" )
00963       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhiL1FastJet" )
00964       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhiL1FastJet" )     
00965       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorHbbVBF" )
00966       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesHbbVBF" )
00967       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksHbbVBF" )
00968       self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20HbbL1FastJet" )
00969       self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20HbbL1FastJet" )
00970       self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20HbbL1FastJet" )
00971       self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20HbbL1FastJet" )
00972       self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20HbbL1FastJet" )
00973       self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20HbbL1FastJet" )
00974       # === hltBLifetimeRegional
00975       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorHbb" )
00976       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesHbb" )
00977       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksHbb" )
00978       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhi" )
00979       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhi" )
00980       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhi" )
00981       self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20Hbb" )
00982       self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20Hbb" )
00983       self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20Hbb" )
00984       self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20Hbb" )
00985       self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20Hbb" )
00986       self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20Hbb" )
00987       self.options['modules'].append( "-hltBLifetimeFastRegionalPixelSeedGeneratorHbbVBF" )
00988       self.options['modules'].append( "-hltBLifetimeFastRegionalCkfTrackCandidatesHbbVBF" )
00989       self.options['modules'].append( "-hltBLifetimeFastRegionalCtfWithMaterialTracksHbbVBF" )
00990       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhiL1FastJetFastPV" )
00991       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhiL1FastJetFastPV" )
00992       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhiL1FastJetFastPV" )
00993       self.options['modules'].append( "-hltFastPixelBLifetimeRegionalPixelSeedGeneratorHbb" )
00994       self.options['modules'].append( "-hltFastPixelBLifetimeRegionalCkfTrackCandidatesHbb" )
00995       self.options['modules'].append( "-hltFastPixelBLifetimeRegionalCtfWithMaterialTracksHbb" )
00996      
00997       self.options['modules'].append( "-hltPixelTracksForMinBias" )
00998       self.options['modules'].append( "-hltPixelTracksForHighMult" )
00999       self.options['modules'].append( "-hltRegionalPixelTracks" )
01000       self.options['modules'].append( "-hltPixelTracksReg" )
01001       self.options['modules'].append( "-hltIter4Merged" )
01002       self.options['modules'].append( "-hltFastPixelHitsVertex" )
01003       self.options['modules'].append( "-hltFastPixelTracks")
01004       self.options['modules'].append( "-hltFastPixelTracksRecover")
01005       
01006       self.options['modules'].append( "-hltFastPrimaryVertex")
01007       self.options['modules'].append( "-hltFastPVPixelTracks")
01008       self.options['modules'].append( "-hltFastPVPixelTracksRecover" )
01009 
01010       self.options['modules'].append( "-hltIter4Tau3MuMerged" )
01011       self.options['modules'].append( "hltPixelMatchElectronsActivity" )
01012 
01013       self.options['modules'].append( "-hltMuonCSCDigis" )
01014       self.options['modules'].append( "-hltMuonDTDigis" )
01015       self.options['modules'].append( "-hltMuonRPCDigis" )
01016       self.options['modules'].append( "-hltGtDigis" )
01017       self.options['modules'].append( "-hltL1GtTrigReport" )
01018       self.options['modules'].append( "hltCsc2DRecHits" )
01019       self.options['modules'].append( "hltDt1DRecHits" )
01020       self.options['modules'].append( "hltRpcRecHits" )
01021       self.options['modules'].append( "-hltScalersRawToDigi" )
01022 
01023       self.options['sequences'].append( "-HLTL1SeededEgammaRegionalRecoTrackerSequence" )
01024       self.options['sequences'].append( "-HLTEcalActivityEgammaRegionalRecoTrackerSequence" )
01025       self.options['sequences'].append( "-HLTPixelMatchElectronActivityTrackingSequence" )
01026       self.options['sequences'].append( "-HLTDoLocalStripSequence" )
01027       self.options['sequences'].append( "-HLTDoLocalPixelSequence" )
01028       self.options['sequences'].append( "-HLTDoLocalPixelSequenceRegL2Tau" )
01029       self.options['sequences'].append( "-hltSiPixelDigis" )
01030       self.options['sequences'].append( "-hltSiPixelClusters" )
01031       self.options['sequences'].append( "-hltSiPixelRecHits" )
01032       self.options['sequences'].append( "-HLTRecopixelvertexingSequence" )
01033       self.options['sequences'].append( "-HLTEndSequence" )
01034       self.options['sequences'].append( "-HLTBeginSequence" )
01035       self.options['sequences'].append( "-HLTBeginSequenceNZS" )
01036       self.options['sequences'].append( "-HLTBeginSequenceBPTX" )
01037       self.options['sequences'].append( "-HLTBeginSequenceAntiBPTX" )
01038       self.options['sequences'].append( "-HLTHBHENoiseSequence" )
01039       self.options['sequences'].append( "-HLTIterativeTracking" )
01040       self.options['sequences'].append( "-HLTIterativeTrackingTau3Mu" )
01041       self.options['sequences'].append( "-HLTRegionalCKFTracksForL3Isolation" )
01042       self.options['sequences'].append( "-HLTHBHENoiseCleanerSequence" )
01043 
01044       # remove HLTAnalyzerEndpath from fastsim cff's
01045       if self.config.fragment:
01046         self.options['paths'].append( "-HLTAnalyzerEndpath" )
01047 
01048 
01049   def build_source(self):
01050     if self.config.input:
01051       # if a dataset or a list of input files was given, use it
01052       if self.config.input[0:8] == 'dataset:':
01053         from dbsFileQuery import dbsFileQuery
01054         # extract the dataset name, and use DBS to fine the list of LFNs
01055         dataset = self.config.input[8:]
01056         query   = 'find file where dataset=' + dataset
01057         files   = dbsFileQuery(query)
01058         self.source = files
01059       else:
01060         # assume a list of input files
01061         self.source = self.config.input.split(',')
01062     elif self.config.online:
01063       # online we always run on data
01064       self.source = [ "file:/tmp/InputCollection.root" ]
01065     elif self.config.data:
01066       # offline we can run on data...
01067       self.source = [ "file:RelVal_Raw_%s_DATA.root" % self.config.type ]
01068     else:
01069       # ...or on mc
01070       self.source = [ "file:RelVal_Raw_%s_STARTUP.root" % self.config.type ]
01071 
01072     self.data += """
01073 %(process)ssource = cms.Source( "PoolSource",
01074     fileNames = cms.untracked.vstring(
01075 """
01076     if self.source: 
01077       for line in self.source:
01078         self.data += "        '%s',\n" % line
01079     self.data += """    ),
01080     secondaryFileNames = cms.untracked.vstring(
01081 """
01082     if self.parent: 
01083       for line in self.parent:
01084         self.data += "        '%s',\n" % line
01085     self.data += """    ),
01086     inputCommands = cms.untracked.vstring(
01087         'keep *'
01088     )
01089 )
01090 """
01091