Belle II Software  release-08-01-10
test_standalone_reco_no_mc_exp1003.py
1 
8 
9 import os
10 import pathlib
11 import subprocess
12 
13 import basf2 as b2
14 import b2test_utils as b2tu
15 
16 
17 if __name__ == "__main__":
18 
19  prepare_path = os.getenv("BELLE2_PREPARE_PATH", "")
20  if prepare_path == "":
21  parent_path = pathlib.Path(b2.find_file('framework')).parent.absolute()
22  prepare_path = os.path.join(parent_path, "prepare_tests")
23  # Let's throw an error if prepare_path is not found
24  b2.find_file(prepare_path)
25 
26  # Reconstruct few events for exp. 1003
27  steering = b2.find_file(os.path.join('reconstruction', 'tests', 'reco.py_noexec'))
28  input_file = b2.find_file(os.path.join(prepare_path, 'test_standalone_reco_no_mc_bbbar_exp1003.root'))
29  output_file = 'output_no_mc_exp1003.root'
30 
31  with b2tu.clean_working_directory():
32  subprocess.check_call(
33  ['basf2', steering, '-i', input_file, '-o', output_file]
34  )
35  subprocess.check_call(
36  ['b2file-check', '-n', '3', output_file]
37  )