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", addSuffix=False, path=None):
23 Reconstruct the standard :math:`\Xi^-` ``ParticleList`` named ``Xi-:std`` by default.
24 If ``addSuffix`` is set to True, then a suffix of form ``_<fitter>`` is added
25 depending on the chosen fitter.
27 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
30 fitter (str): specify either ``KFit`` or ``TreeFit`` for the vertex reconstructions (default ``TreeFit``)
31 addSuffix (bool): whether to add a suffix of form ``_<fitter>`` to the ParticleList name
32 depending on the chosen fitter
33 path (basf2.Path): modules are added to this path building the ``Xi-:std`` list
40 stdLambdas(path=path, addSuffix=addSuffix)
43 f
"Lambda0:reco{suffix}",
44 f
"Lambda0:merged{suffix}",
45 "[ abs( dM ) < 0.0035 ] and \
46 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
47 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
48 [ daughter(0,protonID) > 0.01 ] and \
54 stdPi(
'all', path=path)
56 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
58 f
"Lambda0:reco{suffix}",
60 "[ abs( dM ) < 0.0035 ] and \
61 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
63 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
64 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
72 kFit(f
"Lambda0:reco{suffix}", 0.0, fit_type=
"massvertex", path=path)
74 f
"Xi-:reco{suffix} -> Lambda0:reco{suffix} pi-:all",
78 kFit(f
"Xi-:reco{suffix}", conf_level=0.0, path=path)
79 elif fitter ==
"TreeFit":
81 f
"Xi-:reco{suffix} -> Lambda0:reco{suffix} pi-:all",
85 treeFit(f
"Xi-:reco{suffix}", conf_level=0.0, massConstraint=[3122], path=path)
87 B2ERROR(f
"stdXi: invalid fitter ({fitter}). Choose from KFit or TreeFit")
92 "[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
93 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
94 formula([dr^2 + dz^2 ]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
101def stdXi0(gammatype='eff40', beamBackgroundMVAWeight="", fakePhotonMVAWeight="", biasCorrectionTable="", path=None):
103 Reconstruct the standard :math:`\Xi^0` ``ParticleList`` named ``Xi0:std``.
105 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
108 gammatype (str): specify either ``eff60``, ``eff50``, ``eff40``, ``eff30``, or ``eff20``
109 to select the signal efficiency of the photons used in the pi0 reconstruction
112 beamBackgroundMVAWeight (str): type of weight file for beam background MVA; if empty, beam background MVA will not be used
116 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
117 for information on the beam background MVA.
119 fakePhotonMVAWeight (str): type of weight file for fake photon MVA; if empty, fake photon MVA will not be used
123 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
124 for information on the fake photon MVA.
126 biasCorrectionTable (str): correction table for the photon energy bias correction (should only be applied to data)
130 `Neutrals Performance XWiki page <https://xwiki.desy.de/xwiki/rest/p/e23c8>`_
131 for information on the names of available correction tables.
133 path (basf2.Path): modules are added to this path building the ``Xi0:std`` list
137 stdLambdas(path=path)
142 '[ abs( dM ) < 0.0035 ] and \
143 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
144 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
145 [ daughter(0,protonID) > 0.01 ] and \
150 f
'pi0{gammatype}_May2020',
152 beamBackgroundMVAWeight=beamBackgroundMVAWeight,
153 fakePhotonMVAWeight=fakePhotonMVAWeight,
154 biasCorrectionTable=biasCorrectionTable)
155 reconstructDecay(f
'pi0:reco -> gamma:pi0{gammatype}_May2020 gamma:pi0{gammatype}_May2020',
156 'abs( dM ) < 0.0406',
164 '[ abs( dM ) < 0.0189 ] and \
165 [ [ daughter(0,clusterReg) == 1 and daughter(0,E) > 0.05 ] or [ daughter(0,clusterReg) == 3 and daughter(0,E) > 0.05 ] or \
166 [ daughter(0,clusterReg) == 2 and daughter(0,E) > 0.03 ] ] and \
167 [ [ daughter(1,clusterReg) == 1 and daughter(1,E) > 0.05 ] or [ daughter(1,clusterReg) == 3 and daughter(1,E) > 0.05 ] or \
168 [ daughter(1,clusterReg) == 2 and daughter(1,E) > 0.03 ] ]',
170 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
174 '[ abs( dM ) < 0.0035 ] and \
175 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
177 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
178 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
183 'Xi0:prelim -> Lambda0:reco pi0:reco',
186 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[3122], ipConstraint=
True, updateAllDaughters=
True, path=path)
189 applyCuts(
'Xi0:prelim',
'[ abs( daughter(1,dM) ) < 0.0232 ]', path=path)
190 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[111, 3122], ipConstraint=
True, updateAllDaughters=
False, path=path)
195 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
196 [ daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane) < cosAngleBetweenMomentumAndVertexVectorInXYPlane ] and \
197 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.0 and \
198 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
204def stdOmega(fitter="TreeFit", addSuffix=False, path=None):
206 Reconstruct the standard :math:`\Omega^-` ``ParticleList`` named ``Omega-:std``.
207 If ``addSuffix`` is set to True, then a suffix of form ``_<fitter>`` is added
208 depending on the chosen fitter.
210 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
213 fitter (str): specify either ``KFit`` or ``TreeFit`` for the vertex reconstructions (default ``TreeFit``)
214 addSuffix (bool): whether to add a suffix of form ``_<fitter>`` to the ParticleList name
215 depending on the chosen fitter
216 path (basf2.Path): modules are added to this path building the ``Omega-:std`` list
221 suffix = f
"_{fitter}"
223 stdLambdas(path=path, addSuffix=addSuffix)
226 f
"Lambda0:reco{suffix}",
227 f
"Lambda0:merged{suffix}",
228 "[ abs( dM ) < 0.0035 ] and \
229 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
230 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
231 [ daughter(0,protonID) > 0.01 ] and \
237 stdPi(
'all', path=path)
239 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
241 f
"Lambda0:reco{suffix}",
243 "[ abs( dM ) < 0.0035 ] and \
244 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
246 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
247 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
253 stdK(
'all', path=path)
256 kFit(f
"Lambda0:reco{suffix}", 0.0, fit_type=
"massvertex", path=path)
258 f
"Omega-:reco{suffix} -> Lambda0:reco{suffix} K-:all",
"1.622 < M < 1.722", path=path
260 kFit(f
"Omega-:reco{suffix}", conf_level=0.0, path=path)
261 elif fitter ==
"TreeFit":
263 f
"Omega-:reco{suffix} -> Lambda0:reco{suffix} K-:all",
"1.622 < M < 1.722", path=path
265 treeFit(f
"Omega-:reco{suffix}", conf_level=0.0, massConstraint=[3122], path=path)
267 B2ERROR(f
"stdOmega: invalid fitter ({fitter}). Choose from KFit or TreeFit")
271 f
"Omega-:std{suffix}",
272 f
"Omega-:reco{suffix}",
273 "[ cosAngleBetweenMomentumAndVertexVector > 0.0] and \
274 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
275 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
276 [ chiProb > 0.0 ] and \
277 [ daughter(1,kaonID) > 0.01 ]",
284 f
"Omega-:std{suffix}",
285 f
"Omega-:reco{suffix}",
286 "[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
287 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
288 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2 ]^[0.5])] and \
289 [ chiProb > 0.0 ] and \
290 [ daughter(1,atcPIDBelle(3,4)) > 0.2 and daughter(1,atcPIDBelle(3,2)) > 0.2 ]",
296def goodXi(xitype='loose', path=None):
298 Select the standard good :math:`\Xi^-` ``ParticleList`` named ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``
299 from the reconstructed ``Xi-:std``.
301 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
304 xitype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection (default ``loose``)
305 path (basf2.Path): modules are added to this path building the ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``, list
308 if not _std_hyperon_is_in_path(
"Xi-", path):
309 B2WARNING(
"Could not find standard Xi particle list! Creating it with default options.")
311 assert _std_hyperon_is_in_path(
"Xi-", path)
313 if xitype ==
'veryloose':
317 '[ daughter(1,pt) > 0.05 and \
318 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 ]',
322 elif xitype ==
'loose':
326 '[ daughter(1,pt) > 0.05 and \
327 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 and \
328 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
333 elif xitype ==
'tight':
337 '[ daughter(1,pt) > 0.1 and \
338 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
339 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
344 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi- list types!")
347def goodXi0(xitype='loose', path=None):
349 Select the standard good :math:`\Xi^0` ``ParticleList`` named ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``
350 from the reconstructed ``Xi0:std``.
352 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
355 xitype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection (default ``loose``)
356 path (basf2.Path): modules are added to this path building the ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``, list
359 if not _std_hyperon_is_in_path(
"Xi0", path):
360 B2WARNING(
"Could not find standard Xi0 particle list! Creating it with default options.")
362 assert _std_hyperon_is_in_path(
"Xi0", path)
364 if xitype ==
'veryloose':
369 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.25 and \
370 daughter(1,p) > 0.1 and \
371 abs( daughter(1,dM) ) < 0.0174 ]',
375 elif xitype ==
'loose':
380 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.5 and \
381 daughter(1,p) > 0.15 and \
382 abs( daughter(1,dM) ) < 0.0174 ]',
386 elif xitype ==
'tight':
391 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 1.4 and \
392 daughter(1,p) > 0.25 and \
393 abs( daughter(1,dM) ) < 0.0116 ]',
397 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi0 list types!")
400def goodOmega(omegatype='loose', path=None):
402 Select the standard good :math:`\Omega^-` ``ParticleList`` named ``Omega-:veryloose``, ``Omega-:loose``,
403 or ``Omega-:tight`` from the reconstructed ``Omega-:std``.
405 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
408 omegatype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection
409 (default ``veryloose``)
410 path (basf2.Path): modules are added to this path building the ``Omega-:veryloose``, ``Omega-:loose``,
411 or ``Omega-:tight``, list
414 if not _std_hyperon_is_in_path(
"Omega-", path):
415 B2WARNING(
"Could not find standard Omega particle list! Creating it with default options.")
417 assert _std_hyperon_is_in_path(
"Omega-", path)
419 if omegatype ==
'veryloose':
423 '[ daughter(1,pt) > 0.15 and \
424 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.05 ]',
428 elif omegatype ==
'loose':
432 '[ daughter(1,pt) > 0.15 and \
433 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
434 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
439 elif omegatype ==
'tight':
443 '[ daughter(1,pt) > 0.3 and \
444 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
445 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
450 raise ValueError(f
"\"{omegatype}\" is none of the allowed Omega list types!")
453def _std_hyperon_is_in_path(hyperon, path):
455 Helper function to check if the std hyperon is already in the reconstruction path.
457 Checks whether there is a ``PListCutAndCopy`` module with the
458 ``outputListName``: ``<hyperon>:std``.
459 :param hyperon: One of ["Xi-", "Xi0", "Omega-"]
460 :param path: Instance of basf2.Path
461 :returns: Boolean, whether ``PListCutAndCopy`` with ``outputListName`` ``<hyperon>:std`` was found in path.
465 allowed_hyperons = {
"Xi-",
"Xi0",
"Omega-"}
466 if hyperon
not in allowed_hyperons:
468 f
"\"{hyperon}\" is not in list of hyperons that this function has been tested for ({allowed_hyperons})."
470 for module
in path.modules():
471 if (module.name() == f
"PListCutAndCopy_{hyperon}:std" or
472 module.name().split(
" -> ")[0] == f
"ParticleCombiner_{hyperon}:std"):