Belle II Software light-2509-fornax
TestStdPi0s Class Reference
Inheritance diagram for TestStdPi0s:
Collaboration diagram for TestStdPi0s:

Public Member Functions

 test_nonsense_list (self)
 
 test_default_list_exists (self)
 
 test_default_list_works (self)
 
 test_all_list (self)
 
 test_eff10_May2020_list (self)
 
 test_eff20_May2020_list (self)
 
 test_eff30_May2020_list (self)
 
 test_eff40_May2020_list (self)
 
 test_eff50_May2020_nomcmatch_list (self)
 
 test_eff50_May2020_list (self)
 
 test_eff60_May2020_nomcmatch_list (self)
 
 test_eff60_May2020_list (self)
 
 test_allfit_list (self)
 
 test_eff10_May2020fit_list (self)
 
 test_eff20_May2020fit_list (self)
 
 test_eff30_May2020fit_list (self)
 
 test_eff40_May2020fit_list (self)
 
 test_eff50_May2020fit_list (self)
 
 test_eff60_May2020fit_list (self)
 
 test_skim (self)
 
 test_SkimHighEff (self)
 

Protected Member Functions

 _check_list (self, listtype=None, std_function=stdPi0s.stdPi0s, expected_lists=["all"])
 

Detailed Description

Test case for standard pi0 lists

Definition at line 18 of file test_std_pi0s.py.

Member Function Documentation

◆ _check_list()

_check_list ( self,
listtype = None,
std_function = stdPi0s.stdPi0s,
expected_lists = ["all"] )
protected
check that a given listtype function works

Definition at line 21 of file test_std_pi0s.py.

21 def _check_list(self, listtype=None, std_function=stdPi0s.stdPi0s, expected_lists=["all"]):
22 """check that a given listtype function works"""
23 testpath = create_path()
24 if (std_function is stdPi0s.stdPi0s) and (listtype is not None):
25 std_function(listtype, path=testpath)
26 else:
27 std_function(path=testpath)
28
29 built_lists = []
30 for module in testpath.modules():
31 for param in module.available_params():
32 if module.type() == 'ParticleLoader' and param.name == 'decayStrings':
33 name = param.values[0].split(':')[1]
34 built_lists.append(name)
35 if module.type() == 'ParticleListManipulator' and param.name == 'outputListName':
36 name = str(param.values).split(':')[1]
37 built_lists.append(name)
38 if module.type() == 'ParticleCombiner' and param.name == 'decayString':
39 name = param.values.split(':')[1].split(' -> ')[0]
40 built_lists.append(name)
41
42 # we have the particle lists we expect
43 for a, b in zip(built_lists, expected_lists):
44 self.assertEqual(a, b, f"Loaded list \'{a}\' instead of \'{b}\' with function {std_function.__name__}")
45
46 print(list(built_lists))
47 result = map(lambda w1, w2: w1 == w2, built_lists, expected_lists)
48 print(list(result))
49

◆ test_all_list()

test_all_list ( self)
check that the builder function works with the all list

Definition at line 86 of file test_std_pi0s.py.

86 def test_all_list(self):
87 """check that the builder function works with the all list"""
88 self._check_list("all", expected_lists=["all", "all"])
89

◆ test_allfit_list()

test_allfit_list ( self)
check that the builder function works with the allFit list

Definition at line 140 of file test_std_pi0s.py.

140 def test_allfit_list(self):
141 """check that the builder function works with the allFit list"""
142 self._check_list("allFit", expected_lists=["all", "all", "allFit"])
143

◆ test_default_list_exists()

test_default_list_exists ( self)
Check that the default list type is one of the lists in the cases that are checked for in :func:`stdPi0s.stdPi0s`.

This test relies on ``ValueError`` being raised for nonsense list types, which is tested by
:func:`test_nonsense_list`.  However, :func:`test_nonsense_list` doesn't ensure that the default list works, so
for that this test is needed.

Definition at line 56 of file test_std_pi0s.py.

56 def test_default_list_exists(self):
57 """
58 Check that the default list type is one of the lists in the cases that are checked for in :func:`stdPi0s.stdPi0s`.
59
60 This test relies on ``ValueError`` being raised for nonsense list types, which is tested by
61 :func:`test_nonsense_list`. However, :func:`test_nonsense_list` doesn't ensure that the default list works, so
62 for that this test is needed.
63 """
64 test_path = create_path()
65 try:
66 stdPi0s.stdPi0s(path=test_path)
67 except ValueError:
68 stdPi0s_signature = inspect.signature(stdPi0s.stdPi0s)
69 default_listtype = stdPi0s_signature.parameters["listtype"].default
70 self.fail(f"stdPi0s default listtype {default_listtype} is not in set of allowed list names.")
71
stdPi0s(listtype="eff60_May2020", path=None, beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="")
Definition stdPi0s.py:22

