9 import Configuration.Applications
10 from Configuration.Applications.ConfigBuilder
import ConfigBuilder, defaultOptions
12 from functools
import reduce
23 if items[0] !=
'cmsDriver.py':
25 items.append(
'--evt_type')
26 items.append(items[1])
28 options.arguments = command
35 options.arguments = reduce(
lambda x, y: x+
' '+y, sys.argv[1:])
42 for (index,item)
in enumerate(items):
43 for (opt,value)
in threeValued:
44 if (
str(item)
in opt)
and (index==len(items)-1
or items[index+1].startswith(
'-')):
45 items.insert(index+1,value)
47 (options,args) = parser.parse_args(items)
49 if not options.conditions
or options.conditions==
"help":
50 from Configuration.AlCa
import autoCond
52 for k
in autoCond.autoCond:
53 possible+=
"\nauto:"+k+
" -> "+
str(autoCond.autoCond[k])
54 raise Exception(
"the --conditions option is mandatory. Possibilities are: "+possible)
62 if options.triggerResultsProcess ==
None and "ALCAOUTPUT" in options.step:
63 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" 66 if not options.evt_type:
67 options.evt_type=sys.argv[1]
72 if options.dirin!=
'' and (
not options.dirin.endswith(
'/')): options.dirin+=
'/' 73 if options.dirout!=
'' and (
not options.dirout.endswith(
'/')): options.dirout+=
'/' 78 prec_step = {
"NONE":
"",
88 "DIGIPREMIX_S2":
"SIM",
97 "RAW2DIGI":
"DIGI2RAW",
98 "RAW2RECO":
"DIGI2RAW",
100 "DIGI2RAW":
"DATAMIX",
102 "ALCAHARVEST":
"RECO",
107 trimmedEvtType=options.evt_type.split(
'/')[-1]
110 options.trimmedStep=[]
111 for s
in options.step.split(
','):
113 options.trimmedStep.append(step)
114 first_step=options.trimmedStep[0]
120 'ALL':
'GEN,SIM,DIGI,L1,DIGI2RAW,HLT:GRun,RAW2DIGI,RECO,POSTRECO,VALIDATION,DQM',
121 'DATA_CHAIN':
'RAW2DIGI,RECO,POSTRECO,DQM' 123 if options.step
in stepsAliases:
124 options.step=stepsAliases[options.step]
126 options.step = options.step.replace(
"SIM_CHAIN",
"GEN,SIM,DIGI,L1,DIGI2RAW")
130 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 ==
"":
132 if (
"SKIM" in options.step
and not "RECO" in options.step):
134 if (
"ENDJOB" in options.step):
136 if (
'DQMIO' in options.datatier):
139 options.step=options.step+
',ENDJOB' 143 if options.filetype==defaultOptions.filetype:
144 if options.filein.lower().endswith(
".lhe")
or options.filein.lower().endswith(
".lhef")
or options.filein.startswith(
"lhe:"):
145 options.filetype=
"LHE" 146 elif options.filein.startswith(
"mcdb:"):
147 print "This is a deprecated way of selecting lhe files from article number. Please use lhe:article argument to --filein" 148 options.filein=options.filein.replace(
'mcdb:',
'lhe:')
149 options.filetype=
"LHE" 151 options.filetype=
"EDM" 153 filesuffix = {
"LHE":
"lhe",
"EDM":
"root",
"MCDB":
"",
"DQM":
"root"}[options.filetype]
155 if options.filein==
"" and not (first_step
in (
"ALL",
"GEN",
"LHE",
"SIM_CHAIN")):
156 options.dirin=
"file:"+options.dirin.replace(
'file:',
'')
157 options.filein=trimmedEvtType+
"_"+prec_step[first_step]+
"."+filesuffix
162 standardFileName =
"" 163 standardFileName = trimmedEvtType+
"_"+
"_".
join(options.trimmedStep)
164 standardFileName = standardFileName.replace(
",",
"_").
replace(
".",
"_")
165 if options.pileup !=
"NoPileUp":
166 standardFileName +=
"_PU" 170 if options.fileout==
"" and not first_step
in (
"HARVESTING",
"ALCAHARVEST"):
171 options.fileout = standardFileName+
".root" 174 if not options.python_filename:
175 options.python_filename = standardFileName+
'.py' 183 if 'reSIM' in options.trimmedStep:
184 options.name =
'RESIM' 185 elif 'reDIGI' in options.trimmedStep:
186 options.name =
'REDIGI' 187 elif 'HLT' in options.trimmedStep:
189 elif 'RECO' in options.trimmedStep:
190 options.name =
'RECO' 191 elif options.trimmedStep == [
'NONE']
and options.filetype
in (
'LHE',
'MCDB'):
193 elif len(options.trimmedStep)==0:
194 options.name =
'PROCESS' 196 options.name = options.trimmedStep[-1]
202 if "HARVESTING" in options.trimmedStep
and len(options.trimmedStep) > 1:
203 raise Exception(
"The Harvesting step must be run alone")
206 if not options.isData
and not options.isMC:
207 if 'SIM' in options.trimmedStep:
209 if 'CFWRITER' in options.trimmedStep:
211 if 'DIGI' in options.trimmedStep:
213 if 'DIGI2RAW' in options.trimmedStep:
215 if (
not (options.eventcontent ==
None))
and 'SIM' in options.eventcontent:
217 if 'SIM' in options.datatier:
220 print 'We have determined that this is simulation (if not, rerun cmsDriver.py with --data)' 222 print 'We have determined that this is real data (if not, rerun cmsDriver.py with --mc)' 225 if options.profile
and options.prefix:
226 raise Exception(
"--profile and --prefix are incompatible")
228 profileOpts = options.profile.split(
':')
230 profilerType = profileOpts[0].
replace(
"=",
" ")
232 if profilerType ==
"pp":
233 options.profileTypeLabel =
"performance" 234 elif profilerType ==
"mp":
235 options.profileTypeLabel =
"memory" 236 elif profilerType.startswith(
"fp "):
237 options.profileTypeLabel = profilerType.replace(
"fp ",
"")
239 raise Exception(
"Not a valid profiler type %s. Alternatives are pp, mp, fp=<function>."%(profilerType))
241 options.prefix =
"igprof -t cmsRun -%s" % profilerType
245 from Configuration.StandardSequences.Eras
import eras
246 from FWCore.ParameterSet.Config
import Modifier, ModifierChain
248 requestedEras = options.era.split(
",")
250 for eraName
in requestedEras :
251 if not hasattr( eras, eraName ) :
253 for key
in eras.__dict__ :
254 if isinstance( eras.__dict__[key], Modifier )
or isinstance( eras.__dict__[key], ModifierChain ) :
255 if validOptions!=
"" : validOptions+=
", " 256 validOptions+=
"'"+key+
"'" 257 raise Exception(
"'%s' is not a valid option for '--era'. Valid options are %s." % (eraName, validOptions) )
261 options.era+=
",fastSim" 263 options.era=
"fastSim" 266 if options.fast
and not options.scenario ==
"pp":
267 raise Exception(
"ERROR: the --option fast is only compatible with the default scenario (--scenario=pp)")
268 if options.fast
and 'HLT' in options.trimmedStep:
269 raise Exception(
"ERROR: the --option fast is incompatible with HLT (HLT is no longer available in FastSim)")
def OptionsFromCommandLine()
def OptionsFromItems(items)
def replace(string, replacements)
def OptionsFromCommand(command)
static std::string join(char **cmd)