Belle II Software  light-2212-foldex
test_b2info-luminosity.py
1 
8 
9 '''
10 Test if b2info-luminosity works.
11 Note that the RunDB token must be passed to the test as environment variable (BELLE2_RUNDB_TOKEN).
12 '''
13 
14 
15 import os
16 import subprocess
17 
18 import b2test_utils as b2tu
19 
20 
21 if __name__ == '__main__':
22 
23  rundb_token = os.getenv('BELLE2_RUNDB_TOKEN', '')
24  if rundb_token == '':
25  b2tu.skip_test('The BELLE2_RUNDB_TOKEN environment variable is not set')
26 
27  with b2tu.clean_working_directory():
28 
29  # Check few configurations
30  # Please note: --what offline cannot be properly tested (it works only at KEKCC)
31 
32  subprocess.check_call(
33  ['b2info-luminosity', '--exp', '18', '--runs', '100,200-300,600-650', '--what',
34  'online', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
35  )
36 
37  subprocess.check_call(
38  ['b2info-luminosity', '--exp', '18', '--runs', '100,200-300,600-650', '--what',
39  'online', '--verbose', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
40  )
41 
42  subprocess.check_call(
43  ['b2info-luminosity', '--exp', '18', '--runs', '200-300', '--what', 'online',
44  '--good', '--beam-energy', '4S', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
45  )
46 
47  subprocess.check_call(
48  ['b2info-luminosity', '--exp', '18', '--runs', '100,600-650', '--what', 'online',
49  '--beam-energy', '4S_offres', '--token', os.environ['BELLE2_RUNDB_TOKEN']]
50  )