ATLAS Offline Software
Functions | Variables
generateARTtests Namespace Reference

Functions

def write_RecoTF (opts)
 
def write_AthAnalysis_TestAlg ()
 
def write_AnalysisBase_xAODChecker ()
 
def writeTFileOpen ()
 
def parse_options ()
 
def main ()
 

Variables

 DAOD_FILE
 
 RAW_FILE
 
 RDO_FILE
 
 HAMMERCLOUD_FILE
 
 PROJECTS
 
 XAODCHECKER_TURLS
 
 RECO_TF_TURLS
 
 TFILE_OPEN_TURLs
 

Function Documentation

◆ main()

def generateARTtests.main ( )

Definition at line 280 of file generateARTtests.py.

280 def main():
281  #TODO: Extend to AnalysisBase test algorithms
282 
283  opts = parse_options()
284 
285  if not os.path.exists("./test/"):
286  os.makedirs("./test/")
287 
288  for i in xrange(len(opts.athena_project)):
289  if not opts.athena_project[i] in PROJECTS:
290  print "\tAthena project \"",opts.athena_project[i],"\" not intended for DirectIOART!"
291  continue
292 
293  if opts.mp and not "Athena" in opts.athena_project:
294  opts.mp = False
295 
296  if opts.open_tests:
298 
299  if "AthAnalysis" in opts.athena_project:
301 
302  if "Athena" in opts.athena_project or "AthDerivation" in opts.athena_project:
303  write_RecoTF(opts)
304 
305  if "AnalysisBase" in opts.athena_project:
307 

◆ parse_options()

def generateARTtests.parse_options ( )

Definition at line 269 of file generateARTtests.py.

269 def parse_options():
270  import argparse
271  parser = argparse.ArgumentParser()
272 
273  parser.add_argument("athena_project", help="Specify the Athena release flavour", type=str, nargs="*" )
274  parser.add_argument("-o", "--tfile-open", help="Generate ART scripts for TFile::Open tests", action="store_true", dest="open_tests")
275  parser.add_argument("-m", "--mp", help="Generate ART tests for AthenaMP", action="store_true")
276 
277  options = parser.parse_args()
278  return options
279 

◆ write_AnalysisBase_xAODChecker()

def generateARTtests.write_AnalysisBase_xAODChecker ( )

Definition at line 191 of file generateARTtests.py.

192  #loop over turl list
193  for key, value in XAODCHECKER_TURLS.items():
194  name = os.path.join("test", "test_directioart_analysisbase_xaodchecker_{}.sh".format(key.lower()))
195  print("\tGenerating ... {}".format(name))
196  outfile = open(name,'w')
197  # generate test scripts
198  outstring = """#!/bin/bash\n
199 # art-description: DirectIOART AnalysisBase xAODChecker protocol={protocol}
200 # art-type: grid
201 # art-include: 21.2/AnalysisBase\n
202 set -e\n
203 xAODChecker {turl}\n
204 echo \"art-result: $? DirectIOART_AnalysisBase_xAODChecker_protocol_{protocol}\"\n
205 PFC_FILE=PoolFileCatalog.xml
206 touch $PFC_FILE
207 echo \"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"no\\" ?>\" >> $PFC_FILE
208 echo \"<!-- Edited By POOL -->\" >> $PFC_FILE
209 echo \"<!DOCTYPE POOLFILECATALOG SYSTEM \\"InMemory\\">\" >> $PFC_FILE
210 echo \"<POOLFILECATALOG>\" >> $PFC_FILE
211 echo \"\" >> $PFC_FILE
212 echo \"</POOLFILECATALOG>\" >> $PFC_FILE""".format(turl=value, protocol=key)
213  outfile.write(outstring)
214  outfile.close()
215  os.system("chmod +x " + name)
216 

◆ write_AthAnalysis_TestAlg()

def generateARTtests.write_AthAnalysis_TestAlg ( )

Definition at line 170 of file generateARTtests.py.

171  # loop over turl list
172  for i in xrange(len(TFILE_OPEN_TURLs)):
173  # get values of dictionaries
174  for key, value in TFILE_OPEN_TURLs[i].items():
175  name = os.path.join("test", "test_directioart_athanalysis_alg_{}.sh".format(key.lower()))
176  print("\tGenerating ... {}".format(name))
177  outfile = open(name,'w')
178  # generate tests scripts
179  outstring = """#!/bin/bash\n
180 # art-description: DirectIOART AthAnalysis ParticleSelectionAlg protocol={protocol}
181 # art-type: grid
182 # art-output: *.pool.root
183 # art-include: 21.2/AthAnalysis\n
184 set -e\n
185 athena --filesInput=\"{turl}\" DirectIOART/DirectIOARTAthAnalysisJobOptions.py\n
186 echo \"art-result: $? DirectIOART_AthAnalysis_ParticleSelectionAlg_protocol_{protocol}\"""".format(turl=value[0], protocol=key)
187  outfile.write(outstring)
188  outfile.close()
189  os.system("chmod +x " + name)
190 

◆ write_RecoTF()

