CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/HLTrigger/Configuration/python/Tools/options.py

Go to the documentation of this file.
00001 # available "type"s and relative global tags
00002 globalTag = {
00003   'FULL': 'auto:startup',
00004   'GRun': 'auto:startup',       # use as default
00005   'data': 'auto:hltonline',
00006   'HIon': 'auto:starthi',
00007 }
00008 
00009 
00010 # type used to store a reference to an L1 menu
00011 class ConnectionL1TMenu(object):
00012   def __init__(self, value):
00013     self.override = None
00014     self.connect  = None
00015 
00016     # extract the connection string and configuration name
00017     if value:
00018       if ':' in value:
00019         self.override = 'L1GtTriggerMenu_%s_mc' % value.rsplit(':', 1)[1]
00020         self.connect  = value.rsplit(':', 1)[0]
00021       else:
00022         self.override = 'L1GtTriggerMenu_%s_mc' % value
00023         self.connect  = None
00024 
00025 
00026 # type used to store a reference to an HLT configuration
00027 class ConnectionHLTMenu(object):
00028   def __init__(self, value):
00029     self.value = value
00030     self.db    = None
00031     self.name  = None
00032     self.run   = None
00033 
00034     # extract the database and configuration name
00035     if value:
00036       if ':' in self.value:
00037         (db, name) = self.value.split(':')
00038         if db == 'run':
00039           self.run  = name
00040         elif db in ('hltdev', 'orcoff'):
00041           self.db   = db
00042           self.name = name
00043         else:
00044           raise Exception('Unknown ConfDB database "%s", valid values are "hltdev" (default) and "orcoff")' % db)
00045       else:
00046         self.db   = 'hltdev'
00047         self.name = self.value
00048 
00049 
00050 # options marked with a (*) only apply when creating a whole process configuration
00051 class HLTProcessOptions(object):
00052   def __init__(self):
00053     self.menu       = None        #     hlt menu
00054     self.name       = None        # (*) if set, override the process name
00055     self.type       = 'GRun'      #     defines global options for 'GRun', 'HIon' or 'online' menus
00056     self.data       = True        #     run on data (true) or mc (false)
00057     self.online     = False       # (*) run online (true) or offline (false)
00058     self.globaltag  = None        # (*) if set, override the GlobalTag
00059     self.l1         = None        # (*) if set, override the L1 menu
00060     self.unprescale = False       # (*) if set, unprescale all paths
00061     self.open       = False       #     if set, cms.ignore all filters, making all paths run on and accept all events
00062     self.timing     = False       #     if set, instrument the menu for timing measurements
00063     self.output     = 'all'       # (*) output 'all', 'minimal' or 'none' output modules
00064     self.fragment   = False       #     prepare a configuration fragment (true) or a whole process (false)
00065     self.fastsim    = False       #     prepare a configuration fragment suitable for FastSim
00066 
00067 
00068   # convert HLT and L1 menus to a dedicated object representation on the fly
00069   def __setattr__(self, name, value):
00070     if name is 'menu' and type(value) is not ConnectionHLTMenu:
00071       # format 'menu' as needed
00072       object.__setattr__(self, name, ConnectionHLTMenu(value))
00073     elif name is 'l1' and type(value) is not ConnectionL1TMenu:
00074       # format '--l1' as needed
00075       object.__setattr__(self, name, ConnectionL1TMenu(value))
00076     elif name is 'fastsim' and value:
00077       # '--fastsim' implies '--fragment' and '--mc'
00078       object.__setattr__(self, 'fastsim',    True)
00079       object.__setattr__(self, 'fragment',   True)
00080       object.__setattr__(self, 'data',       False)
00081     elif name is 'open' and value:
00082       # '--open' implies '--unprescale'
00083       object.__setattr__(self, 'open',       True)
00084       object.__setattr__(self, 'unprescale', True)
00085     elif name is 'timing' and value:
00086       # '--timing' implies '--no-output'
00087       object.__setattr__(self, 'timing',     True)
00088       object.__setattr__(self, 'output',     'none')
00089     else:
00090       object.__setattr__(self, name, value)