Belle II Software  release-05-01-25
klm_tools.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 Test the klm tools.
6 """
7 
8 import os
9 import glob
10 
11 import basf2 as b2
12 import b2test_utils as b2u
13 import validation_gt as vgt
14 
15 if __name__ == "__main__":
16 
17  # Test b2klm-create-dqm (it also tests b2klm-mask-dqm and b2klm-execute-masking)
18  if 'BELLE2_VALIDATION_DATA_DIR' not in os.environ:
19  b2.B2INFO('Skipping the b2klm-create-dqm test.')
20  else:
21  globaltags = ' '.join(vgt.get_validation_globaltags())
22  for input_file in glob.glob(os.environ['BELLE2_VALIDATION_DATA_DIR'] + '/rawdata/*HLT?.*.root'):
23  with b2u.clean_working_directory() as test_klm_tools:
24  command = f'b2klm-create-dqm -i {input_file} -n 100 --prepend_gt {globaltags}'
25  assert(0 == os.system(command))
26 
27  # Test b2klm-numberToIndex
28  command = 'b2klm-numberToIndex 20 50020'
29  assert(0 == os.system(command))
30 
31  # Test b2klm-indexToNumber
32  command = 'b2klm-indexToNumber 11489 21997'
33  assert(0 == os.system(command))