Belle II Software development
klm_tools.py
1#!/usr/bin/env python3
2
3
10
11"""
12Test the klm tools.
13"""
14
15import os
16import glob
17import subprocess as sp
18
19import basf2
20import b2test_utils as b2u
21import validation_gt as vgt
22
23if __name__ == '__main__':
24
25 # Test b2klm-create-dqm (it also tests b2klm-mask-dqm and b2klm-execute-masking)
26 if 'BELLE2_VALIDATION_DATA_DIR' not in os.environ:
27 # Silently skip the test, otherwise the test fails on the buildbot.
28 pass
29 else:
30 globaltags = ' '.join(vgt.get_validation_globaltags())
31 input_files = glob.glob(os.environ['BELLE2_VALIDATION_DATA_DIR'] + '/rawdata/*HLT?.*.root')
32 input_files.sort(reverse=True)
33 with b2u.clean_working_directory():
34 assert(0 == sp.call(['b2klm-create-dqm', '-i', f'{basf2.find_file(input_files[0])}', '-n', '100',
35 '--prepend_gt'] + vgt.get_validation_globaltags(), stdout=sp.DEVNULL))
36
37 # Test b2klm-numberToIndex
38 assert(0 == sp.call(['b2klm-numberToIndex', '20', '50020']))
39
40 # Test b2klm-indexToNumber
41 assert(0 == sp.call(['b2klm-indexToNumber', '11489', '21997']))