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