ATLAS Offline Software
StandardTests.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from typing import List
3 
4 from .Checks import AODContentCheck, AODDigestCheck, FrozenTier0PolicyCheck, MetadataCheck
5 from .Inputs import input_EVNT, input_HITS, \
6  input_HITS_unfiltered, \
7  input_RDO_BKG, input_BS_minimum_bias_overlay, \
8  input_HITS_data_overlay, input_BS_SKIM, \
9  input_HITS_minbias_low, input_HITS_minbias_high, input_HITS_neutrino, \
10  input_HITS_minbias_low_fulltruth, input_HITS_minbias_high_fulltruth, \
11  input_AOD
12 from .Test import TestSetup, WorkflowRun, WorkflowTest, WorkflowType
13 
14 
16  """General workflow q-test."""
17 
18  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
19  if "maxEvents" not in extra_args:
20  if type == WorkflowType.MCPileUpReco or run == WorkflowRun.Run4:
21  extra_args += " --maxEvents 5"
22  else:
23  extra_args += " --maxEvents 20"
24 
25  if type == WorkflowType.MCPileUpReco:
26  if "inputHITSFile" not in extra_args:
27  extra_args += f" --inputHITSFile {input_HITS[run]}"
28  if "inputRDO_BKGFile" not in extra_args:
29  extra_args += " --inputRDO_BKGFile ../run_d*/myRDO.pool.root"
30 
31  threads = 1
32  threads_argument = '--multithreaded'
33  if setup.custom_threads is not None:
34  threads = setup.custom_threads
35  if threads <= 0:
36  threads_argument = ''
37 
38  self.command = \
39  (f"ATHENA_CORE_NUMBER={threads} Reco_tf.py {threads_argument} --AMIConfig {ID}"
40  f" --imf False {extra_args}")
41 
42  self.output_checks = []
43  # TODO: disable RDO comparison for now
44  # if type == WorkflowType.MCReco:
45  # self.output_checks.append(FrozenTier0PolicyCheck(setup, "RDO", 10))
46  self.output_checks.append(FrozenTier0PolicyCheck(setup, "AOD", 60))
47  self.output_checks.append(FrozenTier0PolicyCheck(setup, "ESD", 20))
48  self.output_checks.append(MetadataCheck(setup, "AOD"))
49 
50  self.digest_checks = []
51  if not setup.disable_output_checks:
54 
55  super().__init__(ID, run, type, steps, setup)
56 
57 
59  """Simulation workflow test."""
60 
61  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
62  if "maxEvents" not in extra_args:
63  extra_args += " --maxEvents 20"
64 
65  if "jobNumber" not in extra_args and run is WorkflowRun.Run3 and type is WorkflowType.FullSim:
66  extra_args += " --jobNumber 5"
67 
68  input_argument = ""
69  if "inputEVNTFile" not in extra_args and "inputHITSFile" not in extra_args:
70  if type is WorkflowType.HitsFilter:
71  input_argument = f"--inputHITSFile {input_HITS_unfiltered[run]}"
72  elif type is WorkflowType.HitsMerge:
73  input_argument = f"--inputHITSFile {input_HITS[run]}"
74  else:
75  input_argument = f"--inputEVNTFile {input_EVNT[run]}"
76 
77  threads = 0
78  threads_argument = '--multithreaded'
79  if setup.custom_threads is not None:
80  threads = setup.custom_threads
81  if threads <= 0:
82  threads_argument = ''
83 
84  if type is WorkflowType.HitsMerge:
85  self.command = \
86  (f"ATHENA_CORE_NUMBER={threads} HITSMerge_tf.py {threads_argument} --AMIConfig {ID}"
87  f" {input_argument} --outputHITS_MRGFile myHITS.pool.root"
88  f" --imf False {extra_args}")
89  elif type is WorkflowType.HitsFilter:
90  self.command = \
91  (f"ATHENA_CORE_NUMBER={threads} FilterHit_tf.py {threads_argument} --AMIConfig {ID}"
92  f" {input_argument} --outputHITS_FILTFile myHITS.pool.root"
93  f" --imf False {extra_args}")
94  else:
95  self.command = \
96  (f"ATHENA_CORE_NUMBER={threads} Sim_tf.py {threads_argument} --AMIConfig {ID}"
97  f" {input_argument} --outputHITSFile myHITS.pool.root"
98  f" --imf False {extra_args}")
99 
100  self.output_checks = [
101  FrozenTier0PolicyCheck(setup, "HITS", 10),
102  MetadataCheck(setup, "HITS"),
103  ]
104 
105  super().__init__(ID, run, type, steps, setup)
106 
107 
109  """MC overlay workflow test."""
110 
111  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
112  if "maxEvents" not in extra_args:
113  extra_args += " --maxEvents 10"
114 
115  self.command = \
116  (f"Overlay_tf.py --AMIConfig {ID}"
117  f" --inputHITSFile {input_HITS[run]} --inputRDO_BKGFile {input_RDO_BKG[run]} --outputRDOFile myRDO.pool.root"
118  f" --imf False {extra_args}")
119 
120  # skip performance checks for now
122 
123  self.output_checks = [
124  FrozenTier0PolicyCheck(setup, "RDO", 10),
125  MetadataCheck(setup, "RDO"),
126  ]
127 
128  super().__init__(ID, run, type, steps, setup)
129 
130 
132  """Data overlay workflow test."""
133 
134  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
135  if "maxEvents" not in extra_args:
136  extra_args += " --maxEvents 10"
137 
138  self.command = \
139  (f"Overlay_tf.py --AMIConfig {ID}"
140  f" --inputHITSFile {input_HITS_data_overlay[run]} --inputBS_SKIMFile {input_BS_SKIM[run]} --outputRDOFile myRDO.pool.root"
141  " --triggerConfig 'Overlay=NONE'" # disable trigger for now
142  f" --imf False {extra_args}")
143 
144  self.output_checks = [
145  FrozenTier0PolicyCheck(setup, "RDO", 10),
146  MetadataCheck(setup, "RDO"),
147  ]
148 
149  super().__init__(ID, run, type, steps, setup)
150 
151 
153  """Digitization with pile-up workflow test."""
154 
155  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
156  if "maxEvents" not in extra_args:
157  extra_args += " --maxEvents 5"
158 
159  if "StandardInTimeOnlyTruth" in extra_args:
160  input_high = input_HITS_minbias_high_fulltruth[run]
161  input_low = input_HITS_minbias_low_fulltruth[run]
162  else:
163  input_high = input_HITS_minbias_high[run]
164  input_low = input_HITS_minbias_low[run]
165 
166  self.command = \
167  (f"Digi_tf.py --AMIConfig {ID} --jobNumber 1 --digiSeedOffset1 1 --digiSeedOffset2 1"
168  f" --inputHITSFile {input_HITS_neutrino[run]} --inputHighPtMinbiasHitsFile {input_high} --inputLowPtMinbiasHitsFile {input_low} --outputRDOFile myRDO.pool.root"
169  f" --imf False {extra_args}")
170 
171  self.output_checks = [
172  FrozenTier0PolicyCheck(setup, "RDO", 5),
173  MetadataCheck(setup, "RDO"),
174  ]
175 
176  super().__init__(ID, run, type, steps, setup)
177 
178 
180  """Data overlay minimum bias preprocessing test."""
181 
182  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
183  if "maxEvents" not in extra_args:
184  extra_args += " --maxEvents 5"
185 
186  self.command = \
187  (f"Overlay_tf.py --AMIConfig {ID}"
188  f" --inputBSFile {input_BS_minimum_bias_overlay[run]} --outputRDO_BKGFile myRDO_BKG.pool.root"
189  f" --imf False {extra_args}")
190 
191  # TODO: enable once the output stabilises
192  # self.output_checks = [
193  # FrozenTier0PolicyCheck(setup, "RDO_BKG", 5),
194  # MetadataCheck(setup, "RDO_BKG"),
195  # ]
196 
197  super().__init__(ID, run, type, steps, setup)
198 
199 
201  """Derivations test."""
202 
203  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
204  test_def = ID.split("_")
205  data_type = test_def[0].lower()
206  formats = [format.upper() for format in test_def[1:-1]]
207 
208  threads = 0
209  if setup.custom_threads is not None:
210  threads = setup.custom_threads
211 
212  if "maxEvents" not in extra_args:
213  base_events = 100
214  events = threads * base_events + 1
215  flush = 80
216 
217  extra_args += f" --maxEvents {events}"
218  format_flush = ", ".join([f"\"DAOD_{format}\": {flush}" for format in formats])
219  extra_args += f" --preExec 'flags.Output.TreeAutoFlush={{{format_flush}}}'"
220  if "inputAODFile" not in extra_args:
221  extra_args += f" --inputAODFile {input_AOD[run][data_type]}"
222 
223  # could also use p5503
224  self.command = \
225  (f"ATHENA_CORE_NUMBER={threads} Derivation_tf.py"
226  f" --formats {' '.join(formats)}"
227  " --multiprocess --multithreadedFileValidation True"
228  " --athenaMPMergeTargetSize 'DAOD_*:0'"
229  " --sharedWriter True"
230  " --outputDAODFile myOutput.pool.root"
231  f" --imf False {extra_args}")
232 
233  # skip performance checks for now
235 
236  self.output_checks = []
237  for format in formats:
238  self.output_checks.append(FrozenTier0PolicyCheck(setup, f"DAOD_{format}", 10))
239  self.output_checks.append(MetadataCheck(setup, f"DAOD_{format}"))
240 
241  super().__init__(ID, run, type, steps, setup)
242 
243 
245  """Generation test."""
246 
247  def __init__(self, ID: str, run: WorkflowRun, type: WorkflowType, steps: List[str], setup: TestSetup, extra_args: str = "") -> None:
248  if "maxEvents" not in extra_args:
249  extra_args += " --maxEvents 10"
250 
251  if "ecmEnergy" not in extra_args:
252  if run is WorkflowRun.Run2:
253  extra_args += " --ecmEnergy 13000"
254  elif run is WorkflowRun.Run3:
255  extra_args += " --ecmEnergy 13600"
256  else:
257  extra_args += " --ecmEnergy 14000"
258 
259  dsid = ID.replace("gen", "")
260 
261  self.command = \
262  (f"Gen_tf.py --jobConfig {dsid}"
263  " --outputEVNTFile myEVNT.pool.root"
264  f" --imf False {extra_args}")
265 
266  super().__init__(ID, run, type, steps, setup)
python.StandardTests.OverlayTest.skip_performance_checks
skip_performance_checks
Definition: StandardTests.py:121
python.StandardTests.SimulationTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:61
python.StandardTests.SimulationTest.command
command
Definition: StandardTests.py:85
python.StandardTests.DerivationTest.command
command
Definition: StandardTests.py:224
python.StandardTests.PileUpTest
Definition: StandardTests.py:152
python.StandardTests.PileUpTest.output_checks
output_checks
Definition: StandardTests.py:171
python.StandardTests.GenerationTest
Definition: StandardTests.py:244
python.StandardTests.DerivationTest.skip_performance_checks
skip_performance_checks
Definition: StandardTests.py:234
dumpHVPathFromNtuple.append
bool append
Definition: dumpHVPathFromNtuple.py:91
python.StandardTests.DataOverlayPreparationTest
Definition: StandardTests.py:179
python.StandardTests.DataOverlayPreparationTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:182
python.StandardTests.OverlayTest
Definition: StandardTests.py:108
python.StandardTests.QTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:18
python.StandardTests.DataOverlayTest
Definition: StandardTests.py:131
python.Checks.MetadataCheck
Definition: Checks.py:236
python.StandardTests.OverlayTest.command
command
Definition: StandardTests.py:115
python.StandardTests.PileUpTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:155
python.StandardTests.DataOverlayTest.output_checks
output_checks
Definition: StandardTests.py:144
python.Checks.AODDigestCheck
Definition: Checks.py:376
python.StandardTests.GenerationTest.command
command
Definition: StandardTests.py:261
python.Checks.FrozenTier0PolicyCheck
Definition: Checks.py:105
python.StandardTests.DerivationTest.output_checks
output_checks
Definition: StandardTests.py:236
python.StandardTests.DataOverlayTest.command
command
Definition: StandardTests.py:138
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
python.StandardTests.SimulationTest.output_checks
output_checks
Definition: StandardTests.py:100
python.StandardTests.QTest
Definition: StandardTests.py:15
python.Test.WorkflowTest
Definition: Tools/WorkflowTestRunner/python/Test.py:129
python.StandardTests.DerivationTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:203
python.StandardTests.QTest.digest_checks
digest_checks
Definition: StandardTests.py:50
python.StandardTests.GenerationTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:247
python.StandardTests.DerivationTest
Definition: StandardTests.py:200
python.StandardTests.DataOverlayPreparationTest.command
command
Definition: StandardTests.py:186
python.StandardTests.PileUpTest.command
command
Definition: StandardTests.py:166
python.StandardTests.QTest.command
command
Definition: StandardTests.py:38
python.Checks.AODContentCheck
Definition: Checks.py:303
python.StandardTests.DataOverlayTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:134
python.StandardTests.OverlayTest.output_checks
output_checks
Definition: StandardTests.py:123
python.StandardTests.QTest.output_checks
output_checks
Definition: StandardTests.py:42
python.StandardTests.SimulationTest
Definition: StandardTests.py:58
python.StandardTests.OverlayTest.__init__
None __init__(self, str ID, WorkflowRun run, WorkflowType type, List[str] steps, TestSetup setup, str extra_args="")
Definition: StandardTests.py:111