Belle II Software release-09-00-14
test_b2info-luminosity.py
1
8
9'''
10Test if b2info-luminosity works.
11Note that the RunDB token must be passed to the test as environment variable (BELLE2_RUNDB_TOKEN).
12'''
13
14
15import os
16import subprocess
17
18import b2test_utils as b2tu
19
20lumiDB_path = b2tu.require_file('luminosity/', 'validation')
21
22if __name__ == '__main__':
23
24 if b2tu.is_rundb_down():
25 b2tu.skip_test('Test currently disabled due to RunDB troubles')
26
27 rundb_token = os.getenv('BELLE2_RUNDB_TOKEN', '')
28 if rundb_token == '':
29 b2tu.skip_test('The BELLE2_RUNDB_TOKEN environment variable is not set')
30
31 with b2tu.clean_working_directory():
32
33 # Check few configurations
34 # Please note: --what offline cannot be properly tested (it works only at KEKCC)
35
36 subprocess.check_call(
37 ['b2info-luminosity', '--exp', '18', '--runs', '100,200-300,600-650', '--what',
38 'online', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
39 )
40
41 subprocess.check_call(
42 ['b2info-luminosity', '--exp', '18', '--runs', '100,200-300,600-650', '--what',
43 'online', '--verbose', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
44 )
45
46 subprocess.check_call(
47 ['b2info-luminosity', '--exp', '18', '--runs', '200-300', '--what', 'online',
48 '--good', '--beam-energy', '4S', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
49 )
50
51 subprocess.check_call(
52 ['b2info-luminosity', '--exp', '18', '--runs', '100,600-650', '--what', 'online',
53 '--beam-energy', '4S_offres', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
54 )
55
56 subprocess.check_call(
57 ['b2info-luminosity', '--exp', '12,14', '--what', 'offline',
58 '--dboffline', f'{lumiDB_path}/test_OffLineLuminosityProc.db', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
59 )
60
61 subprocess.check_call(
62 ['b2info-luminosity', '--exp', '12,14', '--what', 'offline', '--proc', 'proc12',
63 '--dboffline', f'{lumiDB_path}/test_OffLineLuminosityProc.db', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
64 )