00038 :
00039 import sys
00040 from Configuration.PyReleaseValidation.Options import parser,threeValued
00041
00042 for (index,item) in enumerate(items):
00043 for (opt,value) in threeValued:
00044 if (str(item) in opt) and (index==len(items)-1 or items[index+1].startswith('-')):
00045 items.insert(index+1,value)
00046
00047 (options,args) = parser.parse_args(items)
00048
00049 if not options.conditions or options.conditions=="help":
00050 from Configuration.AlCa import autoCond
00051 possible=""
00052 for k in autoCond.autoCond:
00053 possible+="\nauto:"+k+" -> "+autoCond.autoCond[k]
00054 raise Exception("the --conditions option is mandatory. Possibilities are: "+possible)
00055
00056
00057
00058
00059
00060
00061
00062 if options.triggerResultsProcess == None and "ALCAOUTPUT" in options.step:
00063 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"
00064 sys.exit(1)
00065
00066 if not options.evt_type:
00067 options.evt_type=sys.argv[1]
00068
00069
00070
00071
00072 if options.dirin!='' and (not options.dirin.endswith('/')): options.dirin+='/'
00073 if options.dirout!='' and (not options.dirout.endswith('/')): options.dirout+='/'
00074
00075
00076
00077
00078 prec_step = {"NONE":"",
00079 "ALL":"",
00080 "LHE":"",
00081 "GEN":"",
00082 "reGEN":"",
00083 "SIM":"GEN",
00084 "reSIM":"SIM",
00085 "DIGI":"SIM",
00086 "reDIGI":"DIGI",
00087 "L1REPACK":"RAW",
00088 "HLT":"RAW",
00089 "RECO":"DIGI",
00090 "ALCA":"RECO",
00091 "ANA":"RECO",
00092 "SKIM":"RECO",
00093 "DIGI2RAW":"DIGI",
00094 "RAW2DIGI":"DIGI2RAW",
00095 "RAW2RECO":"DIGI2RAW",
00096 "DATAMIX":"DIGI",
00097 "DIGI2RAW":"DATAMIX",
00098 "HARVESTING":"RECO",
00099 "ALCAHARVEST":"RECO"}
00100
00101 trimmedEvtType=options.evt_type.split('/')[-1]
00102
00103
00104 options.trimmedStep=[]
00105 for s in options.step.split(','):
00106 step=s.split(':')[0]
00107 options.trimmedStep.append(step)
00108 first_step=options.trimmedStep[0]
00109
00110
00111
00112 stepsAliases={
00113 'NONE':'',
00114 'ALL':'GEN,SIM,DIGI,L1,DIGI2RAW,HLT:GRun,RAW2DIGI,RECO,POSTRECO,VALIDATION,DQM',
00115 'DATA_CHAIN':'RAW2DIGI,RECO,POSTRECO,DQM'
00116 }
00117 if options.step in stepsAliases:
00118 options.step=stepsAliases[options.step]
00119
00120 options.step = options.step.replace("SIM_CHAIN","GEN,SIM,DIGI,L1,DIGI2RAW")
00121
00122
00123 addEndJob = True
00124 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 == "":
00125 addEndJob = False
00126 if ("SKIM" in options.step and not "RECO" in options.step):
00127 addEndJob = False
00128 if ("ENDJOB" in options.step):
00129 addEndJob = False
00130 if ('DQMROOT' in options.datatier):
00131 addEndJob = False
00132 if addEndJob:
00133 options.step=options.step+',ENDJOB'
00134
00135
00136
00137 if options.filetype==defaultOptions.filetype:
00138 if options.filein.lower().endswith(".lhe") or options.filein.lower().endswith(".lhef") or options.filein.startswith("lhe:"):
00139 options.filetype="LHE"
00140 elif options.filein.startswith("mcdb:"):
00141 print "This is a deprecated way of selecting lhe files from article number. Please use lhe:article argument to --filein"
00142 options.filein=options.filein.replace('mcdb:','lhe:')
00143 options.filetype="LHE"
00144 else:
00145 options.filetype="EDM"
00146
00147 filesuffix = {"LHE": "lhe", "EDM": "root", "MCDB": "", "DQM":"root"}[options.filetype]
00148
00149 if options.filein=="" and not (first_step in ("ALL","GEN","LHE","SIM_CHAIN")):
00150 options.dirin="file:"+options.dirin.replace('file:','')
00151 options.filein=trimmedEvtType+"_"+prec_step[first_step]+"."+filesuffix
00152
00153
00154
00155
00156 standardFileName = ""
00157 standardFileName = trimmedEvtType+"_"+"_".join(options.trimmedStep)
00158 standardFileName = standardFileName.replace(",","_").replace(".","_")
00159 if options.pileup != "NoPileUp":
00160 standardFileName += "_PU"
00161
00162
00163
00164 if options.fileout=="" and not first_step in ("HARVESTING", "ALCAHARVEST"):
00165 options.fileout = standardFileName+".root"
00166
00167
00168 if not options.python_filename:
00169 options.python_filename = standardFileName+'.py'
00170
00171 print options.step
00172
00173
00174
00175
00176 if not options.name:
00177 if 'reSIM' in options.trimmedStep:
00178 options.name = 'RESIM'
00179 elif 'reDIGI' in options.trimmedStep:
00180 options.name = 'REDIGI'
00181 elif 'HLT' in options.trimmedStep:
00182 options.name = 'HLT'
00183 elif 'RECO' in options.trimmedStep:
00184 options.name = 'RECO'
00185 elif options.trimmedStep == ['NONE'] and options.filetype in ('LHE', 'MCDB'):
00186 options.name = 'LHE'
00187 elif len(options.trimmedStep)==0:
00188 options.name = 'PROCESS'
00189 else:
00190 options.name = options.trimmedStep[-1]
00191
00192
00193 isHarvesting = False
00194 isOther = False
00195
00196 if "HARVESTING" in options.trimmedStep and len(options.trimmedStep) > 1:
00197 raise Exception("The Harvesting step must be run alone")
00198
00199
00200 if not options.isData and not options.isMC:
00201 if 'SIM' in options.trimmedStep:
00202 options.isMC=True
00203 if 'CFWRITER' in options.trimmedStep:
00204 options.isMC=True
00205 if 'DIGI' in options.trimmedStep:
00206 options.isMC=True
00207 if (not (options.eventcontent == None)) and 'SIM' in options.eventcontent:
00208 options.isMC=True
00209 if 'SIM' in options.datatier:
00210 options.isMC=True
00211 if options.isMC:
00212 print 'We have determined that this is simulation (if not, rerun cmsDriver.py with --data)'
00213 else:
00214 print 'We have determined that this is real data (if not, rerun cmsDriver.py with --mc)'
00215
00216 if options.profile:
00217 if options.profile and options.prefix:
00218 raise Exception("--profile and --prefix are incompatible")
00219 profilerType = 'pp'
00220 profileOpts = options.profile.split(':')
00221 if len(profileOpts):
00222 profilerType = profileOpts[0].replace("=", " ")
00223
00224 if profilerType == "pp":
00225 options.profileTypeLabel = "performance"
00226 elif profilerType == "mp":
00227 options.profileTypeLabel = "memory"
00228 elif profilerType.startswith("fp "):
00229 options.profileTypeLabel = profilerType.replace("fp ", "")
00230 else:
00231 raise Exception("Not a valid profiler type %s. Alternatives are pp, mp, fp=<function>."%(profilerType))
00232
00233 options.prefix = "igprof -t cmsRun -%s" % profilerType
00234
00235 return options
00236