Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-26 17:49:22

0001 # available "type"s and relative global tags
0002 globalTag = {
0003   'Fake' : 'auto:run1_mc_Fake',
0004   'Fake1': 'auto:run2_mc_Fake1',
0005   'Fake2': 'auto:run2_mc_Fake2',
0006   'FULL' : 'auto:run3_mc_FULL',
0007   'GRun' : 'auto:run3_mc_GRun',       # used as default
0008   'HIon' : 'auto:run3_mc_HIon',
0009   'PIon' : 'auto:run3_mc_PIon',
0010   'PRef' : 'auto:run3_mc_PRef',
0011   'Special' : 'auto:run3_mc_GRun',    # same as GRun
0012   'data' : 'auto:run3_hlt_relval',
0013   '2024v14' : 'auto:run3_mc_2024v14',
0014 }
0015 
0016 
0017 # type used to store a reference to an L1 menu
0018 class ConnectionL1TMenu(object):
0019   def __init__(self, value):
0020     self.override = None
0021     self.snapshotTime = None
0022 
0023     # extract the override tag and the connection string
0024     if value:
0025       if ',' in value:
0026         self.override = value.split(',')[0]
0027         self.snapshotTime = value.split(',')[1]
0028       else:
0029         self.override = value
0030         self.smapshotTime = None
0031 
0032 
0033 # type used to store a reference to an L1 menu
0034 class ConnectionL1TMenuXml(object):
0035   def __init__(self, value):
0036     self.XmlFile = None
0037     self.LumiDir = None
0038 
0039     # extract the override tag and the connection string
0040     if value:
0041       if ',' in value:
0042         self.XmlFile = value.split(',')[0]
0043         self.LumiDir = value.split(',')[1]
0044       else:
0045         self.XmlFile = value
0046         self.LumiDir = "startup"
0047 
0048 
0049 # type used to store a reference to an HLT configuration
0050 class ConnectionHLTMenu(object):
0051   valid_versions  = 'v1', 'v2', 'v3', 'v3-beta', 'v3-test'
0052   valid_databases = 'online', 'run3', 'adg','dev','run2'
0053   compatibility   = { 'hltdev': ('v3', 'run3'), 'orcoff': ('v3', 'adg') }
0054 
0055   def __init__(self, value):
0056     self.version    = None
0057     self.database   = None
0058     self.name       = None
0059     self.run        = None
0060 
0061     if not value:
0062       return
0063 
0064     if not ':' in value:
0065       # default to 'v3/run3'
0066       self.version    = 'v3'
0067       self.database   = 'run3'
0068       self.name       = value
0069       return
0070 
0071     # extract the version, database and configuration name
0072     tokens = value.split(':')
0073     if len(tokens) != 2:
0074       raise Exception('Invalid HLT menu specification "%s"' % value)
0075     (db, name) = tokens
0076     # check if the menu should be automatically determined based on the run number
0077     if db == 'run':
0078       self.version  = 'v3'
0079       self.database = 'adg'
0080       self.run      = name
0081     # check for backward compatibility names
0082     elif db in self.compatibility:
0083       self.version, self.database = self.compatibility[db]
0084       self.name = name
0085     else:
0086       if '/' in db:
0087         # extract the version and database
0088         tokens = db.split('/')
0089         if len(tokens) != 2:
0090           raise Exception('Invalid HLT menu specification "%s"' % value)
0091         (v, db) = tokens
0092         if v not in self.valid_versions:
0093           raise Exception('Invalid HLT database version "%s", valid values are "%s"' % (v, '", "'.join(self.valid_versions)))
0094         if db not in self.valid_databases:
0095           raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
0096         self.version  = v
0097         self.database = db
0098         self.name     = name
0099       else:
0100         # use the confdb v3 by default
0101         if db not in self.valid_databases:
0102           raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
0103         self.database = db
0104         self.version  = 'v3'
0105         self.name     = name
0106 
0107 # options marked with a (*) only apply when creating a whole process configuration
0108 class HLTProcessOptions(object):
0109   def __init__(self):
0110     self.menu       = None        #     hlt menu
0111     self.name       = 'HLTX'      # (*) if set, override the process name
0112     self.type       = 'GRun'      #     defines global options for 'GRun', 'HIon', 'PIon', 'PRef' or 'online' menus
0113     self.data       = True        #     run on data (true) or mc (false)
0114     self.globaltag  = None        # (*) if set, override the GlobalTag
0115     self.l1         = None        # (*) if set, override the L1 menu
0116     self.l1Xml      = None        # (*) if set, override the L1 menu Xml
0117     self.emulator   = None        # (*) if set, run (part of) the L1 emulator instead of taking the L1 results from the data
0118     self.prescale   = None        # (*) if set, force the use of a specific prescale column. If set to "none", unprescale all paths
0119     self.open       = False       #     if set, cms.ignore all filters, making all paths run on and accept all events
0120     self.eras       = None        #     if set, select the defined Eras into the HLT configuration
0121     self.customise  = None        #     if set, apply the user-defined customization functions using the format HLTrigger/Configuration/customizeHLTTrackingForPhaseI2017.customizeHLTForPFTrackingPhaseI2017
0122     self.errortype  = False       #     if set, change all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)
0123     self.profiling  = False       #     if set, instrument the menu for profiling measurements
0124     self.timing     = False       #     if set, instrument the menu for timing measurements (implies profiling)
0125     self.paths      = None        #     if set, include in the dump only the given paths (wildcards are supported)
0126     self.input      = None        # (*) if set, specify the input file(s) or dataset
0127     self.parent     = None        # (*) if set, specify the parent input file(s) or dataset
0128     self.events     = 100         # (*) run on these many events
0129     self.output     = 'all'       # (*) output 'all', 'minimal' or 'none' output modules
0130     self.fragment   = False       #     prepare a configuration fragment (true) or a whole process (false)
0131     self.hilton     = False       #     prepare a configuration for running with hilton-like modules
0132     self.setup      = None        #     if set, downlad the setup_cff from the specified configuration and load it.
0133     self.proxy      = False       #     use a socks proxy to connect
0134     self.proxy_host = 'localhost' #     host of the proxy server
0135     self.proxy_port = '8080'      #     port of the proxy server
0136     self.tunnel     = False       #     use a direct tunnel on localhost to connect
0137     self.tunnel_port = '10121'    #     port to connect to on localhost when tunneling
0138 
0139   # convert HLT and L1 menus to a dedicated object representation on the fly
0140   def __setattr__(self, name, value):
0141     if name == 'menu' and not isinstance(value, ConnectionHLTMenu):
0142       # format 'menu' as needed
0143       object.__setattr__(self, name, ConnectionHLTMenu(value))
0144     elif name == 'l1' and not isinstance(value, ConnectionL1TMenu):
0145       # format '--l1' as needed
0146       object.__setattr__(self, name, ConnectionL1TMenu(value))
0147     elif name == 'l1Xml' and not isinstance(value, ConnectionL1TMenuXml):
0148       # format '--l1Xml' as needed
0149       object.__setattr__(self, name, ConnectionL1TMenuXml(value))
0150     elif name == 'open' and value:
0151       # '--open' implies '--unprescale'
0152       object.__setattr__(self, 'open',      True)
0153       object.__setattr__(self, 'prescale',  "none")
0154     elif name == 'prescale' and value is not None:
0155       # '--open' overrides '--prescale', set the prescale value only if '--open' is not set
0156       if not self.open:
0157         object.__setattr__(self, 'prescale', value)
0158     elif name == 'profiling' and value:
0159       # '--profiling'
0160       object.__setattr__(self, 'profiling', True)
0161     elif name == 'timing' and value:
0162       # '--timing' implies '--profiling'
0163       object.__setattr__(self, 'timing',    True)
0164       object.__setattr__(self, 'profiling', True)
0165     elif name == 'setup' and value and value.find(":")!=-1:
0166       raise Exception('you can not specify a converter/database in the setup option.\nIt takes the converter database specified by the primary config.\nPlease remove the text upto and including the ":" in\n  {} '.format(value))      
0167     else:
0168       object.__setattr__(self, name, value)