5 from basf2
import create_path
10 """Test case for standard photon lists"""
12 def _check_list(self, listtype=None, std_function=stdPhotons.stdPhotons, expected_lists=["all"]):
13 """check that a given listtype function works"""
14 testpath = create_path()
15 if (std_function
is stdPhotons.stdPhotons)
and (listtype
is not None):
16 std_function(listtype, path=testpath)
18 std_function(path=testpath)
22 len(testpath.modules()), len(expected_lists),
23 "List %s doesn't work with function %s" % (listtype, std_function.__name__))
24 self.assertTrue(all((module.type() ==
"ParticleLoader")
or (module.type() ==
"ParticleListManipulator")
25 for module
in testpath.modules()))
29 for module
in testpath.modules():
30 for param
in module.available_params():
31 if param.name ==
'decayStringsWithCuts':
32 name = param.values[0][0].split(
':')[1]
33 built_list.append(name)
34 if param.name ==
'outputListName':
35 name = str(param.values).split(
':')[1]
36 built_list.append(name)
39 for a, b
in zip(built_list, expected_lists):
40 self.assertEqual(a, b,
"Loaded list \'%s\' instead of \'%s\' with function %s" % (a, b, std_function.__name__))
43 """check that the builder function works with the all list"""
47 """check that the builder function works with the all list"""
51 """check that the builder function works with the cdc list"""
55 """check that the builder function works with the loose list"""
56 self.
_check_list(
"loose", expected_lists=[
"cdc",
"loose"])
59 """check that the builder function works with the default (loose) list"""
63 """check that the builder function works with the tight list"""
64 self.
_check_list(
"tight", expected_lists=[
"cdc",
"loose",
"tight"])
67 """check that the builder function works with the pi0eff60_Jan2020 list"""
68 self.
_check_list(
"pi0eff60_Jan2020", expected_lists=[
"pi0eff60_Jan2020"])
71 """check that the builder function works with the pi0eff50_Jan2020 list"""
72 self.
_check_list(
"pi0eff50_Jan2020", expected_lists=[
"pi0eff50_Jan2020"])
75 """check that the builder function works with the pi0eff40_Jan2020 list"""
76 self.
_check_list(
"pi0eff40_Jan2020", expected_lists=[
"pi0eff40_Jan2020"])
79 """check that the builder function works with the pi0eff30_Jan2020 list"""
80 self.
_check_list(
"pi0eff30_Jan2020", expected_lists=[
"pi0eff30_Jan2020"])
83 """check that the builder function works with the pi0eff20_Jan2020 list"""
84 self.
_check_list(
"pi0eff20_Jan2020", expected_lists=[
"pi0eff20_Jan2020"])
87 """check that the builder function works with the pi0eff10_Jan2020 list"""
88 self.
_check_list(
"pi0eff10_Jan2020", expected_lists=[
"pi0eff10_Jan2020"])
91 """check that the builder function works with the skim list"""
92 self.
_check_list(
"skim", std_function=stdPhotons.loadStdSkimPhoton, expected_lists=[
"cdc",
"loose",
"skim"])
95 """check that the builder function works with the belle list"""
96 self.
_check_list(
"goodBelle", std_function=stdPhotons.loadStdGoodBellePhoton, expected_lists=[
"goodBelle"])
99 if __name__ ==
'__main__':