Belle II Software  release-06-01-15
particleloader_reserved.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 
11 
12 '''
13 Forbid users from filling an 'all' list with cuts. This has dangerous
14 potential to conflict with the standard lists and any standard tools.
15 '''
16 
17 import b2test_utils
18 from basf2 import create_path, set_random_seed
19 
20 # make logging more reproducible by replacing some strings
22 set_random_seed('1337')
23 testinput = [b2test_utils.require_file('analysis/tests/mdst.root')]
24 
25 # the name 'all' is reserved for the ParticleLoader
26 goodpath = create_path()
27 goodpath.add_module('RootInput', inputFileNames=testinput)
28 goodpath.add_module('ParticleLoader', decayStrings=['e+:all']) # legal
29 b2test_utils.safe_process(goodpath, 1)
30 
31 # it should throw b2fatal if there are cuts
32 badpath = create_path()
33 badpath.add_module('RootInput', inputFileNames=testinput)
34 badpath.add_module('ParticleLoader', decayStrings=['e+'])
35 badpath.add_module('ParticleListManipulator', outputListName='e+:my_electrons', inputListNames=['e+:all']) # legal
36 badpath.add_module('ParticleListManipulator', outputListName='e+:all', inputListNames=['e+:my_electrons']) # illlegal
37 
38 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:233