47 for (index,item)
in enumerate(items):
48 for (opt,value)
in threeValued:
49 if (
str(item)
in opt)
and (index==len(items)-1
or items[index+1].startswith(
'-')):
50 items.insert(index+1,value)
52 (options,args) = parser.parse_args(items)
54 if not options.conditions
or options.conditions==
"help":
55 from Configuration.AlCa
import autoCond
57 for k
in autoCond.autoCond:
58 possible+=
"\nauto:"+k+
" -> "+
str(autoCond.autoCond[k])
59 raise Exception(
"the --conditions option is mandatory. Possibilities are: "+possible)
67 if options.triggerResultsProcess ==
None and "ALCAOUTPUT" in options.step:
68 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")
71 if not options.evt_type:
72 options.evt_type=sys.argv[1]
77 if options.dirin!=
'' and (
not options.dirin.endswith(
'/')): options.dirin+=
'/'
78 if options.dirout!=
'' and (
not options.dirout.endswith(
'/')): options.dirout+=
'/'
83 prec_step = {
"NONE":
"",
100 "RAW2DIGI":
"DIGI2RAW",
101 "RAW2RECO":
"DIGI2RAW",
103 "DIGI2RAW":
"DATAMIX",
105 "ALCAHARVEST":
"RECO",
110 trimmedEvtType=options.evt_type.split(
'/')[-1]
113 options.trimmedStep=[]
114 for s
in options.step.split(
','):
116 options.trimmedStep.append(step)
117 first_step=options.trimmedStep[0]
123 'ALL':
'GEN,SIM,DIGI,L1,DIGI2RAW,HLT:GRun,RAW2DIGI,RECO,POSTRECO,VALIDATION,DQM',
124 'DATA_CHAIN':
'RAW2DIGI,RECO,POSTRECO,DQM'
126 if options.step
in stepsAliases:
127 options.step=stepsAliases[options.step]
129 options.step = options.step.replace(
"SIM_CHAIN",
"GEN,SIM,DIGI,L1,DIGI2RAW")
133 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 ==
"":
135 if (
"SKIM" in options.step
and not "RECO" in options.step):
137 if (
"ENDJOB" in options.step):
139 if (
'DQMIO' in options.datatier):
142 options.step=options.step+
',ENDJOB'
146 if options.filetype==defaultOptions.filetype:
147 if options.filein.lower().endswith(
".lhe")
or options.filein.lower().endswith(
".lhef")
or options.filein.startswith(
"lhe:"):
148 options.filetype=
"LHE"
149 elif options.filein.startswith(
"mcdb:"):
150 print(
"This is a deprecated way of selecting lhe files from article number. Please use lhe:article argument to --filein")
151 options.filein=options.filein.replace(
'mcdb:',
'lhe:')
152 options.filetype=
"LHE"
154 options.filetype=
"EDM"
156 filesuffix = {
"LHE":
"lhe",
"EDM":
"root",
"MCDB":
"",
"DQM":
"root"}[options.filetype]
158 if options.filein==
"" and not (first_step
in (
"ALL",
"GEN",
"LHE",
"SIM_CHAIN")):
159 options.dirin=
"file:"+options.dirin.replace(
'file:',
'')
160 options.filein=trimmedEvtType+
"_"+prec_step[first_step]+
"."+filesuffix
165 standardFileName =
""
166 standardFileName = trimmedEvtType+
"_"+
"_".
join(options.trimmedStep)
167 standardFileName = standardFileName.replace(
",",
"_").
replace(
".",
"_")
168 if options.pileup !=
"NoPileUp":
169 standardFileName +=
"_PU"
173 if options.fileout==
"" and not first_step
in (
"HARVESTING",
"ALCAHARVEST"):
174 options.fileout = standardFileName+
".root"
177 if not options.python_filename:
178 options.python_filename = standardFileName+
'.py'
186 if 'reSIM' in options.trimmedStep:
187 options.name =
'RESIM'
188 elif 'reDIGI' in options.trimmedStep:
189 options.name =
'REDIGI'
190 elif 'HLT' in options.trimmedStep:
192 elif 'RECO' in options.trimmedStep:
193 options.name =
'RECO'
194 elif options.trimmedStep == [
'NONE']
and options.filetype
in (
'LHE',
'MCDB'):
196 elif len(options.trimmedStep)==0:
197 options.name =
'PROCESS'
199 options.name = options.trimmedStep[-1]
205 if "HARVESTING" in options.trimmedStep
and len(options.trimmedStep) > 1:
206 raise Exception(
"The Harvesting step must be run alone")
209 if not options.isData
and not options.isMC:
210 if 'LHE' in options.trimmedStep
or 'LHE' in options.datatier:
212 if 'GEN' in options.trimmedStep
or 'GEN' in options.datatier:
214 if 'SIM' in options.trimmedStep:
216 if 'CFWRITER' in options.trimmedStep:
218 if 'DIGI' in options.trimmedStep:
220 if 'DIGI2RAW' in options.trimmedStep:
222 if (
not (options.eventcontent ==
None))
and 'SIM' in options.eventcontent:
224 if 'SIM' in options.datatier:
226 if 'VALIDATION' in options.trimmedStep:
228 if options.era
and 'Phase2' in options.era:
231 print(
'We have determined that this is simulation (if not, rerun cmsDriver.py with --data)')
233 print(
'We have determined that this is real data (if not, rerun cmsDriver.py with --mc)')
237 if options.profile
and options.prefix:
238 raise Exception(
"--profile and --prefix are incompatible")
240 profileOpts = options.profile.split(
':')
242 profilerType = profileOpts[0].
replace(
"=",
" ")
244 if profilerType ==
"pp":
245 options.profileTypeLabel =
"performance"
246 elif profilerType ==
"mp":
247 options.profileTypeLabel =
"memory"
248 elif profilerType.startswith(
"fp "):
249 options.profileTypeLabel = profilerType.replace(
"fp ",
"")
251 raise Exception(
"Not a valid profiler type %s. Alternatives are pp, mp, fp=<function>."%(profilerType))
253 options.prefix =
"igprof -t cmsRun -%s" % profilerType
257 from Configuration.StandardSequences.Eras
import eras
259 requestedEras = options.era.split(
",")
261 for eraName
in requestedEras :
262 if not hasattr( eras, eraName )
or not checkModifier(getattr(eras,eraName)):
264 for key
in eras.__dict__ :
266 if validOptions!=
"" : validOptions+=
", "
267 validOptions+=
"'"+key+
"'"
268 raise Exception(
"'%s' is not a valid option for '--era'. Valid options are %s." % (eraName, validOptions) )
272 options.era+=
",fastSim"
274 options.era=
"fastSim"
277 if options.fast
and not options.scenario ==
"pp":
278 raise Exception(
"ERROR: the --option fast is only compatible with the default scenario (--scenario=pp)")
279 if options.fast
and 'HLT' in options.trimmedStep:
280 raise Exception(
"ERROR: the --option fast is incompatible with HLT (HLT is no longer available in FastSim)")
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)