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