diff --git a/docs/lecture11.ipynb b/docs/lecture11.ipynb new file mode 100644 index 0000000..8bc0638 --- /dev/null +++ b/docs/lecture11.ipynb @@ -0,0 +1,394 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "087f68c1-f88d-43b6-9494-26da5bc621ca", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + "# Lecture 11 Helicity Formalism\n", + "The example `Three-particles-3.dat` in lecture 11\n", + "based on [Lecture 11](https://indico.ific.uv.es/event/6803/contributions/21223) by Vincent Mathieu " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "2b01c249-f183-4faf-9ccd-d6069f678467", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input", + "remove-output" + ] + }, + "outputs": [], + "source": [ + "%pip install -q gdown matplotlib numpy particle" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3e1d9835-1f27-4dcf-b359-3937ec89236b", + "metadata": { + "editable": true, + "jupyter": { + "source_hidden": true + }, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-cell" + ] + }, + "outputs": [], + "source": [ + "from __future__ import annotations\n", + "\n", + "import warnings\n", + "\n", + "import gdown\n", + "import numpy as np\n", + "from IPython.display import display\n", + "\n", + "warnings.filterwarnings(\"ignore\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "62d3b045-8dab-4e5a-92d7-07d2d5af4c79", + "metadata": { + "editable": true, + "jupyter": { + "source_hidden": true + }, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "filename = gdown.cached_download(\n", + " url=\"https://indico.ific.uv.es/event/6803/contributions/21223/attachments/11221/15563/Three-particles-3.dat\",\n", + " path=\"data/Three-particles-3.dat\",\n", + " md5=\"75fedf381f9b62d3210ff200fc63165f\",\n", + " quiet=True,\n", + " verify=False,\n", + ")\n", + "data = np.loadtxt(filename)\n", + "data.shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "166252ab-57a2-4628-88e1-32ab8f354f89", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "data" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adfe5fbb-ab7b-41b2-8a8c-8f0bac0ce009", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "n_final_state = 3\n", + "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" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d10177c3-02c4-4248-8d0e-181a28453be5", + "metadata": {}, + "outputs": [], + "source": [ + "def mass(p: np.ndarray) -> np.ndarray:\n", + " return np.sqrt(mass_squared(p))\n", + "\n", + "\n", + "def mass_squared(p: np.ndarray) -> np.ndarray:\n", + " return p[0] ** 2 - np.sum(p[1:] ** 2, axis=0)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "adc55b5b-8490-4587-b468-848b32873eee", + "metadata": {}, + "outputs": [], + "source": [ + "m0 = mass(p0)\n", + "print(f\"{m0.mean():.4g} +/- {m0.std():.4g}\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "59a10ead-6653-4344-ab55-f85f2f8fbbde", + "metadata": {}, + "outputs": [], + "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}}\"))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b63474a3-8445-49dc-97b8-20c3935853ce", + "metadata": {}, + "outputs": [], + "source": [ + "from particle import Particle\n", + "\n", + "\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 False\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", + "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", + ")" + ] + }, + { + "cell_type": "markdown", + "id": "24fce750-e6d7-40f1-9e24-dec0d85fc7b8", + "metadata": {}, + "source": [ + "a photon $\\gamma$ hitting a proton $p$ and producing a meson $\\eta$, pion $\\pi^0$, and proton $p$." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "376674d5-3bd0-458b-b5d8-3cc356c42f31", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "s12 = mass_squared(p1 + p2)\n", + "s23 = mass_squared(p2 + p3)\n", + "s31 = mass_squared(p3 + p1)\n", + "\n", + "m12 = mass(p1 + p2)\n", + "m23 = mass(p2 + p3)\n", + "m31 = mass(p3 + p1)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "dcef09fd-7994-4302-9e08-70b9950f9b84", + "metadata": { + "editable": true, + "jupyter": { + "source_hidden": true + }, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "import matplotlib.pyplot as plt\n", + "\n", + "fig, ax = plt.subplots()\n", + "fig.suptitle(\"Dalitz plot – 2D histogram\")\n", + "ax.hist2d(s12, s23, bins=100, cmin=1)\n", + "ax.set_xlabel(R\"$s_{12}\\;\\left[\\mathrm{GeV}^2\\right]$\")\n", + "ax.set_ylabel(R\"$s_{23}\\;\\left[\\mathrm{GeV}^2\\right]$\")\n", + "# fig.tight_layout()\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "3da3dd63-d9e1-4603-8167-2298619062e6", + "metadata": {}, + "outputs": [], + "source": [ + "R12 = 1.74\n", + "R23 = 1.53\n", + "R31 = 2.45" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9f8606f4-c64f-4f68-b88f-80f8de58b707", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "fig, (ax1, ax2) = plt.subplots(figsize=(10, 4), ncols=2)\n", + "fig.suptitle(\"Dalitz plot – scatter plot\")\n", + "ax1.scatter(s12, s23, c=\"black\", s=1e-3)\n", + "ax1.set_xlabel(R\"$s_{12}\\;\\left[\\mathrm{GeV}^2\\right]$\")\n", + "ax1.set_ylabel(R\"$s_{23}\\;\\left[\\mathrm{GeV}^2\\right]$\")\n", + "ax1.axvline(R12, c=\"C0\", ls=\"dashed\", label=\"$R_{12}$\")\n", + "ax1.axhline(R23, c=\"C1\", ls=\"dashed\", label=\"$R_{23}$\")\n", + "ax1.legend()\n", + "ax2.scatter(s31, s12, c=\"black\", s=1e-3)\n", + "ax2.set_xlabel(R\"$s_{31}\\;\\left[\\mathrm{GeV}^2\\right]$\")\n", + "ax2.set_ylabel(R\"$s_{12}\\;\\left[\\mathrm{GeV}^2\\right]$\")\n", + "ax2.axvline(R31, c=\"C2\", ls=\"dashed\", label=\"$R_{31}$\")\n", + "ax2.axhline(R12, c=\"C0\", ls=\"dashed\", label=\"$R_{12}$\")\n", + "ax2.legend()\n", + "fig.tight_layout()\n", + "plt.show()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "95aa6945-6427-42ee-8105-9e600b193d03", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [ + "full-width", + "hide-input" + ] + }, + "outputs": [], + "source": [ + "fig, (ax1, ax2, ax3) = plt.subplots(figsize=(12, 4), ncols=3)\n", + "fig.suptitle(\"1D histogram of $s_{12}, s_{23}$, and $s_{31}$\")\n", + "ax1.hist(s12, bins=100, color=\"black\", histtype=\"step\")\n", + "ax1.set_xlabel(R\"$s_{12}$\")\n", + "ax1.set_ylabel(\"counts\")\n", + "ax1.axvline(R12, c=\"C0\", ls=\"dashed\", label=\"$R_{12}$\")\n", + "ax1.legend()\n", + "\n", + "ax2.hist(s23, bins=100, color=\"black\", histtype=\"step\")\n", + "ax2.set_xlabel(R\"$s_{23}$\")\n", + "ax2.set_ylabel(\"counts\")\n", + "ax2.axvline(R23, c=\"C1\", ls=\"dashed\", label=\"$R_{23}$\")\n", + "ax2.legend()\n", + "\n", + "ax3.hist(s31, bins=100, color=\"black\", histtype=\"step\")\n", + "ax3.set_xlabel(R\"$s_{31}$\")\n", + "ax3.set_ylabel(\"counts\")\n", + "ax3.axvline(R31, c=\"C2\", ls=\"dashed\", label=\"$R_{31}$\")\n", + "ax3.legend()\n", + "\n", + "fig.tight_layout()\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "id": "360f674e-801c-4fda-aa3a-e57595e0da44", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + "The intensity of band seems stronger Compare to `Three-particles-1.dat` and `Three-particles-2.dat` in {doc}`lecture02`, but needded further analysis for the modulations." + ] + } + ], + "metadata": { + "colab": { + "toc_visible": true + }, + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}