11from basf2
import B2ERROR, B2WARNING
12from b2bii
import isB2BII
13from modularAnalysis
import cutAndCopyList, reconstructDecay, applyCuts
14from vertex
import treeFit, kFit
16from stdCharged
import stdPi, stdK
17from stdV0s
import stdLambdas
18from stdPhotons
import stdPhotons
21def 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 \
81def stdXi0(gammatype='eff40', beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="", path=None):
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
92 beamBackgroundMVAWeight (str): type of weight file
for beam background MVA;
if empty, beam background MVA will
not be used
96 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
97 for information on the beam background MVA.
99 fakePhotonMVAWeight (str): type of weight file
for fake photon MVA;
if empty, fake photon MVA will
not be used
103 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
104 for information on the fake photon MVA.
106 biasCorrectionTable (str): correction table
for the photon energy bias correction (should only be applied to data)
110 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
111 for information on the names of available correction tables.
113 path (basf2.Path): modules are added to this path building the ``Xi0:std`` list
117 stdLambdas(path=path)
122 '[ abs( dM ) < 0.0035 ] and \
123 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
124 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
125 [ daughter(0,protonID) > 0.01 ] and \
130 f
'pi0{gammatype}_May2020',
132 beamBackgroundMVAWeight=beamBackgroundMVAWeight,
133 fakePhotonMVAWeight=fakePhotonMVAWeight,
134 biasCorrectionTable=biasCorrectionTable)
135 reconstructDecay(f
'pi0:reco -> gamma:pi0{gammatype}_May2020 gamma:pi0{gammatype}_May2020',
136 'abs( dM ) < 0.0406',
144 '[ abs( dM ) < 0.0189 ] and \
145 [ [ daughter(0,clusterReg) == 1 and daughter(0,E) > 0.05 ] or [ daughter(0,clusterReg) == 3 and daughter(0,E) > 0.05 ] or \
146 [ daughter(0,clusterReg) == 2 and daughter(0,E) > 0.03 ] ] and \
147 [ [ daughter(1,clusterReg) == 1 and daughter(1,E) > 0.05 ] or [ daughter(1,clusterReg) == 3 and daughter(1,E) > 0.05 ] or \
148 [ daughter(1,clusterReg) == 2 and daughter(1,E) > 0.03 ] ]',
150 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
154 '[ abs( dM ) < 0.0035 ] and \
155 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
157 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
158 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
163 'Xi0:prelim -> Lambda0:reco pi0:reco',
166 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[3122], ipConstraint=
True, updateAllDaughters=
True, path=path)
169 applyCuts(
'Xi0:prelim',
'[ abs( daughter(1,dM) ) < 0.0232 ]', path=path)
170 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[111, 3122], ipConstraint=
True, updateAllDaughters=
False, path=path)
175 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
176 [ daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane) < cosAngleBetweenMomentumAndVertexVectorInXYPlane ] and \
177 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.0 and \
178 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
184def stdOmega(fitter='TreeFit', path=None):
186 Reconstruct the standard :math:`\Omega^-` ``ParticleList`` named ``Omega-:std``.
188 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
191 fitter (str): specify either ``KFit`` or ``TreeFit``
for the vertex reconstructions (default ``TreeFit``)
192 path (basf2.Path): modules are added to this path building the ``Omega-:std`` list
196 stdLambdas(path=path)
201 '[ abs( dM ) < 0.0035 ] and \
202 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
203 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
204 [ daughter(0,protonID) > 0.01 ] and \
208 stdPi(
'all', path=path)
210 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
214 '[ abs( dM ) < 0.0035 ] and \
215 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
217 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
218 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
222 stdK(
'all', path=path)
225 kFit(
'Lambda0:reco', 0.0, fit_type=
'massvertex', path=path)
226 reconstructDecay(
'Omega-:reco -> Lambda0:reco K-:all',
'1.622 < M < 1.722', path=path)
227 kFit(
'Omega-:reco', conf_level=0.0, path=path)
228 elif fitter ==
'TreeFit':
229 reconstructDecay(
'Omega-:reco -> Lambda0:reco K-:all',
'1.622 < M < 1.722', path=path)
230 treeFit(
'Omega-:reco', conf_level=0.0, massConstraint=[3122], path=path)
232 B2ERROR(f
"stdOmega: invalid fitter ({fitter}). Choose from KFit or TreeFit")
238 '[ cosAngleBetweenMomentumAndVertexVector > 0.0] and \
239 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
240 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
241 [ chiProb > 0.0 ] and \
242 [ daughter(1,kaonID) > 0.01 ]',
250 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
251 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
252 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2 ]^[0.5])] and \
253 [ chiProb > 0.0 ] and \
254 [ daughter(1,atcPIDBelle(3,4)) > 0.2 and daughter(1,atcPIDBelle(3,2)) > 0.2 ]',
259def goodXi(xitype='loose', path=None):
261 Select the standard good :math:`\Xi^-` ``ParticleList`` named ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``
262 from the reconstructed ``Xi-:std``.
264 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
267 xitype (str): specify either ``veryloose``, ``loose``,
or ``tight``
for good ``ParticleList`` selection (default ``loose``)
268 path (basf2.Path): modules are added to this path building the ``Xi-:veryloose``, ``Xi-:loose``,
or ``Xi-:tight``, list
271 if not _std_hyperon_is_in_path(
"Xi-", path):
272 B2WARNING(
"Could not find standard Xi particle list! Creating it with default options.")
274 assert _std_hyperon_is_in_path(
"Xi-", path)
276 if xitype ==
'veryloose':
280 '[ daughter(1,pt) > 0.05 and \
281 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 ]',
285 elif xitype ==
'loose':
289 '[ daughter(1,pt) > 0.05 and \
290 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 and \
291 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
296 elif xitype ==
'tight':
300 '[ daughter(1,pt) > 0.1 and \
301 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
302 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
307 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi- list types!")
310def goodXi0(xitype='loose', path=None):
312 Select the standard good :math:`\Xi^0` ``ParticleList`` named ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``
313 from the reconstructed ``Xi0:std``.
315 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
318 xitype (str): specify either ``veryloose``, ``loose``,
or ``tight``
for good ``ParticleList`` selection (default ``loose``)
319 path (basf2.Path): modules are added to this path building the ``Xi0:veryloose``, ``Xi0:loose``,
or ``Xi0:tight``, list
322 if not _std_hyperon_is_in_path(
"Xi0", path):
323 B2WARNING(
"Could not find standard Xi0 particle list! Creating it with default options.")
325 assert _std_hyperon_is_in_path(
"Xi0", path)
327 if xitype ==
'veryloose':
332 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.25 and \
333 daughter(1,p) > 0.1 and \
334 abs( daughter(1,dM) ) < 0.0174 ]',
338 elif xitype ==
'loose':
343 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.5 and \
344 daughter(1,p) > 0.15 and \
345 abs( daughter(1,dM) ) < 0.0174 ]',
349 elif xitype ==
'tight':
354 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 1.4 and \
355 daughter(1,p) > 0.25 and \
356 abs( daughter(1,dM) ) < 0.0116 ]',
360 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi0 list types!")
363def goodOmega(omegatype='loose', path=None):
365 Select the standard good :math:`\Omega^-` ``ParticleList`` named ``Omega-:veryloose``, ``Omega-:loose``,
366 or ``Omega-:tight``
from the reconstructed ``Omega-:std``.
368 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
371 omegatype (str): specify either ``veryloose``, ``loose``,
or ``tight``
for good ``ParticleList`` selection
372 (default ``veryloose``)
373 path (basf2.Path): modules are added to this path building the ``Omega-:veryloose``, ``Omega-:loose``,
374 or ``Omega-:tight``, list
377 if not _std_hyperon_is_in_path(
"Omega-", path):
378 B2WARNING(
"Could not find standard Omega particle list! Creating it with default options.")
380 assert _std_hyperon_is_in_path(
"Omega-", path)
382 if omegatype ==
'veryloose':
386 '[ daughter(1,pt) > 0.15 and \
387 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.05 ]',
391 elif omegatype ==
'loose':
395 '[ daughter(1,pt) > 0.15 and \
396 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
397 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
402 elif omegatype ==
'tight':
406 '[ daughter(1,pt) > 0.3 and \
407 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
408 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
413 raise ValueError(f
"\"{omegatype}\" is none of the allowed Omega list types!")
416def _std_hyperon_is_in_path(hyperon, path):
418 Helper function to check if the std hyperon
is already
in the reconstruction path.
420 Checks whether there
is a ``PListCutAndCopy`` module
with the
421 ``outputListName``: ``<hyperon>:std``.
422 :param hyperon: One of [
"Xi-",
"Xi0",
"Omega-"]
423 :param path: Instance of basf2.Path
424 :returns: Boolean, whether ``PListCutAndCopy``
with ``outputListName`` ``<hyperon>:std`` was found
in path.
428 allowed_hyperons = {
"Xi-",
"Xi0",
"Omega-"}
429 if hyperon
not in allowed_hyperons:
431 f
"\"{hyperon}\" is not in list of hyperons that this function has been tested for ({allowed_hyperons})."
433 for module
in path.modules():
434 if (module.name() == f
"PListCutAndCopy_{hyperon}:std" or
435 module.name().split(
" -> ")[0] == f
"ParticleCombiner_{hyperon}:std"):