CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/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=https://localhost:3128)(serverurl=https://localhost:8000/FrontierOnProd)(serverurl=https://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     self.data += """
00115 # Extra customisation for CMSSW 42X+ only
00116 %(process)secalSeverityLevel = cms.ESProducer( "EcalSeverityLevelESProducer",
00117     appendToDataLabel = cms.string( "" ),
00118     flagMask = cms.vuint32( 1, 34, 896, 4, 49152, 6232 ),
00119     dbstatusMask = cms.vuint32( 1, 2046, 0, 0, 0, 64512 ),
00120     timeThresh = cms.double( 2.0 )
00121 )
00122 """
00123     if not(self.config.type in ('HIon', )):
00124       self.data += """
00125 if 'hltParticleFlowRecHitHCAL' in %(dict)s:
00126     %(process)shltParticleFlowRecHitHCAL.HCAL_Calib = True
00127     %(process)shltParticleFlowRecHitHCAL.HF_Calib = True
00128 if 'hltParticleFlow' in %(dict)s:
00129     %(process)shltParticleFlow.calibPFSCEle_barrel = [1.004, -1.536, 22.88, -1.467, 0.3555, 0.6227, 14.65, 2051, 25, 0.9932, -0.5444, 0, 0.5438, 0.7109, 7.645, 0.2904, 0]
00130     %(process)shltParticleFlow.calibPFSCEle_endcap = [1.153, -16.5975, 5.668, -0.1772, 16.22, 7.326, 0.0483, -4.068, 9.406]
00131 """
00132 
00133     if self.config.fragment:
00134       # if running on MC, adapt the configuration accordingly
00135       self.fixForMC()
00136 
00137       # if requested, adapt the configuration for FastSim
00138       self.fixForFastSim()
00139 
00140       # if requested, remove the HLT prescales
00141       self.unprescale()
00142 
00143       # if requested, override all ED/HLTfilters to always pass ("open" mode)
00144       self.instrumentOpenMode()
00145 
00146       # if requested, instrument the self with the modules and EndPath needed for timing studies
00147       self.instrumentTiming()
00148 
00149     else:
00150       # if running on MC, adapt the configuration accordingly
00151       self.fixForMC()
00152 
00153       # override the process name and adapt the relevant filters
00154       self.overrideProcessName()
00155 
00156       # if required, remove the HLT prescales
00157       self.unprescale()
00158 
00159       # if requested, override all ED/HLTfilters to always pass ("open" mode)
00160       self.instrumentOpenMode()
00161 
00162       # manual override some Heavy Ion parameters
00163       if self.config.type in ('HIon', ):
00164         self.data += """
00165 # HIon paths in smart prescalers
00166 if 'hltPreDQMOutputSmart' in %(dict)s:
00167     %(process)shltPreDQMOutputSmart.throw     = cms.bool( False )
00168 if 'hltPreExpressOutputSmart' in %(dict)s:
00169     %(process)shltPreExpressOutputSmart.throw = cms.bool( False )
00170 if 'hltPreHLTDQMOutputSmart' in %(dict)s:
00171     %(process)shltPreHLTDQMOutputSmart.throw  = cms.bool( False )
00172 if 'hltPreHLTMONOutputSmart' in %(dict)s:
00173     %(process)shltPreHLTMONOutputSmart.throw  = cms.bool( False )
00174 """
00175 
00176       # override the output modules to output root files
00177       self.overrideOutput()
00178 
00179       # add global options
00180       self.addGlobalOptions()
00181 
00182       # if requested or necessary, override the GlobalTag and connection strings
00183       self.overrideGlobalTag()
00184 
00185       # if requested, override the L1 self from the GlobalTag (using the same connect as the GlobalTag itself)
00186       self.overrideL1Menu()
00187 
00188       # request summary informations from the MessageLogger
00189       self.updateMessageLogger()
00190 
00191       # if requested, instrument the self with the modules and EndPath needed for timing studies
00192       self.instrumentTiming()
00193 
00194 
00195   def addGlobalOptions(self):
00196     # add global options
00197     self.data += """
00198 # add global options
00199 %(process)smaxEvents = cms.untracked.PSet(
00200     input = cms.untracked.int32( 100 )
00201 )
00202 %(process)soptions = cms.untracked.PSet(
00203     wantSummary = cms.untracked.bool( True )
00204 )
00205 """
00206 
00207 
00208   def _fix_parameter(self, **args):
00209     """arguments:
00210         name:     parameter name (optional)
00211         type:     parameter type (look for tracked and untracked variants)
00212         value:    original value
00213         replace:  replacement value
00214     """
00215     if 'name' in args:
00216       self.data = re.sub(
00217           r'%(name)s = cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00218           r'%(name)s = cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00219           self.data)
00220     else:
00221       self.data = re.sub(
00222           r'cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00223           r'cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00224           self.data)
00225 
00226 
00227   def fixForMC(self):
00228     if not self.config.data:
00229       # override the raw data collection label
00230       self._fix_parameter(type = 'InputTag', value = 'source', replace = 'rawDataCollector')
00231       self._fix_parameter(type = 'string',   value = 'source', replace = 'rawDataCollector')
00232 
00233 
00234   def fixForFastSim(self):
00235     if self.config.fastsim:
00236       # adapt the hle configuration (fragment) to run under fastsim
00237       self.data = re.sub( r'import FWCore.ParameterSet.Config as cms', r'\g<0>\nfrom FastSimulation.HighLevelTrigger.HLTSetup_cff import *', self.data)
00238 
00239       # remove the definition of streams and datasets
00240       self.data = re.compile( r'^streams.*\n(.*\n)*?^\)\s*\n',  re.MULTILINE ).sub( '', self.data )
00241       self.data = re.compile( r'^datasets.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
00242 
00243       # fix the definition of module
00244       self._fix_parameter(                               type = 'InputTag', value = 'hltL1extraParticles',  replace = 'l1extraParticles')
00245       self._fix_parameter(name = 'GMTReadoutCollection', type = 'InputTag', value = 'hltGtDigis',           replace = 'gmtDigis')
00246       self._fix_parameter(                               type = 'InputTag', value = 'hltGtDigis',           replace = 'gtDigis')
00247       self._fix_parameter(                               type = 'InputTag', value = 'hltL1GtObjectMap',     replace = 'gtDigis')
00248       self._fix_parameter(name = 'initialSeeds',         type = 'InputTag', value = 'noSeedsHere',          replace = 'globalPixelSeeds:GlobalPixel')
00249       self._fix_parameter(name = 'preFilteredSeeds',     type = 'bool',     value = 'True',                 replace = 'False')
00250       self._fix_parameter(                               type = 'InputTag', value = 'hltOfflineBeamSpot',   replace = 'offlineBeamSpot')
00251       self._fix_parameter(                               type = 'InputTag', value = 'hltOnlineBeamSpot',    replace = 'offlineBeamSpot')
00252       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonCSCDigis',      replace = 'simMuonCSCDigis')
00253       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonDTDigis',       replace = 'simMuonDTDigis')
00254       self._fix_parameter(                               type = 'InputTag', value = 'hltMuonRPCDigis',      replace = 'simMuonRPCDigis')
00255 
00256       # fix the definition of sequences and paths
00257       self.data = re.sub( r'hltMuonCSCDigis', r'cms.SequencePlaceholder( "simMuonCSCDigis" )',  self.data )
00258       self.data = re.sub( r'hltMuonDTDigis',  r'cms.SequencePlaceholder( "simMuonDTDigis" )',   self.data )
00259       self.data = re.sub( r'hltMuonRPCDigis', r'cms.SequencePlaceholder( "simMuonRPCDigis" )',  self.data )
00260       self.data = re.sub( r'HLTEndSequence',  r'cms.SequencePlaceholder( "HLTEndSequence" )',   self.data )
00261       self.data = re.sub( r'hltGtDigis',      r'HLTBeginSequence',                              self.data )
00262 
00263 
00264   def unprescale(self):
00265     if self.config.unprescale:
00266       self.data += """
00267 # remove the HLT prescales
00268 if 'PrescaleService' in %(dict)s:
00269     %(process)sPrescaleService.lvl1DefaultLabel = cms.untracked.string( '0' )
00270     %(process)sPrescaleService.lvl1Labels = cms.vstring( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' )
00271     %(process)sPrescaleService.prescaleTable = cms.VPSet( )
00272 """
00273 
00274 
00275   def instrumentOpenMode(self):
00276     if self.config.open:
00277       # find all EDfilters
00278       filters = [ match[1] for match in re.findall(r'(process\.)?\b(\w+) = cms.EDFilter', self.data) ]
00279       # wrap all EDfilters with "cms.ignore( ... )"
00280       re_filters  = re.compile( r'\b((process\.)?(' + r'|'.join(filters) + r'))\b' )
00281       re_sequence = re.compile( r'cms\.(Path|Sequence)\((.*)\)' )
00282       self.data = re_sequence.sub( lambda line: re_filters.sub( r'cms.ignore( \1 )', line.group(0) ), self.data )
00283 
00284 
00285   def overrideGlobalTag(self):
00286     # overwrite GlobalTag
00287     # the logic is:
00288     #   - for running online, do nothing, unless a globaltag has been specified on the command line
00289     #   - for running offline on data, only add the pfnPrefix
00290     #   - for running offline on mc, take the GT from the command line of the configuration.type
00291     #      - if the GT is "auto:...", insert the code to read it from Configuration.PyReleaseValidation.autoCond
00292     text = ''
00293     if self.config.online:
00294       if self.config.globaltag:
00295         # override the GlobalTag
00296         text += """
00297 # override the GlobalTag
00298 if 'GlobalTag' in %%(dict)s:
00299     %%(process)sGlobalTag.globaltag = '%(globaltag)s'
00300 """
00301 
00302     else:
00303       # override the GlobalTag connection string and pfnPrefix
00304       text += """
00305 # override the GlobalTag, connection string and pfnPrefix
00306 if 'GlobalTag' in %%(dict)s:
00307     %%(process)sGlobalTag.connect   = '%%(connect)s/CMS_COND_31X_GLOBALTAG'
00308     %%(process)sGlobalTag.pfnPrefix = cms.untracked.string('%%(connect)s/')
00309 """
00310 
00311       if self.config.data:
00312         # do not override the GlobalTag unless one was specified on the command line
00313         pass
00314       else:
00315         # check if a specific GlobalTag was specified on the command line, or choose one from the configuration.type
00316         if not self.config.globaltag:
00317           if self.config.type in globalTag:
00318             self.config.globaltag = globalTag[self.config.type]
00319           else:
00320             self.config.globaltag = globalTag['GRun']
00321 
00322       # check if the GlobalTag is an autoCond or an explicit tag
00323       if not self.config.globaltag:
00324         # when running on data, do not override the GlobalTag unless one was specified on the command line
00325         pass
00326       elif self.config.globaltag.startswith('auto:'):
00327         self.config.menuGlobalTagAuto = self.config.globaltag[5:]
00328         text += "    from Configuration.PyReleaseValidation.autoCond import autoCond\n"
00329         text += "    %%(process)sGlobalTag.globaltag = autoCond['%(menuGlobalTagAuto)s']\n"
00330       else:
00331         text += "    %%(process)sGlobalTag.globaltag = '%(globaltag)s'\n"
00332 
00333     self.data += text % self.config.__dict__
00334 
00335 
00336   def overrideL1Menu(self):
00337     # if requested, override the L1 menu from the GlobalTag (using the same connect as the GlobalTag itself)
00338     if self.config.l1.override:
00339       self.config.l1.record = 'L1GtTriggerMenuRcd'
00340       self.config.l1.label  = ''
00341       self.config.l1.tag    = self.config.l1.override
00342       if not self.config.l1.connect:
00343         self.config.l1.connect = '%(connect)s/CMS_COND_31X_L1T'
00344       self.loadAdditionalConditions( 'override the L1 menu', self.config.l1.__dict__ )
00345 
00346 
00347   def overrideOutput(self):
00348     reOutputModuleDef = re.compile(r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\(.*\n([^)].*\n)*\) *\n')
00349     reOutputModuleRef = re.compile(r' *[+*]? *\b(process\.)?hltOutput(\w+)')    # FIXME this does not cover "hltOutputX + something"
00350     if self.config.output == 'none':
00351       # drop all output modules
00352       self.data = reOutputModuleDef.sub('', self.data)
00353       self.data = reOutputModuleRef.sub('', self.data)
00354 
00355     elif self.config.output == 'minimal':
00356       # drop all output modules except "HLTDQMResults"
00357       repl = lambda match: (match.group(2) == 'HLTDQMResults') and match.group() or ''
00358       self.data = reOutputModuleDef.sub(repl, self.data)
00359       self.data = reOutputModuleRef.sub(repl, self.data)
00360 
00361     # override the "online" ShmStreamConsumer output modules with "offline" PoolOutputModule's
00362     self.data = re.sub(
00363       r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\( *"ShmStreamConsumer" *,',
00364       r'%(process)shltOutput\2 = cms.OutputModule( "PoolOutputModule",\n    fileName = cms.untracked.string( "output\2.root" ),\n    fastCloning = cms.untracked.bool( False ),',
00365       self.data
00366     )
00367 
00368 
00369   # override the process name and adapt the relevant filters
00370   def overrideProcessName(self):
00371     # the following was stolen and adapted from HLTrigger.Configuration.customL1THLT_Options
00372     self.data += """
00373 # override the process name
00374 %%(process)ssetName_('%(name)s')
00375 
00376 # adapt HLT modules to the correct process name
00377 if 'hltTrigReport' in %%(dict)s:
00378     %%(process)shltTrigReport.HLTriggerResults       = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00379 
00380 if 'hltPreExpressSmart' in %%(dict)s:
00381     %%(process)shltPreExpressSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00382 
00383 if 'hltPreHLTMONSmart' in %%(dict)s:
00384     %%(process)shltPreHLTMONSmart.TriggerResultsTag  = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00385 
00386 if 'hltPreDQMSmart' in %%(dict)s:
00387     %%(process)shltPreDQMSmart.TriggerResultsTag     = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00388 
00389 if 'hltDQMHLTScalers' in %%(dict)s:
00390     %%(process)shltDQMHLTScalers.triggerResults      = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00391     %%(process)shltDQMHLTScalers.processname         = '%(name)s'
00392     
00393 if 'hltDQML1SeedLogicScalers' in %%(dict)s:
00394     %%(process)shltDQML1SeedLogicScalers.processname = '%(name)s'
00395 """ % self.config.__dict__
00396 
00397 
00398   def updateMessageLogger(self):
00399     # request summary informations from the MessageLogger
00400     self.data += """
00401 if 'MessageLogger' in %(dict)s:
00402     %(process)sMessageLogger.categories.append('TriggerSummaryProducerAOD')
00403     %(process)sMessageLogger.categories.append('L1GtTrigReport')
00404     %(process)sMessageLogger.categories.append('HLTrigReport')
00405 """
00406 
00407 
00408   def loadAdditionalConditions(self, comment, *conditions):
00409     # load additional conditions
00410     self.data += """
00411 # %s
00412 if 'GlobalTag' in %%(dict)s:
00413 """ % comment
00414     for condition in conditions:
00415       self.data += """    %%(process)sGlobalTag.toGet.append(
00416         cms.PSet(
00417             record  = cms.string( '%(record)s' ),
00418             tag     = cms.string( '%(tag)s' ),
00419             label   = cms.untracked.string( '%(label)s' ),
00420             connect = cms.untracked.string( '%(connect)s' )
00421         )
00422     )
00423 """ % condition
00424 
00425   def instrumentTiming(self):
00426     if self.config.timing:
00427       # instrument the menu with the modules and EndPath needed for timing studies
00428       text = ''
00429 
00430       if 'HLTriggerFirstPath' in self.data:
00431         # remove HLTriggerFirstPath
00432         self.data = re.sub(r'.*\bHLTriggerFirstPath\s*=.*\n', '', self.data)
00433 
00434       if not 'hltGetRaw' in self.data:
00435         # add hltGetRaw
00436         text += """
00437 %%(process)shltGetRaw = cms.EDAnalyzer( "HLTGetRaw",
00438     RawDataCollection = cms.InputTag( "%s" )
00439 )
00440 """ % ( self.config.data and 'source' or 'rawDataCollector' )
00441 
00442       if not 'hltGetConditions' in self.data:
00443         # add hltGetConditions
00444         text += """
00445 %(process)shltGetConditions = cms.EDAnalyzer( 'EventSetupRecordDataGetter',
00446     verbose = cms.untracked.bool( False ),
00447     toGet = cms.VPSet( )
00448 )
00449 """
00450 
00451       # add the definition of HLTriggerFirstPath
00452       text += """
00453 %(process)sHLTriggerFirstPath = cms.Path( %(process)shltGetRaw + %(process)shltGetConditions + %(process)shltBoolFalse )
00454 """
00455       self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
00456 
00457       self.data += """
00458 # instrument the menu with the modules and EndPath needed for timing studies
00459 %(process)sPathTimerService = cms.Service( "PathTimerService",
00460 )
00461 %(process)shltTimer = cms.EDProducer( "PathTimerInserter",
00462 )
00463 %(process)shltOutputTiming = cms.OutputModule( "PoolOutputModule",
00464     fileName = cms.untracked.string( "outputTiming.root" ),
00465     fastCloning = cms.untracked.bool( False ),
00466     splitLevel = cms.untracked.int32( 0 ),
00467     dataset = cms.untracked.PSet(
00468         dataTier = cms.untracked.string( 'RECO' ),
00469         filterName = cms.untracked.string( '' )
00470     ),
00471     outputCommands = cms.untracked.vstring( 'drop *',
00472       'keep HLTPerformanceInfo_*_*_*' )
00473 )
00474 
00475 %(process)sTimingOutput = cms.EndPath( %(process)shltTimer + %(process)shltOutputTiming )
00476 """
00477       self.loadAdditionalConditions('add XML geometry to keep hltGetConditions happy',
00478         {
00479           'record'  : 'GeometryFileRcd',
00480           'tag'     : 'XMLFILE_Geometry_380V3_Ideal_mc',
00481           'label'   : 'Ideal',
00482           'connect' : '%(connect)s/CMS_COND_34X_GEOMETRY'
00483         }, {
00484           'record'  : 'GeometryFileRcd',
00485           'tag'     : 'XMLFILE_Geometry_380V3_Extended_mc',
00486           'label'   : 'Extended',
00487           'connect' : '%(connect)s/CMS_COND_34X_GEOMETRY'
00488         }
00489       )
00490 
00491 
00492   def buildOptions(self):
00493     # common configuration for all scenarios
00494     self.options['services'].append( "-FUShmDQMOutputService" )
00495     self.options['paths'].append( "-OfflineOutput" )
00496 
00497     # adapt source and options to the current scenario
00498     if not self.config.fragment:
00499       self.build_source()
00500 
00501     if self.config.fragment:
00502       # extract a configuration file fragment
00503       self.options['essources'].append( "-GlobalTag" )
00504       self.options['essources'].append( "-HepPDTESSource" )
00505       self.options['essources'].append( "-XMLIdealGeometryESSource" )
00506       self.options['essources'].append( "-eegeom" )
00507       self.options['essources'].append( "-es_hardcode" )
00508       self.options['essources'].append( "-magfield" )
00509 
00510       self.options['esmodules'].append( "-AutoMagneticFieldESProducer" )
00511       self.options['esmodules'].append( "-SlaveField0" )
00512       self.options['esmodules'].append( "-SlaveField20" )
00513       self.options['esmodules'].append( "-SlaveField30" )
00514       self.options['esmodules'].append( "-SlaveField35" )
00515       self.options['esmodules'].append( "-SlaveField38" )
00516       self.options['esmodules'].append( "-SlaveField40" )
00517       self.options['esmodules'].append( "-VBF0" )
00518       self.options['esmodules'].append( "-VBF20" )
00519       self.options['esmodules'].append( "-VBF30" )
00520       self.options['esmodules'].append( "-VBF35" )
00521       self.options['esmodules'].append( "-VBF38" )
00522       self.options['esmodules'].append( "-VBF40" )
00523       self.options['esmodules'].append( "-CSCGeometryESModule" )
00524       self.options['esmodules'].append( "-CaloGeometryBuilder" )
00525       self.options['esmodules'].append( "-CaloTowerHardcodeGeometryEP" )
00526       self.options['esmodules'].append( "-CastorHardcodeGeometryEP" )
00527       self.options['esmodules'].append( "-DTGeometryESModule" )
00528       self.options['esmodules'].append( "-EcalBarrelGeometryEP" )
00529       self.options['esmodules'].append( "-EcalElectronicsMappingBuilder" )
00530       self.options['esmodules'].append( "-EcalEndcapGeometryEP" )
00531       self.options['esmodules'].append( "-EcalLaserCorrectionService" )
00532       self.options['esmodules'].append( "-EcalPreshowerGeometryEP" )
00533       self.options['esmodules'].append( "-HcalHardcodeGeometryEP" )
00534       self.options['esmodules'].append( "-HcalTopologyIdealEP" )
00535       self.options['esmodules'].append( "-MuonNumberingInitialization" )
00536       self.options['esmodules'].append( "-ParametrizedMagneticFieldProducer" )
00537       self.options['esmodules'].append( "-RPCGeometryESModule" )
00538       self.options['esmodules'].append( "-SiStripGainESProducer" )
00539       self.options['esmodules'].append( "-SiStripRecHitMatcherESProducer" )
00540       self.options['esmodules'].append( "-SiStripQualityESProducer" )
00541       self.options['esmodules'].append( "-StripCPEfromTrackAngleESProducer" )
00542       self.options['esmodules'].append( "-TrackerDigiGeometryESModule" )
00543       self.options['esmodules'].append( "-TrackerGeometricDetESModule" )
00544       self.options['esmodules'].append( "-VolumeBasedMagneticFieldESProducer" )
00545       self.options['esmodules'].append( "-ZdcHardcodeGeometryEP" )
00546       self.options['esmodules'].append( "-hcal_db_producer" )
00547       self.options['esmodules'].append( "-L1GtTriggerMaskAlgoTrigTrivialProducer" )
00548       self.options['esmodules'].append( "-L1GtTriggerMaskTechTrigTrivialProducer" )
00549       self.options['esmodules'].append( "-hltESPEcalTrigTowerConstituentsMapBuilder" )
00550       self.options['esmodules'].append( "-hltESPGlobalTrackingGeometryESProducer" )
00551       self.options['esmodules'].append( "-hltESPMuonDetLayerGeometryESProducer" )
00552       self.options['esmodules'].append( "-hltESPTrackerRecoGeometryESProducer" )
00553       if not self.config.fastsim:
00554         self.options['esmodules'].append( "-CaloTowerGeometryFromDBEP" )
00555         self.options['esmodules'].append( "-CastorGeometryFromDBEP" )
00556         self.options['esmodules'].append( "-EcalBarrelGeometryFromDBEP" )
00557         self.options['esmodules'].append( "-EcalEndcapGeometryFromDBEP" )
00558         self.options['esmodules'].append( "-EcalPreshowerGeometryFromDBEP" )
00559         self.options['esmodules'].append( "-HcalGeometryFromDBEP" )
00560         self.options['esmodules'].append( "-ZdcGeometryFromDBEP" )
00561         self.options['esmodules'].append( "-XMLFromDBSource" )
00562         self.options['esmodules'].append( "-sistripconn" )
00563 
00564       self.options['services'].append( "-PrescaleService" )
00565       self.options['services'].append( "-MessageLogger" )
00566       self.options['services'].append( "-DQM" )
00567       self.options['services'].append( "-MicroStateService" )
00568       self.options['services'].append( "-ModuleWebRegistry" )
00569       self.options['services'].append( "-TimeProfilerService" )
00570       if not self.config.fastsim:
00571         self.options['services'].append( "-DQMStore" )
00572 
00573       self.options['paths'].append( "-*Output" )
00574 
00575       self.options['psets'].append( "-maxEvents" )
00576       self.options['psets'].append( "-options" )
00577 
00578     if self.config.fastsim:
00579       # remove components not supported or needed by fastsim
00580       self.options['essources'].append( "-BTagRecord" )
00581 
00582       self.options['esmodules'].append( "-SiPixelTemplateDBObjectESProducer" )
00583       self.options['esmodules'].append( "-TTRHBuilderPixelOnly" )
00584       self.options['esmodules'].append( "-WithTrackAngle" )
00585       self.options['esmodules'].append( "-trajectoryCleanerBySharedHits" )
00586       self.options['esmodules'].append( "-trackCounting3D2nd" )
00587       self.options['esmodules'].append( "-navigationSchoolESProducer" )
00588       self.options['esmodules'].append( "-muonCkfTrajectoryFilter" )
00589       self.options['esmodules'].append( "-ckfBaseTrajectoryFilter" )
00590       self.options['esmodules'].append( "-TransientTrackBuilderESProducer" )
00591       self.options['esmodules'].append( "-TrackerRecoGeometryESProducer" )
00592       self.options['esmodules'].append( "-SteppingHelixPropagatorOpposite" )
00593       self.options['esmodules'].append( "-SteppingHelixPropagatorAny" )
00594       self.options['esmodules'].append( "-SteppingHelixPropagatorAlong" )
00595       self.options['esmodules'].append( "-SmootherRK" )
00596       self.options['esmodules'].append( "-SmartPropagatorRK" )
00597       self.options['esmodules'].append( "-SmartPropagatorOpposite" )
00598       self.options['esmodules'].append( "-SmartPropagatorAnyRK" )
00599       self.options['esmodules'].append( "-SmartPropagatorAnyOpposite" )
00600       self.options['esmodules'].append( "-SmartPropagatorAny" )
00601       self.options['esmodules'].append( "-SmartPropagator" )
00602       self.options['esmodules'].append( "-RungeKuttaTrackerPropagator" )
00603       self.options['esmodules'].append( "-OppositeMaterialPropagator" )
00604       self.options['esmodules'].append( "-MuonTransientTrackingRecHitBuilderESProducer" )
00605       self.options['esmodules'].append( "-MuonDetLayerGeometryESProducer" )
00606       self.options['esmodules'].append( "-MuonCkfTrajectoryBuilder" )
00607       self.options['esmodules'].append( "-hltMeasurementTracker" )
00608       self.options['esmodules'].append( "-MaterialPropagator" )
00609       self.options['esmodules'].append( "-L3MuKFFitter" )
00610       self.options['esmodules'].append( "-KFUpdatorESProducer" )
00611       self.options['esmodules'].append( "-KFSmootherForRefitInsideOut" )
00612       self.options['esmodules'].append( "-KFSmootherForMuonTrackLoader" )
00613       self.options['esmodules'].append( "-KFFitterForRefitInsideOut" )
00614       self.options['esmodules'].append( "-GroupedCkfTrajectoryBuilder" )
00615       self.options['esmodules'].append( "-GlobalTrackingGeometryESProducer" )
00616       self.options['esmodules'].append( "-FittingSmootherRK" )
00617       self.options['esmodules'].append( "-FitterRK" )
00618       self.options['esmodules'].append( "-hltCkfTrajectoryBuilder" )
00619       self.options['esmodules'].append( "-Chi2MeasurementEstimator" )
00620       self.options['esmodules'].append( "-Chi2EstimatorForRefit" )
00621       self.options['esmodules'].append( "-CaloTowerConstituentsMapBuilder" )
00622       self.options['esmodules'].append( "-CaloTopologyBuilder" )
00623 
00624       self.options['services'].append( "-UpdaterService" )
00625 
00626       self.options['blocks'].append( "hltL1NonIsoLargeWindowElectronPixelSeeds::SeedConfiguration" )
00627       self.options['blocks'].append( "hltL1IsoLargeWindowElectronPixelSeeds::SeedConfiguration" )
00628       self.options['blocks'].append( "hltL1NonIsoStartUpElectronPixelSeeds::SeedConfiguration" )
00629       self.options['blocks'].append( "hltL1IsoStartUpElectronPixelSeeds::SeedConfiguration" )
00630 
00631       self.options['modules'].append( "hltL3MuonIsolations" )
00632       self.options['modules'].append( "hltPixelVertices" )
00633       self.options['modules'].append( "-hltCkfL1IsoTrackCandidates" )
00634       self.options['modules'].append( "-hltCtfL1IsoWithMaterialTracks" )
00635       self.options['modules'].append( "-hltCkfL1NonIsoTrackCandidates" )
00636       self.options['modules'].append( "-hltCtfL1NonIsoWithMaterialTracks" )
00637       self.options['modules'].append( "hltPixelMatchLargeWindowElectronsL1Iso" )
00638       self.options['modules'].append( "hltPixelMatchLargeWindowElectronsL1NonIso" )
00639       self.options['modules'].append( "-hltESRegionalEgammaRecHit" )
00640       self.options['modules'].append( "-hltEcalRegionalJetsFEDs" )
00641       self.options['modules'].append( "-hltEcalRegionalJetsRecHitTmp" )
00642       self.options['modules'].append( "-hltEcalRegionalMuonsFEDs" )
00643       self.options['modules'].append( "-hltEcalRegionalMuonsRecHitTmp" )
00644       self.options['modules'].append( "-hltEcalRegionalEgammaFEDs" )
00645       self.options['modules'].append( "-hltEcalRegionalEgammaRecHitTmp" )
00646       self.options['modules'].append( "-hltFEDSelector" )
00647       self.options['modules'].append( "-hltL3TrajSeedOIHit" )
00648       self.options['modules'].append( "-hltL3TrajSeedIOHit" )
00649       self.options['modules'].append( "-hltL3TrackCandidateFromL2OIState" )
00650       self.options['modules'].append( "-hltL3TrackCandidateFromL2OIHit" )
00651       self.options['modules'].append( "-hltL3TrackCandidateFromL2IOHit" )
00652       self.options['modules'].append( "-hltL3TrackCandidateFromL2NoVtx" )
00653       self.options['modules'].append( "-hltHcalDigis" )
00654       self.options['modules'].append( "-hltHoreco" )
00655       self.options['modules'].append( "-hltHfreco" )
00656       self.options['modules'].append( "-hltHbhereco" )
00657       self.options['modules'].append( "-hltEcalRegionalRestFEDs" )
00658       self.options['modules'].append( "-hltEcalRegionalESRestFEDs" )
00659       self.options['modules'].append( "-hltEcalRawToRecHitFacility" )
00660       self.options['modules'].append( "-hltESRawToRecHitFacility" )
00661       self.options['modules'].append( "-hltEcalRegionalJetsRecHit" )
00662       self.options['modules'].append( "-hltEcalRegionalMuonsRecHit" )
00663       self.options['modules'].append( "-hltEcalRegionalEgammaRecHit" )
00664       self.options['modules'].append( "-hltEcalRecHitAll" )
00665       self.options['modules'].append( "-hltESRecHitAll" )
00666      #self.options['modules'].append( "-hltL3TauPixelSeeds" )
00667      #self.options['modules'].append( "-hltL3TauHighPtPixelSeeds" )
00668      #self.options['modules'].append( "-hltL3TauCkfTrackCandidates" )
00669      #self.options['modules'].append( "-hltL3TauCkfHighPtTrackCandidates" )
00670      #self.options['modules'].append( "-hltL3TauCtfWithMaterialTracks" )
00671      #self.options['modules'].append( "-hltL25TauPixelSeeds" )
00672      #self.options['modules'].append( "-hltL25TauCkfTrackCandidates" )
00673      #self.options['modules'].append( "-hltL25TauCtfWithMaterialTracks" )
00674      #self.options['modules'].append( "-hltL3TauSingleTrack15CtfWithMaterialTracks" )
00675       # === hltPF
00676       self.options['modules'].append( "-hltPFJetPixelSeeds" )
00677       self.options['modules'].append( "-hltPFJetCkfTrackCandidates" )
00678       self.options['modules'].append( "-hltPFJetCtfWithMaterialTracks" )
00679       self.options['modules'].append( "-hltPFlowTrackSelectionHighPurity" )
00680       # === hltBLifetimeRegional
00681       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGenerator" )
00682       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidates" )
00683       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracks" )
00684       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorSingleTop" )
00685       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksSingleTop" )
00686       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesSingleTop" )
00687       self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorEleJetSingleTop" )
00688       self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesEleJetSingleTop" )
00689       self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksEleJetSingleTop" )
00690 
00691       self.options['modules'].append( "-hltPixelTracksForMinBias" )
00692       self.options['modules'].append( "-hltPixelTracksForHighMult" )
00693 
00694       self.options['modules'].append( "-hltMuonCSCDigis" )
00695       self.options['modules'].append( "-hltMuonDTDigis" )
00696       self.options['modules'].append( "-hltMuonRPCDigis" )
00697       self.options['modules'].append( "-hltGtDigis" )
00698       self.options['modules'].append( "-hltL1GtTrigReport" )
00699       self.options['modules'].append( "hltCsc2DRecHits" )
00700       self.options['modules'].append( "hltDt1DRecHits" )
00701       self.options['modules'].append( "hltRpcRecHits" )
00702 
00703       self.options['sequences'].append( "-HLTL1IsoEgammaRegionalRecoTrackerSequence" )
00704       self.options['sequences'].append( "-HLTL1NonIsoEgammaRegionalRecoTrackerSequence" )
00705       self.options['sequences'].append( "-HLTEcalActivityEgammaRegionalRecoTrackerSequence" )
00706       self.options['sequences'].append( "-HLTPixelMatchElectronActivityTrackingSequence" )
00707       self.options['sequences'].append( "-HLTL1IsoElectronsRegionalRecoTrackerSequence" )
00708       self.options['sequences'].append( "-HLTL1NonIsoElectronsRegionalRecoTrackerSequence" )
00709       self.options['sequences'].append( "-HLTPixelMatchLargeWindowElectronL1IsoTrackingSequence" )
00710       self.options['sequences'].append( "-HLTPixelMatchLargeWindowElectronL1NonIsoTrackingSequence" )
00711       self.options['sequences'].append( "-HLTPixelTrackingForMinBiasSequence" )
00712       self.options['sequences'].append( "-HLTDoLocalStripSequence" )
00713       self.options['sequences'].append( "-HLTDoLocalPixelSequence" )
00714       self.options['sequences'].append( "-hltSiPixelDigis" )
00715       self.options['sequences'].append( "-hltSiPixelClusters" )
00716       self.options['sequences'].append( "-hltSiPixelRecHits" )
00717       self.options['sequences'].append( "-HLTRecopixelvertexingSequence" )
00718      #self.options['sequences'].append( "-HLTL3TauTrackReconstructionSequence" )
00719      #self.options['sequences'].append( "-HLTL3TauHighPtTrackReconstructionSequence" )
00720      #self.options['sequences'].append( "-HLTL25TauTrackReconstructionSequence" )
00721      #self.options['sequences'].append( "-HLTL3TauSingleTrack15ReconstructionSequence" )
00722      #self.options['sequences'].append( "-HLTTrackReconstructionForJets" )
00723       self.options['sequences'].append( "-HLTEndSequence" )
00724       self.options['sequences'].append( "-HLTBeginSequence" )
00725       self.options['sequences'].append( "-HLTBeginSequenceNZS" )
00726       self.options['sequences'].append( "-HLTBeginSequenceBPTX" )
00727       self.options['sequences'].append( "-HLTBeginSequenceAntiBPTX" )
00728       self.options['sequences'].append( "-HLTL2HcalIsolTrackSequence" )
00729       self.options['sequences'].append( "-HLTL2HcalIsolTrackSequenceHB" )
00730       self.options['sequences'].append( "-HLTL2HcalIsolTrackSequenceHE" )
00731       self.options['sequences'].append( "-HLTL3HcalIsolTrackSequence" )
00732 
00733       # remove unsupported paths
00734       self.options['paths'].append( "-AlCa_EcalEta_v*" )
00735       self.options['paths'].append( "-AlCa_EcalPhiSym_v*" )
00736       self.options['paths'].append( "-AlCa_EcalPi0_v*" )
00737       self.options['paths'].append( "-AlCa_RPCMuonNoHits_v*" )
00738       self.options['paths'].append( "-AlCa_RPCMuonNoTriggers_v*" )
00739       self.options['paths'].append( "-AlCa_RPCMuonNormalisation_v*" )
00740       self.options['paths'].append( "-DQM_FEDIntegrity_v*" )
00741      #self.options['paths'].append( "-HLT_Activity_DT" )
00742      #self.options['paths'].append( "-HLT_Activity_DT_Tuned" )
00743      #self.options['paths'].append( "-HLT_Activity_Ecal" )
00744      #self.options['paths'].append( "-HLT_Activity_EcalREM" )
00745      #self.options['paths'].append( "-HLT_Activity_Ecal_SC15" )
00746      #self.options['paths'].append( "-HLT_Activity_Ecal_SC17" )
00747      #self.options['paths'].append( "-HLT_Activity_Ecal_SC7" )
00748      #self.options['paths'].append( "-HLT_Activity_L1A" )
00749      #self.options['paths'].append( "-HLT_Activity_PixelClusters" )
00750      #self.options['paths'].append( "-HLT_DTErrors" )
00751      #self.options['paths'].append( "-HLT_DoubleEle4_SW_eeRes_L1R" )
00752      #self.options['paths'].append( "-HLT_DoubleEle4_SW_eeRes_L1R_v*" )
00753      #self.options['paths'].append( "-HLT_DoubleEle5_SW_Upsilon_L1R_v*" )
00754      #self.options['paths'].append( "-HLT_DoublePhoton4_Jpsi_L1R" )
00755      #self.options['paths'].append( "-HLT_DoublePhoton4_Upsilon_L1R" )
00756      #self.options['paths'].append( "-HLT_DoublePhoton4_eeRes_L1R" )
00757      #self.options['paths'].append( "-HLT_EgammaSuperClusterOnly_L1R" )
00758      #self.options['paths'].append( "-HLT_Ele15_SiStrip_L1R" )
00759      #self.options['paths'].append( "-HLT_Ele20_SiStrip_L1R" )
00760      #self.options['paths'].append( "-HLT_HFThreshold10" )
00761      #self.options['paths'].append( "-HLT_HFThreshold3" )
00762       self.options['paths'].append( "-HLT_Calibration_v*" )
00763       self.options['paths'].append( "-HLT_EcalCalibration_v*" )
00764       self.options['paths'].append( "-HLT_HcalCalibration_v*" )
00765       self.options['paths'].append( "-HLT_TrackerCalibration_v*" )
00766       self.options['paths'].append( "-HLT_HcalNZS_v*" )
00767       self.options['paths'].append( "-HLT_HcalPhiSym_v*" )
00768       self.options['paths'].append( "-HLT_IsoTrackHB_v*" )
00769       self.options['paths'].append( "-HLT_IsoTrackHE_v*" )
00770      #self.options['paths'].append( "-HLT_Jet15U_HcalNoiseFiltered" )
00771      #self.options['paths'].append( "-HLT_Jet15U_HcalNoiseFiltered_v*" )
00772      #self.options['paths'].append( "-HLT_L1DoubleMuOpen_Tight" )
00773      #self.options['paths'].append( "-HLT_L1MuOpen_AntiBPTX" )
00774       self.options['paths'].append( "-HLT_L1SingleMuOpen_AntiBPTX_v*" )
00775       self.options['paths'].append( "-HLT_JetE30_NoBPTX*_v*" )
00776      #self.options['paths'].append( "-HLT_Mu0_TkMu0_OST_Jpsi" )
00777      #self.options['paths'].append( "-HLT_Mu0_TkMu0_OST_Jpsi_Tight_v*" )
00778      #self.options['paths'].append( "-HLT_Mu0_Track0_Jpsi" )
00779      #self.options['paths'].append( "-HLT_Mu3_TkMu0_OST_Jpsi" )
00780      #self.options['paths'].append( "-HLT_Mu3_TkMu0_OST_Jpsi_Tight_v*" )
00781      #self.options['paths'].append( "-HLT_Mu3_Track0_Jpsi" )
00782      #self.options['paths'].append( "-HLT_Mu3_Track3_Jpsi" )
00783       self.options['paths'].append( "-HLT_Mu3_Track3_Jpsi_v*" )
00784      #self.options['paths'].append( "-HLT_Mu3_Track5_Jpsi_v*" )
00785      #self.options['paths'].append( "-HLT_Mu5_TkMu0_OST_Jpsi_Tight_v*" )
00786      #self.options['paths'].append( "-HLT_Mu5_Track0_Jpsi_v*" )
00787       self.options['paths'].append( "-HLT_Mu5_TkMu0_OST_Jpsi_Tight_B5Q7_v*" )
00788       self.options['paths'].append( "-HLT_Mu5_Track0_Jpsi_B5Q7_v*" )
00789       self.options['paths'].append( "-HLT_Random_v*" )
00790       self.options['paths'].append( "-HLT_Mu5_Track2_Jpsi_v*" )
00791       self.options['paths'].append( "-HLT_Mu5_Track5_Jpsi_v*" )
00792       self.options['paths'].append( "-HLT_Mu7_Track5_Jpsi_v*" )
00793       self.options['paths'].append( "-HLT_Mu7_Track7_Jpsi_v*" )
00794      #self.options['paths'].append( "-HLT_SelectEcalSpikesHighEt_L1R" )
00795      #self.options['paths'].append( "-HLT_SelectEcalSpikes_L1R" )
00796 
00797       self.options['paths'].append( "-HLT_DTErrors_v*" )
00798       
00799       # TODO: 5E32 paths for which a recovery should be attempted:
00800       self.options['paths'].append( "-HLT_Mu3_Ele8_CaloIdL_TrkIdVL_HT160_v*" )
00801       self.options['paths'].append( "-HLT_Mu3_Ele8_CaloIdT_TrkIdVL_HT160_v*" )
00802       self.options['paths'].append( "-HLT_Ele17_CaloIdT_TrkIdVL_CaloIsoVL_TrkIsoVL_Ele8_CaloIdT_TrkIdVL_CaloIsoVL_TrkIsoVL_v*")
00803       self.options['paths'].append( "-HLT_HT250_DoubleDisplacedJet60_v*" )
00804 
00805       # remove HLTAnalyzerEndpath from fastsim cff's
00806       if self.config.fragment:
00807         self.options['paths'].append( "-HLTAnalyzerEndpath" )
00808 
00809 
00810   def build_source(self):
00811     if self.config.online:
00812       # online we always run on data
00813       self.source = "file:/tmp/InputCollection.root"
00814     elif self.config.data:
00815       # offline we can run on data...
00816       self.source = "/store/data/Run2011A/MinimumBias/RAW/v1/000/161/312/FEE65985-EF55-E011-A137-001617E30F50.root"
00817     else:
00818       # ...or on mc
00819       self.source = "file:RelVal_DigiL1Raw_%s.root" % self.config.type
00820