CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  'FULL': 'auto:run2_mc_FULL',
5  'GRun': 'auto:run2_mc_GRun', # used as default
6  'HIon' : 'auto:run2_mc_HIon',
7  'PIon' : 'auto:run2_mc_PIon',
8  'PRef' : 'auto:run2_mc_PRef',
9  'data' : 'auto:run2_hlt',
10 }
11 
12 
13 # type used to store a reference to an L1 menu
14 class ConnectionL1TMenu(object):
15  def __init__(self, value):
16  self.override = None
17  self.connect = None
18 
19  # extract the override tag and the connection string
20  if value:
21  if ',' in value:
22  self.override = value.split(',')[0]
23  self.connect = value.split(',')[1]
24  else:
25  self.override = value
26  self.connect = None
27 
28 
29 # type used to store a reference to an L1 menu
30 class ConnectionL1TMenuXml(object):
31  def __init__(self, value):
32  self.XmlFile = None
33  self.LumiDir = None
34 
35  # extract the override tag and the connection string
36  if value:
37  if ',' in value:
38  self.XmlFile = value.split(',')[0]
39  self.LumiDir = value.split(',')[1]
40  else:
41  self.XmlFile = value
42  self.LumiDir = "startup"
43 
44 
45 # type used to store a reference to an HLT configuration
46 class ConnectionHLTMenu(object):
47  valid_versions = 'v1', 'v2'
48  valid_databases = 'online', 'offline', 'adg'
49  compatibility = { 'hltdev': ('v1', 'offline'), 'orcoff': ('v2', 'adg') }
50 
51  def __init__(self, value):
52  self.version = None
53  self.database = None
54  self.name = None
55  self.run = None
56 
57  if not value:
58  return
59 
60  if not ':' in value:
61  # default to 'v1/offline'
62  self.version = 'v1'
63  self.database = 'offline'
64  self.name = value
65  return
66 
67  # extract the version, database and configuration name
68  tokens = value.split(':')
69  if len(tokens) != 2:
70  raise Exception('Invalid HLT menu specification "%s"' % value)
71  (db, name) = tokens
72  # check if the menu should be automatically determined based on the run number
73  if db == 'run':
74  self.version = 'v2'
75  self.database = 'adg'
76  self.run = name
77  # check for backward compatibility names
78  elif db in self.compatibility:
79  self.version, self.database = self.compatibility[db]
80  self.name = name
81  else:
82  if '/' in db:
83  # extract the version and database
84  tokens = db.split('/')
85  if len(tokens) != 2:
86  raise Exception('Invalid HLT menu specification "%s"' % value)
87  (v, db) = tokens
88  if v not in self.valid_versions:
89  raise Exception('Invalid HLT database version "%s", valid values are "%s"' % (v, '", "'.join(self.valid_versions)))
90  if db not in self.valid_databases:
91  raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
92  self.version = v
93  self.database = db
94  self.name = name
95  else:
96  # use the default version for the given database
97  if db not in self.valid_databases:
98  raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
99  self.database = db
100  if db == 'offline' :
101  self.version = 'v1'
102  else:
103  self.version = 'v2'
104  self.name = name
105 
106 # options marked with a (*) only apply when creating a whole process configuration
107 class HLTProcessOptions(object):
108  def __init__(self):
109  self.menu = None # hlt menu
110  self.name = 'HLTX' # (*) if set, override the process name
111  self.type = 'GRun' # defines global options for 'GRun', 'HIon', 'PIon', 'PRef' or 'online' menus
112  self.data = True # run on data (true) or mc (false)
113  self.online = False # (*) run online (true) or offline (false)
114  self.globaltag = None # (*) if set, override the GlobalTag
115  self.l1 = None # (*) if set, override the L1 menu
116  self.l1Xml = None # (*) if set, override the L1 menu Xml
117  self.l1skim = False # (*) if set, add snippet to process L1 skim files done with new L1, ignoring old L1
118  self.emulator = None # (*) if set, run (part of) the L1 emulator instead of taking the L1 results from the data
119  self.prescale = None # (*) if set, force the use of a specific prescale column. If set to "none", unprescale all paths
120  self.open = False # if set, cms.ignore all filters, making all paths run on and accept all events
121  self.errortype = False # if set, change all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)
122  self.profiling = False # if set, instrument the menu for profiling measurements
123  self.timing = False # if set, instrument the menu for timing measurements (implies profiling)
124  self.paths = None # if set, include in the dump only the given paths (wildcards are supported)
125  self.input = None # (*) if set, specify the input file(s) or dataset
126  self.parent = None # (*) if set, specify the parent input file(s) or dataset
127  self.events = 100 # (*) run on these many events
128  self.output = 'all' # (*) output 'all', 'minimal' or 'none' output modules
129  self.fragment = False # prepare a configuration fragment (true) or a whole process (false)
130  self.hilton = False # prepare a configuration for running with hilton-like modules
131 
132 
133  # convert HLT and L1 menus to a dedicated object representation on the fly
134  def __setattr__(self, name, value):
135  if name is 'menu' and type(value) is not ConnectionHLTMenu:
136  # format 'menu' as needed
137  object.__setattr__(self, name, ConnectionHLTMenu(value))
138  elif name is 'l1' and type(value) is not ConnectionL1TMenu:
139  # format '--l1' as needed
140  object.__setattr__(self, name, ConnectionL1TMenu(value))
141  elif name is 'l1Xml' and type(value) is not ConnectionL1TMenuXml:
142  # format '--l1Xml' as needed
143  object.__setattr__(self, name, ConnectionL1TMenuXml(value))
144  elif name is 'open' and value:
145  # '--open' implies '--unprescale'
146  object.__setattr__(self, 'open', True)
147  object.__setattr__(self, 'prescale', "none")
148  elif name is 'prescale' and value is not None:
149  # '--open' overrides '--prescale', set the prescale value only if '--open' is not set
150  if not self.open:
151  object.__setattr__(self, 'prescale', value)
152  elif name is 'profiling' and value:
153  # '--profiling'
154  object.__setattr__(self, 'profiling', True)
155  elif name is 'timing' and value:
156  # '--timing' implies '--profiling'
157  object.__setattr__(self, 'timing', True)
158  object.__setattr__(self, 'profiling', True)
159  else:
160  object.__setattr__(self, name, value)
dictionary compatibility
Definition: options.py:49
static std::string join(char **cmd)
Definition: RemoteFile.cc:18