diff --git a/.vscode/extensions.json b/.vscode/extensions.json index f57b991..ee5a6b4 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -4,6 +4,7 @@ "editorconfig.editorconfig", "esbenp.prettier-vscode", "executablebookproject.myst-highlight", + "github.vscode-github-actions", "github.vscode-pull-request-github", "mhutchie.git-graph", "ms-python.python", diff --git a/lecture2.ipynb b/lecture2.ipynb index 474da2f..508a318 100644 --- a/lecture2.ipynb +++ b/lecture2.ipynb @@ -111,7 +111,9 @@ "outputs": [], "source": [ "n_final_state = 3\n", - "pa, p1, p2, p3 = (data[i::4].T for i in range(n_final_state + 1))" + "pa, p1, p2, p3 = (data[i::4].T for i in range(n_final_state + 1))\n", + "p0 = p1 + p2 + p3\n", + "pb = p0 - pa" ] }, { @@ -120,6 +122,9 @@ "id": "a0b70dc7-a087-4b43-a08c-f48840a2c6a3", "metadata": { "editable": true, + "jupyter": { + "source_hidden": true + }, "slideshow": { "slide_type": "" }, @@ -135,7 +140,6 @@ " return p[0] ** 2 - np.sum(p[1:] ** 2, axis=0)\n", "\n", "\n", - "p0 = p1 + p2 + p3\n", "m0 = mass(p0)\n", "print(f\"{m0.mean():.4g} +/- {m0.std():.4g}\")" ] @@ -160,10 +164,10 @@ "source": [ "from IPython.display import Math\n", "\n", + "display(Math(Rf\"m_a = {mass(pa).mean():.3g}\\text{{ GeV}}\"))\n", + "display(Math(Rf\"m_b = {mass(pb).mean():.3g}\\text{{ GeV}}\"))\n", "for i, p in enumerate([p0, p1, p2, p3]):\n", - " display(Math(Rf\"m_{i} = {mass(p).mean():.3g}\\text{{ GeV}}\"))\n", - "\n", - "display(Math(Rf\"m_{{a}} = {mass(pa).mean():.3g}\\text{{ GeV}}\"))" + " display(Math(Rf\"m_{i} = {mass(p).mean():.3g}\\text{{ GeV}}\"))" ] }, { @@ -190,17 +194,35 @@ "from particle import Particle\n", "\n", "\n", - "def find_candidates(m: float, delta: float = 0.001) -> list[Particle]:\n", - " return Particle.findall(lambda p: (m - delta) < 1e-3 * p.mass < (m + delta))\n", + "def find_candidates(\n", + " mass: float, delta: float = 0.001, charge: float | None = None\n", + ") -> list[Particle]:\n", + " def identify(p) -> bool:\n", + " if p.pdgid in {21}:\n", + " return\n", + " if charge is not None and p.charge != charge:\n", + " return False\n", + " if (mass - delta) < 1e-3 * p.mass < (mass + delta):\n", + " return True\n", + " return False\n", "\n", + " return Particle.findall(identify)\n", "\n", + "\n", + "ma = mass(pa).mean()\n", + "mb = mass(pb).mean()\n", "m1 = mass(p1).mean()\n", "m2 = mass(p2).mean()\n", "m3 = mass(p3).mean()\n", - "particles = tuple(find_candidates(m.mean())[0] for m in [m1, m2, m3])\n", - "\n", - "src = R\"\\text{Final state: }\" + \", \".join(f\"{p.latex_name}\" for p in particles)\n", - "Math(src)" + "initial_state = (\n", + " find_candidates(ma.mean(), delta=1e-4)[0],\n", + " find_candidates(mb.mean())[0],\n", + ")\n", + "final_state = tuple(find_candidates(m.mean())[0] for m in [m1, m2, m3])\n", + "display(\n", + " Math(R\"\\text{Incoming: }\" + \", \".join(f\"{p.latex_name}\" for p in initial_state)),\n", + " Math(R\"\\text{Outgoing: }\" + \", \".join(f\"{p.latex_name}\" for p in final_state)),\n", + ")" ] }, { @@ -214,7 +236,7 @@ "tags": [] }, "source": [ - "So this is probably some photon $\\gamma$ hitting a target that produces a meson $\\eta$, pion $\\pi^0$, and proton $p$." + "So this is a photon $\\gamma$ hitting a proton $p$ and producing a meson $\\eta$, pion $\\pi^0$, and proton $p$." ] }, { @@ -457,7 +479,7 @@ }, "outputs": [], "source": [ - "find_candidates(m=np.sqrt(R12), delta=0.01)" + "find_candidates(mass=np.sqrt(R12), delta=0.01, charge=0)" ] }, { @@ -473,7 +495,7 @@ }, "outputs": [], "source": [ - "find_candidates(m=np.sqrt(R23), delta=0.01)" + "find_candidates(mass=np.sqrt(R23), delta=0.01, charge=+1)" ] }, { @@ -489,7 +511,7 @@ }, "outputs": [], "source": [ - "find_candidates(m=np.sqrt(R31), delta=0.01)" + "find_candidates(mass=np.sqrt(R31), delta=0.01, charge=+1)" ] }, {