ATLAS Offline Software
Loading...
Searching...
No Matches
StandardTests.py
Go to the documentation of this file.
1# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2from .Checks import (
3 AODContentCheck,
4 AODDigestCheck,
5 FrozenTier0PolicyCheck,
6 MetadataCheck,
7)
8from .Inputs import (
9 input_AOD,
10 input_BS_minimum_bias_overlay,
11 input_EVNT,
12 input_EVNT_data_overlay,
13 input_HITS,
14 input_HITS_data_overlay,
15 input_HITS_minbias_high,
16 input_HITS_minbias_high_fulltruth,
17 input_HITS_minbias_low,
18 input_HITS_minbias_low_fulltruth,
19 input_HITS_neutrino,
20 input_HITS_unfiltered,
21 input_RDO_BKG,
22 input_RDO_BKG_data,
23)
24from .Test import TestSetup, WorkflowRun, WorkflowTest, WorkflowType
25
26
28 """General workflow q-test."""
29
30 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
31 if "maxEvents" not in extra_args:
32 if type == WorkflowType.MCPileUpReco or run == WorkflowRun.Run4:
33 extra_args += " --maxEvents 5"
34 else:
35 extra_args += " --maxEvents 20"
36
37 if type == WorkflowType.MCPileUpReco:
38 if "inputHITSFile" not in extra_args:
39 extra_args += f" --inputHITSFile {input_HITS[run]}"
40 if "inputRDO_BKGFile" not in extra_args:
41 extra_args += " --inputRDO_BKGFile ../run_d*/myRDO.pool.root"
42
43 threads = 1
44 threads_argument = '--multithreaded'
45 if setup.custom_threads is not None:
46 threads = setup.custom_threads
47 if threads <= 0:
48 threads_argument = ''
49
50 self.command = \
51 (f"ATHENA_CORE_NUMBER={threads} Reco_tf.py {threads_argument} --AMIConfig {ID}"
52 f" --imf False {extra_args}")
53
54 self.output_checks = []
55 # TODO: disable RDO comparison for now
56 # if type == WorkflowType.MCReco:
57 # self.output_checks.append(FrozenTier0PolicyCheck(setup, "RDO", 10))
58 self.output_checks.append(FrozenTier0PolicyCheck(setup, "AOD", 60))
59 self.output_checks.append(FrozenTier0PolicyCheck(setup, "ESD", 20))
60 self.output_checks.append(MetadataCheck(setup, "AOD"))
61
62 self.digest_checks = []
63 if not setup.disable_output_checks:
64 self.digest_checks.append(AODContentCheck(setup))
65 self.digest_checks.append(AODDigestCheck(setup))
66
67 super().__init__(ID, run, type, steps, setup)
68
69
71 """Simulation workflow test."""
72
73 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
74 if "maxEvents" not in extra_args:
75 extra_args += " --maxEvents 20"
76
77 if "jobNumber" not in extra_args and run is WorkflowRun.Run3 and type is WorkflowType.FullSim:
78 extra_args += " --jobNumber 5"
79
80 input_argument = ""
81 if "inputEVNTFile" not in extra_args and "inputHITSFile" not in extra_args:
82 if type is WorkflowType.HitsFilter:
83 input_argument = f"--inputHITSFile {input_HITS_unfiltered[run]}"
84 elif type is WorkflowType.HitsMerge:
85 input_argument = f"--inputHITSFile {input_HITS[run]}"
86 else:
87 input_argument = f"--inputEVNTFile {input_EVNT[run]}"
88
89 threads = 0
90 threads_argument = '--multithreaded'
91 if setup.custom_threads is not None:
92 threads = setup.custom_threads
93 if threads <= 0:
94 threads_argument = ''
95
96 if type is WorkflowType.HitsMerge:
97 self.command = \
98 (f"ATHENA_CORE_NUMBER={threads} HITSMerge_tf.py {threads_argument} --AMIConfig {ID}"
99 f" {input_argument} --outputHITS_MRGFile myHITS.pool.root"
100 f" --imf False {extra_args}")
101 elif type is WorkflowType.HitsFilter:
102 self.command = \
103 (f"ATHENA_CORE_NUMBER={threads} FilterHit_tf.py {threads_argument} --AMIConfig {ID}"
104 f" {input_argument} --outputHITS_FILTFile myHITS.pool.root"
105 f" --imf False {extra_args}")
106 else:
107 self.command = \
108 (f"ATHENA_CORE_NUMBER={threads} Sim_tf.py {threads_argument} --AMIConfig {ID}"
109 f" {input_argument} --outputHITSFile myHITS.pool.root"
110 f" --imf False {extra_args}")
111
113 FrozenTier0PolicyCheck(setup, "HITS", 10),
114 MetadataCheck(setup, "HITS"),
115 ]
116
117 super().__init__(ID, run, type, steps, setup)
118
119
121 """MC overlay workflow test."""
122
123 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
124 if "maxEvents" not in extra_args:
125 extra_args += " --maxEvents 10"
126
127 self.command = \
128 (f"Overlay_tf.py --AMIConfig {ID}"
129 f" --inputHITSFile {input_HITS[run]} --inputRDO_BKGFile {input_RDO_BKG[run]} --outputRDOFile myRDO.pool.root"
130 f" --imf False {extra_args}")
131
132 # skip performance checks for now
134
136 FrozenTier0PolicyCheck(setup, "RDO", 10),
137 MetadataCheck(setup, "RDO"),
138 ]
139
140 super().__init__(ID, run, type, steps, setup)
141
142
144 """Data overlay workflow test."""
145
146 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
147 if "maxEvents" not in extra_args:
148 extra_args += " --maxEvents 10"
149
150 if type is WorkflowType.DataOverlayChain:
151 self.command = \
152 (f"FastChain_tf.py --AMIConfig {ID}"
153 f" --inputEVNTFile {input_EVNT_data_overlay[run]} --inputRDO_BKGFile {input_RDO_BKG_data[run]} --outputHITSFile myHITS.pool.root --outputRDOFile myRDO.pool.root"
154 f" --imf False {extra_args}")
155 else:
156 self.command = \
157 (f"Overlay_tf.py --AMIConfig {ID}"
158 f" --inputHITSFile {input_HITS_data_overlay[run]} --inputRDO_BKGFile {input_RDO_BKG_data[run]} --outputRDOFile myRDO.pool.root"
159 f" --imf False {extra_args}")
160
162 if type is WorkflowType.DataOverlayChain:
163 self.output_checks.extend([
164 FrozenTier0PolicyCheck(setup, "HITS", 10),
165 MetadataCheck(setup, "HITS"),
166 ])
167
168 self.output_checks.extend([
169 FrozenTier0PolicyCheck(setup, "RDO", 10),
170 MetadataCheck(setup, "RDO"),
171 ])
172
173 super().__init__(ID, run, type, steps, setup)
174
175
177 """Digitization with pile-up workflow test."""
178
179 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
180 if "maxEvents" not in extra_args:
181 extra_args += " --maxEvents 5"
182
183 if "StandardInTimeOnlyTruth" in extra_args:
184 input_high = input_HITS_minbias_high_fulltruth[run]
185 input_low = input_HITS_minbias_low_fulltruth[run]
186 else:
187 input_high = input_HITS_minbias_high[run]
188 input_low = input_HITS_minbias_low[run]
189
190 self.command = \
191 (f"Digi_tf.py --AMIConfig {ID} --jobNumber 1 --digiSeedOffset1 1 --digiSeedOffset2 1"
192 f" --inputHITSFile {input_HITS_neutrino[run]} --inputHighPtMinbiasHitsFile {input_high} --inputLowPtMinbiasHitsFile {input_low} --outputRDOFile myRDO.pool.root"
193 f" --imf False {extra_args}")
194
196 FrozenTier0PolicyCheck(setup, "RDO", 5),
197 MetadataCheck(setup, "RDO"),
198 ]
199
200 super().__init__(ID, run, type, steps, setup)
201
202
204 """Data overlay minimum bias preprocessing test."""
205
206 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
207 if "maxEvents" not in extra_args:
208 extra_args += " --maxEvents 5"
209
210 self.command = \
211 (f"Overlay_tf.py --AMIConfig {ID}"
212 f" --inputBSFile {input_BS_minimum_bias_overlay[run]} --outputRDO_BKGFile myRDO_BKG.pool.root"
213 f" --imf False {extra_args}")
214
215 # TODO: enable once the output stabilises
216 # self.output_checks = [
217 # FrozenTier0PolicyCheck(setup, "RDO_BKG", 5),
218 # MetadataCheck(setup, "RDO_BKG"),
219 # ]
220
221 super().__init__(ID, run, type, steps, setup)
222
223
225 """Derivations test."""
226
227 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
228 self.diff_tolerances = "PROCTools/DAOD_diff-tolerances.yaml"
229
230 test_def = ID.split("_")
231 multithreaded = False
232 if test_def[-2] == "MT":
233 multithreaded = True
234 test_run = test_def.pop()
235 test_def.pop() # remove MT
236 test_def.append(test_run) # add run back to the end
237 data_type = test_def[0].lower()
238 formats = [format.upper() for format in test_def[1:-1]]
239
240 threads = 0
241 if setup.custom_threads is not None:
242 threads = setup.custom_threads
243
244 # If we're running a DAOD to DAOD job, the output stream is called D2AOD
245 out_stream = "DAOD"
246 parallel_compression = "True"
247 if "inputDAOD_PHYSFile" in extra_args:
248 out_stream = "D2AOD"
249 parallel_compression = "False" # Disable parallel compression for DAOD to DAOD tests (ATEAM-1194)
250
251 if "maxEvents" not in extra_args:
252 base_events = 100
253 events = threads * base_events + 1
254 extra_args += f" --maxEvents {events}"
255
256 if not multithreaded:
257 flush = 80
258 format_flush = ", ".join([f"\"{out_stream}_{format}\": {flush}" for format in formats])
259 extra_args += f" --preExec 'flags.Output.TreeAutoFlush={{{format_flush}}}'"
260
261 if "inputAODFile" not in extra_args and "inputDAOD_PHYSFile" not in extra_args:
262 extra_args += f" --inputAODFile {input_AOD[run][data_type]}"
263
264 # could also use p5503
265 if not multithreaded:
266 self.command = \
267 (f"ATHENA_CORE_NUMBER={threads} Derivation_tf.py"
268 f" --formats {' '.join(formats)}"
269 " --multiprocess --multithreadedFileValidation True"
270 f" --athenaMPMergeTargetSize '{out_stream}_*:0'"
271 " --sharedWriter True"
272 f" --parallelCompression {parallel_compression}"
273 f" --output{out_stream}File myOutput.pool.root"
274 f" --imf False {extra_args}")
275 else:
276 self.command = \
277 (f"ATHENA_CORE_NUMBER={threads} Derivation_tf.py"
278 f" --formats {' '.join(formats)}"
279 " --multithreaded"
280 f" --output{out_stream}File myOutput.pool.root"
281 f" --imf False {extra_args}")
282
283 # skip performance checks for now
285
287 for format in formats:
288 self.output_checks.append(FrozenTier0PolicyCheck(setup, f"{out_stream}_{format}", 10))
289 self.output_checks.append(MetadataCheck(setup, f"{out_stream}_{format}"))
290
291 super().__init__("_".join(test_def), run, type, steps, setup)
292
293
295 """Generation test."""
296
297 def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: list[str], setup: TestSetup, extra_args: str = "") -> None:
298 if "output" not in extra_args:
299 extra_args += " --outputEVNTFile myEVNT.pool.root"
300
301 if "maxEvents" not in extra_args:
302 extra_args += " --maxEvents 10"
303
304 if "ecmEnergy" not in extra_args:
305 if run is WorkflowRun.Run2:
306 extra_args += " --ecmEnergy 13000"
307 elif run is WorkflowRun.Run3:
308 extra_args += " --ecmEnergy 13600"
309 else:
310 extra_args += " --ecmEnergy 14000"
311
312 dsid = ID.replace("gen", "")
313
314 self.command = \
315 (f"Gen_tf.py --jobConfig {dsid}"
316 f" --imf False {extra_args}")
317
318 super().__init__(ID, run, type, steps, setup)
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")
None __init__(self, str ID, WorkflowRun run, WorkflowType type, list[str] steps, TestSetup setup, str extra_args="")