ATLAS Offline Software
Functions | Variables
LArMerge_trf Namespace Reference

Functions

def getFileMap (fname, dsname, nevts=0, guid='')
 
def larMerge (dataMap)
 

Variables

 picklefile = sys.argv[1][len('--argdict='):]
 main() More...
 
 f = open(picklefile, 'rb')
 
 dataMap = pickle.load(f)
 
 inputFiles = sys.argv[1][13:].split(',')
 
 outputFile = sys.argv[2][13:]
 

Function Documentation

◆ getFileMap()

def LArMerge_trf.getFileMap (   fname,
  dsname,
  nevts = 0,
  guid = '' 
)

Definition at line 30 of file LArMerge_trf.py.

30 def getFileMap(fname, dsname, nevts=0, guid='') :
31  if os.path.isfile(fname) :
32  dataMap = { 'lfn': fname,
33  'dataset' : dsname,
34  'events' : nevts
35  }
36  if guid :
37  dataMap['GUID'] = guid
38  else :
39  dataMap = {}
40  return dataMap
41 

◆ larMerge()

def LArMerge_trf.larMerge (   dataMap)

Definition at line 45 of file LArMerge_trf.py.

45 def larMerge(dataMap) :
46 
47  print ("\n##################################################################")
48  print ( "## ATLAS Tier0 LAr CAF file Merging ##")
49  print ( "##################################################################\n")
50 
51  print ("\nFull Tier-0 run options:\n")
52  pprint.pprint(dataMap)
53 
54  inputList = []
55  inputDSName = None
56 
57  for val in dataMap['inputLArFiles'] :
58  inputList.append(val.split('#')[1])
59  if not inputDSName :
60  inputDSName = val.split('#')[0]
61 
62  print ("\ninputLArFiles list:\n")
63  pprint.pprint(inputList)
64 
65  # output file
66  outputDSName = dataMap['outputLArFile'].split('#')[0]
67  outputFile = dataMap['outputLArFile'].split('#')[1]
68 
69  print ('\nOutput file name:', outputFile)
70 
71  retcode = 0
72  acronym = 'OK'
73 
74  outFiles = []
75  inFiles = []
76  nEvents=0
77 
78  cmdline=["LArSamplesMerge.exe"]
79  for fileName in inputList:
80  if os.access(fileName,os.R_OK):
81  cmdline.append(fileName)
82  else:
83  print ('ERROR : could not open file', fileName)
84  retcode = 74001
85  acronym = 'TRF_LAR_FILE_INPUT_ERROR'
86  break
87  pass
88 
89  if (retcode==0):
90  writepath=os.path.split(outputFile)[0]
91  if writepath=="":
92  writepath="./"
93  if (os.access(writepath,os.W_OK)):
94  cmdline.append(outputFile)
95  else:
96  print ("ERROR, not allowed to write to oututfile", outputFile)
97  retcode = 74002
98  acronym = 'TRF_LAR_MERGE_ERROR'
99  pass
100  pass
101 
102  if (retcode==0):
103 
104  logfile=open("log.LArMerge","w")
105 
106  try:
107  subprocess.check_call(cmdline,stdout=logfile,stderr=subprocess.STDOUT)
108  except Exception as e:
109  print ("ERROR exectution of subprocess failed")
110  print (e)
111  acronym = 'TRF_LAR_MERGE_ERROR'
112  pass
113 
114  logfile.close()
115  logfile=open("log.LArMerge","r")
116 
117  for line in logfile:
118  print (line, end='')
119  if line.startswith("Open file "):
120  linetok=line.split(" ")
121  inFiles.append(getFileMap(linetok[2], None, nevts=int(linetok[4])))
122  pass
123  if line.startswith("Wrote output file "):
124  linetok=line.split(" ")
125  nEvents=int(linetok[5])
126  outFiles=[getFileMap(linetok[3], outputDSName, nevts=nEvents),]
127  pass
128 
129  logfile.close()
130 
131 
132 
133  # assemble job report map, pickle it
134  outMap = { 'prodsys': { 'trfCode': retcode,
135  'trfAcronym': acronym,
136  'jobOutputs': outFiles,
137  'jobInputs': inFiles,
138  'nevents': nEvents,
139  }
140  }
141  f = open('jobReport.gpickle', 'wb')
142  pickle.dump(outMap, f)
143  f.close()
144 
145  print ("\n##################################################################")
146  print ( "## End of job.")
147  print ( "##################################################################\n")
148 
149  print (outMap)
150 

Variable Documentation

◆ dataMap

dictionary LArMerge_trf.dataMap = pickle.load(f)

Definition at line 162 of file LArMerge_trf.py.

◆ f

LArMerge_trf.f = open(picklefile, 'rb')

Definition at line 161 of file LArMerge_trf.py.

◆ inputFiles

LArMerge_trf.inputFiles = sys.argv[1][13:].split(',')

Definition at line 166 of file LArMerge_trf.py.

◆ outputFile

LArMerge_trf.outputFile = sys.argv[2][13:]

Definition at line 167 of file LArMerge_trf.py.

◆ picklefile

LArMerge_trf.picklefile = sys.argv[1][len('--argdict='):]

main()

Definition at line 158 of file LArMerge_trf.py.

LArMerge_trf.larMerge
def larMerge(dataMap)
Definition: LArMerge_trf.py:45
LArMerge_trf.getFileMap
def getFileMap(fname, dsname, nevts=0, guid='')
Definition: LArMerge_trf.py:30
Trk::open
@ open
Definition: BinningType.h:40
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45
Trk::split
@ split
Definition: LayerMaterialProperties.h:38