48 print (
"\n##################################################################")
49 print (
"## ATLAS Tier0 LAr CAF file Merging ##")
50 print (
"##################################################################\n")
52 print (
"\nFull Tier-0 run options:\n")
53 pprint.pprint(dataMap)
58 for val
in dataMap[
'inputLArFiles'] :
59 inputList.append(val.split(
'#')[1])
61 inputDSName = val.split(
'#')[0]
63 print (
"\ninputLArFiles list:\n")
64 pprint.pprint(inputList)
67 outputDSName = dataMap[
'outputLArFile'].
split(
'#')[0]
68 outputFile = dataMap[
'outputLArFile'].
split(
'#')[1]
70 print (
'\nOutput file name:', outputFile)
79 cmdline=[
"LArSamplesMerge.exe"]
80 for fileName
in inputList:
81 if os.access(fileName,os.R_OK):
82 cmdline.append(fileName)
84 print (
'ERROR : could not open file', fileName)
86 acronym =
'TRF_LAR_FILE_INPUT_ERROR'
91 writepath=os.path.split(outputFile)[0]
94 if (os.access(writepath,os.W_OK)):
95 cmdline.append(outputFile)
97 print (
"ERROR, not allowed to write to oututfile", outputFile)
99 acronym =
'TRF_LAR_MERGE_ERROR'
105 logfile=
open(
"log.LArMerge",
"w")
108 subprocess.check_call(cmdline,stdout=logfile,stderr=subprocess.STDOUT)
109 except Exception
as e:
110 print (
"ERROR exectution of subprocess failed")
112 acronym =
'TRF_LAR_MERGE_ERROR'
116 logfile=
open(
"log.LArMerge",
"r")
120 if line.startswith(
"Open file "):
121 linetok=line.split(
" ")
122 inFiles.append(
getFileMap(linetok[2],
None, nevts=
int(linetok[4])))
124 if line.startswith(
"Wrote output file "):
125 linetok=line.split(
" ")
126 nEvents=
int(linetok[5])
127 outFiles=[
getFileMap(linetok[3], outputDSName, nevts=nEvents),]
135 outMap = {
'prodsys': {
'trfCode': retcode,
136 'trfAcronym': acronym,
137 'jobOutputs': outFiles,
138 'jobInputs': inFiles,
142 f =
open(
'jobReport.gpickle',
'wb')
143 pickle.dump(outMap, f)
146 print (
"\n##################################################################")
147 print (
"## End of job.")
148 print (
"##################################################################\n")