def generateARTtests.write_RecoTF (   opts)

Definition at line 69 of file generateARTtests.py.

69 def write_RecoTF(opts):
70  # in case of "Athena"
71  if "Athena" in opts.athena_project:
72  # loop over turl list of RDO input files
73  for item in RECO_TF_TURLS["RDO"]:
74  name = os.path.join("test", "test_directioart_athena_recotf_with_rdo_{}.sh".format(item.keys()[0].lower()))
75  print("\tGenerating ... {}".format(name))
76  outfile = open(name,'w')
77  # generate test scripts
78  outstring = """#!/bin/bash\n
79 # art-description: DirectIOART Athena Reco_tf.py inputFile:RDO protocol={protocol}
80 # art-type: grid
81 # art-output: *.pool.root
82 # art-include: 21.0/Athena
83 # art-include: main/Athena\n
84 set -e\n
85 Reco_tf.py --AMI q221 --inputRDOFile {turl} --outputRDO_TRIGFile art.pool.root\n
86 echo \"art-result: $? DirectIOART_Athena_RecoTF_inputRDO_protocol_{protocol}\"""".format(turl=item.values()[0], protocol=item.keys()[0])
87  outfile.write(outstring)
88  outfile.close()
89  os.system("chmod +x " + name)
90  # if AthenaMP
91  if opts.mp:
92  name = os.path.join("test", "test_directioart_athenamp_recotf_with_rdo_{}.sh".format(item.keys()[0].lower()))
93  print("\tGenerating ... {}".format(name))
94  outfile = open(name,'w')
95  # generate test scripts
96  outstring = """#!/bin/bash\n
97 # art-description: DirectIOART AthenaMP Reco_tf.py inputFile:RDO protocol={protocol}
98 # art-type: grid
99 # art-output: *.pool.root
100 # art-include: 21.0/Athena
101 # art-include: main/Athena\n
102 set -e\n
103 export ATHENA_CORE_NUMBER=2
104 Reco_tf.py --AMI q221 --multiprocess --inputRDOFile {turl} --outputRDO_TRIGFile art.pool.root\n
105 echo \"art-result: $? DirectIOART_AthenaMP_RecoTF_inputRDO_protocol_{protocol}\"""".format(turl=item.values()[0], protocol=item.keys()[0])
106  outfile.write(outstring)
107  outfile.close()
108  os.system("chmod +x " + name)
109 
110  # loop over turl list if RAW input files
111  for item in RECO_TF_TURLS["RAW"]:
112  name = os.path.join("test", "test_directioart_athena_recotf_with_raw_{}.sh".format(item.keys()[0].lower()))
113  print("\tGenerating ... {}".format(name))
114  outfile = open(name,'w')
115  # generate test scripts
116  outstring = """#!/bin/bash\n
117 # art-description: DirectIOART Athena Reco_tf.py inputFile:RAW protocol={protocol}
118 # art-type: grid
119 # art-output: *.pool.root
120 # art-include: 21.0/Athena
121 # art-include: main/Athena\n
122 set -e\n
123 Reco_tf.py --AMI q431 --inputBSFile {turl} --outputESDFile art.pool.root\n
124 echo \"art-result: $? DirectIOART_Athena_RecoTF_inputBS_protocol_{protocol}\"""".format(turl=item.values()[0], protocol=item.keys()[0])
125  outfile.write(outstring)
126  outfile.close()
127  os.system("chmod +x " + name)
128  # if AthenaMP
129  if opts.mp:
130  name = os.path.join("test", "test_directioart_athenamp_recotf_with_raw_{}.sh".format(item.keys()[0].lower()))
131  print("\tGenerating ... {}".format(name))
132  outfile = open(name,'w')
133  # generate test scripts
134  outstring = """#!/bin/bash\n
135 # art-description: DirectIOART AthenaMP Reco_tf.py inputFile:RAW protocol={protocol}
136 # art-type: grid
137 # art-output: *.pool.root
138 # art-include: 21.0/Athena
139 # art-include: main/Athena\n
140 set -e\n
141 export ATHENA_CORE_NUMBER=2
142 Reco_tf.py --AMI q431 --multiprocess --inputBSFile {turl} --outputESDFile art.pool.root\n
143 echo \"art-result: $? DirectIOART_AthenaMP_RecoTF_inputBS_protocol_{protocol}\"""".format(turl=item.values()[0], protocol=item.keys()[0])
144  outfile.write(outstring)
145  outfile.close()
146  os.system("chmod +x " + name)
147 
148  # in case of "AthDerivation"
149  if "AthDerivation" in opts.athena_project:
150  # loop over turl list
151  for i in xrange(len(TFILE_OPEN_TURLs)):
152  # get values of dictionaries
153  for key, value in TFILE_OPEN_TURLs[i].items():
154  name = os.path.join("test", "test_directioart_athderivation_recotf_with_aod_{}.sh".format(key.lower()))
155  print("\tGenerating ... {}".format(name))
156  outfile = open(name,'w')
157  # generate test scripts
158  outstring = """#!/bin/bash\n
159 # art-description: DirectIOART AthDerivation Reco_tf.py inputFile:RDO protocol={protocol} reductionConf:TEST1
160 # art-type: grid
161 # art-output: *.pool.root
162 # art-include: 21.2/AthDerivation\n
163 set -e\n
164 Reco_tf.py --inputAODFile {turl} --outputDAODFile art.pool.root --reductionConf TEST1 --maxEvents 100\n
165 echo \"art-result: $? DirectIOART_AthDerivation_RecoTF_inputAOD_protocol_{protocol}_TEST1\"""".format(turl=value[0], protocol=key)
166  outfile.write(outstring)
167  outfile.close()
168  os.system("chmod +x " + name)
169 

