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