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