CMS 3D CMS Logo

options.py
Go to the documentation of this file.
1 # available "type"s and relative global tags
2 globalTag = {
3  'Fake' : 'auto:run1_mc_Fake',
4  'Fake1': 'auto:run2_mc_Fake1',
5  'Fake2': 'auto:run2_mc_Fake2',
6  'FULL' : 'auto:run3_mc_FULL',
7  'GRun' : 'auto:run3_mc_GRun', # used as default
8  'HIon' : 'auto:run3_mc_HIon',
9  'PIon' : 'auto:run3_mc_PIon',
10  'PRef' : 'auto:run3_mc_PRef',
11  'data' : 'auto:run2_hlt_relval',
12 }
13 
14 
15 # type used to store a reference to an L1 menu
17  def __init__(self, value):
18  self.override = None
19  self.snapshotTime = None
20 
21  # extract the override tag and the connection string
22  if value:
23  if ',' in value:
24  self.override = value.split(',')[0]
25  self.snapshotTime = value.split(',')[1]
26  else:
27  self.override = value
28  self.smapshotTime = None
29 
30 
31 # type used to store a reference to an L1 menu
33  def __init__(self, value):
34  self.XmlFile = None
35  self.LumiDir = None
36 
37  # extract the override tag and the connection string
38  if value:
39  if ',' in value:
40  self.XmlFile = value.split(',')[0]
41  self.LumiDir = value.split(',')[1]
42  else:
43  self.XmlFile = value
44  self.LumiDir = "startup"
45 
46 
47 # type used to store a reference to an HLT configuration
49  valid_versions = 'v1', 'v2', 'v3', 'v3-beta', 'v3-test'
50  valid_databases = 'online', 'run3', 'adg','dev','run2'
51  compatibility = { 'hltdev': ('v3', 'run3'), 'orcoff': ('v3', 'adg') }
52 
53  def __init__(self, value):
54  self.version = None
55  self.database = None
56  self.name = None
57  self.run = None
58 
59  if not value:
60  return
61 
62  if not ':' in value:
63  # default to 'v3/run3'
64  self.version = 'v3'
65  self.database = 'run3'
66  self.name = value
67  return
68 
69  # extract the version, database and configuration name
70  tokens = value.split(':')
71  if len(tokens) != 2:
72  raise Exception('Invalid HLT menu specification "%s"' % value)
73  (db, name) = tokens
74  # check if the menu should be automatically determined based on the run number
75  if db == 'run':
76  self.version = 'v3'
77  self.database = 'adg'
78  self.run = name
79  # check for backward compatibility names
80  elif db in self.compatibility:
81  self.version, self.database = self.compatibility[db]
82  self.name = name
83  else:
84  if '/' in db:
85  # extract the version and database
86  tokens = db.split('/')
87  if len(tokens) != 2:
88  raise Exception('Invalid HLT menu specification "%s"' % value)
89  (v, db) = tokens
90  if v not in self.valid_versions:
91  raise Exception('Invalid HLT database version "%s", valid values are "%s"' % (v, '", "'.join(self.valid_versions)))
92  if db not in self.valid_databases:
93  raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
94  self.version = v
95  self.database = db
96  self.name = name
97  else:
98  # use the confdb v3 by default
99  if db not in self.valid_databases:
100  raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
101  self.database = db
102  self.version = 'v3'
103  self.name = name
104 
105 # options marked with a (*) only apply when creating a whole process configuration
107  def __init__(self):
108  self.menu = None # hlt menu
109  self.name = 'HLTX' # (*) if set, override the process name
110  self.type = 'GRun' # defines global options for 'GRun', 'HIon', 'PIon', 'PRef' or 'online' menus
111  self.data = True # run on data (true) or mc (false)
112  self.globaltag = None # (*) if set, override the GlobalTag
113  self.l1 = None # (*) if set, override the L1 menu
114  self.l1Xml = None # (*) if set, override the L1 menu Xml
115  self.emulator = None # (*) if set, run (part of) the L1 emulator instead of taking the L1 results from the data
116  self.prescale = None # (*) if set, force the use of a specific prescale column. If set to "none", unprescale all paths
117  self.open = False # if set, cms.ignore all filters, making all paths run on and accept all events
118  self.eras = None # if set, select the defined Eras into the HLT configuration
119  self.customise = None # if set, apply the user-defined customization functions using the format HLTrigger/Configuration/customizeHLTTrackingForPhaseI2017.customizeHLTForPFTrackingPhaseI2017
120  self.errortype = False # if set, change all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)
121  self.profiling = False # if set, instrument the menu for profiling measurements
122  self.timing = False # if set, instrument the menu for timing measurements (implies profiling)
123  self.paths = None # if set, include in the dump only the given paths (wildcards are supported)
124  self.input = None # (*) if set, specify the input file(s) or dataset
125  self.parent = None # (*) if set, specify the parent input file(s) or dataset
126  self.events = 100 # (*) run on these many events
127  self.output = 'all' # (*) output 'all', 'minimal' or 'none' output modules
128  self.fragment = False # prepare a configuration fragment (true) or a whole process (false)
129  self.hilton = False # prepare a configuration for running with hilton-like modules
130  self.setup = None # if set, downlad the setup_cff from the specified configuration and load it.
131  self.proxy = False # use a socks proxy to connect
132  self.proxy_host = 'localhost' # host of the proxy server
133  self.proxy_port = '8080' # port of the proxy server
134 
135  # convert HLT and L1 menus to a dedicated object representation on the fly
136  def __setattr__(self, name, value):
137  if name == 'menu' and not isinstance(value, ConnectionHLTMenu):
138  # format 'menu' as needed
139  object.__setattr__(self, name, ConnectionHLTMenu(value))
140  elif name == 'l1' and not isinstance(value, ConnectionL1TMenu):
141  # format '--l1' as needed
142  object.__setattr__(self, name, ConnectionL1TMenu(value))
143  elif name == 'l1Xml' and not isinstance(value, ConnectionL1TMenuXml):
144  # format '--l1Xml' as needed
145  object.__setattr__(self, name, ConnectionL1TMenuXml(value))
146  elif name == 'open' and value:
147  # '--open' implies '--unprescale'
148  object.__setattr__(self, 'open', True)
149  object.__setattr__(self, 'prescale', "none")
150  elif name == 'prescale' and value is not None:
151  # '--open' overrides '--prescale', set the prescale value only if '--open' is not set
152  if not self.open:
153  object.__setattr__(self, 'prescale', value)
154  elif name == 'profiling' and value:
155  # '--profiling'
156  object.__setattr__(self, 'profiling', True)
157  elif name == 'timing' and value:
158  # '--timing' implies '--profiling'
159  object.__setattr__(self, 'timing', True)
160  object.__setattr__(self, 'profiling', True)
161  elif name == 'setup' and value and value.find(":")!=-1:
162  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))
163  else:
164  object.__setattr__(self, name, value)
options.HLTProcessOptions.proxy_port
proxy_port
Definition: options.py:133
options.ConnectionL1TMenu.smapshotTime
smapshotTime
Definition: options.py:28
options.ConnectionHLTMenu.run
run
Definition: options.py:57
resolutioncreator_cfi.object
object
Definition: resolutioncreator_cfi.py:4
options.ConnectionL1TMenu.snapshotTime
snapshotTime
Definition: options.py:19
options.HLTProcessOptions.proxy_host
proxy_host
Definition: options.py:132
options.ConnectionL1TMenuXml.__init__
def __init__(self, value)
Definition: options.py:33
options.HLTProcessOptions.emulator
emulator
Definition: options.py:115
options.ConnectionHLTMenu.valid_databases
valid_databases
Definition: options.py:50
join
static std::string join(char **cmd)
Definition: RemoteFile.cc:17
options.HLTProcessOptions.name
name
Definition: options.py:109
options.ConnectionHLTMenu.__init__
def __init__(self, value)
Definition: options.py:53
options.HLTProcessOptions.eras
eras
Definition: options.py:118
options.HLTProcessOptions.type
type
Definition: options.py:110
options.ConnectionL1TMenuXml.XmlFile
XmlFile
Definition: options.py:34
options.HLTProcessOptions.l1
l1
Definition: options.py:113
options.HLTProcessOptions.input
input
Definition: options.py:124
options.HLTProcessOptions.__setattr__
def __setattr__(self, name, value)
Definition: options.py:136
options.ConnectionHLTMenu
Definition: options.py:48
options.HLTProcessOptions.customise
customise
Definition: options.py:119
options.HLTProcessOptions.l1Xml
l1Xml
Definition: options.py:114
options.ConnectionL1TMenu.override
override
Definition: options.py:18
options.ConnectionL1TMenu.__init__
def __init__(self, value)
Definition: options.py:17
options.HLTProcessOptions.proxy
proxy
Definition: options.py:131
options.HLTProcessOptions
Definition: options.py:106
options.HLTProcessOptions.globaltag
globaltag
Definition: options.py:112
options.ConnectionHLTMenu.database
database
Definition: options.py:55
options.HLTProcessOptions.parent
parent
Definition: options.py:125
options.ConnectionL1TMenuXml
Definition: options.py:32
options.ConnectionHLTMenu.version
version
Definition: options.py:54
options.HLTProcessOptions.setup
setup
Definition: options.py:130
options.HLTProcessOptions.hilton
hilton
Definition: options.py:129
Exception
options.HLTProcessOptions.data
data
Definition: options.py:111
options.HLTProcessOptions.errortype
errortype
Definition: options.py:120
options.HLTProcessOptions.profiling
profiling
Definition: options.py:121
options.HLTProcessOptions.__init__
def __init__(self)
Definition: options.py:107
options.ConnectionHLTMenu.compatibility
compatibility
Definition: options.py:51
options.HLTProcessOptions.events
events
Definition: options.py:126
options.ConnectionL1TMenuXml.LumiDir
LumiDir
Definition: options.py:35
options.HLTProcessOptions.output
output
Definition: options.py:127
options.ConnectionL1TMenu
Definition: options.py:16
format
options.ConnectionHLTMenu.valid_versions
valid_versions
Definition: options.py:49
options.HLTProcessOptions.paths
paths
Definition: options.py:123
options.HLTProcessOptions.prescale
prescale
Definition: options.py:116
options.HLTProcessOptions.timing
timing
Definition: options.py:122
options.HLTProcessOptions.open
open
Definition: options.py:117
options.HLTProcessOptions.menu
menu
Definition: options.py:108
options.ConnectionHLTMenu.name
name
Definition: options.py:56
options.HLTProcessOptions.fragment
fragment
Definition: options.py:128