CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/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 from pipe import pipe as _pipe
00006 from options import globalTag
00007 
00008 
00009 class HLTProcess(object):
00010   def __init__(self, configuration):
00011     self.config = configuration
00012     self.data   = None
00013     self.source = None
00014 
00015     self.options = {
00016       'essources' : [],
00017       'esmodules' : [],
00018       'modules'   : [],
00019       'sequences' : [],
00020       'services'  : [],
00021       'paths'     : [],
00022       'psets'     : [],
00023       'blocks'    : [],
00024     }
00025 
00026     self.labels = {}
00027     if self.config.fragment:
00028       self.labels['process'] = ''
00029       self.labels['dict']    = 'locals()'
00030     else:
00031       self.labels['process'] = 'process.'
00032       self.labels['dict']    = 'process.__dict__'
00033 
00034     if self.config.online:
00035       self.labels['connect'] = 'frontier://(proxyurl=http://localhost:3128)(serverurl=http://localhost:8000/FrontierOnProd)(serverurl=http://localhost:8000/FrontierOnProd)(retrieve-ziplevel=0)'
00036     else:
00037       self.labels['connect'] = 'frontier://FrontierProd'
00038 
00039     # get the configuration from ConfdB
00040     self.buildOptions()
00041     self.expandWildcardOptions()
00042     self.getRawConfigurationFromDB()
00043     self.customize()
00044 
00045 
00046   def _build_query(self):
00047     if self.config.menu.run:
00048       return '--runNumber %s' % self.config.menu.run
00049     else:
00050       return '--%s --configName %s' % (self.config.menu.db, self.config.menu.name)
00051 
00052   def _build_source(self):
00053     if self.source is None:
00054       return '--noedsources'
00055     else:
00056       return '--input ' + self.source
00057 
00058   def _build_options(self):
00059     return ' '.join(['--%s %s' % (key, ','.join(vals)) for key, vals in self.options.iteritems() if vals])
00060 
00061   def _build_cmdline(self):
00062     if not self.config.fragment:
00063       return 'edmConfigFromDB %s %s %s'       % (self._build_query(), self._build_source(), self._build_options())
00064     else:
00065       return 'edmConfigFromDB --cff %s %s %s' % (self._build_query(), self._build_source(), self._build_options())
00066 
00067 
00068   def getRawConfigurationFromDB(self):
00069     cmdline = self._build_cmdline()
00070     data = _pipe(cmdline)
00071     if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00072       raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00073     self.data = data
00074 
00075 
00076   def getPathList(self):
00077     cmdline = 'edmConfigFromDB --cff %s --noedsources --noes --noservices --nosequences --nomodules' % self._build_query()
00078     data = _pipe(cmdline)
00079     if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00080       raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00081     filter = re.compile(r' *= *cms.(End)?Path.*')
00082     paths  = [ filter.sub('', line) for line in data.splitlines() if filter.search(line) ]
00083     return paths
00084 
00085 
00086   def expandWildcardOptions(self):
00087     # for the time being, this is limited only to the --paths option
00088     self.options['paths'] = self.expandWildcards(self.options['paths'], self.getPathList())
00089 
00090 
00091   @staticmethod
00092   def expandWildcards(globs, collection):
00093     # expand a list of unix-style wildcards matching a given collection
00094     # wildcards with no matches are silently discarded
00095     matches = []
00096     for glob in globs:
00097       negate = ''
00098       if glob[0] == '-':
00099         negate = '-'
00100         glob   = glob[1:]
00101       # translate a unix-style glob expression into a regular expression
00102       filter = re.compile(r'^' + glob.replace('?', '.').replace('*', '.*').replace('[!', '[^') + r'$')
00103       matches.extend( negate + element for element in collection if filter.match(element) )
00104     return matches
00105 
00106 
00107   # dump the final configuration
00108   def dump(self):
00109     return self.data % self.labels
00110 
00111 
00112   # customize the configuration according to the options
00113   def customize(self):
00114     if self.config.fragment:
00115       # if running on MC, adapt the configuration accordingly
00116       self.fixForMC()
00117 
00118       # if requested, adapt the configuration for FastSim
00119       self.fixForFastSim()
00120 
00121       # if requested, remove the HLT prescales
00122       self.unprescale()
00123 
00124       # if requested, override all ED/HLTfilters to always pass ("open" mode)
00125       self.instrumentOpenMode()
00126 
00127       # if requested, instrument the self with the modules and EndPath needed for timing studies
00128       self.instrumentTiming()
00129 
00130     else:
00131       # if running on MC, adapt the configuration accordingly
00132       self.fixForMC()
00133 
00134       # override the process name and adapt the relevant filters
00135       self.overrideProcessName()
00136 
00137       # if required, remove the HLT prescales
00138       self.unprescale()
00139 
00140       # if requested, override all ED/HLTfilters to always pass ("open" mode)
00141       self.instrumentOpenMode()
00142 
00143       # manual override some Heavy Ion parameters
00144       if self.config.type in ('HIon', ):
00145         self.data += """
00146 # HIon paths in smart prescalers
00147 if 'hltPreHLTDQMSmart' in %(dict)s:
00148     %(process)shltPreHLTDQMSmart.throw  = cms.bool( False )
00149 if 'hltPreHLTMONSmart' in %(dict)s:
00150     %(process)shltPreHLTMONSmart.throw  = cms.bool( False )
00151 if 'hltPreExpressSmart' in %(dict)s:
00152     %(process)shltPreExpressSmart.throw = cms.bool( False )
00153 if 'hltPreDQMSmart' in %(dict)s:
00154     %(process)shltPreDQMSmart.throw     = cms.bool( False )
00155 """
00156 
00157       # override the output modules to output root files
00158       self.overrideOutput()
00159 
00160       # add global options
00161       self.addGlobalOptions()
00162 
00163       # if requested or necessary, override the GlobalTag and connection strings
00164       self.overrideGlobalTag()
00165 
00166       # if requested, override the L1 self from the GlobalTag (using the same connect as the GlobalTag itself)
00167       self.overrideL1Menu()
00168 
00169       # request summary informations from the MessageLogger
00170       self.updateMessageLogger()
00171 
00172       # if requested, instrument the self with the modules and EndPath needed for timing studies
00173       self.instrumentTiming()
00174 
00175 
00176   def addGlobalOptions(self):
00177     # add global options
00178     self.data += """
00179 # add global options
00180 %(process)smaxEvents = cms.untracked.PSet(
00181     input = cms.untracked.int32( 100 )
00182 )
00183 %(process)soptions = cms.untracked.PSet(
00184     wantSummary = cms.untracked.bool( True )
00185 )
00186 """
00187 
00188 
00189   def _fix_parameter(self, **args):
00190     """arguments:
00191         name:     parameter name (optional)
00192         type:     parameter type (look for tracked and untracked variants)
00193         value:    original value
00194         replace:  replacement value
00195     """
00196     if 'name' in args:
00197       self.data = re.sub(
00198           r'%(name)s = cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00199           r'%(name)s = cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00200           self.data)
00201     else:
00202       self.data = re.sub(
00203           r'cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00204           r'cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00205           self.data)
00206 
00207 
00208   def fixForMC(self):
00209     if not self.config.data:
00210       # override the raw data collection label
00211       self._fix_parameter(type = 'InputTag', value = 'source', replace = 'rawDataCollector')
00212       self._fix_parameter(type = 'string',   value = 'source', replace = 'rawDataCollector')
00213 
00214 
00215   def fixForFastSim(self):
00216     if self.config.fastsim:
00217       # adapt the hle configuration (fragment) to run under fastsim
00218       self.data = re.sub( r'import FWCore.ParameterSet.Config as cms', r'\g<0>\nfrom FastSimulation.HighLevelTrigger.HLTSetup_cff import *', self.data)
00219 
00220       # remove the definition of streams and datasets
00221       self.data = re.compile( r'^streams.*\n(.*\n)*?^\)\s*\n',  re.MULTILINE ).sub( '', self.data )
00222       self.data = re.compile( r'^datasets.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
00223 
00224       # fix the definition of module
00225       self._fix_parameter(                               type = 'InputTag', value = 'hltL1extraParticles',  replace = 'l1extraParticles')
00226       self._fix_parameter(name = 'GMTReadoutCollection', type = 'InputTag', value = 'hltGtDigis',           replace = 'gmtDigis')
00227       self._fix_parameter(                               type = 'InputTag', value = 'hltGtDigis',           replace = 'gtDigis')
00228       self._fix_parameter(                               type = 'InputTag', value = 'hltL1GtObjectMap',     replace = 'gtDigis')
00229       self._fix_parameter(name = 'initialSeeds',         type = 'InputTag', value = 'noSeedsHere',          replace = 'globalPixelSeeds:GlobalPixel')
00230       self._fix_parameter(name = 'preFilteredSeeds',     type = 'bool',     value = 'True',                 replace = 'False')
00231       self._fix_parameter(                               type = 'InputTag', value = 'hltOfflineBeamSpot',   replace = 'offlineBeamSpot')
00232       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonCSCDigis',      replace = 'simMuonCSCDigis')
00233       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonDTDigis',       replace = 'simMuonDTDigis')
00234       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonRPCDigis',      replace = 'simMuonRPCDigis')
00235 
00236       # fix the definition of sequences and paths
00237       self.data = re.sub( r'hltMuonCSCDigis', r'cms.SequencePlaceholder( "simMuonCSCDigis" )',  self.data )
00238       self.data = re.sub( r'hltMuonDTDigis',  r'cms.SequencePlaceholder( "simMuonDTDigis" )',   self.data )
00239       self.data = re.sub( r'hltMuonRPCDigis', r'cms.SequencePlaceholder( "simMuonRPCDigis" )',  self.data )
00240       self.data = re.sub( r'HLTEndSequence',  r'cms.SequencePlaceholder( "HLTEndSequence" )',   self.data )
00241       self.data = re.sub( r'hltGtDigis',      r'HLTBeginSequence',                              self.data )
00242 
00243 
00244   def unprescale(self):
00245     if self.config.unprescale:
00246       self.data += """
00247 # remove the HLT prescales
00248 if 'PrescaleService' in %(dict)s:
00249     %(process)sPrescaleService.lvl1DefaultLabel = cms.untracked.string( '0' )
00250     %(process)sPrescaleService.lvl1Labels = cms.vstring( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' )
00251     %(process)sPrescaleService.prescaleTable = cms.VPSet( )
00252 """
00253 
00254 
00255   def instrumentOpenMode(self):
00256     if self.config.open:
00257       # find all EDfilters
00258       filters = [ match[1] for match in re.findall(r'(process\.)?\b(\w+) = cms.EDFilter', self.data) ]
00259       # wrap all EDfilters with "cms.ignore( ... )"
00260       re_filters  = re.compile( r'\b((process\.)?(' + r'|'.join(filters) + r'))\b' )
00261       re_sequence = re.compile( r'cms\.(Path|Sequence)\((.*)\)' )
00262       self.data = re_sequence.sub( lambda line: re_filters.sub( r'cms.ignore( \1 )', line.group(0) ), self.data )
00263 
00264 
00265   def overrideGlobalTag(self):
00266     # overwrite GlobalTag
00267     # the logic is:
00268     #   - for running online, do nothing, unless a globaltag has been specified on the command line
00269     #   - for running offline on data, only add the pfnPrefix
00270     #   - for running offline on mc, take the GT from the command line of the configuration.type
00271     #      - if the GT is "auto:...", insert the code to read it from Configuration.PyReleaseValidation.autoCond
00272     text = ''
00273     if self.config.online:
00274       if self.config.globaltag:
00275         # override the GlobalTag
00276         text += """
00277 # override the GlobalTag
00278 if 'GlobalTag' in %%(dict)s:
00279     %%(process)sGlobalTag.globaltag = '%(globaltag)s'
00280 """
00281 
00282     else:
00283       # override the GlobalTag connection string and pfnPrefix
00284       text += """
00285 # override the GlobalTag, connection string and pfnPrefix
00286 if 'GlobalTag' in %%(dict)s:
00287     %%(process)sGlobalTag.connect   = '%%(connect)s/CMS_COND_31X_GLOBALTAG'
00288     %%(process)sGlobalTag.pfnPrefix = cms.untracked.string('%%(connect)s/')
00289 """
00290 
00291       if self.config.data:
00292         # do not override the GlobalTag unless one was specified on the command line
00293         pass
00294       else:
00295         # check if a specific GlobalTag was specified on the command line, or choose one from the configuration.type
00296         if not self.config.globaltag:
00297           if self.config.type in globalTag:
00298             self.config.globaltag = globalTag[self.config.type]
00299           else:
00300             self.config.globaltag = globalTag['GRun']
00301 
00302       # check if the GlobalTag is an autoCond or an explicit tag
00303       if not self.config.globaltag:
00304         # when running on data, do not override the GlobalTag unless one was specified on the command line
00305         pass
00306       elif self.config.globaltag.startswith('auto:'):
00307         self.config.menuGlobalTagAuto = self.config.globaltag[5:]
00308         text += "    from Configuration.PyReleaseValidation.autoCond import autoCond\n"
00309         text += "    %%(process)sGlobalTag.globaltag = autoCond['%(menuGlobalTagAuto)s']\n"
00310       else:
00311         text += "    %%(process)sGlobalTag.globaltag = '%(globaltag)s'\n"
00312 
00313     self.data += text % self.config.__dict__
00314 
00315 
00316   def overrideL1Menu(self):
00317     # if requested, override the L1 menu from the GlobalTag (using the same connect as the GlobalTag itself)
00318     if self.config.l1.override:
00319       self.config.l1.record = 'L1GtTriggerMenuRcd'
00320       self.config.l1.label  = ''
00321       self.config.l1.tag    = self.config.l1.override
00322       if not self.config.l1.connect:
00323         self.config.l1.connect = '%(connect)s/CMS_COND_31X_L1T'
00324       self.loadAdditionalConditions( 'override the L1 menu', self.config.l1.__dict__ )
00325 
00326 
00327   def overrideOutput(self):
00328     reOutputModuleDef = re.compile(r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\(.*\n([^)].*\n)*\) *\n')
00329     reOutputModuleRef = re.compile(r' *[+*]? *\b(process\.)?hltOutput(\w+)')    # FIXME this does not cover "hltOutputX + something"
00330     if self.config.output == 'none':
00331       # drop all output modules
00332       self.data = reOutputModuleDef.sub('', self.data)
00333       self.data = reOutputModuleRef.sub('', self.data)
00334 
00335     elif self.config.output == 'minimal':
00336       # drop all output modules except "HLTDQMResults"
00337       repl = lambda match: (match.group(2) == 'HLTDQMResults') and match.group() or ''
00338       self.data = reOutputModuleDef.sub(repl, self.data)
00339       self.data = reOutputModuleRef.sub(repl, self.data)
00340 
00341     # override the "online" ShmStreamConsumer output modules with "offline" PoolOutputModule's
00342     self.data = re.sub(
00343       r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\( *"ShmStreamConsumer" *,',
00344       r'%(process)shltOutput\2 = cms.OutputModule( "PoolOutputModule",\n    fileName = cms.untracked.string( "output\2.root" ),\n    fastCloning = cms.untracked.bool( False ),',
00345       self.data
00346     )
00347 
00348 
00349   # override the process name and adapt the relevant filters
00350   def overrideProcessName(self):
00351     # the following was stolen and adapted from HLTrigger.Configuration.customL1THLT_Options
00352     self.data += """
00353 # override the process name
00354 %%(process)ssetName_('%(name)s')
00355 
00356 # adapt HLT modules to the correct process name
00357 if 'hltTrigReport' in %%(dict)s:
00358     %%(process)shltTrigReport.HLTriggerResults       = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00359 
00360 if 'hltDQMHLTScalers' in %%(dict)s:
00361     %%(process)shltDQMHLTScalers.triggerResults      = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00362 
00363 if 'hltPreExpressSmart' in %%(dict)s:
00364     %%(process)shltPreExpressSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00365 
00366 if 'hltPreHLTMONSmart' in %%(dict)s:
00367     %%(process)shltPreHLTMONSmart.TriggerResultsTag  = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00368 
00369 if 'hltPreDQMSmart' in %%(dict)s:
00370     %%(process)shltPreDQMSmart.TriggerResultsTag     = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00371 
00372 if 'hltDQML1SeedLogicScalers' in %%(dict)s:
00373     %%(process)shltDQML1SeedLogicScalers.processname = '%(name)s'
00374 """ % self.config.__dict__
00375 
00376 
00377   def updateMessageLogger(self):
00378     # request summary informations from the MessageLogger
00379     self.data += """
00380 if 'MessageLogger' in %(dict)s:
00381     %(process)sMessageLogger.categories.append('TriggerSummaryProducerAOD')
00382     %(process)sMessageLogger.categories.append('L1GtTrigReport')
00383     %(process)sMessageLogger.categories.append('HLTrigReport')
00384 """
00385 
00386 
00387   def loadAdditionalConditions(self, comment, *conditions):
00388     # load additional conditions
00389     self.data += """
00390 # %s
00391 if 'GlobalTag' in %%(dict)s:
00392 """ % comment
00393     for condition in conditions:
00394       self.data += """    %%(process)sGlobalTag.toGet.append(
00395         cms.PSet(
00396             record  = cms.string( '%(record)s' ),
00397             tag     = cms.string( '%(tag)s' ),
00398             label   = cms.untracked.string( '%(label)s' ),
00399             connect = cms.untracked.string( '%(connect)s' )
00400         )
00401     )
00402 """ % condition
00403 
00404   def instrumentTiming(self):
00405     if self.config.timing:
00406       # instrument the menu with the modules and EndPath needed for timing studies
00407       text = ''
00408 
00409       if 'HLTriggerFirstPath' in self.data:
00410         # remove HLTriggerFirstPath
00411         self.data = re.sub(r'.*\bHLTriggerFirstPath\s*=.*\n', '', self.data)
00412 
00413       if not 'hltGetRaw' in self.data:
00414         # add hltGetRaw
00415         text += """
00416 %%(process)shltGetRaw = cms.EDAnalyzer( "HLTGetRaw",
00417     RawDataCollection = cms.InputTag( "%s" )
00418 )
00419 """ % ( self.config.data and 'source' or 'rawDataCollector' )
00420 
00421       if not 'hltGetConditions' in self.data:
00422         # add hltGetConditions
00423         text += """
00424 %(process)shltGetConditions = cms.EDAnalyzer( 'EventSetupRecordDataGetter',
00425     verbose = cms.untracked.bool( False ),
00426     toGet = cms.VPSet( )
00427 )
00428 """
00429 
00430       # add the definition of HLTriggerFirstPath
00431       text += """
00432 %(process)sHLTriggerFirstPath = cms.Path( %(process)shltGetRaw + %(process)shltGetConditions + %(process)shltBoolFalse )
00433 """
00434       self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
00435 
00436       self.data += """
00437 # instrument the menu with the modules and EndPath needed for timing studies
00438 %(process)sPathTimerService = cms.Service( "PathTimerService",
00439 )
00440 %(process)shltTimer = cms.EDProducer( "PathTimerInserter",
00441 )
00442 %(process)shltOutputTiming = cms.OutputModule( "PoolOutputModule",
00443     fileName = cms.untracked.string( "outputTiming.root" ),
00444     fastCloning = cms.untracked.bool( False ),
00445     splitLevel = cms.untracked.int32( 0 ),
00446     dataset = cms.untracked.PSet(
00447         dataTier = cms.untracked.string( 'RECO' ),
00448         filterName = cms.untracked.string( '' )
00449     ),
00450     outputCommands = cms.untracked.vstring( 'drop *',
00451       'keep HLTPerformanceInfo_*_*_*' )
00452 )
00453 
00454 %(process)sTimingOutput = cms.EndPath( %(process)shltTimer + %(process)shltOutputTiming )
00455 """
00456       self.loadAdditionalConditions('add XML geometry to keep hltGetConditions happy',
00457         {
00458           'record'  : 'GeometryFileRcd',
00459           'tag'     : 'XMLFILE_Geometry_380V3_Ideal_mc',
00460           'label'   : 'Ideal',
00461           'connect' : '%(connect)s/CMS_COND_34X_GEOMETRY'
00462         }, {
00463           'record'  : 'GeometryFileRcd',
00464           'tag'     : 'XMLFILE_Geometry_380V3_Extended_mc',
00465           'label'   : 'Extended',
00466           'connect' : '%(connect)s/CMS_COND_34X_GEOMETRY'
00467         }
00468       )
00469 
00470 
00471   def buildOptions(self):
00472     # common configuration for all scenarios
00473     self.options['services'].append( "-FUShmDQMOutputService" )
00474     self.options['paths'].append( "-OfflineOutput" )
00475 
00476     # adapt source and options to the current scenario
00477     if not self.config.fragment:
00478       self.build_source()
00479 
00480     if self.config.fragment:
00481       # extract a configuration file fragment
00482       self.options['essources'].append( "-GlobalTag" )
00483       self.options['essources'].append( "-HepPDTESSource" )
00484       self.options['essources'].append( "-XMLIdealGeometryESSource" )
00485       self.options['essources'].append( "-eegeom" )
00486       self.options['essources'].append( "-es_hardcode" )
00487       self.options['essources'].append( "-magfield" )
00488 
00489       self.options['esmodules'].append( "-AutoMagneticFieldESProducer" )
00490       self.options['esmodules'].append( "-SlaveField0" )
00491       self.options['esmodules'].append( "-SlaveField20" )
00492       self.options['esmodules'].append( "-SlaveField30" )
00493       self.options['esmodules'].append( "-SlaveField35" )
00494       self.options['esmodules'].append( "-SlaveField38" )
00495       self.options['esmodules'].append( "-SlaveField40" )
00496       self.options['esmodules'].append( "-VBF0" )
00497       self.options['esmodules'].append( "-VBF20" )
00498       self.options['esmodules'].append( "-VBF30" )
00499       self.options['esmodules'].append( "-VBF35" )
00500       self.options['esmodules'].append( "-VBF38" )
00501       self.options['esmodules'].append( "-VBF40" )
00502       self.options['esmodules'].append( "-CSCGeometryESModule" )
00503       self.options['esmodules'].append( "-CaloGeometryBuilder" )
00504       self.options['esmodules'].append( "-CaloTowerHardcodeGeometryEP" )
00505       self.options['esmodules'].append( "-CastorHardcodeGeometryEP" )
00506       self.options['esmodules'].append( "-DTGeometryESModule" )
00507       self.options['esmodules'].append( "-EcalBarrelGeometryEP" )
00508       self.options['esmodules'].append( "-EcalElectronicsMappingBuilder" )
00509       self.options['esmodules'].append( "-EcalEndcapGeometryEP" )
00510       self.options['esmodules'].append( "-EcalLaserCorrectionService" )
00511       self.options['esmodules'].append( "-EcalPreshowerGeometryEP" )
00512       self.options['esmodules'].append( "-HcalHardcodeGeometryEP" )
00513       self.options['esmodules'].append( "-HcalTopologyIdealEP" )
00514       self.options['esmodules'].append( "-MuonNumberingInitialization" )
00515       self.options['esmodules'].append( "-ParametrizedMagneticFieldProducer" )
00516       self.options['esmodules'].append( "-RPCGeometryESModule" )
00517       self.options['esmodules'].append( "-SiStripGainESProducer" )
00518       self.options['esmodules'].append( "-SiStripRecHitMatcherESProducer" )
00519       self.options['esmodules'].append( "-SiStripQualityESProducer" )
00520       self.options['esmodules'].append( "-StripCPEfromTrackAngleESProducer" )
00521       self.options['esmodules'].append( "-TrackerDigiGeometryESModule" )
00522       self.options['esmodules'].append( "-TrackerGeometricDetESModule" )
00523       self.options['esmodules'].append( "-VolumeBasedMagneticFieldESProducer" )
00524       self.options['esmodules'].append( "-ZdcHardcodeGeometryEP" )
00525       self.options['esmodules'].append( "-hcal_db_producer" )
00526       self.options['esmodules'].append( "-L1GtTriggerMaskAlgoTrigTrivialProducer" )
00527       self.options['esmodules'].append( "-L1GtTriggerMaskTechTrigTrivialProducer" )
00528       self.options['esmodules'].append( "-hltESPEcalTrigTowerConstituentsMapBuilder" )
00529       self.options['esmodules'].append( "-hltESPGlobalTrackingGeometryESProducer" )
00530       self.options['esmodules'].append( "-hltESPMuonDetLayerGeometryESProducer" )
00531       self.options['esmodules'].append( "-hltESPTrackerRecoGeometryESProducer" )
00532       if not self.config.fastsim:
00533         self.options['esmodules'].append( "-CaloTowerGeometryFromDBEP" )
00534         self.options['esmodules'].append( "-CastorGeometryFromDBEP" )
00535         self.options['esmodules'].append( "-EcalBarrelGeometryFromDBEP" )
00536         self.options['esmodules'].append( "-EcalEndcapGeometryFromDBEP" )
00537         self.options['esmodules'].append( "-EcalPreshowerGeometryFromDBEP" )
00538         self.options['esmodules'].append( "-HcalGeometryFromDBEP" )
00539         self.options['esmodules'].append( "-ZdcGeometryFromDBEP" )
00540         self.options['esmodules'].append( "-XMLFromDBSource" )
00541         self.options['esmodules'].append( "-sistripconn" )
00542 
00543       self.options['services'].append( "-PrescaleService" )
00544       self.options['services'].append( "-MessageLogger" )
00545       self.options['services'].append( "-DQM" )
00546       self.options['services'].append( "-MicroStateService" )
00547       self.options['services'].append( "-ModuleWebRegistry" )
00548       self.options['services'].append( "-TimeProfilerService" )
00549       if not self.config.fastsim:
00550         self.options['services'].append( "-DQMStore" )
00551 
00552       self.options['paths'].append( "-HLTOutput" )
00553       self.options['paths'].append( "-ExpressOutput" )
00554       self.options['paths'].append( "-EventDisplayOutput" )
00555       self.options['paths'].append( "-AlCaOutput" )
00556       self.options['paths'].append( "-AlCaPPOutput" )
00557       self.options['paths'].append( "-AlCaHIOutput" )
00558       self.options['paths'].append( "-DQMOutput" )
00559       self.options['paths'].append( "-HLTDQMOutput" )
00560       self.options['paths'].append( "-HLTDQMResultsOutput" )
00561       self.options['paths'].append( "-HLTMONOutput" )
00562       self.options['paths'].append( "-NanoDSTOutput" )
00563 
00564       self.options['psets'].append( "-maxEvents" )
00565       self.options['psets'].append( "-options" )
00566 
00567     if self.config.fastsim:
00568       # remove components not supported or needed by fastsim
00569       self.options['essources'].append( "-BTagRecord" )
00570 
00571       self.options['esmodules'].append( "-SiPixelTemplateDBObjectESProducer" )
00572       self.options['esmodules'].append( "-TTRHBuilderPixelOnly" )
00573       self.options['esmodules'].append( "-WithTrackAngle" )
00574       self.options['esmodules'].append( "-trajectoryCleanerBySharedHits" )
00575       self.options['esmodules'].append( "-trackCounting3D2nd" )
00576       self.options['esmodules'].append( "-navigationSchoolESProducer" )
00577       self.options['esmodules'].append( "-muonCkfTrajectoryFilter" )
00578       self.options['esmodules'].append( "-ckfBaseTrajectoryFilter" )
00579       self.options['esmodules'].append( "-TransientTrackBuilderESProducer" )
00580       self.options['esmodules'].append( "-TrackerRecoGeometryESProducer" )
00581       self.options['esmodules'].append( "-SteppingHelixPropagatorOpposite" )
00582       self.options['esmodules'].append( "-SteppingHelixPropagatorAny" )
00583       self.options['esmodules'].append( "-SteppingHelixPropagatorAlong" )
00584       self.options['esmodules'].append( "-SmootherRK" )
00585       self.options['esmodules'].append( "-SmartPropagatorRK" )
00586       self.options['esmodules'].append( "-SmartPropagatorOpposite" )
00587       self.options['esmodules'].append( "-SmartPropagatorAnyRK" )
00588       self.options['esmodules'].append( "-SmartPropagatorAnyOpposite" )
00589       self.options['esmodules'].append( "-SmartPropagatorAny" )
00590       self.options['esmodules'].append( "-SmartPropagator" )
00591       self.options['esmodules'].append( "-RungeKuttaTrackerPropagator" )
00592       self.options['esmodules'].append( "-OppositeMaterialPropagator" )
00593       self.options['esmodules'].append( "-MuonTransientTrackingRecHitBuilderESProducer" )
00594       self.options['esmodules'].append( "-MuonDetLayerGeometryESProducer" )
00595       self.options['esmodules'].append( "-MuonCkfTrajectoryBuilder" )
00596       self.options['esmodules'].append( "-hltMeasurementTracker" )
00597       self.options['esmodules'].append( "-MaterialPropagator" )
00598       self.options['esmodules'].append( "-L3MuKFFitter" )
00599       self.options['esmodules'].append( "-KFUpdatorESProducer" )
00600       self.options['esmodules'].append( "-KFSmootherForRefitInsideOut" )
00601       self.options['esmodules'].append( "-KFSmootherForMuonTrackLoader" )
00602       self.options['esmodules'].append( "-KFFitterForRefitInsideOut" )
00603       self.options['esmodules'].append( "-GroupedCkfTrajectoryBuilder" )
00604       self.options['esmodules'].append( "-GlobalTrackingGeometryESProducer" )
00605       self.options['esmodules'].append( "-FittingSmootherRK" )
00606       self.options['esmodules'].append( "-FitterRK" )
00607       self.options['esmodules'].append( "-hltCkfTrajectoryBuilder" )
00608       self.options['esmodules'].append( "-Chi2MeasurementEstimator" )
00609       self.options['esmodules'].append( "-Chi2EstimatorForRefit" )
00610       self.options['esmodules'].append( "-CaloTowerConstituentsMapBuilder" )
00611       self.options['esmodules'].append( "-CaloTopologyBuilder" )
00612 
00613       self.options['services'].append( "-UpdaterService" )
00614 
00615       self.options['blocks'].append( "hltL1NonIsoLargeWindowElectronPixelSeeds::SeedConfiguration" )
00616       self.options['blocks'].append( "hltL1IsoLargeWindowElectronPixelSeeds::SeedConfiguration" )
00617       self.options['blocks'].append( "hltL1NonIsoStartUpElectronPixelSeeds::SeedConfiguration" )
00618       self.options['blocks'].append( "hltL1IsoStartUpElectronPixelSeeds::SeedConfiguration" )
00619 
00620       self.options['modules'].append( "hltL3MuonIsolations" )
00621       self.options['modules'].append( "hltPixelVertices" )
00622       self.options['modules'].append( "-hltCkfL1IsoTrackCandidates" )
00623       self.options['modules'].append( "-hltCtfL1IsoWithMaterialTracks" )
00624       self.options['modules'].append( "-hltCkfL1NonIsoTrackCandidates" )
00625       self.options['modules'].append( "-hltCtfL1NonIsoWithMaterialTracks" )
00626       self.options['modules'].append( "hltPixelMatchLargeWindowElectronsL1Iso" )
00627       self.options['modules'].append( "hltPixelMatchLargeWindowElectronsL1NonIso" )
00628       self.options['modules'].append( "-hltESRegionalEgammaRecHit" )
00629       self.options['modules'].append( "-hltEcalRegionalJetsFEDs" )
00630       self.options['modules'].append( "-hltEcalRegionalJetsRecHitTmp" )
00631       self.options['modules'].append( "-hltEcalRegionalMuonsFEDs" )
00632       self.options['modules'].append( "-hltEcalRegionalMuonsRecHitTmp" )
00633       self.options['modules'].append( "-hltEcalRegionalEgammaFEDs" )
00634       self.options['modules'].append( "-hltEcalRegionalEgammaRecHitTmp" )
00635       self.options['modules'].append( "-hltFEDSelector" )
00636       self.options['modules'].append( "-hltL3TrajSeedOIHit" )
00637       self.options['modules'].append( "-hltL3TrajSeedIOHit" )
00638       self.options['modules'].append( "-hltL3TrackCandidateFromL2OIState" )
00639       self.options['modules'].append( "-hltL3TrackCandidateFromL2OIHit" )
00640       self.options['modules'].append( "-hltL3TrackCandidateFromL2IOHit" )
00641       self.options['modules'].append( "-hltL3TrackCandidateFromL2NoVtx" )
00642       self.options['modules'].append( "-hltHcalDigis" )
00643       self.options['modules'].append( "-hltHoreco" )
00644       self.options['modules'].append( "-hltHfreco" )
00645       self.options['modules'].append( "-hltHbhereco" )
00646       self.options['modules'].append( "-hltEcalRegionalRestFEDs" )
00647       self.options['modules'].append( "-hltEcalRegionalESRestFEDs" )
00648       self.options['modules'].append( "-hltEcalRawToRecHitFacility" )
00649       self.options['modules'].append( "-hltESRawToRecHitFacility" )
00650       self.options['modules'].append( "-hltEcalRegionalJetsRecHit" )
00651       self.options['modules'].append( "-hltEcalRegionalMuonsRecHit" )
00652       self.options['modules'].append( "-hltEcalRegionalEgammaRecHit" )
00653       self.options['modules'].append( "-hltEcalRecHitAll" )
00654       self.options['modules'].append( "-hltESRecHitAll" )
00655       self.options['modules'].append( "-hltL3TauPixelSeeds" )
00656       self.options['modules'].append( "-hltL3TauHighPtPixelSeeds" )
00657       self.options['modules'].append( "-hltL3TauCkfTrackCandidates" )
00658       self.options['modules'].append( "-hltL3TauCkfHighPtTrackCandidates" )
00659       self.options['modules'].append( "-hltL3TauCtfWithMaterialTracks" )
00660       self.options['modules'].append( "-hltL25TauPixelSeeds" )
00661       self.options['modules'].append( "-hltL25TauCkfTrackCandidates" )
00662       self.options['modules'].append( "-hltL25TauCtfWithMaterialTracks" )
00663       self.options['modules'].append( "-hltL3TauSingleTrack15CtfWithMaterialTracks" )
00664       self.options['modules'].append( "-hltPFJetCtfWithMaterialTracks" )
00665       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorStartup" )
00666       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesStartup" )
00667       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksStartup" )
00668       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorStartupU" )
00669       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesStartupU" )
00670       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksStartupU" )
00671       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGenerator" )
00672       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidates" )
00673       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracks" )
00674       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorRelaxed" )
00675       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesRelaxed" )
00676       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksRelaxed" )
00677       self.options['modules'].append( "-hltPixelTracksForMinBias" )
00678       self.options['modules'].append( "-hltPixelTracksForHighMult" )
00679       self.options['modules'].append( "-hltMuonCSCDigis" )
00680       self.options['modules'].append( "-hltMuonDTDigis" )
00681       self.options['modules'].append( "-hltMuonRPCDigis" )
00682       self.options['modules'].append( "-hltGtDigis" )
00683       self.options['modules'].append( "-hltL1GtTrigReport" )
00684       self.options['modules'].append( "hltCsc2DRecHits" )
00685       self.options['modules'].append( "hltDt1DRecHits" )
00686       self.options['modules'].append( "hltRpcRecHits" )
00687 
00688       self.options['sequences'].append( "-HLTL1IsoEgammaRegionalRecoTrackerSequence" )
00689       self.options['sequences'].append( "-HLTL1NonIsoEgammaRegionalRecoTrackerSequence" )
00690       self.options['sequences'].append( "-HLTL1IsoElectronsRegionalRecoTrackerSequence" )
00691       self.options['sequences'].append( "-HLTL1NonIsoElectronsRegionalRecoTrackerSequence" )
00692       self.options['sequences'].append( "-HLTPixelMatchLargeWindowElectronL1IsoTrackingSequence" )
00693       self.options['sequences'].append( "-HLTPixelMatchLargeWindowElectronL1NonIsoTrackingSequence" )
00694       self.options['sequences'].append( "-HLTPixelTrackingForMinBiasSequence" )
00695       self.options['sequences'].append( "-HLTDoLocalStripSequence" )
00696       self.options['sequences'].append( "-HLTDoLocalPixelSequence" )
00697       self.options['sequences'].append( "-HLTRecopixelvertexingSequence" )
00698       self.options['sequences'].append( "-HLTL3TauTrackReconstructionSequence" )
00699       self.options['sequences'].append( "-HLTL3TauHighPtTrackReconstructionSequence" )
00700       self.options['sequences'].append( "-HLTL25TauTrackReconstructionSequence" )
00701       self.options['sequences'].append( "-HLTL3TauSingleTrack15ReconstructionSequence" )
00702       self.options['sequences'].append( "-HLTTrackReconstructionForJets" )
00703       self.options['sequences'].append( "-HLTEndSequence" )
00704       self.options['sequences'].append( "-HLTBeginSequence" )
00705       self.options['sequences'].append( "-HLTBeginSequenceNZS" )
00706       self.options['sequences'].append( "-HLTBeginSequenceBPTX" )
00707       self.options['sequences'].append( "-HLTBeginSequenceAntiBPTX" )
00708       self.options['sequences'].append( "-HLTL2HcalIsolTrackSequence" )
00709       self.options['sequences'].append( "-HLTL2HcalIsolTrackSequenceHB" )
00710       self.options['sequences'].append( "-HLTL2HcalIsolTrackSequenceHE" )
00711       self.options['sequences'].append( "-HLTL3HcalIsolTrackSequence" )
00712 
00713       # remove unsupported paths
00714       self.options['paths'].append( "-AlCa_EcalEta" )
00715       self.options['paths'].append( "-AlCa_EcalPhiSym" )
00716       self.options['paths'].append( "-AlCa_EcalPi0" )
00717       self.options['paths'].append( "-AlCa_RPCMuonNoHits" )
00718       self.options['paths'].append( "-AlCa_RPCMuonNoTriggers" )
00719       self.options['paths'].append( "-AlCa_RPCMuonNormalisation" )
00720       self.options['paths'].append( "-DQM_FEDIntegrity" )
00721       self.options['paths'].append( "-DQM_FEDIntegrity_v*" )
00722       self.options['paths'].append( "-HLT_Activity_DT" )
00723       self.options['paths'].append( "-HLT_Activity_DT_Tuned" )
00724       self.options['paths'].append( "-HLT_Activity_Ecal" )
00725       self.options['paths'].append( "-HLT_Activity_EcalREM" )
00726       self.options['paths'].append( "-HLT_Activity_Ecal_SC15" )
00727       self.options['paths'].append( "-HLT_Activity_Ecal_SC17" )
00728       self.options['paths'].append( "-HLT_Activity_Ecal_SC7" )
00729       self.options['paths'].append( "-HLT_Activity_L1A" )
00730       self.options['paths'].append( "-HLT_Activity_PixelClusters" )
00731       self.options['paths'].append( "-HLT_Calibration" )
00732       self.options['paths'].append( "-HLT_DTErrors" )
00733       self.options['paths'].append( "-HLT_DoubleEle4_SW_eeRes_L1R" )
00734       self.options['paths'].append( "-HLT_DoubleEle4_SW_eeRes_L1R_v*" )
00735       self.options['paths'].append( "-HLT_DoubleEle5_SW_Upsilon_L1R_v*" )
00736       self.options['paths'].append( "-HLT_DoublePhoton4_Jpsi_L1R" )
00737       self.options['paths'].append( "-HLT_DoublePhoton4_Upsilon_L1R" )
00738       self.options['paths'].append( "-HLT_DoublePhoton4_eeRes_L1R" )
00739       self.options['paths'].append( "-HLT_EcalCalibration" )
00740       self.options['paths'].append( "-HLT_EgammaSuperClusterOnly_L1R" )
00741       self.options['paths'].append( "-HLT_Ele15_SiStrip_L1R" )
00742       self.options['paths'].append( "-HLT_Ele20_SiStrip_L1R" )
00743       self.options['paths'].append( "-HLT_HFThreshold10" )
00744       self.options['paths'].append( "-HLT_HFThreshold3" )
00745       self.options['paths'].append( "-HLT_HcalCalibration" )
00746       self.options['paths'].append( "-HLT_HcalNZS" )
00747       self.options['paths'].append( "-HLT_HcalPhiSym" )
00748       self.options['paths'].append( "-HLT_IsoTrackHB_v*" )
00749       self.options['paths'].append( "-HLT_IsoTrackHE_v*" )
00750       self.options['paths'].append( "-HLT_Jet15U_HcalNoiseFiltered" )
00751       self.options['paths'].append( "-HLT_Jet15U_HcalNoiseFiltered_v*" )
00752       self.options['paths'].append( "-HLT_L1DoubleMuOpen_Tight" )
00753       self.options['paths'].append( "-HLT_L1MuOpen_AntiBPTX" )
00754       self.options['paths'].append( "-HLT_L1MuOpen_AntiBPTX_v*" )
00755       self.options['paths'].append( "-HLT_Mu0_TkMu0_OST_Jpsi" )
00756       self.options['paths'].append( "-HLT_Mu0_TkMu0_OST_Jpsi_Tight_v*" )
00757       self.options['paths'].append( "-HLT_Mu0_Track0_Jpsi" )
00758       self.options['paths'].append( "-HLT_Mu3_TkMu0_OST_Jpsi" )
00759       self.options['paths'].append( "-HLT_Mu3_TkMu0_OST_Jpsi_Tight_v*" )
00760       self.options['paths'].append( "-HLT_Mu3_Track0_Jpsi" )
00761       self.options['paths'].append( "-HLT_Mu3_Track3_Jpsi" )
00762       self.options['paths'].append( "-HLT_Mu3_Track3_Jpsi_v*" )
00763       self.options['paths'].append( "-HLT_Mu3_Track5_Jpsi_v*" )
00764       self.options['paths'].append( "-HLT_Mu5_TkMu0_OST_Jpsi" )
00765       self.options['paths'].append( "-HLT_Mu5_TkMu0_OST_Jpsi_Tight_v*" )
00766       self.options['paths'].append( "-HLT_Mu5_Track0_Jpsi" )
00767       self.options['paths'].append( "-HLT_Mu5_Track0_Jpsi_v*" )
00768       self.options['paths'].append( "-HLT_Random" )
00769       self.options['paths'].append( "-HLT_SelectEcalSpikesHighEt_L1R" )
00770       self.options['paths'].append( "-HLT_SelectEcalSpikes_L1R" )
00771 
00772       # remove HLTAnalyzerEndpath from fastsim cff's
00773       if self.config.fragment:
00774         self.options['paths'].append( "-HLTAnalyzerEndpath" )
00775 
00776 
00777   def build_source(self):
00778     if self.config.online:
00779       # online we always run on data
00780       self.source = "file:/tmp/InputCollection.root"
00781     elif self.config.data:
00782       # offline we can run on data...
00783       self.source = "/store/data/Run2010B/MinimumBias/RAW/v1/000/149/291/DC6C917A-0EE3-DF11-867B-001617C3B654.root"
00784     else:
00785       # ...or on mc
00786       self.source = "file:RelVal_DigiL1Raw_%s.root" % self.config.type
00787