Belle II Software light-2406-ragdoll
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 rundb_token = os.getenv('BELLE2_RUNDB_TOKEN', '')
25 if rundb_token == '':
26 b2tu.skip_test('The BELLE2_RUNDB_TOKEN environment variable is not set')
27
28 with b2tu.clean_working_directory():
29
30 # Check few configurations
31 # Please note: --what offline cannot be properly tested (it works only at KEKCC)
32
33 subprocess.check_call(
34 ['b2info-luminosity', '--exp', '18', '--runs', '100,200-300,600-650', '--what',
35 'online', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
36 )
37
38 subprocess.check_call(
39 ['b2info-luminosity', '--exp', '18', '--runs', '100,200-300,600-650', '--what',
40 'online', '--verbose', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
41 )
42
43 subprocess.check_call(
44 ['b2info-luminosity', '--exp', '18', '--runs', '200-300', '--what', 'online',
45 '--good', '--beam-energy', '4S', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
46 )
47
48 subprocess.check_call(
49 ['b2info-luminosity', '--exp', '18', '--runs', '100,600-650', '--what', 'online',
50 '--beam-energy', '4S_offres', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
51 )
52
53 subprocess.check_call(
54 ['b2info-luminosity', '--exp', '12,14', '--what', 'offline',
55 '--dboffline', f'{lumiDB_path}/test_OffLineLuminosityProc.db', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
56 )
57
58 subprocess.check_call(
59 ['b2info-luminosity', '--exp', '12,14', '--what', 'offline', '--proc', 'proc12',
60 '--dboffline', f'{lumiDB_path}/test_OffLineLuminosityProc.db', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
61 )