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 #! /usr/bin/env python
2 
3 # A Pyrelval Wrapper
4 
5 import optparse
6 import sys
7 import os
8 import re
9 import Configuration.Applications
10 from Configuration.Applications.ConfigBuilder import ConfigBuilder, defaultOptions
11 import traceback
12 # Prepare a parser to read the options
13 usage=\
14 """%prog <TYPE> [options].
15 Example:
16 
17 %prog reco -s RAW2DIGI,RECO --conditions STARTUP_V4::All --eventcontent RECOSIM
18 """
19 parser = optparse.OptionParser(usage)
20 
21 expertSettings = optparse.OptionGroup(parser, '===============\n Expert Options', 'Caution: please use only if you know what you are doing.')
22 famosSettings = optparse.OptionGroup(parser, '===============\n FastSimulation options', '')
23 parser.add_option_group(expertSettings)
24 
25 threeValued=[]
26 parser.add_option("-s", "--step",
27  help="The desired step. The possible values are: "+\
28  "GEN,SIM,DIGI,L1,DIGI2RAW,HLT,RAW2DIGI,RECO,POSTRECO,DQM,ALCA,VALIDATION,HARVESTING, NONE or ALL.",
29  default="ALL",
30  dest="step")
31 
32 parser.add_option("--conditions",
33  help="What conditions to use. This has to be specified",
34  default=None,
35  dest="conditions")
36 
37 parser.add_option("--useCondDBv1",
38  help="use conditions DB V1",
39  action="store_false",
40  default=False,
41  dest="useCondDBv1")
42 
43 parser.add_option("--eventcontent",
44  help="What event content to write out. Default=FEVTDEBUG, or FEVT (for cosmics)",
45  default='RECOSIM',
46  dest="eventcontent")
47 
48 parser.add_option("--filein",
49  help="The infile name.",
50  default="",#to be changed in the default form later
51  dest="filein")
52 
53 parser.add_option("--fileout",
54  help="The outfile name. If absent a default value is assigned",
55  default="", #to be changed in the default form later
56  dest="fileout")
57 
58 parser.add_option("--filetype",
59  help="The type of the infile (EDM, LHE or MCDB).",
60  default=defaultOptions.filetype,
61  dest="filetype",
62  choices=['EDM','DAT','LHE','MDCB','DQM','DQMDAQ']
63  )
64 
65 parser.add_option("-n", "--number",
66  help="The number of events. The default is 1.",
67  default="1",
68  dest="number")
69 parser.add_option("-o", "--number_out",
70  help="The number of events in output. The default is not set",
71  default=None,
72  dest="number_out")
73 
74 parser.add_option("--mc",
75  help="Specify that simulation is to be processed (default = guess based on options",
76  action="store_true",
77  default=False,
78  dest="isMC")
79 
80 parser.add_option("--data",
81  help="Specify that data is to be processed (default = guess based on options",
82  action="store_true",
83  default=False,
84  dest="isData")
85 
86 
87 parser.add_option("--no_exec",
88  help="Do not exec cmsRun. Just prepare the python config file.",
89  action="store_true",
90  default=False,
91  dest="no_exec_flag")
92 parser.add_option("--fast",
93  help="Specify that the configuration is for FASTSIM",
94  action="store_true",
95  default=False)
96 
97 parser.add_option("--runsAndWeightsForMC",
98  help="Assign run numbers to MC source according to relatieve weights. [(run1,weight1),...,(runN,weightN)])",
99  default=None,
100  dest="runsAndWeightsForMC")
101 
102 parser.add_option("--runsScenarioForMC",
103  help="Load a scenario to set run numbers in MC.)",
104  default=None,
105  dest="runsScenarioForMC")
106 
107 parser.add_option("--runUnscheduled",
108  help="Enable unscheduled mode",
109  action="store_true",
110  default=False,
111  dest="runUnscheduled")
112 
113 # expert settings
114 expertSettings.add_option("--beamspot",
115  help="What beam spot to use (from Configuration/StandardSequences). Default depends on scenario",
116  default=None,
117  dest="beamspot")
118 
119 expertSettings.add_option("--customise",
120  help="Specify the file where the code to modify the process object is stored.",
121  default=[],
122  action="append",
123  dest="customisation_file")
124 expertSettings.add_option("--customise_unsch",
125  help="Specify the file where the code to modify the process object is stored.",
126  default=[],
127  action="append",
128  dest="customisation_file_unsch")
129 expertSettings.add_option("--customise_commands",
130  help="Specify a string of commands",
131  default="",
132  dest="customise_commands")
133 
134 expertSettings.add_option("--inline_custom",
135  help="inline the customisation file",
136  default=False,
137  action="store_true",
138  dest="inline_custom")
139 
140 expertSettings.add_option("--datatier",
141  help="What data tier to use.",
142  default='',
143  dest="datatier")
144 
145 expertSettings.add_option( "--dirin",
146  help="The infile directory.",
147  default="",
148  dest="dirin")
149 
150 expertSettings.add_option( "--dirout",
151  help="The outfile directory.",
152  default="",
153  dest="dirout")
154 
155 expertSettings.add_option("--filtername",
156  help="What filter name to specify in output module",
157  default="",
158  dest="filtername")
159 
160 expertSettings.add_option("--geometry",
161  help="What simulation geometry to use. Default="+defaultOptions.geometry+". Coma separated SimGeometry,RecoGeometry is supported.",
162  default=defaultOptions.geometry,
163  dest="geometry")
164 
165 expertSettings.add_option("--magField",
166  help="What magnetic field to use (from Configuration/StandardSequences).",
167  default=defaultOptions.magField,
168  dest="magField")
169 
170 expertSettings.add_option("--no_output",
171  help="Do not write anything to disk. This is for "+\
172  "benchmarking purposes.",
173  action="store_true",
174  default=False,
175  dest="no_output_flag")
176 
177 expertSettings.add_option("--prefix",
178  help="Specify a prefix to the cmsRun command.",
179  default="",
180  dest="prefix")
181 
182 expertSettings.add_option("--suffix",
183  help="Specify a suffix to the cmsRun command.",
184  default="",
185  dest="suffix")
186 
187 expertSettings.add_option("--relval",
188  help="Set total number of events and events per job.", #this does not get used but get parsed in the command by DatOps
189  default="",
190  dest="relval")
191 
192 expertSettings.add_option("--dump_python",
193  help="Dump the config file in python "+\
194  "and do a full expansion of imports.",
195  action="store_true",
196  default=False,
197  dest="dump_python")
198 
199 expertSettings.add_option("--pileup",
200  help="What pileup config to use. Default="+defaultOptions.pileup,
201  default=defaultOptions.pileup,
202  dest="pileup")
203 
204 expertSettings.add_option("--pileup_input",
205  help="define the pile up files to mix with",
206  default=None,
207  dest="pileup_input")
208 
209 expertSettings.add_option("--pileup_dasoption",
210  help="Additional option for DAS query of pile up",
211  default="",
212  dest="pileup_dasoption")
213 
214 expertSettings.add_option("--datamix",
215  help="What datamix config to use. Default=DataOnSim.",
216  default=defaultOptions.datamix,
217  dest="datamix")
218 
219 expertSettings.add_option("--gflash",
220  help="Run the FULL SIM using the GFlash parameterization.",
221  action="store_true",
222  default=defaultOptions.gflash,
223  dest="gflash")
224 
225 expertSettings.add_option("--python_filename",
226  help="Change the name of the created config file ",
227  default='',
228  dest="python_filename")
229 
230 expertSettings.add_option("--secondfilein",
231  help="The secondary infile name."+\
232  "for the two-file solution. Default is no file",
233  default="",#to be changed in the default form later
234  dest="secondfilein")
235 
236 expertSettings.add_option("--processName",
237  help="set process name explicitly",
238  default = None,
239  dest="name"
240  )
241 
242 expertSettings.add_option("--triggerResultsProcess",
243  help="for splitting jobs specify from which process to take edm::TriggerResults",
244  default = None,
245  dest="triggerResultsProcess"
246  )
247 
248 expertSettings.add_option("--hltProcess",
249  help="modify the DQM sequence to look for HLT trigger results with the specified process name",
250  default = None,
251  dest="hltProcess"
252  )
253 
254 expertSettings.add_option("--scenario",
255  help="Select scenario overriding standard settings (available:"+str(defaultOptions.scenarioOptions)+")",
256  default='pp',
257  dest="scenario",
258  choices=defaultOptions.scenarioOptions)
259 
260 expertSettings.add_option("--harvesting",
261  help="What harvesting to use (from Configuration/StandardSequences). Default=AtRunEnd",
262  default=defaultOptions.harvesting,
263  dest="harvesting")
264 
265 expertSettings.add_option("--particle_table",
266  help="Which particle properties table is loaded. Default=pythia",
267  default=defaultOptions.particleTable,
268  dest="particleTable")
269 
270 expertSettings.add_option("--dasquery",
271  help="Allow to define the source.fileNames from the das search command",
272  default='',
273  dest="dasquery")
274 
275 expertSettings.add_option("--dasoption",
276  help="Additional option for DAS query",
277  default='',
278  dest="dasoption")
279 
280 expertSettings.add_option("--dbsquery",
281  help="Deprecated. Please use dasquery option. Functions for backward compatibility",
282  default='',
283  dest="dasquery")
284 
285 expertSettings.add_option("--lazy_download",
286  help="Enable lazy downloading of input files",
287  action="store_true",
288  default=False,
289  dest="lazy_download")
290 
291 expertSettings.add_option("--repacked",
292  help="When the input file is a file with repacked raw data with label rawDataRepacker",
293  action="store_true",
294  default=False,
295  dest="isRepacked"
296  )
297 
298 expertSettings.add_option("--custom_conditions",
299  help="Allow to give a few overriding tags for the GT",
300  default='',
301  dest='custom_conditions')
302 
303 expertSettings.add_option("--inline_eventcontent",
304  help="expand event content definitions",
305  action="store_true",
306  default=False,
307  dest="inlineEventContent")
308 
309 
310 expertSettings.add_option("--inline_object",
311  help="expand explicitely the definition of a list of objects",
312  default='',
313  dest="inlineObjets")
314 
315 expertSettings.add_option("--hideGen",
316  help="do not inline the generator information, just load it",
317  default=False,
318  action="store_true")
319 expertSettings.add_option("--output",
320  help="specify the list of output modules using dict",
321  default='',
322  dest="outputDefinition")
323 
324 expertSettings.add_option("--inputCommands",
325  help="specify the input commands; i.e dropping products",
326  default=None,
327  dest="inputCommands")
328 expertSettings.add_option("--outputCommands",
329  help="specify the extra output commands;",
330  default=None,
331  dest="outputCommands")
332 
333 expertSettings.add_option("--inputEventContent",
334  help="specify the input event content",
335  default=defaultOptions.inputEventContent,
336  dest="inputEventContent")
337 
338 expertSettings.add_option("--dropDescendant",
339  help="allow to drop descendant on input",
340  default=defaultOptions.dropDescendant,
341  action="store_true")
342 
343 expertSettings.add_option("--donotDropOnInput",
344  help="when using reSTEP, prevent the automatic product dropping on input",
345  default=defaultOptions.donotDropOnInput
346  )
347 
348 expertSettings.add_option("--restoreRNDSeeds",
349  help="restore the random number engine state",
350  default=False,
351  )
352 threeValued.append( ('--restoreRNDSeeds',True) )
353 
354 expertSettings.add_option("--slhc",
355  help="Specify the SLHC scenario version",
356  default=None,
357  dest="slhc")
358 
359 expertSettings.add_option("--era",
360  help="Specify which era to use (e.g. \"run2\")",
361  default=None,
362  dest="era")
363 
364 expertSettings.add_option("--evt_type",
365  help="specify the gen fragment",
366  default=None,
367  dest="evt_type")
368 
369 expertSettings.add_option("--profile",
370  help="add the IgprofService with the parameter provided PROFILER:START:STEP:PEREVENOUTPUTFORMAT:ENDOFJOBOUTPUTFORMAT",
371  default=None,
372  dest="profile")
373 
374 expertSettings.add_option("--io",
375  help="Create a json file with io informations",
376  default=None,
377  dest="io")
378 
379 expertSettings.add_option("--lumiToProcess",
380  help="specify a certification json file in input to run on certified data",
381  default=None,
382  dest='lumiToProcess'
383  )
384 
385 expertSettings.add_option("--timeoutOutput",
386  help="use a TimeoutPoolOutputModule instead of a PoolOutputModule (needed for evt. display)",
387  default=False,
388  dest='timeoutOutput'
389  )
390 
391 expertSettings.add_option("--nThreads",
392  help="How many threads should CMSSW use (default is 1)",
393  default="1",
394  dest='nThreads'
395  )