Belle II Software  release-05-01-25
roemodules_clone.py
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 """
5 A clone of the test of the ROE-related module tests using a larger test file (mdst12.root)
6 this is not present on the bamboo server so this test only runs on buildbot or
7 wherever the validation-data are visible (it's also a bit slower).
8 """
9 
10 import b2test_utils
11 from basf2 import set_random_seed, create_path, process
12 
13 inputFile = b2test_utils.require_file('mdst12.root', 'validation')
14 # make logging more reproducible by replacing some strings
16 set_random_seed("1337")
17 fsps = ['K-', 'pi-', 'gamma', 'K_L0']
18 
19 
21 testpath = create_path()
22 testpath.add_module('RootInput', inputFileNames=inputFile)
23 for fsp in fsps:
24  testpath.add_module('ParticleLoader', decayStringsWithCuts=[(fsp, '')])
25 testpath.add_module('ParticleStats', particleLists=[fsps[0]])
26 
27 testpath.add_module('RestOfEventBuilder', particleList=fsps[0],
28  particleListsInput=['pi+', 'gamma', 'K_L0'])
29 mask = ('cleanMask', 'E > 0.05', 'E > 0.05')
30 testpath.add_module('RestOfEventInterpreter', particleList=fsps[0],
31  ROEMasks=mask)
32 
33 
34 roe_path = create_path()
35 v0list = 'K_S0 -> pi+ pi-'
36 roe_path.add_module('ParticleLoader', decayStringsWithCuts=[(v0list, '')])
37 
38 roe_path.add_module('ParticleLoader', decayStringsWithCuts=[('mu+:roe',
39  'isInRestOfEvent == 1 and isSignal == 1')])
40 
41 roe_path.add_module('RestOfEventUpdater',
42  particleList=v0list.split(' ->', 1)[0],
43  updateMasks=[mask[0]])
44 roe_path.add_module('RestOfEventPrinter',
45  maskNames=[mask[0]],
46  fullPrint=False)
47 
48 jpsi_roe_list = 'J/psi:roe'
49 roe_path.add_module('ParticleCombiner',
50  decayString=jpsi_roe_list+' -> mu+:roe mu-:roe',
51  cut='')
52 roe_path.add_module('ParticlePrinter', listName=jpsi_roe_list, fullPrint=False)
53 
54 roe_path.add_module('RestOfEventBuilder', particleList=jpsi_roe_list,
55  createNestedROE=True, nestedROEMask=mask[0])
56 
57 # --------------------------------------------------------------------------- #
58 nested_roe_path = create_path()
59 
60 nested_roe_path.add_module('RestOfEventPrinter',
61  fullPrint=False)
62 
63 roe_path.for_each('RestOfEvent', 'NestedRestOfEvents', path=nested_roe_path)
64 # --------------------------------------------------------------------------- #
65 
66 nested_list = 'B+:other'
67 roe_path.add_module('ParticleLoader',
68  decayStringsWithCuts=[(nested_list+' -> '+jpsi_roe_list, '')],
69  useROEs=True)
70 
71 roe_path.add_module('ParticleStats', particleLists=[nested_list])
72 roe_path.add_module('ParticlePrinter', listName=nested_list, fullPrint=True)
73 
74 testpath.for_each('RestOfEvent', 'RestOfEvents', path=roe_path)
75 
76 
77 process(testpath, 5)
b2test_utils.configure_logging_for_tests
def configure_logging_for_tests(user_replacements=None)
Definition: __init__.py:99
b2test_utils.require_file
def require_file(filename, data_type="", py_case=None)
Definition: __init__.py:47