Belle II Software  release-05-01-25
particleloader_reserved.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 '''
5 Forbid users from filling an 'all' list with cuts. This has dangerous
6 potential to conflict with the standard lists and any standard tools.
7 '''
8 
9 import b2test_utils
10 from basf2 import set_random_seed, create_path, process
11 
12 # make logging more reproducible by replacing some strings
14 set_random_seed('1337')
15 testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
16 
17 # the name 'all' is reserved, but it should still work as long as it really is all
18 goodpath = create_path()
19 goodpath.add_module('RootInput', inputFileNames=testinput)
20 goodpath.add_module('ParticleLoader', decayStringsWithCuts=[('e+:all', '')]) # legal
21 b2test_utils.safe_process(goodpath, 1)
22 
23 # it should throw b2fatal if there are cuts
24 badpath = create_path()
25 badpath.add_module('RootInput', inputFileNames=testinput)
26 badpath.add_module('ParticleLoader', decayStringsWithCuts=[('e+:all', 'p > 3')]) # illegal
27 b2test_utils.safe_process(badpath, 1)
b2test_utils.configure_logging_for_tests
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:99
b2test_utils.safe_process
def safe_process(*args, **kwargs)
Definition: __init__.py:224
b2test_utils.require_file
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:47