11from basf2
import set_random_seed, create_path, register_module, process, find_file
12from b2test_utils
import clean_working_directory, require_file, configure_logging_for_tests, is_ci, skip_test
13import modularAnalysis
as ma
18 skip_test(
"The test is too slow for running on our pipeline")
20configure_logging_for_tests()
21set_random_seed(
'pid_priors')
23with clean_working_directory():
27 inputfile = require_file(
'analysis/1000_B_DstD0Kpi_skimmed.root',
'validation')
28 ma.inputMdst(inputfile, path=main)
30 ma.fillParticleList(
'pi+',
'', path=main)
31 ma.matchMCTruth(
'pi+', path=main)
33 ntupler = register_module(
'VariablesToNtuple')
34 ntupler.param(
'fileName',
'pid_priors.root')
35 ntupler.param(
'variables', [
'cosTheta',
'p',
'mcPDG'])
36 ntupler.param(
'particleList',
'pi+')
37 main.add_module(ntupler)
41 assert 0 == subprocess.run([
'analysis-train-priors',
'-i',
'pid_priors.root',
'-k',
'ntuple',
'-o',
42 'pid_priors.pth',
'-p',
'211',
'321'], stdout=subprocess.DEVNULL).returncode
44 assert 0 == subprocess.run([
'basf2', find_file(
'analysis/tests/pid_priors.py_noexec')]).returncode