Belle II Software development
test_hlt_tools.py
1
8
9'''
10Test for checking if the main tools of the hlt package works.
11'''
12
13import glob
14import subprocess
15
16import basf2 as b2
17import b2test_utils as b2tu
18
19if __name__ == '__main__':
20 with b2tu.clean_working_directory():
21
22 # Check if b2hlt_print_result.py works.
23 mdst_files = glob.glob(f'{b2.find_file("mdst/tests")}/mdst-v*.root')
24 mdst_files.sort(reverse=True)
25 subprocess.check_call(['b2hlt_print_result.py', mdst_files[0]])
26
27 # Check if b2hlt_triggers works.
28 # 1: b2hlt_triggers print
29 subprocess.check_call(['b2hlt_triggers', 'print', '--database', 'online'])
30 # 2: b2hlt_triggers download
31 subprocess.check_call(['b2hlt_triggers', 'download', '--database', 'online'])
32 # 3: b2hlt_triggers add_cut
33 subprocess.check_call(['b2hlt_triggers', 'add_cut', 'filter', 'accept_goats', '[nTrkLoose > 0]', '10', 'False'])
34 # 4: b2hlt_triggers remove_cut
35 subprocess.check_call(['b2hlt_triggers', 'remove_cut', 'skim', 'accept_bhabha'])