Belle II Software  release-05-01-25
ExecuteStandaloneReco.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 Test to ensure the reconstruction can be run standalone without load evtgen/simulation
6 performed before in the same process.
7 """
8 
9 import os
10 import tempfile
11 import shutil
12 from ROOT import Belle2
13 
14 evtgen_steering = Belle2.FileSystem.findFile('reconstruction/tests/evtgen.py_noexec')
15 reco_steering = Belle2.FileSystem.findFile('reconstruction/tests/reco.py_noexec')
16 
17 # create and move to temporary directory
18 with tempfile.TemporaryDirectory() as tempdir:
19  print("Moving to temporary directory " + str(tempdir))
20  os.chdir(tempdir)
21 
22  # run generator & simulation
23  assert(0 == os.system("basf2 " + evtgen_steering))
24  # run reconstruction only
25  assert(0 == os.system("basf2 " + reco_steering))
26  # Check if there are 10 events in the file
27  assert(0 == os.system("b2file-check -n10 evtgen_bbar.root"))
Belle2::FileSystem::findFile
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
Definition: FileSystem.cc:147