222 msg.info(
"This is %s" % sys.argv[0])
224 main_dir = os.getcwd()
226 trf.parseCmdLineArgs(sys.argv[1:])
227 if ((
"cleanOut" in trf.argdict)
and (trf.argdict[
"cleanOut"].value != 0)):
228 name_tmpdir =
"tmprun"
229 tmp_dir = os.path.join(main_dir, name_tmpdir)
230 if os.path.isdir(tmp_dir):
231 shutil.rmtree(tmp_dir, ignore_errors=
True)
234 tmp_dir = os.getcwd()
235 whitelist_in = [
'MC',
'group',
'TXT']
240 msg.info(
"%s stopped at %s, trf exit code %d" % (sys.argv[0], time.asctime(), trf.exitCode))
245 if ((
"cleanOut" in trf.argdict)
and (trf.argdict[
"cleanOut"].value!=0)):
246 whitelist_out = [
'log.generate',
'.root']
247 if "outputTXTFile" in trf.argdict:
248 whitelist_out.append(
'TXT')
249 if "saveList" in trf.argdict:
250 saveList_dic= trf.argdict[
"saveList"].value
251 saveList_str=
str(saveList_dic)
252 saveList_str=saveList_str[10:-3]
253 saveList= saveList_str.split(
",")
254 for item
in saveList:
255 test_ex = os.path.join(main_dir,
str(item))
256 if os.path.isdir(test_ex):
257 shutil.rmtree(test_ex, ignore_errors=
True)
258 elif os.path.isfile(test_ex):
260 if not saveList[0].isdigit():
261 whitelist_out=whitelist_out+saveList
265 if "saveList" not in trf.argdict:
266 shutil.rmtree(tmp_dir, ignore_errors=
True)
267 elif not saveList[0].isdigit():
268 shutil.rmtree(tmp_dir, ignore_errors=
True)
270 elif (
"inputGeneratorFile" in trf.argdict):
271 myinputfiles = trf.argdict[
"inputGeneratorFile"].value
272 genInputFiles = myinputfiles.split(
',')
273 numberOfFiles = len(genInputFiles)
274 merge_file =
'merged_lhef._0.events'
275 if((numberOfFiles>1)
and (os.path.exists(merge_file))):
276 os.remove(merge_file)
278 if ((
"lheOnly" in trf.argdict )
and (trf.argdict[
"lheOnly"].value == 1)):
279 outputName =
''.
join(trf.argdict[
"outputEVNTFile"].value)
280 os.remove(outputName)
281 sys.exit(trf.exitCode)