9 import Configuration.Applications
10 from Configuration.Applications.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:])
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":
"",
87 "DIGIPREMIX_S2":
"SIM",
96 "RAW2DIGI":
"DIGI2RAW",
97 "RAW2RECO":
"DIGI2RAW",
101 "ALCAHARVEST":
"RECO",
104 trimmedEvtType=options.evt_type.split(
'/')[-1]
107 options.trimmedStep=[]
108 for s
in options.step.split(
','):
110 options.trimmedStep.append(step)
111 first_step=options.trimmedStep[0]
117 'ALL':
'GEN,SIM,DIGI,L1,DIGI2RAW,HLT:GRun,RAW2DIGI,RECO,POSTRECO,VALIDATION,DQM',
118 'DATA_CHAIN':
'RAW2DIGI,RECO,POSTRECO,DQM'
120 if options.step
in stepsAliases:
121 options.step=stepsAliases[options.step]
123 options.step = options.step.replace(
"SIM_CHAIN",
"GEN,SIM,DIGI,L1,DIGI2RAW")
127 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 ==
"":
129 if (
"SKIM" in options.step
and not "RECO" in options.step):
131 if (
"ENDJOB" in options.step):
133 if (
'DQMIO' in options.datatier):
136 options.step=options.step+
',ENDJOB'
140 if options.filetype==defaultOptions.filetype:
141 if options.filein.lower().endswith(
".lhe")
or options.filein.lower().endswith(
".lhef")
or options.filein.startswith(
"lhe:"):
142 options.filetype=
"LHE"
143 elif options.filein.startswith(
"mcdb:"):
144 print "This is a deprecated way of selecting lhe files from article number. Please use lhe:article argument to --filein"
145 options.filein=options.filein.replace(
'mcdb:',
'lhe:')
146 options.filetype=
"LHE"
148 options.filetype=
"EDM"
150 filesuffix = {
"LHE":
"lhe",
"EDM":
"root",
"MCDB":
"",
"DQM":
"root"}[options.filetype]
152 if options.filein==
"" and not (first_step
in (
"ALL",
"GEN",
"LHE",
"SIM_CHAIN")):
153 options.dirin=
"file:"+options.dirin.replace(
'file:',
'')
154 options.filein=trimmedEvtType+
"_"+prec_step[first_step]+
"."+filesuffix
159 standardFileName =
""
160 standardFileName = trimmedEvtType+
"_"+
"_".
join(options.trimmedStep)
161 standardFileName = standardFileName.replace(
",",
"_").
replace(
".",
"_")
162 if options.pileup !=
"NoPileUp":
163 standardFileName +=
"_PU"
167 if options.fileout==
"" and not first_step
in (
"HARVESTING",
"ALCAHARVEST"):
168 options.fileout = standardFileName+
".root"
171 if not options.python_filename:
172 options.python_filename = standardFileName+
'.py'
180 if 'reSIM' in options.trimmedStep:
181 options.name =
'RESIM'
182 elif 'reDIGI' in options.trimmedStep:
183 options.name =
'REDIGI'
184 elif 'HLT' in options.trimmedStep:
186 elif 'RECO' in options.trimmedStep:
187 options.name =
'RECO'
188 elif options.trimmedStep == [
'NONE']
and options.filetype
in (
'LHE',
'MCDB'):
190 elif len(options.trimmedStep)==0:
191 options.name =
'PROCESS'
193 options.name = options.trimmedStep[-1]
199 if "HARVESTING" in options.trimmedStep
and len(options.trimmedStep) > 1:
200 raise Exception(
"The Harvesting step must be run alone")
203 if not options.isData
and not options.isMC:
204 if 'SIM' in options.trimmedStep:
206 if 'CFWRITER' in options.trimmedStep:
208 if 'DIGI' in options.trimmedStep:
210 if 'DIGI2RAW' in options.trimmedStep:
212 if (
not (options.eventcontent ==
None))
and 'SIM' in options.eventcontent:
214 if 'SIM' in options.datatier:
217 print 'We have determined that this is simulation (if not, rerun cmsDriver.py with --data)'
219 print 'We have determined that this is real data (if not, rerun cmsDriver.py with --mc)'
222 if options.profile
and options.prefix:
223 raise Exception(
"--profile and --prefix are incompatible")
225 profileOpts = options.profile.split(
':')
227 profilerType = profileOpts[0].
replace(
"=",
" ")
229 if profilerType ==
"pp":
230 options.profileTypeLabel =
"performance"
231 elif profilerType ==
"mp":
232 options.profileTypeLabel =
"memory"
233 elif profilerType.startswith(
"fp "):
234 options.profileTypeLabel = profilerType.replace(
"fp ",
"")
236 raise Exception(
"Not a valid profiler type %s. Alternatives are pp, mp, fp=<function>."%(profilerType))
238 options.prefix =
"igprof -t cmsRun -%s" % profilerType
242 from Configuration.StandardSequences.Eras
import eras
245 requestedEras = options.era.split(
",")
247 for eraName
in requestedEras :
248 if not hasattr( eras, eraName ) :
250 for key
in eras.__dict__ :
251 if eras.internalUseEras.count(getattr(eras,key)) > 0 :
continue
252 if isinstance( eras.__dict__[key], Modifier )
or isinstance( eras.__dict__[key], ModifierChain ) :
253 if validOptions!=
"" : validOptions+=
", "
254 validOptions+=
"'"+key+
"'"
255 raise Exception(
"'%s' is not a valid option for '--era'. Valid options are %s." % (eraName, validOptions) )
258 for eraName
in requestedEras :
259 if eras.internalUseEras.count(getattr(eras,eraName)) > 0 :
260 print "WARNING: You have explicitly set '"+eraName+
"' with the '--era' command. That is usually reserved for internal use only."
def OptionsFromCommandLine
static std::string join(char **cmd)