Belle II Software development
TestStdPi0s Class Reference
Inheritance diagram for TestStdPi0s:

Public Member Functions

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

Protected Member Functions

def _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()

def _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()

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

Definition at line 84 of file test_std_pi0s.py.

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

◆ test_allfit_list()

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

Definition at line 138 of file test_std_pi0s.py.

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

◆ test_default_list_exists()

def 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 54 of file test_std_pi0s.py.

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

◆ test_default_list_works()

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

Definition at line 70 of file test_std_pi0s.py.

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

◆ test_eff10_May2020_list()

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

Definition at line 88 of file test_std_pi0s.py.

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

◆ test_eff10_May2020fit_list()

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

Definition at line 142 of file test_std_pi0s.py.

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

◆ test_eff20_May2020_list()

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

Definition at line 92 of file test_std_pi0s.py.

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

◆ test_eff20_May2020fit_list()

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

Definition at line 152 of file test_std_pi0s.py.

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

◆ test_eff30_May2020_list()

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

Definition at line 96 of file test_std_pi0s.py.

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

◆ test_eff30_May2020fit_list()

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

Definition at line 162 of file test_std_pi0s.py.

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

◆ test_eff40_May2020_list()

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

Definition at line 100 of file test_std_pi0s.py.

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

◆ test_eff40_May2020fit_list()

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

Definition at line 172 of file test_std_pi0s.py.

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

◆ test_eff50_May2020_list()

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

Definition at line 111 of file test_std_pi0s.py.

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

◆ test_eff50_May2020_nomcmatch_list()

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

Definition at line 104 of file test_std_pi0s.py.

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

◆ test_eff50_May2020fit_list()

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

Definition at line 182 of file test_std_pi0s.py.

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

◆ test_eff60_May2020_list()

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

Definition at line 128 of file test_std_pi0s.py.

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

◆ test_eff60_May2020_nomcmatch_list()

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

Definition at line 121 of file test_std_pi0s.py.

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

◆ test_eff60_May2020fit_list()

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

Definition at line 193 of file test_std_pi0s.py.

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

◆ test_nonsense_list()

def 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 self.assertRaises(ValueError, self._check_list, "flibble")
53

◆ test_skim()

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

Definition at line 204 of file test_std_pi0s.py.

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

◆ test_SkimHighEff()

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

Definition at line 214 of file test_std_pi0s.py.

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

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