Skip to content

Commit

Permalink
FEAT: analyse second data file
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Sep 9, 2023
1 parent 0361cca commit df71242
Showing 1 changed file with 254 additions and 4 deletions.
258 changes: 254 additions & 4 deletions lecture2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "aacd8225-ff98-488c-a9d1-7c59e95076e7",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"R12 = 1.74\n",
"R23 = 1.53\n",
"R31 = 2.45"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -320,9 +338,15 @@
"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()"
]
Expand Down Expand Up @@ -417,7 +441,7 @@
"tags": []
},
"source": [
"The particle candidates for $R_{12}$, $R_{23}$, and $R_{31}$ are then:"
"The particle candidates for $R_{12} \\to \\eta\\pi^0$, $R_{23} \\to \\pi^0 p$, and $R_{31} \\to p\\eta$ are then:"
]
},
{
Expand All @@ -433,7 +457,7 @@
},
"outputs": [],
"source": [
"find_candidates(m12_mean, delta=0.01)"
"find_candidates(m=np.sqrt(R12), delta=0.01)"
]
},
{
Expand All @@ -449,7 +473,7 @@
},
"outputs": [],
"source": [
"find_candidates(m23_mean, delta=0.015)"
"find_candidates(m=np.sqrt(R23), delta=0.01)"
]
},
{
Expand All @@ -465,7 +489,233 @@
},
"outputs": [],
"source": [
"find_candidates(m31_mean, delta=0.01)"
"find_candidates(m=np.sqrt(R31), delta=0.01)"
]
},
{
"cell_type": "markdown",
"id": "4049d15e-cf9e-4161-b270-e06241ee0279",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"## `Three-particles-2.dat`"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "44163d03-d34f-4b5d-8fc0-1a73f718e363",
"metadata": {
"editable": true,
"mystnb": {
"code_prompt_show": "Load data"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-cell"
]
},
"outputs": [],
"source": [
"filename2 = gdown.cached_download(\n",
" url=\"https://indico.ific.uv.es/event/6803/contributions/21220/attachments/11209/15511/Three-particles-2.dat\",\n",
" path=\"data/Three-particles-2.dat\",\n",
" md5=\"831aee9fd925c43e8630edc6783ab28d\",\n",
" quiet=True,\n",
" verify=False,\n",
")\n",
"data2 = np.loadtxt(filename2)\n",
"pa, p1, p2, p3 = (data2[i::4].T for i in range(n_final_state + 1))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f14f0f0f-c2f2-47a5-9df4-c74ed1431802",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"p0 = p1 + p2 + p3\n",
"m0 = mass(p0)\n",
"print(f\"{m0.mean():.4g} +/- {m0.std():.4g}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3c53c8c1-bce8-4f47-b04c-fea311a36f23",
"metadata": {
"editable": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"from IPython.display import Math\n",
"\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}}\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0fad698b-3112-4329-9a08-b1062fff0ada",
"metadata": {
"editable": true,
"jupyter": {
"source_hidden": true
},
"mystnb": {
"code_prompt_show": "Identify final state particles"
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"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",
"\n",
"\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)"
]
},
{
"cell_type": "markdown",
"id": "f11fc1ae-7459-4ec7-8ce8-3acc737874e7",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"This is again a photon&nbsp;$\\gamma$ hitting a target that produces a meson&nbsp;$\\eta$, pion&nbsp;$\\pi^0$, and proton&nbsp;$p$."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b95b90b5-99da-4b8b-8aa6-8c4f1d285ee8",
"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": "5e93638b-fe9a-4ce8-8e3a-5f025a448378",
"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": "3d521919-c81d-4750-874c-81c459d9f130",
"metadata": {
"editable": true,
"jupyter": {
"source_hidden": true
},
"slideshow": {
"slide_type": ""
},
"tags": [
"hide-input",
"full-width"
]
},
"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()"
]
}
],
Expand Down

0 comments on commit df71242

Please sign in to comment.