Belle II Software  release-06-02-00
ExecuteStandaloneReco.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 """
13 Test to ensure the reconstruction can be run standalone without load evtgen/simulation
14 performed before in the same process.
15 """
16 
17 import os
18 import tempfile
19 import basf2
20 
21 evtgen_steering = basf2.find_file('reconstruction/tests/evtgen.py_noexec')
22 reco_steering = basf2.find_file('reconstruction/tests/reco.py_noexec')
23 
24 # create and move to temporary directory
25 with tempfile.TemporaryDirectory() as tempdir:
26  print("Moving to temporary directory " + str(tempdir))
27  os.chdir(tempdir)
28 
29  # run generator & simulation
30  assert(0 == os.system("basf2 " + evtgen_steering))
31  # run reconstruction only
32  assert(0 == os.system("basf2 " + reco_steering))
33  # Check if there are 10 events in the file
34  assert(0 == os.system("b2file-check -n10 evtgen_bbar.root"))