ATLAS Offline Software
Loading...
Searching...
No Matches
generateARTtests.py
Go to the documentation of this file.
1#!/usr/bin/env python
2
3import os
4
5DAOD_FILE = "data18_13TeV:DAOD_MUON0.14316152._000001.pool.root.1"
6RAW_FILE = "data15_13TeV:data15_13TeV.00284285.physics_Main.daq.RAW"
7RDO_FILE = "mc16_13TeV:mc16_13TeV.361108.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Ztautau.recon.RDO.e3601_s3126_r9546"
8HAMMERCLOUD_FILE = "mc15_13TeV.423202.Pythia8B_A14_CTEQ6L1_Jpsie3e13.merge.AOD.e3869_s2608_s2183_r6630_r6264" #NOTE: needs update to mc16(?)
9PROJECTS = ["AthAnalysis", "AthDerivation", "AthSimulation", "Athena", "AnalysisBase"]
10
11XAODCHECKER_TURLS = {
12 "ROOT" : "root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlaslocalgroupdisk/rucio/data18_13TeV/e6/c2/DAOD_MUON0.14316152._000001.pool.root.1", # LRZ-LMU,
13 "DAVS" : "davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlaslocalgroupdisk/rucio/data18_13TeV/e6/c2/DAOD_MUON0.14316152._000001.pool.root.1", # LRZ-LMU
14 "HTTPS" : "https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlaslocalgroupdisk/rucio/data18_13TeV/e6/c2/DAOD_MUON0.14316152._000001.pool.root.1", # LRZ-LMU
15}
16
17RECO_TF_TURLS = {
18 "RDO" : (
19 {"ROOT" : "root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1"}, # LRZ-LMU
20 {"DAVS" : "davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1" }, # LRZ-LMU
21 {"HTTPS" : "https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc16_13TeV/90/96/RDO.11373415._000001.pool.root.1" }, # LRZ-LMU
22 ),
23 "RAW" : (
24 {"ROOT" : "root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/data15_13TeV/71/42/data15_13TeV.00284285.physics_Main.daq.RAW._lb0856._SFO-1._0003.data" }, # LRZ-LMU
25 {"DAVS" : "davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/data15_13TeV/71/42/data15_13TeV.00284285.physics_Main.daq.RAW._lb0856._SFO-1._0003.data" }, # LRZ-LMU
26 {"HTTPS" : "https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/data15_13TeV/71/42/data15_13TeV.00284285.physics_Main.daq.RAW._lb0856._SFO-1._0003.data" }, # LRZ-LMU
27 ),
28}
29
30TFILE_OPEN_TURLs = [
31 {"ROOT":
32 (
33 "root://lcg-lrz-rootd.grid.lrz.de:1094/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # LRZ-LMU
34 "root://grid-dc.rzg.mpg.de:1094//pnfs/rzg.mpg.de/data/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # MPPMU
35 "root://dcache-atlas-xrootd.desy.de:1094//pnfs/desy.de/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # DESY-Hamburg
36 "root://lcg-se0.ifh.de:1094//pnfs/ifh.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # DESY-Zeuthen
37 "root://atlasxrootd-kit.gridka.de:1094//pnfs/gridka.de/atlas/disk-only/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Karlsruhe
38 "root://sedoor1.bfg.uni-freiburg.de:1094//pnfs/bfg.uni-freiburg.de/data/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Freiburg
39 "root://se-goegrid.gwdg.de:1094//pnfs/gwdg.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Goettingen
40 "root://grid-se.physik.uni-wuppertal.de:1094//pnfs/physik.uni-wuppertal.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Wuppertal
41 )
42 },
43 {"DAVS":
44 (
45 "davs://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # LRZ-LMU
46 "davs://grid-dav.rzg.mpg.de:2880/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # MPPMU
47 "davs://dcache-atlas-webdav.desy.de:2880/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # DESY-Hamburg
48 "davs://lcg-se0.ifh.de:2880/pnfs/ifh.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # DESY-Zeuthen
49 "davs://atlaswebdav-kit.gridka.de:2880/pnfs/gridka.de/atlas/disk-only/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Karlsruhe
50 "davs://webdav.bfg.uni-freiburg.de:2880/pnfs/bfg.uni-freiburg.de/data/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Freiburg
51 "davs://se-goegrid.gwdg.de:2880/pnfs/gwdg.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Goettingen
52 "davs://grid-se.physik.uni-wuppertal.de:2881/pnfs/physik.uni-wuppertal.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Wuppertal
53 )
54 },
55 {"HTTPS":
56 (
57 "https://lcg-lrz-http.grid.lrz.de:443/pnfs/lrz-muenchen.de/data/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # LRZ-LMU
58 "https://grid-dav.rzg.mpg.de:2880/atlas/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # MPPMU
59 "https://dcache-atlas-webdav.desy.de:2880/dq2/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # DESY-Hamburg
60 "https://lcg-se0.ifh.de:2880/pnfs/ifh.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # DESY-Zeuthen
61 "https://atlaswebdav-kit.gridka.de:2880/pnfs/gridka.de/atlas/disk-only/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Karlsruhe
62 "https://webdav.bfg.uni-freiburg.de:2880/pnfs/bfg.uni-freiburg.de/data/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Freiburg
63 "https://se-goegrid.gwdg.de:2880/pnfs/gwdg.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Goettingen
64 "https://grid-se.physik.uni-wuppertal.de:2881/pnfs/physik.uni-wuppertal.de/data/atlas/atlasdatadisk/rucio/mc15_13TeV/ed/68/AOD.05536542._000001.pool.root.1", # Wuppertal
65 )
66 },
67]
68
69def 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
84set -e\n
85Reco_tf.py --AMI q221 --inputRDOFile {turl} --outputRDO_TRIGFile art.pool.root\n
86echo \"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
102set -e\n
103export ATHENA_CORE_NUMBER=2
104Reco_tf.py --AMI q221 --multiprocess --inputRDOFile {turl} --outputRDO_TRIGFile art.pool.root\n
105echo \"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
122set -e\n
123Reco_tf.py --AMI q431 --inputBSFile {turl} --outputESDFile art.pool.root\n
124echo \"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
140set -e\n
141export ATHENA_CORE_NUMBER=2
142Reco_tf.py --AMI q431 --multiprocess --inputBSFile {turl} --outputESDFile art.pool.root\n
143echo \"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
163set -e\n
164Reco_tf.py --inputAODFile {turl} --outputDAODFile art.pool.root --reductionConf TEST1 --maxEvents 100\n
165echo \"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
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
184set -e\n
185athena --filesInput=\"{turl}\" DirectIOART/DirectIOARTAthAnalysisJobOptions.py\n
186echo \"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
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
202set -e\n
203xAODChecker {turl}\n
204echo \"art-result: $? DirectIOART_AnalysisBase_xAODChecker_protocol_{protocol}\"\n
205PFC_FILE=PoolFileCatalog.xml
206touch $PFC_FILE
207echo \"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\" standalone=\\"no\\" ?>\" >> $PFC_FILE
208echo \"<!-- Edited By POOL -->\" >> $PFC_FILE
209echo \"<!DOCTYPE POOLFILECATALOG SYSTEM \\"InMemory\\">\" >> $PFC_FILE
210echo \"<POOLFILECATALOG>\" >> $PFC_FILE
211echo \"\" >> $PFC_FILE
212echo \"</POOLFILECATALOG>\" >> $PFC_FILE""".format(turl=value, protocol=key)
213 outfile.write(outstring)
214 outfile.close()
215 os.system("chmod +x " + name)
216
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
236import ROOT
237import 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 += """
248f = ROOT.TFile.Open(\"{turl}\")
249if f: print(\"art-result: 0 DirectIOART_TFileOpen_protocol_{protocol}\")
250else: print(\"art-result: 1 DirectIOART_TFileOpen_protocol_{protocol}\")
251del f\n""".format(turl=filenames, protocol=key)
252 filenames = ""
253
254 # back to main test scripts
255 outstring += """
256outstr = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>
257<!-- Edited By POOL -->
258<!DOCTYPE POOLFILECATALOG SYSTEM \"InMemory\">
259<POOLFILECATALOG>
260
261</POOLFILECATALOG>\"\"\"
262with 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
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
280def 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
308if __name__ == "__main__":
309 try:
310 main()
311 except KeyboardInterrupt:
312 print "\nexiting"
void print(char *figname, TCanvas *c1)
void xrange(TH1 *h, bool symmetric)