13 from basf2
import create_path
18 """Test case for standard V0 lists"""
22 std_function=stdV0s.stdKshorts,
25 "ParticleListManipulator",
32 "ParticleListManipulator"],
33 expected_lists=['V0', 'V0_MassWindow', 'all', 'RD', 'merged']):
34 """check that a given function works"""
35 testpath = create_path()
36 std_function(path=testpath)
40 len(testpath.modules()), len(expected_modules),
41 "Function %s does not load the expected number of modules" % (std_function.__name__))
46 for module
in testpath.modules():
47 loaded_modules.append(module.type())
48 for param
in module.available_params():
49 if module.type() ==
'ParticleLoader' and param.name ==
'decayStrings':
50 name = param.values[0].split(
':')[1].split(
' -> ')[0]
51 built_lists.append(name)
52 if module.type() ==
'ParticleListManipulator' and param.name ==
'outputListName':
53 name = str(param.values).split(
':')[1].split(
' -> ')[0]
54 built_lists.append(name)
55 if module.type() ==
'ParticleCombiner' and param.name ==
'decayString':
56 name = param.values.split(
':')[1].split(
' -> ')[0]
57 built_lists.append(name)
60 for a, b
in zip(loaded_modules, expected_modules):
61 self.assertEqual(a, b,
"Loaded module \'%s\' instead of \'%s\' with function %s" % (a, b, std_function.__name__))
64 for a, b
in zip(built_lists, expected_lists):
65 self.assertEqual(a, b,
"Loaded list \'%s\' instead of \'%s\' with function %s" % (a, b, std_function.__name__))
68 """check that the builder function works with the stdKshorts list"""
72 """check that the builder function works with the legacy Belle Kshorts list"""
73 expected_modules = [
"ParticleLoader",
74 "ParticleListManipulator",
76 "ParticleVertexFitter",
78 self.
_check_list_check_list(std_function=stdV0s.goodBelleKshort, expected_modules=expected_modules, expected_lists=[
"legacyGoodKS"])
81 """check that the builder function works with the stdLambdas list"""
82 expected_modules = [
"ParticleLoader",
83 "ParticleListManipulator",
86 "DuplicateVertexMarker",
93 "DuplicateVertexMarker",
95 "ParticleListManipulator"]
96 expected_lists = [
'V0',
'V0_MassWindow',
'all',
'all',
'RD',
'merged']
97 self.
_check_list_check_list(std_function=stdV0s.stdLambdas, expected_modules=expected_modules, expected_lists=expected_lists)
100 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', 'V0_MassWindow', 'all', 'RD', 'merged'])
def test_stdlambdas_list(self)
def test_stdkshorts_list(self)
def test_belle_list(self)