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  'Fake1': 'auto:run2_mc_Fake1',
5  'FULL' : 'auto:run2_mc_FULL',
6  'GRun' : 'auto:run2_mc_GRun', # used as default
7  'HIon' : 'auto:run2_mc_HIon',
8  'PIon' : 'auto:run2_mc_PIon',
9  'PRef' : 'auto:run2_mc_PRef',
10  'data' : 'auto:run2_hlt',
11 }
12 
13 
14 # type used to store a reference to an L1 menu
15 class ConnectionL1TMenu(object):
16  def __init__(self, value):
17  self.override = None
18  self.snapshotTime = None
19 
20  # extract the override tag and the connection string
21  if value:
22  if ',' in value:
23  self.override = value.split(',')[0]
24  self.snapshotTime = value.split(',')[1]
25  else:
26  self.override = value
27  self.smapshotTime = None
28 
29 
30 # type used to store a reference to an L1 menu
31 class ConnectionL1TMenuXml(object):
32  def __init__(self, value):
33  self.XmlFile = None
34  self.LumiDir = None
35 
36  # extract the override tag and the connection string
37  if value:
38  if ',' in value:
39  self.XmlFile = value.split(',')[0]
40  self.LumiDir = value.split(',')[1]
41  else:
42  self.XmlFile = value
43  self.LumiDir = "startup"
44 
45 
46 # type used to store a reference to an HLT configuration
47 class ConnectionHLTMenu(object):
48  valid_versions = 'v1', 'v2'
49  valid_databases = 'online', 'offline', 'adg'
50  compatibility = { 'hltdev': ('v1', 'offline'), 'orcoff': ('v2', 'adg') }
51 
52  def __init__(self, value):
53  self.version = None
54  self.database = None
55  self.name = None
56  self.run = None
57 
58  if not value:
59  return
60 
61  if not ':' in value:
62  # default to 'v1/offline'
63  self.version = 'v1'
64  self.database = 'offline'
65  self.name = value
66  return
67 
68  # extract the version, database and configuration name
69  tokens = value.split(':')
70  if len(tokens) != 2:
71  raise Exception('Invalid HLT menu specification "%s"' % value)
72  (db, name) = tokens
73  # check if the menu should be automatically determined based on the run number
74  if db == 'run':
75  self.version = 'v2'
76  self.database = 'adg'
77  self.run = name
78  # check for backward compatibility names
79  elif db in self.compatibility:
80  self.version, self.database = self.compatibility[db]
81  self.name = name
82  else:
83  if '/' in db:
84  # extract the version and database
85  tokens = db.split('/')
86  if len(tokens) != 2:
87  raise Exception('Invalid HLT menu specification "%s"' % value)
88  (v, db) = tokens
89  if v not in self.valid_versions:
90  raise Exception('Invalid HLT database version "%s", valid values are "%s"' % (v, '", "'.join(self.valid_versions)))
91  if db not in self.valid_databases:
92  raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
93  self.version = v
94  self.database = db
95  self.name = name
96  else:
97  # use the default version for the given database
98  if db not in self.valid_databases:
99  raise Exception('Invalid HLT database "%s", valid values are "%s"' % (db, '", "'.join(self.valid_databases)))
100  self.database = db
101  if db == 'offline' :
102  self.version = 'v1'
103  else:
104  self.version = 'v2'
105  self.name = name
106 
107 # options marked with a (*) only apply when creating a whole process configuration
108 class HLTProcessOptions(object):
109  def __init__(self):
110  self.menu = None # hlt menu
111  self.name = 'HLTX' # (*) if set, override the process name
112  self.type = 'GRun' # defines global options for 'GRun', 'HIon', 'PIon', 'PRef' or 'online' menus
113  self.data = True # run on data (true) or mc (false)
114  self.online = False # (*) run online (true) or offline (false)
115  self.globaltag = None # (*) if set, override the GlobalTag
116  self.l1 = None # (*) if set, override the L1 menu
117  self.l1Xml = None # (*) if set, override the L1 menu Xml
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:50
static std::string join(char **cmd)
Definition: RemoteFile.cc:18