Belle II Software  release-08-01-10
particleloader_reserved.py
1 #!/usr/bin/env python3
2 
3 
10 
11 '''
12 Forbid users from filling an 'all' list with cuts. This has dangerous
13 potential to conflict with the standard lists and any standard tools.
14 '''
15 
16 import b2test_utils
17 from basf2 import create_path, set_random_seed
18 
19 # make logging more reproducible by replacing some strings
21 set_random_seed('1337')
22 testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
23 
24 # the name 'all' is reserved for the ParticleLoader
25 goodpath = create_path()
26 goodpath.add_module('RootInput', inputFileNames=testinput)
27 goodpath.add_module('ParticleLoader', decayStrings=['e+:all']) # legal
28 b2test_utils.safe_process(goodpath, 1)
29 
30 # it should throw b2fatal if there are cuts
31 badpath = create_path()
32 badpath.add_module('RootInput', inputFileNames=testinput)
33 badpath.add_module('ParticleLoader', decayStrings=['e+'])
34 badpath.add_module('ParticleListManipulator', outputListName='e+:my_electrons', inputListNames=['e+:all']) # legal
35 badpath.add_module('ParticleListManipulator', outputListName='e+:all', inputListNames=['e+:my_electrons']) # illlegal
36 
37 b2test_utils.safe_process(badpath, 1)
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:106
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54
def safe_process(*args, **kwargs)
Definition: __init__.py:236