226 msg.info(
"This is %s" % sys.argv[0])
228 main_dir = os.getcwd()
230 trf.parseCmdLineArgs(sys.argv[1:])
231 if ((
"cleanOut" in trf.argdict)
and (trf.argdict[
"cleanOut"].value != 0)):
232 name_tmpdir =
"tmprun"
233 tmp_dir = os.path.join(main_dir, name_tmpdir)
234 if os.path.isdir(tmp_dir):
235 shutil.rmtree(tmp_dir, ignore_errors=
True)
238 tmp_dir = os.getcwd()
239 allowedlist_in = [
'MC',
'group',
'TXT']
244 msg.info(
"%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode))
249 if ((
"cleanOut" in trf.argdict)
and (trf.argdict[
"cleanOut"].value!=0)):
250 allowedlist_out = [
'log.generate',
'.root']
251 if "outputTXTFile" in trf.argdict:
252 allowedlist_out.append(
'TXT')
253 if "saveList" in trf.argdict:
254 saveList_dic= trf.argdict[
"saveList"].value
255 saveList_str=
str(saveList_dic)
256 saveList_str=saveList_str[10:-3]
257 saveList= saveList_str.split(
",")
258 for item
in saveList:
259 test_ex = os.path.join(main_dir,
str(item))
260 if os.path.isdir(test_ex):
261 shutil.rmtree(test_ex, ignore_errors=
True)
262 elif os.path.isfile(test_ex):
264 if not saveList[0].isdigit():
265 allowedlist_out=allowedlist_out+saveList
269 if "saveList" not in trf.argdict:
270 shutil.rmtree(tmp_dir, ignore_errors=
True)
271 elif not saveList[0].isdigit():
272 shutil.rmtree(tmp_dir, ignore_errors=
True)
274 elif (
"inputGeneratorFile" in trf.argdict):
275 myinputfiles = trf.argdict[
"inputGeneratorFile"].value
276 genInputFiles = myinputfiles.split(
',')
277 numberOfFiles = len(genInputFiles)
278 merge_file =
'merged_lhef._0.events'
279 if((numberOfFiles>1)
and (os.path.exists(merge_file))):
280 os.remove(merge_file)
282 if ((
"lheOnly" in trf.argdict )
and (trf.argdict[
"lheOnly"].value == 1)):
283 outputName =
''.
join(trf.argdict[
"outputEVNTFile"].value)
284 os.remove(outputName)
285 sys.exit(trf.exitCode)