CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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   'PIon': 'auto:startup',
00008 }
00009 
00010 
00011 # type used to store a reference to an L1 menu
00012 class ConnectionL1TMenu(object):
00013   def __init__(self, value):
00014     self.override = None
00015     self.connect  = None
00016 
00017     # extract the override tag and the connection string
00018     if value:
00019       if ',' in value:
00020         self.override = value.split(',')[0]
00021         self.connect  = value.split(',')[1]
00022       else:
00023         self.override = value
00024         self.connect  = None
00025 
00026 
00027 # type used to store a reference to an L1 menu
00028 class ConnectionL1TMenuXml(object):
00029   def __init__(self, value):
00030     self.XmlFile = None
00031     self.LumiDir = None
00032 
00033     # extract the override tag and the connection string
00034     if value:
00035       if ',' in value:
00036         self.XmlFile = value.split(',')[0]
00037         self.LumiDir = value.split(',')[1]
00038       else:
00039         self.XmlFile = value
00040         self.LumiDir = "startup"
00041 
00042 
00043 # type used to store a reference to an HLT configuration
00044 class ConnectionHLTMenu(object):
00045   def __init__(self, value):
00046     self.value = value
00047     self.db    = None
00048     self.name  = None
00049     self.run   = None
00050 
00051     # extract the database and configuration name
00052     if value:
00053       if ':' in self.value:
00054         (db, name) = self.value.split(':')
00055         if db == 'run':
00056           self.run  = name
00057         elif db in ('hltdev', 'orcoff'):
00058           self.db   = db
00059           self.name = name
00060         else:
00061           raise Exception('Unknown ConfDB database "%s", valid values are "hltdev" (default) and "orcoff")' % db)
00062       else:
00063         self.db   = 'hltdev'
00064         self.name = self.value
00065 
00066 
00067 # options marked with a (*) only apply when creating a whole process configuration
00068 class HLTProcessOptions(object):
00069   def __init__(self):
00070     self.menu       = None        #     hlt menu
00071     self.name       = 'HLTX'      # (*) if set, override the process name
00072     self.type       = 'GRun'      #     defines global options for 'GRun', 'HIon', 'PIon' or 'online' menus
00073     self.data       = True        #     run on data (true) or mc (false)
00074     self.online     = False       # (*) run online (true) or offline (false)
00075     self.globaltag  = None        # (*) if set, override the GlobalTag
00076     self.l1         = None        # (*) if set, override the L1 menu
00077     self.l1Xml      = None        # (*) if set, override the L1 menu Xml
00078     self.emulator   = None        # (*) if set, run (part of) the L1 emulator instead of taking the L1 results from the data
00079     self.unprescale = False       # (*) if set, unprescale all paths
00080     self.open       = False       #     if set, cms.ignore all filters, making all paths run on and accept all events
00081     self.errortype  = False       #     if set, change all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)
00082     self.profiling  = False       #     if set, instrument the menu for profiling measurements
00083     self.timing     = False       #     if set, instrument the menu for timing measurements (implies profiling)
00084     self.paths      = None        #     if set, include in the dump only the given paths (wildcards are supported)
00085     self.input      = None        # (*) if set, run on a specific input file
00086     self.events     = 100         # (*) run on these many events
00087     self.output     = 'all'       # (*) output 'all', 'minimal' or 'none' output modules
00088     self.fragment   = False       #     prepare a configuration fragment (true) or a whole process (false)
00089     self.fastsim    = False       #     prepare a configuration fragment suitable for FastSim
00090 
00091 
00092   # convert HLT and L1 menus to a dedicated object representation on the fly
00093   def __setattr__(self, name, value):
00094     if name is 'menu' and type(value) is not ConnectionHLTMenu:
00095       # format 'menu' as needed
00096       object.__setattr__(self, name, ConnectionHLTMenu(value))
00097     elif name is 'l1' and type(value) is not ConnectionL1TMenu:
00098       # format '--l1' as needed
00099       object.__setattr__(self, name, ConnectionL1TMenu(value))
00100     elif name is 'l1Xml' and type(value) is not ConnectionL1TMenuXml:
00101       # format '--l1Xml' as needed
00102       object.__setattr__(self, name, ConnectionL1TMenuXml(value))
00103     elif name is 'fastsim' and value:
00104       # '--fastsim' implies '--fragment' and '--mc'
00105       object.__setattr__(self, 'fastsim',    True)
00106       object.__setattr__(self, 'fragment',   True)
00107       object.__setattr__(self, 'data',       False)
00108     elif name is 'open' and value:
00109       # '--open' implies '--unprescale'
00110       object.__setattr__(self, 'open',       True)
00111       object.__setattr__(self, 'unprescale', True)
00112     elif name is 'profiling' and value:
00113       # '--profiling'
00114       object.__setattr__(self, 'profiling',  True)
00115     elif name is 'timing' and value:
00116       # '--timing' implies '--profiling'
00117       object.__setattr__(self, 'timing',     True)
00118       object.__setattr__(self, 'profiling',  True)
00119     else:
00120       object.__setattr__(self, name, value)