Belle II Software  release-05-01-25
reco_cdst.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import os
5 import sys
6 import glob
7 import subprocess
8 import basf2 as b2
9 import b2test_utils as b2u
10 import ROOT.Belle2 as B2
11 
12 if 'BELLE2_VALIDATION_DATA_DIR' not in os.environ:
13  b2u.skip_test("BELLE2_VALIDATION_DATA_DIR environment variable not set.")
14 
15 steering_file = B2.FileSystem.findFile('reconstruction/tests/reco_cdst.py_noexec')
16 
17 for rawdata_file in glob.glob(os.environ['BELLE2_VALIDATION_DATA_DIR'] + '/rawdata/*HLT?.*.root'):
18  b2.B2INFO(f'Running the test using {rawdata_file} as input file.')
19  if 'cosmic' in os.path.basename(rawdata_file):
20  assert(0 == subprocess.check_call(['basf2', steering_file, rawdata_file, 'cosmic']))
21  elif 'physics' in os.path.basename(rawdata_file):
22  assert(0 == subprocess.check_call(['basf2', steering_file, rawdata_file, 'physics']))
23  else:
24  b2.B2INFO('Not a "cosmic" neither a "physics" run, skipping it.')