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

Public Member Functions

def remove_spaces (self, s)
 
def test_stdXi (self)
 
def test_stdXi_b2bii (self)
 
def test_stdXi0 (self)
 
def test_stdXi0_b2bii (self)
 
def test_stdOmega (self)
 
def test_stdOmega_b2bii (self)
 
def test_goodXi (self)
 
def test_goodXi_with_std_added_before (self)
 
def test_goodXi0 (self)
 
def test_goodXi0_with_std_added_before (self)
 
def test_goodOmega (self)
 
def test_goodOmega_with_std_added_before (self)
 

Protected Member Functions

def _check_list (self, std_function, expected_lists=[])
 

Detailed Description

Test case for standard hyperon lists

Definition at line 17 of file test_std_hyperons.py.

Member Function Documentation

◆ _check_list()

def _check_list (   self,
  std_function,
  expected_lists = [] 
)
protected
Check the given particle lists are created.
The std_function ONLY takes one path argument.

Definition at line 24 of file test_std_hyperons.py.

27 expected_lists=[]):
28 """
29 Check the given particle lists are created.
30 The std_function ONLY takes one path argument.
31 """
32 testpath = create_path()
33 std_function(path=testpath)
34
35 built_lists = []
36 for module in testpath.modules():
37 for param in module.available_params():
38 if module.type() == 'ParticleLoader' and param.name == 'decayStringsWithCuts':
39 listname = param.values[0][0].split('->')[0]
40 elif module.type() == 'ParticleListManipulator' and param.name == 'outputListName':
41 listname = str(param.values).split(' -> ')[0]
42 elif module.type() == 'ParticleCombiner' and param.name == 'decayString':
43 listname = param.values.split(' -> ')[0]
44 else:
45 continue
46 listname = self.remove_spaces(listname)
47 if listname not in built_lists:
48 built_lists.append(listname)
49 expected_lists = [self.remove_spaces(listname) for listname in expected_lists]
50
51 for expected in expected_lists:
52 if expected not in built_lists:
53 return False
54 return True
55

◆ remove_spaces()

def remove_spaces (   self,
  s 
)
Remove all spaces within a string

Definition at line 20 of file test_std_hyperons.py.

20 def remove_spaces(self, s):
21 """Remove all spaces within a string"""
22 return "".join(s.split(' '))
23

◆ test_goodOmega()

def test_goodOmega (   self)
Check goodOmega lists: veryloose, loose, tight

Definition at line 164 of file test_std_hyperons.py.

164 def test_goodOmega(self):
165 """Check goodOmega lists: veryloose, loose, tight"""
166 for omegatype in ['veryloose', 'loose', 'tight']:
167 def create_list(path):
168 goodOmega(omegatype, path)
169 self.assertTrue(self._check_list(create_list, expected_lists=['Omega-:std', f'Omega-:{omegatype}']))
170 self.assertFalse(self._check_list(create_list, expected_lists=[f'Omega:{omegatype}']))
171

◆ test_goodOmega_with_std_added_before()

def test_goodOmega_with_std_added_before (   self)
Check goodOmega lists: veryloose, loose, tight. Test behavior if std list was already added before.

Definition at line 172 of file test_std_hyperons.py.

172 def test_goodOmega_with_std_added_before(self):
173 """Check goodOmega lists: veryloose, loose, tight. Test behavior if std list was already added before."""
174 for omegatype in ['veryloose', 'loose', 'tight']:
175 def create_list(path):
176 stdOmega(path=path)
177 goodOmega(omegatype, path)
178 self.assertTrue(self._check_list(create_list, expected_lists=['Omega-:std', f'Omega-:{omegatype}']))
179 self.assertFalse(self._check_list(create_list, expected_lists=[f'Omega:{omegatype}']))
180
181

◆ test_goodXi()

def test_goodXi (   self)
Check goodXi lists: veryloose, loose, tight

Definition at line 126 of file test_std_hyperons.py.

126 def test_goodXi(self):
127 """Check goodXi lists: veryloose, loose, tight"""
128 for xitype in ['veryloose', 'loose', 'tight']:
129 def create_list(path):
130 goodXi(xitype, path)
131 self.assertTrue(self._check_list(create_list, expected_lists=['Xi-:std', f'Xi-:{xitype}']))
132 # Should be no 'Xi' list. Make sure we did not make typos.
133 self.assertFalse(self._check_list(create_list, expected_lists=[f'Xi:{xitype}']))
134

◆ test_goodXi0()

def test_goodXi0 (   self)
Check goodXi0 lists: veryloose, loose, tight

Definition at line 145 of file test_std_hyperons.py.

145 def test_goodXi0(self):
146 """Check goodXi0 lists: veryloose, loose, tight"""
147 for xitype in ['veryloose', 'loose', 'tight']:
148 def create_list(path):
149 goodXi0(xitype, path)
150 self.assertTrue(self._check_list(create_list, expected_lists=['Xi0:std', f'Xi0:{xitype}']),
151 f"xitype = {xitype}")
152 self.assertFalse(self._check_list(create_list, expected_lists=[f'Xi:{xitype}']))
153

◆ test_goodXi0_with_std_added_before()

