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, loadPhotonHadronicSplitOffMVA=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.
93 loadPhotonHadronicSplitOffMVA (bool): If true, photon candidates will be assigned a hadronic split-off probability.
102 '[ abs( dM ) < 0.0035 ] and \
103 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
104 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
105 [ daughter(0,protonID) > 0.01 ] and \
110 f
'pi0{gammatype}_May2020',
112 loadPhotonBeamBackgroundMVA=loadPhotonBeamBackgroundMVA,
113 loadPhotonHadronicSplitOffMVA=loadPhotonHadronicSplitOffMVA)
114 reconstructDecay(f
'pi0:reco -> gamma:pi0{gammatype}_May2020 gamma:pi0{gammatype}_May2020',
115 'abs( dM ) < 0.0406',
123 '[ abs( dM ) < 0.0189 ] and \
124 [ [ daughter(0,clusterReg) == 1 and daughter(0,E) > 0.05 ] or [ daughter(0,clusterReg) == 3 and daughter(0,E) > 0.05 ] or \
125 [ daughter(0,clusterReg) == 2 and daughter(0,E) > 0.03 ] ] and \
126 [ [ daughter(1,clusterReg) == 1 and daughter(1,E) > 0.05 ] or [ daughter(1,clusterReg) == 3 and daughter(1,E) > 0.05 ] or \
127 [ daughter(1,clusterReg) == 2 and daughter(1,E) > 0.03 ] ]',
129 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
133 '[ abs( dM ) < 0.0035 ] and \
134 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
136 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
137 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
142 'Xi0:prelim -> Lambda0:reco pi0:reco',
145 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[3122], ipConstraint=
True, updateAllDaughters=
True, path=path)
148 applyCuts(
'Xi0:prelim',
'[ abs( daughter(1,dM) ) < 0.0232 ]', path=path)
149 treeFit(
'Xi0:prelim', conf_level=0.0, massConstraint=[111, 3122], ipConstraint=
True, updateAllDaughters=
False, path=path)
154 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
155 [ daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane) < cosAngleBetweenMomentumAndVertexVectorInXYPlane ] and \
156 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.0 and \
157 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
163 def stdOmega(fitter='TreeFit', path=None):
165 Reconstruct the standard :math:`\Omega^-` ``ParticleList`` named ``Omega-:std``.
167 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
170 fitter (str): specify either ``KFit`` or ``TreeFit`` for the vertex reconstructions (default ``TreeFit``)
171 path (basf2.Path): modules are added to this path building the ``Omega-:std`` list
175 stdLambdas(path=path)
180 '[ abs( dM ) < 0.0035 ] and \
181 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
182 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.35 ] and \
183 [ daughter(0,protonID) > 0.01 ] and \
187 stdPi(
'all', path=path)
189 kFit(
'Lambda0:mdst', conf_level=0.0, path=path)
193 '[ abs( dM ) < 0.0035 ] and \
194 [ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
196 [ daughter(0,atcPIDBelle(4,3)) > 0.2 ] and \
197 [ daughter(0,atcPIDBelle(4,2)) > 0.2 ] and \
201 stdK(
'all', path=path)
204 kFit(
'Lambda0:reco', 0.0, fit_type=
'massvertex', path=path)
205 reconstructDecay(
'Omega-:reco -> Lambda0:reco K-:all',
'1.622 < M < 1.722', path=path)
206 kFit(
'Omega-:reco', conf_level=0.0, path=path)
207 elif fitter ==
'TreeFit':
208 reconstructDecay(
'Omega-:reco -> Lambda0:reco K-:all',
'1.622 < M < 1.722', path=path)
209 treeFit(
'Omega-:reco', conf_level=0.0, massConstraint=[3122], path=path)
211 B2ERROR(f
"stdOmega: invalid fitter ({fitter}). Choose from KFit or TreeFit")
217 '[ cosAngleBetweenMomentumAndVertexVector > 0.0] and \
218 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
219 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2]^[0.5])] and \
220 [ chiProb > 0.0 ] and \
221 [ daughter(1,kaonID) > 0.01 ]',
229 '[ cosAngleBetweenMomentumAndVertexVector > 0.0 ] and \
230 [ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0. and \
231 formula([dr^2 + dz^2]^[0.5])<formula([daughter(0,dr)^2 + daughter(0,dz)^2 ]^[0.5])] and \
232 [ chiProb > 0.0 ] and \
233 [ daughter(1,atcPIDBelle(3,4)) > 0.2 and daughter(1,atcPIDBelle(3,2)) > 0.2 ]',
238 def goodXi(xitype='loose', path=None):
240 Select the standard good :math:`\Xi^-` ``ParticleList`` named ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``
241 from the reconstructed ``Xi-:std``.
243 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
246 xitype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection (default ``loose``)
247 path (basf2.Path): modules are added to this path building the ``Xi-:veryloose``, ``Xi-:loose``, or ``Xi-:tight``, list
250 if not _std_hyperon_is_in_path(
"Xi-", path):
251 B2WARNING(
"Could not find standard Xi particle list! Creating it with default options.")
253 assert _std_hyperon_is_in_path(
"Xi-", path)
255 if xitype ==
'veryloose':
259 '[ daughter(1,pt) > 0.05 and \
260 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 ]',
264 elif xitype ==
'loose':
268 '[ daughter(1,pt) > 0.05 and \
269 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.1 and \
270 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
275 elif xitype ==
'tight':
279 '[ daughter(1,pt) > 0.1 and \
280 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
281 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
286 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi- list types!")
289 def goodXi0(xitype='loose', path=None):
291 Select the standard good :math:`\Xi^0` ``ParticleList`` named ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``
292 from the reconstructed ``Xi0:std``.
294 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
297 xitype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection (default ``loose``)
298 path (basf2.Path): modules are added to this path building the ``Xi0:veryloose``, ``Xi0:loose``, or ``Xi0:tight``, list
301 if not _std_hyperon_is_in_path(
"Xi0", path):
302 B2WARNING(
"Could not find standard Xi0 particle list! Creating it with default options.")
304 assert _std_hyperon_is_in_path(
"Xi0", path)
306 if xitype ==
'veryloose':
311 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.25 and \
312 daughter(1,p) > 0.1 and \
313 abs( daughter(1,dM) ) < 0.0174 ]',
317 elif xitype ==
'loose':
322 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.5 and \
323 daughter(1,p) > 0.15 and \
324 abs( daughter(1,dM) ) < 0.0174 ]',
328 elif xitype ==
'tight':
333 '[ formula( [ dr^2 + dz^2 ]^[0.5] ) > 1.4 and \
334 daughter(1,p) > 0.25 and \
335 abs( daughter(1,dM) ) < 0.0116 ]',
339 raise ValueError(f
"\"{xitype}\" is none of the allowed Xi0 list types!")
342 def goodOmega(omegatype='loose', path=None):
344 Select the standard good :math:`\Omega^-` ``ParticleList`` named ``Omega-:veryloose``, ``Omega-:loose``,
345 or ``Omega-:tight`` from the reconstructed ``Omega-:std``.
347 .. seealso:: `BELLE2-NOTE-PH-2019-011 <https://docs.belle2.org/record/BELLE2-NOTE-PH-2019-011.pdf>`_.
350 omegatype (str): specify either ``veryloose``, ``loose``, or ``tight`` for good ``ParticleList`` selection
351 (default ``veryloose``)
352 path (basf2.Path): modules are added to this path building the ``Omega-:veryloose``, ``Omega-:loose``,
353 or ``Omega-:tight``, list
356 if not _std_hyperon_is_in_path(
"Omega-", path):
357 B2WARNING(
"Could not find standard Omega particle list! Creating it with default options.")
359 assert _std_hyperon_is_in_path(
"Omega-", path)
361 if omegatype ==
'veryloose':
365 '[ daughter(1,pt) > 0.15 and \
366 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.05 ]',
370 elif omegatype ==
'loose':
374 '[ daughter(1,pt) > 0.15 and \
375 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
376 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
381 elif omegatype ==
'tight':
385 '[ daughter(1,pt) > 0.3 and \
386 formula( [ dr^2 + dz^2 ]^[0.5] ) > 0.15 and \
387 formula([daughter(0,cosAngleBetweenMomentumAndVertexVectorInXYPlane)/cosAngleBetweenMomentumAndVertexVectorInXYPlane])\
392 raise ValueError(f
"\"{omegatype}\" is none of the allowed Omega list types!")
395 def _std_hyperon_is_in_path(hyperon, path):
397 Helper function to check if the std hyperon is already in the reconstruction path.
399 Checks whether there is a ``PListCutAndCopy`` module with the
400 ``outputListName``: ``<hyperon>:std``.
401 :param hyperon: One of ["Xi-", "Xi0", "Omega-"]
402 :param path: Instance of basf2.Path
403 :returns: Boolean, whether ``PListCutAndCopy`` with ``outputListName`` ``<hyperon>:std`` was found in path.
407 allowed_hyperons = {
"Xi-",
"Xi0",
"Omega-"}
408 if hyperon
not in allowed_hyperons:
410 f
"\"{hyperon}\" is not in list of hyperons that this function has been tested for ({allowed_hyperons})."
412 for module
in path.modules():
413 if (module.name() == f
"PListCutAndCopy_{hyperon}:std" or
414 module.name().split(
" -> ")[0] == f
"ParticleCombiner_{hyperon}:std"):