import xml.etree.ElementTree as ET
from particle import literals as lp
from matplotlib import pyplot as plt
from pathlib import Path
import chromo
from chromo.models import Pythia8
from chromo.util import _cached_data_dir
from chromo.kinematics import CenterOfMass, TeV
# HACK: ensure that Pythia8 data is downloaded without running Pythia8
= Path(_cached_data_dir(Pythia8._data_url)) pythia8_data
In a recent paper review, the question came up how many resonances there are which decay into two kaons. It is not easy to look this up somewhere. My solution was to extract the information in the following way from the Pythia8 decay database. I have to first get the database, which is in XML format. I parse the XML database and then go through all entries and isolate the particles which exclusively decay into two kaons.
# TODO: we should make this information accessible via the chromo API
= pythia8_data / "xmldoc" / "ParticleData.xml"
fn = ["<root>"]
lines with open(fn) as f:
for iline, line in enumerate(f.readlines()):
if iline < 166: continue
if "</chapter>" in line: break
lines.append(line)"</root>")
lines.append(
= ET.fromstring("".join(lines))
tree
= []
all_kk
= int(lp.K_plus.pdgid)
pid_k
for p in tree.findall("particle"):
for ch in p.findall("channel"):
= [int(x) for x in ch.attrib["products"].split()]
da if len(da) != 2: continue
if all(abs(pi) == pid_k for pi in da):
= p.attrib
pa "name"], float(pa["m0"]))) all_kk.append((pa[
The plot shows where the resonances are located in the invariant mass distribution. The y-axis has no meaning, it just separates the points vertically.
from cycler import cycler
from matplotlib.colors import TABLEAU_COLORS
= cycler(marker="osd") * cycler(color=TABLEAU_COLORS)
c
plt.gca().set_prop_cycle(c)
= 0
i for kk in sorted(all_kk, key=lambda x: x[1]):
1] * 1e3, i, label=kk[0])
plt.plot(kk[+=1
i=3)
plt.legend(ncol"mass / MeV$c^{-2}$"); plt.xlabel(
And here is a sorted list of the masses.
for kk in sorted(all_kk, key=lambda x:x[1]):
print(kk[0], kk[1] * 1e3)
a_0(980)0 983.5
f_0(980) 1000.0
phi 1019.46
f_2 1275.1
a_20 1318.3
f_0(1370) 1350.0
a_0(1450)0 1474.0
f'_2(1525) 1525.0
f_0(1710) 1720.0
rho(1700)0 1720.0
D0 1864.86
chi_0c 3414.75
chi_2c 3556.2
psi(2S) 3686.11
B0 5279.58
B_s0 5366.7699999999995