◆ writeTFileOpen()

def generateARTtests.writeTFileOpen ( )

Definition at line 217 of file generateARTtests.py.

217 def writeTFileOpen():
218  name = os.path.join("test", "test_directioart_tfileopen.py")
219  print("\tGenerating ... {}".format(name))
220  outfile = open(name,'w')
221 
222  # generate frame of test scripts
223  outstring = """#!/usr/bin/env python\n
224 # art-description: DirectIOART TFile::Open
225 # art-type: grid
226 # art-include: main/Athena
227 # art-include: main/AthSimulation
228 # art-include: 21.0/Athena
229 # art-include: 21.0/AthSimulation
230 # art-include: 21.2/AthAnalysis
231 # art-include: 21.2/AthDerivation
232 # art-include: 21.2/AnalysisBase
233 # art-include: 21.2/AnalysisTop
234 # art-include: 21.3/Athena
235 # art-include: 21.9/Athena\n
236 import ROOT
237 import os\n"""
238  # loop over turl list
239  for i in xrange(len(TFILE_OPEN_TURLs)):
240  # get values of dictionaries
241  for key, value in TFILE_OPEN_TURLs[i].items():
242  # add turl to filenames string
243  filenames = ""
244  for j in xrange(len(value)):
245  filenames += value[j]
246  if j < len(value)-1: filenames += " | "
247  outstring += """
248 f = ROOT.TFile.Open(\"{turl}\")
249 if f: print(\"art-result: 0 DirectIOART_TFileOpen_protocol_{protocol}\")
250 else: print(\"art-result: 1 DirectIOART_TFileOpen_protocol_{protocol}\")
251 del f\n""".format(turl=filenames, protocol=key)
252  filenames = ""
253 
254  # back to main test scripts
255  outstring += """
256 outstr = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>
257 <!-- Edited By POOL -->
258 <!DOCTYPE POOLFILECATALOG SYSTEM \"InMemory\">
259 <POOLFILECATALOG>
260 
261 </POOLFILECATALOG>\"\"\"
262 with open(\"PoolFileCatalog.xml\", \"w\") as outfile:
263  outfile.write(outstr)"""
264 
265  outfile.write(outstring)
266  outfile.close()
267  os.system("chmod +x " + name)
268 

Variable Documentation

◆ DAOD_FILE

generateARTtests.DAOD_FILE

Definition at line 5 of file generateARTtests.py.

◆ HAMMERCLOUD_FILE

generateARTtests.HAMMERCLOUD_FILE

Definition at line 8 of file generateARTtests.py.

◆ PROJECTS

generateARTtests.PROJECTS

Definition at line 9 of file generateARTtests.py.

◆ RAW_FILE

generateARTtests.RAW_FILE

Definition at line 6 of file generateARTtests.py.

◆ RDO_FILE

generateARTtests.RDO_FILE

Definition at line 7 of file generateARTtests.py.

◆ RECO_TF_TURLS

generateARTtests.RECO_TF_TURLS

Definition at line 17 of file generateARTtests.py.

◆ TFILE_OPEN_TURLs

generateARTtests.TFILE_OPEN_TURLs

Definition at line 30 of file generateARTtests.py.

◆ XAODCHECKER_TURLS

generateARTtests.XAODCHECKER_TURLS

Definition at line 11 of file generateARTtests.py.

xrange
void xrange(TH1 *h, bool symmetric)
Definition: computils.cxx:516
generateARTtests.writeTFileOpen
def writeTFileOpen()
Definition: generateARTtests.py:217
vtune_athena.format
format
Definition: vtune_athena.py:14
generateARTtests.main
def main()
Definition: generateARTtests.py:280
generateARTtests.write_AthAnalysis_TestAlg
def write_AthAnalysis_TestAlg()
Definition: generateARTtests.py:170
print
void print(char *figname, TCanvas *c1)
Definition: TRTCalib_StrawStatusPlots.cxx:25
generateARTtests.write_AnalysisBase_xAODChecker
def write_AnalysisBase_xAODChecker()
Definition: generateARTtests.py:191
TrigJetMonitorAlgorithm.items
items
Definition: TrigJetMonitorAlgorithm.py:79
Trk::open
@ open
Definition: BinningType.h:40
generateARTtests.parse_options
def parse_options()
Definition: generateARTtests.py:269
generateARTtests.write_RecoTF
def write_RecoTF(opts)
Definition: generateARTtests.py:69