25class TestGetDefaultChannels(unittest.TestCase):
26 def test_get_default(self):
28 self.assertEqual([p.identifier
for p
in particles],
29 [
'pi+:generic',
'K+:generic',
'p+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
30 'pi0:generic',
'K_S0:generic',
'Lambda0:generic',
'Sigma+:generic',
'J/psi:generic',
31 'D0:generic',
'D+:generic',
'D_s+:generic',
'Lambda_c+:generic',
32 'D*0:generic',
'D*+:generic',
'D_s*+:generic',
33 'B0:generic',
'B+:generic',
34 'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
'D*+:semileptonic',
35 'B0:semileptonic',
'B+:semileptonic'])
37 def test_get_hadronic(self):
39 self.assertEqual([p.identifier
for p
in particles],
40 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
41 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
42 'D_s*+:generic',
'B0:generic',
'B+:generic'])
44 def test_get_semileptonic(self):
46 self.assertEqual([p.identifier
for p
in particles],
47 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
48 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
49 'D_s*+:generic',
'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
'D*+:semileptonic',
50 'B0:semileptonic',
'B+:semileptonic'])
52 def test_get_charged(self):
54 self.assertEqual([p.identifier
for p
in particles],
55 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
56 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
57 'D_s*+:generic',
'B+:generic',
'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
58 'D*+:semileptonic',
'B+:semileptonic'])
60 def test_get_neutral(self):
62 self.assertEqual([p.identifier
for p
in particles],
63 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
64 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
65 'D_s*+:generic',
'B0:generic',
'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
66 'D*+:semileptonic',
'B0:semileptonic'])
68 def test_get_klong(self):
70 self.assertEqual([p.identifier
for p
in particles],
71 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
72 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
73 'D_s*+:generic',
'K_L0:generic',
'D0:KL',
'D+:KL',
'D_s+:KL',
'D*0:KL',
'D*+:KL',
'D_s*+:KL',
76 def test_B_extra_cut(self):
78 self.assertEqual([p.identifier
for p
in particles],
79 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
80 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
81 'D_s*+:generic',
'B0:generic',
'B+:generic',
82 'K_L0:generic',
'D0:KL',
'D+:KL',
'D_s+:KL',
'D*0:KL',
'D*+:KL',
'D_s*+:KL',
'B0:KL',
'B+:KL',
83 'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
'D*+:semileptonic',
84 'B0:semileptonic',
'B+:semileptonic',
86 self.assertEqual(particles[14].preCutConfig.userCut,
'Mbc > 5.2 and abs(deltaE) < 0.5 and [nRemainingTracksInROE == 0]')
87 self.assertEqual(particles[15].preCutConfig.userCut,
'Mbc > 5.2 and abs(deltaE) < 0.5 and [nRemainingTracksInROE == 0]')
88 self.assertEqual(particles[23].preCutConfig.userCut,
'nRemainingTracksInROE == 0')
89 self.assertEqual(particles[24].preCutConfig.userCut,
'nRemainingTracksInROE == 0')
90 self.assertEqual(particles[29].preCutConfig.userCut,
'nRemainingTracksInROE == 0')
91 self.assertEqual(particles[30].preCutConfig.userCut,
'nRemainingTracksInROE == 0')
93 def test_get_specific(self):
95 self.assertEqual([p.identifier
for p
in particles],
96 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
97 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
98 'D_s*+:generic',
'B0:generic',
'B+:generic',
99 'K_L0:generic',
'D0:KL',
'D+:KL',
'D_s+:KL',
'D*0:KL',
'D*+:KL',
'D_s*+:KL',
'B0:KL',
'B+:KL',
100 'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
'D*+:semileptonic',
101 'B0:semileptonic',
'B+:semileptonic'])
102 self.assertEqual(particles[0].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
103 self.assertEqual(particles[1].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
104 self.assertEqual(particles[2].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
105 self.assertEqual(particles[3].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
106 self.assertEqual(particles[4].preCutConfig.userCut,
'[[clusterReg == 1 and E > 0.10] or [clusterReg == 2 and E > 0.05]'
107 ' or [clusterReg == 3 and E > 0.15]] and isInRestOfEvent > 0.5')
108 self.assertEqual(particles[6].preCutConfig.userCut,
'0.4 < M < 0.6')
109 self.assertEqual(particles[6].channels[2].preCutConfig.userCut,
'0.4 < M < 0.6 and isInRestOfEvent > 0.5')
110 self.assertEqual(particles[16].preCutConfig.userCut,
'isInRestOfEvent > 0.5')
112 def test_get_specific_converted(self):
115 self.assertEqual([p.identifier
for p
in particles],
116 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
117 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
118 'D_s*+:generic',
'B0:generic',
'B+:generic',
119 'K_L0:generic',
'D0:KL',
'D+:KL',
'D_s+:KL',
'D*0:KL',
'D*+:KL',
'D_s*+:KL',
'B0:KL',
'B+:KL',
120 'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
'D*+:semileptonic',
121 'B0:semileptonic',
'B+:semileptonic'])
122 self.assertEqual(particles[0].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
123 self.assertEqual(particles[1].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
124 self.assertEqual(particles[2].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
125 self.assertEqual(particles[3].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4] and isInRestOfEvent > 0.5')
126 self.assertEqual(particles[4].preCutConfig.userCut,
'goodBelleGamma == 1 and clusterBelleQuality == 0 '
127 'and isInRestOfEvent > 0.5')
128 self.assertEqual(particles[5].preCutConfig.userCut,
'0.08 < InvM < 0.18 and isInRestOfEvent > 0.5')
129 self.assertEqual(particles[6].preCutConfig.userCut,
'0.4 < M < 0.6 and isInRestOfEvent > 0.5')
130 self.assertEqual(particles[16].preCutConfig.userCut,
'isInRestOfEvent > 0.5')
133 def test_get_converted(self):
136 self.assertEqual([p.identifier
for p
in particles],
137 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
138 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
139 'D_s*+:generic',
'B0:generic',
'B+:generic',
140 'D0:semileptonic',
'D+:semileptonic',
'D*0:semileptonic',
'D*+:semileptonic',
141 'B0:semileptonic',
'B+:semileptonic'])
143 chargedVariables = [
'eIDBelle',
145 'atcPIDBelle(4,2)',
'atcPIDBelle(4,3)',
147 'p',
'pt',
'pz',
'dr',
'dz',
'chiProb',
'extraInfo(preCut_rank)']
148 self.assertEqual(particles[0].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4]')
149 self.assertEqual(particles[0].mvaConfig.variables, chargedVariables)
150 self.assertEqual(particles[0].preCutConfig.bestCandidateVariable,
'atcPIDBelle(2,3)')
151 self.assertEqual(particles[1].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4]')
152 self.assertEqual(particles[1].mvaConfig.variables, chargedVariables)
153 self.assertEqual(particles[1].preCutConfig.bestCandidateVariable,
'atcPIDBelle(3,2)')
154 self.assertEqual(particles[2].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4]')
155 self.assertEqual(particles[2].mvaConfig.variables, chargedVariables)
156 self.assertEqual(particles[2].preCutConfig.bestCandidateVariable,
'muIDBelle')
157 self.assertEqual(particles[3].preCutConfig.userCut,
'[dr < 2] and [abs(dz) < 4]')
158 self.assertEqual(particles[3].mvaConfig.variables, chargedVariables)
159 self.assertEqual(particles[3].preCutConfig.bestCandidateVariable,
'eIDBelle')
160 self.assertEqual(particles[4].preCutConfig.userCut,
'goodBelleGamma == 1 and clusterBelleQuality == 0')
161 self.assertEqual(particles[6].mvaConfig.variables, [
'dr',
'dz',
'distance',
'significanceOfDistance',
'chiProb',
163 'useCMSFrame(E)',
'daughterAngle(0,1)',
164 'cosAngleBetweenMomentumAndVertexVector',
165 'extraInfo(preCut_rank)',
'extraInfo(goodKs)',
'extraInfo(ksnbVLike)',
166 'extraInfo(ksnbNoLam)',
'extraInfo(ksnbStandard)'])
170class TestGetFRChannels(unittest.TestCase):
171 def test_get_default(self):
173 self.assertEqual([p.identifier
for p
in particles],
174 [
'pi+:generic',
'K+:generic',
'mu+:generic',
'e+:generic',
'gamma:generic',
'pi0:generic',
'K_S0:generic',
175 'J/psi:generic',
'D0:generic',
'D+:generic',
'D_s+:generic',
'D*0:generic',
'D*+:generic',
176 'D_s*+:generic',
'B0:generic',
'B+:generic'])
177 self.assertEqual(len(particles[0].channels), 1)
178 self.assertEqual(len(particles[1].channels), 1)
179 self.assertEqual(len(particles[2].channels), 1)
180 self.assertEqual(len(particles[3].channels), 1)
181 self.assertEqual(len(particles[4].channels), 2)
182 self.assertEqual(len(particles[5].channels), 1)
183 self.assertEqual(len(particles[6].channels), 3)
184 self.assertEqual(len(particles[7].channels), 2)
185 self.assertEqual(len(particles[8].channels), 10)
186 self.assertEqual(len(particles[9].channels), 7)
187 self.assertEqual(len(particles[10].channels), 8)
188 self.assertEqual(len(particles[11].channels), 2)
189 self.assertEqual(len(particles[12].channels), 2)
190 self.assertEqual(len(particles[13].channels), 1)
191 self.assertEqual(len(particles[14].channels), 15)
192 self.assertEqual(len(particles[15].channels), 17)
194 def test_get_mode_names(self):
196 self.assertEqual(len(had_modes), 32)
198 self.assertEqual(len(sl_modes), 8)
200 self.assertEqual(len(had_modes), 36)
202 self.assertEqual(len(sl_modes), 8)
205if __name__ ==
'__main__':
206 tempdir = tempfile.mkdtemp()
209 atexit.register(shutil.rmtree, tempdir)
def get_fr_channels(convertedFromBelle=False)
def get_default_channels(B_extra_cut=None, hadronic=True, semileptonic=True, KLong=False, baryonic=True, chargedB=True, neutralB=True, specific=False, removeSLD=False, strangeB=False)
list get_mode_names(str particle_name, hadronic=True, semileptonic=False, removeSLD=True, remove_list_labels=True, **channel_kwargs)