9 import Configuration.PyReleaseValidation
10 from Configuration.PyReleaseValidation.ConfigBuilder
import ConfigBuilder, defaultOptions
22 if items[0] !=
'cmsDriver.py':
24 items.append(
'--evt_type')
25 items.append(items[1])
27 options.arguments = command
34 options.arguments = reduce(
lambda x, y: x+
' '+y, sys.argv[1:])
39 from Configuration.PyReleaseValidation.Options
import parser,threeValued
41 for (index,item)
in enumerate(items):
42 for (opt,value)
in threeValued:
43 if (str(item)
in opt)
and (index==len(items)-1
or items[index+1].startswith(
'-')):
44 items.insert(index+1,value)
46 (options,args) = parser.parse_args(items)
48 if not options.conditions
or options.conditions==
"help":
49 from Configuration.AlCa
import autoCond
51 for k
in autoCond.autoCond:
52 possible+=
"\nauto:"+k+
" -> "+autoCond.autoCond[k]
53 raise Exception(
"the --conditions option is mandatory. Possibilities are: "+possible)
61 if options.triggerResultsProcess ==
None and "ALCAOUTPUT" in options.step:
62 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"
65 if not options.evt_type:
66 options.evt_type=sys.argv[1]
71 if options.dirin!=
'' and (
not options.dirin.endswith(
'/')): options.dirin+=
'/'
72 if options.dirout!=
'' and (
not options.dirout.endswith(
'/')): options.dirout+=
'/'
77 prec_step = {
"NONE":
"",
94 "RAW2DIGI":
"DIGI2RAW",
95 "RAW2RECO":
"DIGI2RAW",
101 trimmedEvtType=options.evt_type.split(
'/')[-1]
104 options.trimmedStep=[]
105 for s
in options.step.split(
','):
107 options.trimmedStep.append(step)
108 first_step=options.trimmedStep[0]
114 'ALL':
'GEN,SIM,DIGI,L1,DIGI2RAW,HLT:GRun,RAW2DIGI,RECO,POSTRECO,VALIDATION,DQM',
115 'DATA_CHAIN':
'RAW2DIGI,RECO,POSTRECO,DQM'
117 if options.step
in stepsAliases:
118 options.step=stepsAliases[options.step]
120 options.step = options.step.replace(
"SIM_CHAIN",
"GEN,SIM,DIGI,L1,DIGI2RAW")
124 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 ==
"":
126 if (
"SKIM" in options.step
and not "RECO" in options.step):
128 if (
"ENDJOB" in options.step):
130 if (
'DQMROOT' in options.datatier):
133 options.step=options.step+
',ENDJOB'
137 if options.filetype==defaultOptions.filetype:
138 if options.filein.lower().endswith(
".lhe")
or options.filein.lower().endswith(
".lhef")
or options.filein.startswith(
"lhe:"):
139 options.filetype=
"LHE"
140 elif options.filein.startswith(
"mcdb:"):
141 print "This is a deprecated way of selecting lhe files from article number. Please use lhe:article argument to --filein"
142 options.filein=options.filein.replace(
'mcdb:',
'lhe:')
143 options.filetype=
"LHE"
145 options.filetype=
"EDM"
147 filesuffix = {
"LHE":
"lhe",
"EDM":
"root",
"MCDB":
"",
"DQM":
"root"}[options.filetype]
149 if options.filein==
"" and not (first_step
in (
"ALL",
"LHE",
"GEN",
"SIM_CHAIN")):
150 options.dirin=
"file:"+options.dirin.replace(
'file:',
'')
151 options.filein=trimmedEvtType+
"_"+prec_step[first_step]+
"."+filesuffix
156 standardFileName =
""
157 standardFileName = trimmedEvtType+
"_"+
"_".
join(options.trimmedStep)
158 standardFileName = standardFileName.replace(
",",
"_").
replace(
".",
"_")
159 if options.pileup !=
"NoPileUp":
160 standardFileName +=
"_PU"
164 if options.fileout==
"" and not first_step
in (
"HARVESTING",
"ALCAHARVEST"):
165 options.fileout = standardFileName+
".root"
168 if not options.python_filename:
169 options.python_filename = standardFileName+
'.py'
177 if 'reSIM' in options.trimmedStep:
178 options.name =
'RESIM'
179 elif 'reDIGI' in options.trimmedStep:
180 options.name =
'REDIGI'
181 elif 'HLT' in options.trimmedStep:
183 elif 'RECO' in options.trimmedStep:
184 options.name =
'RECO'
185 elif options.trimmedStep == [
'NONE']
and options.filetype
in (
'LHE',
'MCDB'):
187 elif len(options.trimmedStep)==0:
188 options.name =
'PROCESS'
190 options.name = options.trimmedStep[-1]
196 if "HARVESTING" in options.trimmedStep
and len(options.trimmedStep) > 1:
197 raise Exception(
"The Harvesting step must be run alone")
200 if not options.isData
and not options.isMC:
201 if 'SIM' in options.trimmedStep:
203 if 'CFWRITER' in options.trimmedStep:
205 if 'DIGI' in options.trimmedStep:
207 if (
not (options.eventcontent ==
None))
and 'SIM' in options.eventcontent:
209 if 'SIM' in options.datatier:
212 print 'We have determined that this is simulation (if not, rerun cmsDriver.py with --data)'
214 print 'We have determined that this is real data (if not, rerun cmsDriver.py with --mc)'
217 if options.profile
and options.prefix:
218 raise Exception(
"--profile and --prefix are incompatible")
220 profileOpts = options.profile.split(
':')
222 profilerType = profileOpts[0].
replace(
"=",
" ")
224 if profilerType ==
"pp":
225 options.profileTypeLabel =
"performance"
226 elif profilerType ==
"mp":
227 options.profileTypeLabel =
"memory"
228 elif profilerType.startswith(
"fp "):
229 options.profileTypeLabel = profilerType.replace(
"fp ",
"")
231 raise Exception(
"Not a valid profiler type %s. Alternatives are pp, mp, fp=<function>."%(profilerType))
233 options.prefix =
"igprof -t cmsRun -%s" % profilerType
def OptionsFromCommandLine
static std::string join(char **cmd)