◆ test_default_list_works()

test_default_list_works ( self)
Check that the default list type works.

Definition at line 72 of file test_std_pi0s.py.

72 def test_default_list_works(self):
73 """Check that the default list type works."""
74 stdPi0s_signature = inspect.signature(stdPi0s.stdPi0s)
75 default_listtype = stdPi0s_signature.parameters["listtype"].default
76 self._check_list(
77 expected_lists=[
78 "pi0" +
79 default_listtype,
80 "pi0" +
81 default_listtype,
82 default_listtype +
83 "_nomcmatch",
84 default_listtype])
85

◆ test_eff10_May2020_list()

test_eff10_May2020_list ( self)
check that the builder function works with the eff10_May2020 list

Definition at line 90 of file test_std_pi0s.py.

90 def test_eff10_May2020_list(self):
91 """check that the builder function works with the eff10_May2020 list"""
92 self._check_list("eff10_May2020", expected_lists=["pi0eff10_May2020", "pi0eff10_May2020", "eff10_May2020"])
93

◆ test_eff10_May2020fit_list()

test_eff10_May2020fit_list ( self)
check that the builder function works with the eff10_May2020Fit list

Definition at line 144 of file test_std_pi0s.py.

144 def test_eff10_May2020fit_list(self):
145 """check that the builder function works with the eff10_May2020Fit list"""
146 self._check_list(
147 "eff10_May2020Fit",
148 expected_lists=[
149 "pi0eff10_May2020",
150 "pi0eff10_May2020",
151 "eff10_May2020",
152 "eff10_May2020Fit"])
153

◆ test_eff20_May2020_list()

test_eff20_May2020_list ( self)
check that the builder function works with the eff20_May2020 list

Definition at line 94 of file test_std_pi0s.py.

94 def test_eff20_May2020_list(self):
95 """check that the builder function works with the eff20_May2020 list"""
96 self._check_list("eff20_May2020", expected_lists=["pi0eff20_May2020", "pi0eff20_May2020", "eff20_May2020"])
97

◆ test_eff20_May2020fit_list()

test_eff20_May2020fit_list ( self)
check that the builder function works with the eff20_May2020Fit list

Definition at line 154 of file test_std_pi0s.py.

154 def test_eff20_May2020fit_list(self):
155 """check that the builder function works with the eff20_May2020Fit list"""
156 self._check_list(
157 "eff20_May2020Fit",
158 expected_lists=[
159 "pi0eff20_May2020",
160 "pi0eff20_May2020",
161 "eff20_May2020",
162 "eff20_May2020Fit"])
163

◆ test_eff30_May2020_list()

test_eff30_May2020_list ( self)
check that the builder function works with the eff30_May2020 list

Definition at line 98 of file test_std_pi0s.py.

98 def test_eff30_May2020_list(self):
99 """check that the builder function works with the eff30_May2020 list"""
100 self._check_list("eff30_May2020", expected_lists=["pi0eff30_May2020", "pi0eff30_May2020", "eff30_May2020"])
101

◆ test_eff30_May2020fit_list()

test_eff30_May2020fit_list ( self)
check that the builder function works with the eff30_May2020Fit list

Definition at line 164 of file test_std_pi0s.py.

164 def test_eff30_May2020fit_list(self):
165 """check that the builder function works with the eff30_May2020Fit list"""
166 self._check_list(
167 "eff30_May2020Fit",
168 expected_lists=[
169 "pi0eff30_May2020",
170 "pi0eff30_May2020",
171 "eff30_May2020",
172 "eff30_May2020Fit"])
173

◆ test_eff40_May2020_list()

test_eff40_May2020_list ( self)
check that the builder function works with the eff40_May2020 list

Definition at line 102 of file test_std_pi0s.py.

102 def test_eff40_May2020_list(self):
103 """check that the builder function works with the eff40_May2020 list"""
104 self._check_list("eff40_May2020", expected_lists=["pi0eff40_May2020", "pi0eff40_May2020", "eff40_May2020"])
105

◆ test_eff40_May2020fit_list()

test_eff40_May2020fit_list ( self)
check that the builder function works with the eff40_May2020Fit list

Definition at line 174 of file test_std_pi0s.py.

174 def test_eff40_May2020fit_list(self):
175 """check that the builder function works with the eff40_May2020Fit list"""
176 self._check_list(
177 "eff40_May2020Fit",
178 expected_lists=[
179 "pi0eff40_May2020",
180 "pi0eff40_May2020",
181 "eff40_May2020",
182 "eff40_May2020Fit"])
183

◆ test_eff50_May2020_list()

test_eff50_May2020_list ( self)
check that the builder function works with the eff50_May2020 list

