11 from basf2
import B2ERROR, B2WARNING
12 from b2bii
import isB2BII
13 from modularAnalysis
import cutAndCopyList, reconstructDecay, applyCuts
14 from vertex
import treeFit, kFit
16 from stdCharged
import stdPi, stdK
17 from stdV0s
import stdLambdas
18 from stdPhotons
import stdPhotons
21 def stdXi(fitter='TreeFit', path=None):
23 Reconstruct the standard :math:`\Xi^-` ``ParticleList`` named ``Xi-:std``.
25 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
28 fitter (str): specify either ``KFit`` or ``TreeFit`` for the vertex reconstructions (default ``TreeFit``)
29 path (basf2.Path): modules are added to this path building the ``Xi-:std`` list
38 '[ abs( dM ) < 0.0035 ] and \
39 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
40 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
41 [ daughter(0,protonID) > 0.01 ] and \
45 stdPi(
'all', path=path)
47 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
51 '[ abs( dM ) < 0.0035 ] and \
52 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
54 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
55 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
61 kFit(
'Lambda0:reco', 0.0, fit_type=
'massvertex', path=path)
62 reconstructDecay(
'Xi-:reco -> Lambda0:reco pi-:all',
'1.295 < M < 1.35', path=path)
63 kFit(
'Xi-:reco', conf_level=0.0, path=path)
64 elif fitter ==
'TreeFit':
65 reconstructDecay(
'Xi-:reco -> Lambda0:reco pi-:all',
'1.295 < M < 1.35', path=path)
66 treeFit(
'Xi-:reco', conf_level=0.0, massConstraint=[3122], path=path)
68 B2ERROR(f
"stdXi: invalid fitter ({fitter}). Choose from KFit or TreeFit")
73 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
74 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
75 formula([dr^2 + dz^2 ]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
81 def stdXi0(gammatype='eff40', path=None, loadPhotonBeamBackgroundMVA=True):
83 Reconstruct the standard :math:`\Xi^0` ``ParticleList`` named ``Xi0:std``.
85 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
88 gammatype (str): specify either ``eff60``, ``eff50``, ``eff40``, ``eff30``, or ``eff20``
89 to select the signal efficiency of the photons used in the pi0 reconstruction
91 path (basf2.Path): modules are added to this path building the ``Xi0:std`` list
92 loadPhotonBeamBackgroundMVA (bool): If true, photon candidates will be assigned a beam background probability.
101 '[ abs( dM ) < 0.0035 ] and \
102 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
103 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
104 [ daughter(0,protonID) > 0.01 ] and \
108 stdPhotons(f
'pi0{gammatype}_May2020', path=path, loadPhotonBeamBackgroundMVA=loadPhotonBeamBackgroundMVA)
109 reconstructDecay(f
'pi0:reco -> gamma:pi0{gammatype}_May2020 gamma:pi0{gammatype}_May2020',
110 'abs( dM ) < 0.0406',
118 '[ abs( dM ) < 0.0189 ] and \
119 [ [ daughter(0,clusterReg) == 1 and daughter(0,E) > 0.05 ] or [ daughter(0,clusterReg) == 3 and daughter(0,E) > 0.05 ] or \
120 [ daughter(0,clusterReg) == 2 and daughter(0,E) > 0.03 ] ] and \
121 [ [ daughter(1,clusterReg) == 1 and daughter(1,E) > 0.05 ] or [ daughter(1,clusterReg) == 3 and daughter(1,E) > 0.05 ] or \
122 [ daughter(1,clusterReg) == 2 and daughter(1,E) > 0.03 ] ]',
124 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
128 '[ abs( dM ) < 0.0035 ] and \
129 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
131 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
132 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
137 'Xi0:prelim -> Lambda0:reco pi0:reco',
140 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[3122], ipConstraint=
True, updateAllDaughters=
True, path=path)
143 applyCuts(
'Xi0:prelim',
'[ abs( daughter(1,dM) ) < 0.0232 ]', path=path)
144 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[111, 3122], ipConstraint=
True, updateAllDaughters=
False, path=path)
149 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
150 [ daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane) < cosAngleBetweenMomentumAndVertexVectorInXYPlane ] and \
151 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.0 and \
152 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
158 def stdOmega(fitter='TreeFit', path=None):
160 Reconstruct the standard :math:`\Omega^-` ``ParticleList`` named ``Omega-:std``.
162 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
165 fitter (str): specify either ``KFit`` or ``TreeFit`` for the vertex reconstructions (default ``TreeFit``)
166 path (basf2.Path): modules are added to this path building the ``Omega-:std`` list
170 stdLambdas(path=path)
175 '[ abs( dM ) < 0.0035 ] and \
176 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
177 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
178 [ daughter(0,protonID) > 0.01 ] and \
182 stdPi(
'all', path=path)
184 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
188 '[ abs( dM ) < 0.0035 ] and \
189 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
191 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
192 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
196 stdK(
'all', path=path)
199 kFit(
'Lambda0:reco', 0.0, fit_type=
'massvertex', path=path)
200 reconstructDecay(
'Omega-:reco -> Lambda0:reco K-:all',
'1.622 < M < 1.722', path=path)
201 kFit(
'Omega-:reco', conf_level=0.0, path=path)
202 elif fitter ==
'TreeFit':
203 reconstructDecay(
'Omega-:reco -> Lambda0:reco K-:all',
'1.622 < M < 1.722', path=path)
204 treeFit(
'Omega-:reco', conf_level=0.0, massConstraint=[3122], path=path)
206 B2ERROR(f
"stdOmega: invalid fitter ({fitter}). Choose from KFit or TreeFit")
212 '[ cosAngleBetweenMomentumAndVertexVector > 0.0] and \
213 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
214 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
215 [ chiProb > 0.0 ] and \
216 [ daughter(1,kaonID) > 0.01 ]',
224 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
225 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
226 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2 ]^[0.5])] and \
227 [ chiProb > 0.0 ] and \
228 [ daughter(1,atcPIDBelle(3,4)) > 0.2 and daughter(1,atcPIDBelle(3,2)) > 0.2 ]',
233 def goodXi(xitype='loose', path=None):
235 Select the standard good :math:`\Xi^-` ``ParticleList`` named ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``
236 from the reconstructed ``Xi-:std``.
238 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
241 xitype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection (default ``loose``)
242 path (basf2.Path): modules are added to this path building the ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``, list
245 if not _std_hyperon_is_in_path(
"Xi-", path):
246 B2WARNING(
"Could not find standard Xi particle list! Creating it with default options.")
248 assert _std_hyperon_is_in_path(
"Xi-", path)
250 if xitype ==
'veryloose':
254 '[ daughter(1,pt) > 0.05 and \
255 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 ]',
259 elif xitype ==
'loose':
263 '[ daughter(1,pt) > 0.05 and \
264 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 and \
265 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
270 elif xitype ==
'tight':
274 '[ daughter(1,pt) > 0.1 and \
275 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
276 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
281 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi- list types!")
284 def goodXi0(xitype='loose', path=None):
286 Select the standard good :math:`\Xi^0` ``ParticleList`` named ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``
287 from the reconstructed ``Xi0:std``.
289 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
292 xitype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection (default ``loose``)
293 path (basf2.Path): modules are added to this path building the ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``, list
296 if not _std_hyperon_is_in_path(
"Xi0", path):
297 B2WARNING(
"Could not find standard Xi0 particle list! Creating it with default options.")
299 assert _std_hyperon_is_in_path(
"Xi0", path)
301 if xitype ==
'veryloose':
306 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.25 and \
307 daughter(1,p) > 0.1 and \
308 abs( daughter(1,dM) ) < 0.0174 ]',
312 elif xitype ==
'loose':
317 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.5 and \
318 daughter(1,p) > 0.15 and \
319 abs( daughter(1,dM) ) < 0.0174 ]',
323 elif xitype ==
'tight':
328 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 1.4 and \
329 daughter(1,p) > 0.25 and \
330 abs( daughter(1,dM) ) < 0.0116 ]',
334 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi0 list types!")
337 def goodOmega(omegatype='loose', path=None):
339 Select the standard good :math:`\Omega^-` ``ParticleList`` named ``Omega-:veryloose``, ``Omega-:loose``,
340 or ``Omega-:tight`` from the reconstructed ``Omega-:std``.
342 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
345 omegatype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection
346 (default ``veryloose``)
347 path (basf2.Path): modules are added to this path building the ``Omega-:veryloose``, ``Omega-:loose``,
348 or ``Omega-:tight``, list
351 if not _std_hyperon_is_in_path(
"Omega-", path):
352 B2WARNING(
"Could not find standard Omega particle list! Creating it with default options.")
354 assert _std_hyperon_is_in_path(
"Omega-", path)
356 if omegatype ==
'veryloose':
360 '[ daughter(1,pt) > 0.15 and \
361 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.05 ]',
365 elif omegatype ==
'loose':
369 '[ daughter(1,pt) > 0.15 and \
370 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
371 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
376 elif omegatype ==
'tight':
380 '[ daughter(1,pt) > 0.3 and \
381 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
382 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
387 raise ValueError(f
"\"{omegatype}\" is none of the allowed Omega list types!")
390 def _std_hyperon_is_in_path(hyperon, path):
392 Helper function to check if the std hyperon is already in the reconstruction path.
394 Checks whether there is a ``PListCutAndCopy`` module with the
395 ``outputListName``: ``<hyperon>:std``.
396 :param hyperon: One of ["Xi-", "Xi0", "Omega-"]
397 :param path: Instance of basf2.Path
398 :returns: Boolean, whether ``PListCutAndCopy`` with ``outputListName`` ``<hyperon>:std`` was found in path.
402 allowed_hyperons = {
"Xi-",
"Xi0",
"Omega-"}
403 if hyperon
not in allowed_hyperons:
405 f
"\"{hyperon}\" is not in list of hyperons that this function has been tested for ({allowed_hyperons})."
407 for module
in path.modules():
408 if (module.name() == f
"PListCutAndCopy_{hyperon}:std" or
409 module.name().split(
" -> ")[0] == f
"ParticleCombiner_{hyperon}:std"):