Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-05-17 02:07:38

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