9 import Configuration.PyReleaseValidation
10 from Configuration.PyReleaseValidation.ConfigBuilder
import ConfigBuilder, defaultOptions
14 """%prog <TYPE> [options].
17 %prog reco -s RAW2DIGI,RECO --conditions STARTUP_V4::All --eventcontent RECOSIM
19 parser = optparse.OptionParser(usage)
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)
25 parser.add_option(
"-s",
"--step",
26 help=
"The desired step. The possible values are: "+\
27 "GEN,SIM,DIGI,L1,DIGI2RAW,HLT,RAW2DIGI,RECO,POSTRECO,DQM,ALCA,VALIDATION,HARVESTING, NONE or ALL.",
31 parser.add_option(
"--conditions",
32 help=
"What conditions to use. This has to be specified",
36 parser.add_option(
"--eventcontent",
37 help=
"What event content to write out. Default=FEVTDEBUG, or FEVT (for cosmics)",
41 parser.add_option(
"--filein",
42 help=
"The infile name.",
46 parser.add_option(
"--fileout",
47 help=
"The outfile name. If absent a default value is assigned",
51 parser.add_option(
"--filetype",
52 help=
"The type of the infile (EDM, LHE or MCDB).",
56 parser.add_option(
"-n",
"--number",
57 help=
"The number of events. The default is 1.",
61 parser.add_option(
"--mc",
62 help=
"Specify that simulation is to be processed (default = guess based on options",
67 parser.add_option(
"--data",
68 help=
"Specify that data is to be processed (default = guess based on options",
74 parser.add_option(
"--no_exec",
75 help=
"Do not exec cmsRun. Just prepare the python config file.",
81 expertSettings.add_option(
"--beamspot",
82 help=
"What beam spot to use (from Configuration/StandardSequences). Default depends on scenario",
83 default=defaultOptions.beamspot,
86 expertSettings.add_option(
"--customise",
87 help=
"Specify the file where the code to modify the process object is stored.",
89 dest=
"customisation_file")
91 expertSettings.add_option(
"--inline_custom",
92 help=
"inline the customisation file",
96 expertSettings.add_option(
"--datatier",
97 help=
"What data tier to use.",
101 expertSettings.add_option(
"--dirin",
102 help=
"The infile directory.",
106 expertSettings.add_option(
"--dirout",
107 help=
"The outfile directory.",
111 expertSettings.add_option(
"--filtername",
112 help=
"What filter name to specify in output module",
116 expertSettings.add_option(
"--geometry",
117 help=
"What geometry to use (from Configuration/StandardSequences). Default=Ideal",
118 default=defaultOptions.geometry,
121 expertSettings.add_option(
"--magField",
122 help=
"What magnetic field to use (from Configuration/StandardSequences).",
123 default=defaultOptions.magField,
126 expertSettings.add_option(
"--no_output",
127 help=
"Do not write anything to disk. This is for "+\
128 "benchmarking purposes.",
131 dest=
"no_output_flag")
133 expertSettings.add_option(
"--oneoutput",
134 help=
"use only one output module",
139 expertSettings.add_option(
"--prefix",
140 help=
"Specify a prefix to the cmsRun command.",
144 expertSettings.add_option(
"--relval",
145 help=
"Set total number of events and events per job.",
149 expertSettings.add_option(
"--dump_python",
150 help=
"Dump the config file in python "+\
151 "and do a full expansion of imports.",
156 expertSettings.add_option(
"--dump_DSetName",
157 help=
"Dump the primary datasetname.",
160 dest=
"dump_dsetname_flag")
162 expertSettings.add_option(
"--pileup",
163 help=
"What pileup config to use. Default=NoPileUp.",
164 default=defaultOptions.pileup,
167 expertSettings.add_option(
"--pileup_input",
168 help=
"define the pile up files to mix with",
172 expertSettings.add_option(
"--datamix",
173 help=
"What datamix config to use. Default=DataOnSim.",
174 default=defaultOptions.datamix,
177 expertSettings.add_option(
"--gflash",
178 help=
"Run the FULL SIM using the GFlash parameterization.",
180 default=defaultOptions.gflash,
183 expertSettings.add_option(
"--himix",
184 help=
"Run the Heavy Ions signal mixing.",
186 default=defaultOptions.himix,
189 expertSettings.add_option(
"--python_filename",
190 help=
"Change the name of the created config file ",
192 dest=
"python_filename")
194 expertSettings.add_option(
"--secondfilein",
195 help=
"The secondary infile name."+\
196 "for the two-file solution. Default is no file",
200 expertSettings.add_option(
"--writeraw",
201 help=
"In addition to the nominal output, write a file with just raw",
206 expertSettings.add_option(
"--processName",
207 help=
"set process name explicitly",
212 expertSettings.add_option(
"--triggerResultsProcess",
213 help=
"for splitting jobs specify from which process to take edm::TriggerResults",
215 dest=
"triggerResultsProcess"
218 expertSettings.add_option(
"--hltProcess",
219 help=
"modify the DQM sequence to look for HLT trigger results with the specified process name",
224 expertSettings.add_option(
"--scenario",
225 help=
"Select scenario overriding standard settings (available:"+str(defaultOptions.scenarioOptions)+
")",
229 expertSettings.add_option(
"--harvesting",
230 help=
"What harvesting to use (from Configuration/StandardSequences). Default=AtRunEnd",
231 default=defaultOptions.harvesting,
234 expertSettings.add_option(
"--particle_table",
235 help=
"Which particle properties table is loaded. Default=pythia",
236 default=defaultOptions.particleTable,
237 dest=
"particleTable")
239 expertSettings.add_option(
"--dasquery",
240 help=
"Allow to define the source.fileNames from the das search command",
243 expertSettings.add_option(
"--dbsquery",
244 help=
"Deprecated. Please use dasquery option. Functions for backward compatibility",
248 expertSettings.add_option(
"--lazy_download",
249 help=
"Enable lazy downloading of input files",
252 dest=
"lazy_download")
254 expertSettings.add_option(
"--repacked",
255 help=
"When the input file is a file with repacked raw data with label rawDataRepacker",
261 expertSettings.add_option(
"--custom_conditions",
262 help=
"Allow to give a few overriding tags for the GT",
264 dest=
'custom_conditions')
266 expertSettings.add_option(
"--inline_eventcontent",
267 help=
"expand event content definitions",
270 dest=
"inlineEventContent")
273 expertSettings.add_option(
"--inline_object",
274 help=
"expand explicitely the definition of a list of objects",
278 expertSettings.add_option(
"--hideGen",
279 help=
"do not inline the generator information, just load it",
282 expertSettings.add_option(
"--output",
283 help=
"specify the list of output modules using dict",
285 dest=
"outputDefinition")
287 expertSettings.add_option(
"--inputCommands",
288 help=
"specify the input commands; i.e dropping products",
290 dest=
"inputCommands")
292 expertSettings.add_option(
"--inputEventContent",
293 help=
"specify the input event content",
295 dest=
"inputEventContent")
296 expertSettings.add_option(
"--slhc",
297 help=
"Specify the SLHC scenario version",
301 (options,args) = parser.parse_args()
309 raise "Event Type: ",
"No event type specified!"
312 if options.triggerResultsProcess ==
None and "ALCAOUTPUT" in options.step:
313 print "ERROR: If ALCA splitting is requested, the name of the process in which the alca producers ran needs to be specified. E.g. via --triggerResultsProcess RECO"
317 options.evt_type=sys.argv[1]
320 options.arguments = reduce(
lambda x, y: x+
' '+y, sys.argv[1:])
329 prec_step = {
"NONE":
"",
340 "RAW2DIGI":
"DIGI2RAW",
341 "RAW2RECO":
"DIGI2RAW",
343 "DIGI2RAW":
"DATAMIX",
345 "ALCAHARVEST":
"RECO"}
347 trimmedEvtType=options.evt_type.split(
'/')[-1]
351 step_list=options.step.split(
',')
359 trimmedStep=trimmedStep+
','+step
362 if options.filetype==
"":
363 if options.filein.lower().endswith(
".lhe")
or options.filein.lower().endswith(
".lhef"):
364 options.filetype=
"LHE"
365 elif options.filein.startswith(
"mcdb:"):
366 options.filetype=
"MCDB"
368 options.filetype=
"EDM"
369 if options.filetype==
"MCDB" and options.filein.startswith(
"mcdb:"):
370 options.filein = options.filein[5:]
372 filesuffix = {
"LHE":
"lhe",
"EDM":
"root",
"MCDB":
""}[options.filetype]
374 first_step=trimmedStep.split(
',')[0]
375 if options.filein==
"" and not (first_step
in (
"ALL",
"GEN",
"SIM_CHAIN")
and options.dirin ==
""):
376 if options.dirin==
"":
377 options.dirin=
"file:"
378 options.filein=trimmedEvtType+
"_"+prec_step[first_step]+
"."+filesuffix
383 standardFileName =
""
384 standardFileName = trimmedEvtType+
"_"+trimmedStep
385 standardFileName = standardFileName.replace(
",",
"_").
replace(
".",
"_")
386 if options.pileup !=
"NoPileUp":
387 standardFileName +=
"_PU"
391 if options.fileout==
"" and not first_step
in (
"HARVESTING",
"ALCAHARVEST"):
392 options.fileout = standardFileName+
".root"
396 python_config_filename = standardFileName
399 conditionsSP = options.conditions.split(
',')
400 if len(conditionsSP) > 1:
402 conditionsType = conditionsSP[1].
split(
"_")[0]
403 python_config_filename +=
"_"+str(conditionsType)
405 python_config_filename+=
".py"
411 fileraw=options.dirout
412 wrSP=options.fileout.split(
'.')
417 if ( counter < wrSPLen ):
421 fileraw=fileraw+
'.'+w
423 fileraw=fileraw+
'_rawonly.'+w
428 if options.secondfilein!=
'':
429 secondfilestr=options.dirin+options.secondfilein
433 if options.step==
'NONE':
435 elif options.step==
'ALL':
436 options.step=
'GEN,SIM,DIGI,L1,DIGI2RAW,RAW2DIGI,RECO,POSTRECO,VALIDATION,DQM'
437 elif options.step==
'DATA_CHAIN':
438 options.step=
'RAW2DIGI,RECO,POSTRECO,DQM'
439 options.step = options.step.replace(
"SIM_CHAIN",
"GEN,SIM,DIGI,L1,DIGI2RAW")
445 if (
"FASTSIM" in options.step
and not "VALIDATION" in options.step)
or "HARVESTING" in options.step
or "ALCAHARVEST" in options.step
or "ALCAOUTPUT" in options.step
or options.step ==
"":
447 if (
"SKIM" in options.step
and not "RECO" in options.step):
449 if (
"ENDJOB" in options.step):
452 options.step=options.step+
',ENDJOB'
459 if 'HLT' in trimmedStep:
461 elif 'RECO' in trimmedStep:
462 options.name =
'RECO'
463 elif trimmedStep ==
'NONE' and options.filetype
in (
'LHE',
'MCDB'):
466 options.name = trimmedStep.split(
',')[-1]
472 s_list=options.step.split(
',')
473 if "HARVESTING" in options.step
and len(s_list) > 1:
474 print "The Harvesting step must be run alone"
478 if not options.isData
and not options.isMC:
479 if 'SIM' in trimmedStep:
481 if 'CFWRITER' in trimmedStep:
483 if 'DIGI' in trimmedStep:
485 if (
not (options.eventcontent ==
None))
and 'SIM' in options.eventcontent:
487 if 'SIM' in options.datatier:
490 print 'We have determined that this is simulation (if not, rerun cmsDriver.py with --data)'
492 print 'We have determined that this is real data (if not, rerun cmsDriver.py with --mc)'