Belle II Software development
test_standalone_reco_exp0.py
1
8
9import os
10import pathlib
11import subprocess
12
13import basf2 as b2
14import b2test_utils as b2tu
15
16
17if __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. 0
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_bbbar_exp0.root'))
29 output_file = 'output_exp0.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 )