Definition at line 113 of file test_std_pi0s.py.

113 def test_eff50_May2020_list(self):
114 """check that the builder function works with the eff50_May2020 list"""
115 self._check_list(
116 "eff50_May2020",
117 expected_lists=[
118 "pi0eff50_May2020",
119 "pi0eff50_May2020",
120 "eff50_May2020_nomcmatch",
121 "eff50_May2020"])
122

◆ test_eff50_May2020_nomcmatch_list()

test_eff50_May2020_nomcmatch_list ( self)
check that the builder function works with the eff50_May2020_nomcmatch list

Definition at line 106 of file test_std_pi0s.py.

106 def test_eff50_May2020_nomcmatch_list(self):
107 """check that the builder function works with the eff50_May2020_nomcmatch list"""
108 self._check_list("eff50_May2020_nomcmatch",
109 expected_lists=["pi0eff50_May2020",
110 "pi0eff50_May2020",
111 "eff50_May2020_nomcmatch"])
112

◆ test_eff50_May2020fit_list()

test_eff50_May2020fit_list ( self)
check that the builder function works with the eff50_May2020Fit list

Definition at line 184 of file test_std_pi0s.py.

184 def test_eff50_May2020fit_list(self):
185 """check that the builder function works with the eff50_May2020Fit list"""
186 self._check_list(
187 "eff50_May2020Fit",
188 expected_lists=[
189 "pi0eff50_May2020",
190 "pi0eff50_May2020",
191 'eff50_May2020_nomcmatch',
192 "eff50_May2020",
193 "eff50_May2020Fit"])
194

◆ test_eff60_May2020_list()

test_eff60_May2020_list ( self)
check that the builder function works with the eff60_May2020 list

Definition at line 130 of file test_std_pi0s.py.

130 def test_eff60_May2020_list(self):
131 """check that the builder function works with the eff60_May2020 list"""
132 self._check_list(
133 "eff60_May2020",
134 expected_lists=[
135 "pi0eff60_May2020",
136 "pi0eff60_May2020",
137 "eff60_May2020_nomcmatch",
138 "eff60_May2020"])
139

◆ test_eff60_May2020_nomcmatch_list()

test_eff60_May2020_nomcmatch_list ( self)
check that the builder function works with the eff50_May2020_nomcmatch list

Definition at line 123 of file test_std_pi0s.py.

123 def test_eff60_May2020_nomcmatch_list(self):
124 """check that the builder function works with the eff50_May2020_nomcmatch list"""
125 self._check_list("eff60_May2020_nomcmatch",
126 expected_lists=["pi0eff60_May2020",
127 "pi0eff60_May2020",
128 "eff60_May2020_nomcmatch"])
129

◆ test_eff60_May2020fit_list()

test_eff60_May2020fit_list ( self)
check that the builder function works with the eff60_May2020Fit list

Definition at line 195 of file test_std_pi0s.py.

195 def test_eff60_May2020fit_list(self):
196 """check that the builder function works with the eff60_May2020Fit list"""
197 self._check_list(
198 "eff60_May2020Fit",
199 expected_lists=[
200 "pi0eff60_May2020",
201 "pi0eff60_May2020",
202 'eff60_May2020_nomcmatch',
203 "eff60_May2020",
204 "eff60_May2020Fit"])
205

◆ test_nonsense_list()

test_nonsense_list ( self)
check that the builder function raises a ValueError for a non-existing list name

Definition at line 50 of file test_std_pi0s.py.

50 def test_nonsense_list(self):
51 """check that the builder function raises a ValueError for a non-existing list name"""
52 # \cond false positive doxygen warning
53 self.assertRaises(ValueError, self._check_list, "flibble")
54 # \endcond
55

◆ test_skim()

test_skim ( self)
check that the builder function works with the skim list

Definition at line 206 of file test_std_pi0s.py.

206 def test_skim(self):
207 """check that the builder function works with the skim list"""
208 self._check_list(
209 std_function=stdPi0s.loadStdSkimPi0,
210 expected_lists=[
211 "pi0eff50_May2020",
212 "pi0eff50_May2020",
213 "eff50_May2020_nomcmatch",
214 "skim"])
215

◆ test_SkimHighEff()

test_SkimHighEff ( self)
check that the builder function works with the skim list

Definition at line 216 of file test_std_pi0s.py.

216 def test_SkimHighEff(self):
217 """check that the builder function works with the skim list"""
218 self._check_list(
219 std_function=stdPi0s.loadStdSkimHighEffPi0,
220 expected_lists=[
221 "pi0eff60_May2020",
222 "pi0eff60_May2020",
223 "eff60_May2020_nomcmatch",
224 "SkimHighEff"])
225
226

The documentation for this class was generated from the following file: