12 from basf2
import create_path
17 """Test case for standard V0 lists"""
21 std_function=stdV0s.stdKshorts,
24 "ParticleListManipulator",
31 "ParticleListManipulator"],
32 expected_lists=['V0_ToFit', 'V0_ToFit', 'all', 'RD', 'merged']):
33 """check that a given function works"""
34 testpath = create_path()
35 std_function(path=testpath)
39 for module
in testpath.modules():
40 loaded_modules.append(module.type())
41 for param
in module.available_params():
42 if module.type() ==
'ParticleLoader' and param.name ==
'decayStrings':
43 name = param.values[0].split(
':')[1].split(
' -> ')[0]
44 built_lists.append(name)
45 if module.type() ==
'ParticleListManipulator' and param.name ==
'outputListName':
46 name = str(param.values).split(
':')[1].split(
' -> ')[0]
47 built_lists.append(name)
48 if module.type() ==
'ParticleCombiner' and param.name ==
'decayString':
49 name = param.values.split(
':')[1].split(
' -> ')[0]
50 built_lists.append(name)
54 loaded_modules, expected_modules,
55 f
"Loaded modules do not match the expected ones (function {std_function.__name__})")
59 built_lists, expected_lists,
60 f
"Built particles lists do not match the expected ones (function {std_function.__name__})")
63 """check that the builder function works with the stdKshorts list"""
67 """check that the builder function works with the legacy Belle Kshorts list"""
68 expected_modules = [
"ParticleLoader",
69 "ParticleListManipulator",
71 "ParticleVertexFitter",
73 self.
_check_list_check_list(std_function=stdV0s.goodBelleKshort, expected_modules=expected_modules,
74 expected_lists=[
"legacyGoodKS",
"legacyGoodKS"])
77 """check that the builder function works with the stdLambdas list"""
78 expected_modules = [
"ParticleLoader",
79 "ParticleListManipulator",
82 "DuplicateVertexMarker",
89 "DuplicateVertexMarker",
91 "ParticleListManipulator"]
92 expected_lists = [
'V0_ToFit',
'V0_ToFit',
'all',
'all',
'RD',
'merged']
93 self.
_check_list_check_list(std_function=stdV0s.stdLambdas, expected_modules=expected_modules, expected_lists=expected_lists)
96 if __name__ ==
'__main__':
def _check_list(self, std_function=stdV0s.stdKshorts, expected_modules=["ParticleLoader", "ParticleListManipulator", "TreeFitter", "ParticleSelector", "ParticleLoader", "ParticleCombiner", "TreeFitter", "ParticleSelector", "ParticleListManipulator"], expected_lists=['V0_ToFit', 'V0_ToFit', 'all', 'RD', 'merged'])
def test_stdlambdas_list(self)
def test_stdkshorts_list(self)
def test_belle_list(self)