def test_goodXi0_with_std_added_before (   self)
Check goodXi0 lists: veryloose, loose, tight. Test behavior if std list was already added before.

Definition at line 154 of file test_std_hyperons.py.

154 def test_goodXi0_with_std_added_before(self):
155 """Check goodXi0 lists: veryloose, loose, tight. Test behavior if std list was already added before."""
156 for xitype in ['veryloose', 'loose', 'tight']:
157 def create_list(path):
158 stdXi0(path=path)
159 goodXi0(xitype, path)
160 self.assertTrue(self._check_list(create_list, expected_lists=['Xi0:std', f'Xi0:{xitype}']),
161 f"xitype = {xitype}")
162 self.assertFalse(self._check_list(create_list, expected_lists=[f'Xi:{xitype}']))
163

◆ test_goodXi_with_std_added_before()

def test_goodXi_with_std_added_before (   self)
Check goodXi lists: veryloose, loose, tight. Test behavior if std list was already added before.

Definition at line 135 of file test_std_hyperons.py.

135 def test_goodXi_with_std_added_before(self):
136 """Check goodXi lists: veryloose, loose, tight. Test behavior if std list was already added before."""
137 for xitype in ['veryloose', 'loose', 'tight']:
138 def create_list(path):
139 stdXi(path=path)
140 goodXi(xitype, path)
141 self.assertTrue(self._check_list(create_list, expected_lists=['Xi-:std', f'Xi-:{xitype}']))
142 # Should be no 'Xi' list. Make sure we did not make typos.
143 self.assertFalse(self._check_list(create_list, expected_lists=[f'Xi:{xitype}']))
144

◆ test_stdOmega()

def test_stdOmega (   self)
Check stdOmega

Definition at line 104 of file test_std_hyperons.py.

104 def test_stdOmega(self):
105 """Check stdOmega"""
106 for fitter in ['KFit', 'TreeFit']:
107 self.assertTrue(
108 self._check_list(
109 lambda path: stdOmega(
110 fitter=fitter,
111 path=path),
112 expected_lists=['Omega-:std']))
113

◆ test_stdOmega_b2bii()

def test_stdOmega_b2bii (   self)
Check stdOmega for B2BII settings

Definition at line 114 of file test_std_hyperons.py.

114 def test_stdOmega_b2bii(self):
115 """Check stdOmega for B2BII settings"""
116 setB2BII()
117 for fitter in ['KFit', 'TreeFit']:
118 self.assertTrue(
119 self._check_list(
120 lambda path: stdOmega(
121 fitter=fitter,
122 path=path),
123 expected_lists=['Omega-:std']))
124 unsetB2BII()
125

◆ test_stdXi()

def test_stdXi (   self)
Check stdXi

Definition at line 56 of file test_std_hyperons.py.

56 def test_stdXi(self):
57 """Check stdXi"""
58 for fitter in ['KFit', 'TreeFit']:
59 self.assertTrue(self._check_list(lambda path: stdXi(fitter=fitter, path=path), expected_lists=['Xi-:std']))
60 # Also serves as a test for _check_list
61 self.assertFalse(
62 self._check_list(
63 lambda path: stdXi(
64 fitter='TreeFit',
65 path=path),
66 expected_lists=['Xi-:good']))
67 # Allow spaces in particle list
68 self.assertTrue(
69 self._check_list(
70 lambda path: stdXi(
71 fitter='TreeFit',
72 path=path),
73 expected_lists=['Xi- : std']))
74

◆ test_stdXi0()

def test_stdXi0 (   self)
Check stdXi0

Definition at line 82 of file test_std_hyperons.py.

82 def test_stdXi0(self):
83 """Check stdXi0"""
84 for gamma_efficiency in ['eff20', 'eff30', 'eff40', 'eff50', 'eff60']:
85 self.assertTrue(
86 self._check_list(
87 lambda path: stdXi0(
88 gammatype=gamma_efficiency,
89 path=path),
90 expected_lists=['Xi0:std']))
91

◆ test_stdXi0_b2bii()

def test_stdXi0_b2bii (   self)
Check stdXi0 for B2BII settings

Definition at line 92 of file test_std_hyperons.py.

92 def test_stdXi0_b2bii(self):
93 """Check stdXi0 for B2BII settings"""
94 setB2BII()
95 for gamma_efficiency in ['eff20', 'eff30', 'eff40', 'eff50', 'eff60']:
96 self.assertTrue(
97 self._check_list(
98 lambda path: stdXi0(
99 gammatype=gamma_efficiency,
100 path=path),
101 expected_lists=['Xi0:std']))
102 unsetB2BII()
103

◆ test_stdXi_b2bii()

def test_stdXi_b2bii (   self)
Check stdXi for B2BII settings

Definition at line 75 of file test_std_hyperons.py.

75 def test_stdXi_b2bii(self):
76 """Check stdXi for B2BII settings"""
77 setB2BII()
78 for fitter in ['KFit', 'TreeFit']:
79 self.assertTrue(self._check_list(lambda path: stdXi(fitter=fitter, path=path), expected_lists=['Xi-:std']))
80 unsetB2BII()
81

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