Belle II Software development
assert_parallel_certificate_on_hlt.py
1
8
9# Test for the parallel certified flag in all modules in the default, hlt and expressreco
10# reconstruction chains.
11# It creates a path and fills it with all reconstruction modules, without anything else
12# (this path can never be executed, but we do not want that anyway).
13# Then it goes through all modules and checks it flag.
14
15import basf2
16import reconstruction
17from softwaretrigger.processing import add_hlt_processing, add_expressreco_processing
18
19from softwaretrigger.constants import SoftwareTriggerModes, RunTypes
20
21
22def test_path(path):
23 # Assert that all modules have a parallel processing certified flag.
24 modules = path.modules()
25 for m in modules:
26 if m.name() == "HistoManager":
27 continue
28 assert m.has_properties(basf2.ModulePropFlags.PARALLELPROCESSINGCERTIFIED), \
29 f'{m} is missing c_ParallelProcessingCertified flag!'
30
31 for sub_path in m.get_all_condition_paths():
32 test_path(sub_path)
33
34
35if __name__ == "__main__":
36
37 # Add only the reconstruction
38 path = basf2.create_path()
40 test_path(path)
41
42 # Add various modes of HLT
43 for trigger in SoftwareTriggerModes:
44 path = basf2.create_path()
45 path.add_module("HistoManager")
46 add_hlt_processing(path, run_type=RunTypes.beam, softwaretrigger_mode=trigger)
47 test_path(path)
48
49 path = basf2.create_path()
50 path.add_module("HistoManager")
51 add_hlt_processing(path, run_type=RunTypes.cosmic, softwaretrigger_mode=SoftwareTriggerModes.monitor)
52
53 test_path(path)
54
55 # Add various modes of express reco
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.beam, do_reconstruction=do_reconstruction)
60 test_path(path)
61
62 for do_reconstruction in [True, False]:
63 path = basf2.create_path()
64 path.add_module("HistoManager")
65 add_expressreco_processing(path, run_type=RunTypes.cosmic, do_reconstruction=do_reconstruction)
66 test_path(path)
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, event_abort=default_event_abort, use_random_numbers_for_hlt_prescale=True, pxd_filtering_offline=False, create_intercepts_for_pxd_ckf=False, append_full_grid_cdc_eventt0=True, legacy_ecl_charged_pid=False, emulate_HLT=False, skip_full_grid_cdc_eventt0_if_svd_time_present=True)