Belle II Software  release-05-01-25
assert_parallel_certificate_on_hlt.py
1 # Test for the parallel certified flag in all modules in the default, hlt and expressreco
2 # reconstruction chains.
3 # It creates a path and fills it with all reconstruction modules, without anything else
4 # (this path can never be executed, but we do not want that anyway).
5 # Then it goes through all modules and checks it flag.
6 #
7 #
8 # Author: Nils Braun
9 import basf2
10 import reconstruction
11 from softwaretrigger.processing import add_hlt_processing, add_expressreco_processing
12 
13 from softwaretrigger.constants import SoftwareTriggerModes, RunTypes
14 
15 
16 def test_path(path):
17  # Assert that all modules have a parallel processing certified flag.
18  modules = path.modules()
19  for m in modules:
20  if m.name() == "HistoManager":
21  continue
22  assert m.has_properties(basf2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED), \
23  f'{m} is missing c_ParallelProcessingCertified flag!'
24 
25  for sub_path in m.get_all_condition_paths():
26  test_path(sub_path)
27 
28 
29 if __name__ == "__main__":
30 
31  # Add only the reconstruction
32  path = basf2.create_path()
34  test_path(path)
35 
36  # Add various modes of HLT
37  for trigger in SoftwareTriggerModes:
38  path = basf2.create_path()
39  path.add_module("HistoManager")
40  add_hlt_processing(path, run_type=RunTypes.beam, softwaretrigger_mode=trigger)
41  test_path(path)
42 
43  path = basf2.create_path()
44  path.add_module("HistoManager")
45  add_hlt_processing(path, run_type=RunTypes.cosmic, softwaretrigger_mode=SoftwareTriggerModes.monitor,
46  data_taking_period="phase3")
47  test_path(path)
48 
49  # Add various modes of express reco
50  for do_reconstruction in [True, False]:
51  path = basf2.create_path()
52  path.add_module("HistoManager")
53  add_expressreco_processing(path, run_type=RunTypes.beam, do_reconstruction=do_reconstruction)
54  test_path(path)
55 
56  for do_reconstruction in [True, False]:
57  path = basf2.create_path()
58  path.add_module("HistoManager")
59  add_expressreco_processing(path, run_type=RunTypes.cosmic, do_reconstruction=do_reconstruction,
60  data_taking_period="phase3")
61  test_path(path)
softwaretrigger.constants
Definition: constants.py:1
reconstruction.add_reconstruction
def add_reconstruction(path, components=None, pruneTracks=True, add_trigger_calculation=True, skipGeometryAdding=False, trackFitHypotheses=None, addClusterExpertModules=True, use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=None, nCDCHitsMax=6000, nSVDShaperDigitsMax=70000, event_abort=default_event_abort, use_random_numbers_for_hlt_prescale=True)
Definition: reconstruction.py:41
softwaretrigger.processing
Definition: processing.py:1