Belle II Software development
roemodules.py
1#!/usr/bin/env python3
2
3
10
11"""
12A test of the ROE-related module tests using a large test file
13(mdst16.root from the validation server)
14"""
15
16import b2test_utils
17from basf2 import set_random_seed, create_path, process
18
19inputFile = b2test_utils.require_file('mdst16.root', 'validation')
20# make logging more reproducible by replacing some strings
22set_random_seed("1337")
23fsps = ['K-:all', 'pi-:all', 'gamma:all', 'K_L0:all']
24
25
27testpath = create_path()
28testpath.add_module('RootInput', inputFileNames=inputFile)
29for fsp in fsps:
30 testpath.add_module('ParticleLoader', decayStrings=[fsp])
31testpath.add_module('ParticleSelector', decayString='gamma:all', cut='isFromECL')
32testpath.add_module('ParticleStats', particleLists=[fsps[0]])
33
34testpath.add_module('RestOfEventBuilder', particleList=fsps[0],
35 particleListsInput=['pi+:all', 'gamma:all', 'K_L0:all'])
36mask = ('cleanMask', 'E > 0.05', 'E > 0.05', '')
37testpath.add_module('RestOfEventInterpreter', particleList=fsps[0],
38 ROEMasks=mask)
39
40
41roe_path = create_path()
42v0list = 'K_S0:V0 -> pi+ pi-'
43roe_path.add_module('ParticleLoader', decayStrings=[v0list])
44
45roe_path.add_module('ParticleLoader', decayStrings=['mu+'])
46roe_path.add_module('ParticleListManipulator', outputListName='mu+:roe',
47 inputListNames=['mu+:all'],
48 cut='isInRestOfEvent == 1 and isSignal == 1')
49
50roe_path.add_module('RestOfEventUpdater',
51 particleList=v0list.split(' ->', 1)[0],
52 updateMasks=[mask[0]])
53roe_path.add_module('RestOfEventPrinter',
54 maskNames=[mask[0]],
55 fullPrint=False)
56
57jpsi_roe_list = 'J/psi:roe'
58roe_path.add_module('ParticleCombiner',
59 decayString=jpsi_roe_list + ' -> mu+:roe mu-:roe',
60 cut='')
61roe_path.add_module('ParticlePrinter', listName=jpsi_roe_list, fullPrint=False)
62
63roe_path.add_module('RestOfEventBuilder', particleList=jpsi_roe_list,
64 createNestedROE=True, nestedROEMask=mask[0])
65
66# --------------------------------------------------------------------------- #
67nested_roe_path = create_path()
68
69nested_roe_path.add_module('RestOfEventPrinter',
70 fullPrint=False)
71
72roe_path.for_each('RestOfEvent', 'NestedRestOfEvents', path=nested_roe_path)
73# --------------------------------------------------------------------------- #
74
75nested_list = 'B+:other'
76roe_path.add_module('ParticleLoader',
77 decayStrings=[nested_list + ' -> ' + jpsi_roe_list],
78 useROEs=True)
79
80roe_path.add_module('ParticleStats', particleLists=[nested_list])
81roe_path.add_module('ParticlePrinter', listName=nested_list, fullPrint=True)
82
83testpath.for_each('RestOfEvent', 'RestOfEvents', path=roe_path)
84
85
86process(testpath, 15)
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:54
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:106