Projektpraktikum/notebooks/trackinglosses_photons.ipynb

522 lines
72 KiB
Plaintext
Raw Normal View History

2024-01-19 11:22:15 +01:00
{
"cells": [
{
"cell_type": "code",
2024-02-08 17:43:22 +01:00
"execution_count": 1,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [],
"source": [
"import uproot\t\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from mpl_toolkits import mplot3d\n",
"import awkward as ak\n",
"from scipy.optimize import curve_fit\n",
2024-02-04 16:56:05 +01:00
"import mplhep\n",
"mplhep.style.use([\"LHCbTex2\"])\n",
"\n",
"plt.rcParams[\"savefig.dpi\"] = 600\n",
2024-01-19 11:22:15 +01:00
"%matplotlib inline"
]
},
{
"cell_type": "code",
2024-02-08 17:43:22 +01:00
"execution_count": 2,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [],
"source": [
2024-02-05 15:44:27 +01:00
"file = uproot.open(\n",
" \"/work/cetin/Projektpraktikum/trackinglosses_B_photon_cuts.root\")\n",
2024-01-19 11:22:15 +01:00
"\n",
"# selektiere nur elektronen von B->K*ee\n",
"allcolumns = []\n",
"for i in range(11):\n",
2024-02-04 16:56:05 +01:00
" allcolumns.append(file[\"Tree\" + str(i)].arrays())"
2024-01-19 11:22:15 +01:00
]
},
{
"cell_type": "code",
2024-02-08 17:43:22 +01:00
"execution_count": 3,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<pre>{oneCut_event_id: 1,\n",
" oneCut_lost: False,\n",
" oneCut_rad_length_frac: 0.148,\n",
" oneCut_energy: 1.28e+04,\n",
" noneCut_brem_photons_pe: 1,\n",
" oneCut_brem_photons_pe: [7.42e+03],\n",
" noneCut_brem_vtx_x: 1,\n",
" oneCut_brem_vtx_x: [-3.61],\n",
" noneCut_brem_vtx_z: 1,\n",
" oneCut_brem_vtx_z: [35.6],\n",
" oneCut_photon_length: 1}\n",
"------------------------------------------\n",
"type: {\n",
" oneCut_event_id: int64,\n",
" oneCut_lost: bool,\n",
" oneCut_rad_length_frac: float64,\n",
" oneCut_energy: float64,\n",
" noneCut_brem_photons_pe: int32,\n",
" oneCut_brem_photons_pe: var * float64,\n",
" noneCut_brem_vtx_x: int32,\n",
" oneCut_brem_vtx_x: var * float64,\n",
" noneCut_brem_vtx_z: int32,\n",
" oneCut_brem_vtx_z: var * float64,\n",
" oneCut_photon_length: int64\n",
"}</pre>"
],
"text/plain": [
"<Record {oneCut_event_id: 1, ...} type='{oneCut_event_id: int64, oneCut_los...'>"
]
},
2024-02-08 17:43:22 +01:00
"execution_count": 3,
2024-01-19 11:22:15 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"allcolumns[1][1]"
]
},
{
"cell_type": "code",
2024-02-08 17:43:22 +01:00
"execution_count": 4,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [],
"source": [
"def cutdict():\n",
" basedict = {\n",
2024-02-04 16:56:05 +01:00
" \"0\": {},\n",
" \"1\": {},\n",
" \"2\": {},\n",
" \"3\": {},\n",
" \"4\": {},\n",
" \"5\": {},\n",
" \"6\": {},\n",
" \"7\": {},\n",
" \"8\": {},\n",
" \"9\": {},\n",
" \"10\": {},\n",
" }\n",
"\n",
2024-01-19 11:22:15 +01:00
" basedict[\"0\"] = \"no\"\n",
" basedict[\"1\"] = \"one\"\n",
" basedict[\"2\"] = \"two\"\n",
" basedict[\"3\"] = \"three\"\n",
" basedict[\"4\"] = \"four\"\n",
" basedict[\"5\"] = \"five\"\n",
" basedict[\"6\"] = \"six\"\n",
" basedict[\"7\"] = \"seven\"\n",
" basedict[\"8\"] = \"eight\"\n",
" basedict[\"9\"] = \"nine\"\n",
" basedict[\"10\"] = \"ten\"\n",
2024-02-04 16:56:05 +01:00
"\n",
2024-01-19 11:22:15 +01:00
" return basedict\n",
"\n",
2024-02-04 16:56:05 +01:00
"\n",
2024-01-19 11:22:15 +01:00
"Cuts = cutdict()"
]
},
{
"cell_type": "code",
2024-02-08 17:43:22 +01:00
"execution_count": 5,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [],
"source": [
2024-02-04 16:56:05 +01:00
"# electrons = []\n",
"# for jcut in range(11):\n",
"\n",
"jcut = 4 # cut 0.2*E\n",
"\n",
"energy_emissions = ak.ArrayBuilder()\n",
"\n",
"for jelec in range(ak.num(allcolumns[jcut], axis=0)):\n",
" energy_emissions.begin_record()\n",
" energy_emissions.field(\"lost\").boolean(\n",
2024-02-16 11:27:21 +01:00
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"lost\"])\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"rad_length_frac\").real(\n",
2024-02-16 11:27:21 +01:00
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"rad_length_frac\"])\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"energy\").real(\n",
2024-02-16 11:27:21 +01:00
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"energy\"])\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-04 16:56:05 +01:00
" tmp_velo = 0\n",
" tmp_richut = 0\n",
" tmp_neither = 0\n",
" tmp_velo_length = 0\n",
" tmp_richut_length = 0\n",
" tmp_neither_length = 0\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-04 16:56:05 +01:00
" for jphoton in range(\n",
2024-02-16 11:27:21 +01:00
" ak.num(\n",
" allcolumns[jcut][jelec][Cuts[str(jcut)] + \"Cut_\" +\n",
" \"brem_photons_pe\"],\n",
" axis=0,\n",
" )):\n",
" if (allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_vtx_z\",\n",
" jphoton] <= 770):\n",
" tmp_velo += allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" +\n",
" \"brem_photons_pe\", jphoton]\n",
2024-02-04 16:56:05 +01:00
" tmp_velo_length += 1\n",
2024-02-16 11:27:21 +01:00
" elif (allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_vtx_z\",\n",
" jphoton]\n",
" > 770) and (allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" +\n",
" \"brem_vtx_z\", jphoton] <= 2700):\n",
" tmp_richut += allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" +\n",
" \"brem_photons_pe\", jphoton]\n",
2024-02-04 16:56:05 +01:00
" tmp_richut_length += 1\n",
" else:\n",
2024-02-16 11:27:21 +01:00
" tmp_neither += allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" +\n",
" \"brem_photons_pe\", jphoton]\n",
2024-02-04 16:56:05 +01:00
" tmp_neither_length += 1\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"velo_length\").integer(tmp_velo_length)\n",
" energy_emissions.field(\"velo\").real(tmp_velo)\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"rich_length\").integer(tmp_richut_length)\n",
" energy_emissions.field(\"rich\").real(tmp_richut)\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"neither_length\").integer(tmp_neither_length)\n",
" energy_emissions.field(\"downstream\").real(tmp_neither)\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-16 11:27:21 +01:00
" energy_emissions.field(\"photon_length\").integer(tmp_richut_length +\n",
" tmp_velo_length)\n",
2024-02-04 16:56:05 +01:00
"\n",
2024-02-16 11:27:21 +01:00
" if ((tmp_velo == 0) and (tmp_richut == 0)\n",
" or (allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"energy\"] -\n",
" tmp_velo < 3000)):\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"quality\").integer(0)\n",
" else:\n",
" energy_emissions.field(\"quality\").integer(1)\n",
"\n",
" energy_emissions.end_record()\n",
"\n",
"energy_emissions = ak.Array(energy_emissions)\n",
"# electrons.append(energy_emissions)"
2024-01-19 11:22:15 +01:00
]
},
{
"cell_type": "code",
2024-02-08 17:43:22 +01:00
"execution_count": 6,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-02-16 11:27:21 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMEAAAOWCAYAAADm+IXMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACq5UlEQVR4nOz9zW8b6Z3vf3/KafyQHw5GKsmDAxgWkGaxfTazGKsoB8jyWGQn24lJqXeziEW2J4sbUGLR8h/QNtndBu5FJiblXgT35kik3duMSbmXAdJk2b2YVZolNWBDwAGaKjM4mGAwUd0LHzKiRD2SYhWl9wsgIpJXXfUtPXSsj77XVYbv+74AAAAAAACAc+xS0AUAAAAAAAAAZ40QDAAAAAAAAOceIRgAAAAAAADOPUIwAAAAAAAAnHuEYAAAAAAAADj3CMEAAAAAAABw7hGCAQAAAAAA4NwjBAMAAAAAAMC5RwgGAAAAAACAc48QDAAAAAAAAOceIRgAAAAAAADOPUIwAAAAAAAAnHuEYAAAAAAAADj3CMEAAAAAAABw7hGCAQAAAAAA4NwjBAMAAAAAAMC5RwgGAAAAAACAc48QDAAAAAAAAOceIRgAAAAAAADOPUIwAAAAAAAAnHuEYAAAAAAAADj3CMEAAAAAAABw7hGCASfkeZ7K5XLQZQAAAAAAgBMgBAN6cBxHhmH0fExMTMg0zaBLBAAAAAAAJ0AIBvTw4MGDA9+zLEvxeHyI1QAAAAAAgH4Zvu/7QRcBhInruopGoyqVSj07vizLkmVZwy8MAAAAAACcGiEYsEcmk1Gz2VSpVAq6FAAAAAAAMCDvBV0AECae56lYLBKAAQAAAABwzrAnGLBLey+wVColwzAUi8WUz+fleV6whQEAAAAAgL4QgqEvrusqkUioXC73NU8+n1cikdDExIQMw1A0GlUqlVK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z5o2uXLkyktcw6vVLXENYcA3hwDWEw6hfw6jXL3ENYcE1hAPXEA6jfg2jXr/ENYTFebiGH/zgB50sIygjF4Jtbm7KcRw1m015nqfvv/9eknT58mWZpinLsjQzM6OxsbGAKwUAAAAAAEBYjEQI9uzZM1UqFa2trcnzvGMdY1mW4vG4UqmUbt68ebYFAgAAAAAAINRCHYI9efJEuVxOrutK6l43ahhGz2PaYxqNhlzXVbFYlGVZunfvnn7xi1+cfdEAAAAAAAAIneAWYh7ixYsXunbtmjKZTM8ArP2816PXGNd1lU6n9T/+x//QN998M7TrAAAAAAAAQDiErhNseXlZ+Xx+X6AVj8dl27YuX74sy7JkmqYkaXJyUpLUbDYlSZ7nyXVdff/993JdV9VqtbOE8ttvv5Vt28pms/rkk0+Gdk0AAAAAAAAIVmhCsFarpdnZWdXrdUnvQq9EIqF4PK7p6em+5n779q1WV1dVLBblOI5yuZyq1aqq1Sob6AMAAAAAAFwAoVgO+erVK0UiEdXrdaXTaTUaDT1//lx3797tOwCTpPHxcaXTadVqNX377be6efOmarWaZmZm9Oc//3kAVwAAAAAAAIAwC7wT7OXLl4rFYrJtW7VaTZFI5EzPZ1mWKpWKqtWqUqmUYrGYarXaSHWE/d3f/Z3evn2rv/u7vwu6lAtrcXFRrVZrpL5v9uIawuE8XMN5cB6+DlxD8Ea9/vPiPHwduIZwOA/XcB6M+tdh1OuXuAYMThiyDMPfu/nWEG1sbCgWiykej2ttbW3o5/c8T7FYTNeuXdPvf//7oZ//tKampvTmzRtdvXpVr1+/DrqcUzkP1wDgHX6egfODn2fgfOFnGjg/zsPPcxiuIdBOsEQiobm5OT1+/DiQ85umqXq9rpmZGX3++ef61a9+FUgdp7W1taWpqalDxywuLmpxcXFIFQEAAAAAgIvm0aNHevTo0aF
2024-01-19 11:22:15 +01:00
"text/plain": [
2024-02-04 16:56:05 +01:00
"<Figure size 1200x900 with 1 Axes>"
2024-01-19 11:22:15 +01:00
]
},
"metadata": {},
"output_type": "display_data"
}
],
2024-02-04 16:56:05 +01:00
"source": [
"velo_found = ak.to_numpy(\n",
2024-02-16 11:27:21 +01:00
" energy_emissions[(~energy_emissions.lost)\n",
" & (energy_emissions.quality == 1)][\"velo\"])\n",
2024-02-04 16:56:05 +01:00
"rich_found = ak.to_numpy(\n",
2024-02-16 11:27:21 +01:00
" energy_emissions[(~energy_emissions.lost)\n",
" & (energy_emissions.quality == 1)][\"rich\"])\n",
2024-02-04 16:56:05 +01:00
"energy_found = ak.to_numpy(\n",
2024-02-16 11:27:21 +01:00
" energy_emissions[(~energy_emissions.lost)\n",
" & (energy_emissions.quality == 1)][\"energy\"])\n",
2024-02-04 16:56:05 +01:00
"\n",
"velo_lost = ak.to_numpy(\n",
2024-02-16 11:27:21 +01:00
" energy_emissions[(energy_emissions.lost)\n",
" & (energy_emissions.quality == 1)][\"velo\"])\n",
2024-02-04 16:56:05 +01:00
"rich_lost = ak.to_numpy(\n",
2024-02-16 11:27:21 +01:00
" energy_emissions[(energy_emissions.lost)\n",
" & (energy_emissions.quality == 1)][\"rich\"])\n",
2024-02-04 16:56:05 +01:00
"energy_lost = ak.to_numpy(\n",
2024-02-16 11:27:21 +01:00
" energy_emissions[(energy_emissions.lost)\n",
" & (energy_emissions.quality == 1)][\"energy\"])\n",
2024-02-04 16:56:05 +01:00
"\n",
"diff_found = velo_found - rich_found\n",
"diff_lost = velo_lost - rich_lost\n",
"\n",
"xlim = 20000\n",
"nbins = 60\n",
"\n",
"plt.hist(\n",
" diff_lost,\n",
" bins=nbins,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"#F05342\",\n",
" label=\"lost\",\n",
" range=[-xlim, xlim],\n",
")\n",
"plt.hist(\n",
" diff_found,\n",
" bins=nbins,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
2024-02-05 15:44:27 +01:00
" color=\"#2A9D8F\", # \"#107E7D\",\n",
2024-02-04 16:56:05 +01:00
" label=\"found\",\n",
" range=[-xlim, xlim],\n",
")\n",
"# plt.xlim(-20000, 20000)\n",
"# plt.yscale(\"log\")\n",
"# plt.title(\"emitted energy difference\")\n",
2024-02-05 15:44:27 +01:00
"plt.xlabel(r\"$\\Delta E_{VELO} - \\Delta E_{RICH1+UT}$ [MeV]\")\n",
2024-02-16 11:27:21 +01:00
"plt.ylabel(\"Number of Tracks (normalised)\")\n",
"plt.legend(loc=\"best\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
2024-02-08 17:43:22 +01:00
"# plt.show()\n",
2024-02-05 15:44:27 +01:00
"plt.savefig(\n",
2024-02-16 11:27:21 +01:00
" \"/work/cetin/Projektpraktikum/thesis/emitted_energy_difference.pdf\",\n",
" format=\"PDF\")"
2024-02-04 16:56:05 +01:00
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
2024-01-19 11:22:15 +01:00
"source": [
"nbins = 6\n",
2024-02-04 16:56:05 +01:00
"quality_cut = electrons[jcut].quality != -1\n",
2024-01-19 11:22:15 +01:00
"\n",
"### all split in velo and rich\n",
"\n",
2024-02-04 16:56:05 +01:00
"fig, axs = plt.subplots(3, 3, figsize=(15, 6))\n",
2024-01-19 11:22:15 +01:00
"ax = axs.ravel()\n",
2024-02-04 16:56:05 +01:00
"for jcut, ax in enumerate(ax):\n",
"ax.hist(\n",
"ak.to_numpy(electrons[jcut][quality_cut][\"velo_length\"]),\n",
"bins=nbins,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"darkorange\",\n",
"histtype=\"bar\",\n",
"label=\"velo\",\n",
"range=[0, nbins],\n",
")\n",
"ax.hist(\n",
"ak.to_numpy(electrons[jcut][quality_cut][\"rich_length\"]),\n",
"bins=nbins,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"blue\",\n",
"histtype=\"bar\",\n",
"label=\"rich\",\n",
"range=[0, nbins],\n",
")\n",
"ax.set_xlim(0, nbins)\n",
"ax.set_ylim(0, 1)\n",
"ax.set_title(\"Photon Cut: \" + str(np.round(jcut \\* 0.05, 2)) + f\"$E_0$\")\n",
"ax.set_xlabel(\"number of photons\")\n",
"ax.set_ylabel(\"a.u.\")\n",
2024-01-19 11:22:15 +01:00
"plt.suptitle(\"number of photons in velo and rich\")\n",
"plt.legend()\n",
"plt.tight_layout()\n",
"plt.show()\n",
"\n",
"### found\n",
"\n",
2024-02-04 16:56:05 +01:00
"fig, axs = plt.subplots(3, 3, figsize=(15, 6))\n",
2024-01-19 11:22:15 +01:00
"ax = axs.ravel()\n",
2024-02-04 16:56:05 +01:00
"for jcut, ax in enumerate(ax):\n",
"ax.hist(\n",
"ak.to_numpy(\n",
"electrons[jcut]~(electrons[jcut].lost) & quality_cut][\"velo_length\"]\n",
"),\n",
"bins=nbins,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"darkorange\",\n",
"histtype=\"bar\",\n",
"label=\"velo\",\n",
"range=[0, nbins],\n",
")\n",
"ax.hist(\n",
"ak.to_numpy(\n",
"electrons[jcut]~(electrons[jcut].lost) & quality_cut][\"rich_length\"]\n",
"),\n",
"bins=nbins,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"blue\",\n",
"histtype=\"bar\",\n",
"label=\"rich\",\n",
"range=[0, nbins],\n",
")\n",
"ax.set_xlim(0, nbins)\n",
"ax.set_ylim(0, 1)\n",
"ax.set_title(\"Photon Cut: \" + str(np.round(jcut \\* 0.05, 2)) + f\"$E_0$\")\n",
"ax.set_xlabel(\"number of photons\")\n",
"ax.set_ylabel(\"a.u.\")\n",
2024-01-19 11:22:15 +01:00
"plt.suptitle(\"number of photons of found electrons\")\n",
"plt.legend()\n",
"plt.tight_layout()\n",
"plt.show()\n",
"\n",
2024-02-04 16:56:05 +01:00
"### lost\n",
2024-01-19 11:22:15 +01:00
"\n",
2024-02-04 16:56:05 +01:00
"fig, axs = plt.subplots(3, 3, figsize=(15, 6))\n",
2024-01-19 11:22:15 +01:00
"ax = axs.ravel()\n",
2024-02-04 16:56:05 +01:00
"for jcut, ax in enumerate(ax):\n",
"ax.hist(\n",
"ak.to_numpy(\n",
"electrons[jcut](electrons[jcut].lost) & quality_cut][\"velo_length\"]\n",
"),\n",
"bins=nbins,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"darkorange\",\n",
"histtype=\"bar\",\n",
"label=\"velo\",\n",
"range=[0, nbins],\n",
")\n",
"ax.hist(\n",
"ak.to_numpy(\n",
"electrons[jcut](electrons[jcut].lost) & quality_cut][\"rich_length\"]\n",
"),\n",
"bins=nbins,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"blue\",\n",
"histtype=\"bar\",\n",
"label=\"rich\",\n",
"range=[0, nbins],\n",
")\n",
"ax.set_xlim(0, nbins)\n",
"ax.set_ylim(0, 1)\n",
"ax.set_title(\"Photon Cut: \" + str(np.round(jcut \\* 0.05, 2)) + f\"$E_0$\")\n",
"ax.set_xlabel(\"number of photons\")\n",
"ax.set_ylabel(\"a.u.\")\n",
2024-01-19 11:22:15 +01:00
"plt.suptitle(\"number of photons of lost electrons\")\n",
"plt.legend()\n",
"plt.tight_layout()\n",
2024-02-04 16:56:05 +01:00
"plt.show()\n",
2024-01-19 11:22:15 +01:00
"quality_cut = electrons[jcut].quality != -1\n",
2024-02-04 16:56:05 +01:00
"\n",
2024-01-19 11:22:15 +01:00
"### all split in lost and found\n",
"\n",
2024-02-04 16:56:05 +01:00
"fig, axs = plt.subplots(3, 3, figsize=(15, 6))\n",
2024-01-19 11:22:15 +01:00
"ax = axs.ravel()\n",
2024-02-04 16:56:05 +01:00
"for jcut, ax in enumerate(ax):\n",
"ax.hist(\n",
"ak.to_numpy(\n",
"electrons[jcut](electrons[jcut].lost) & (quality_cut)][\"photon_length\"]\n",
"),\n",
"bins=10,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"darkorange\",\n",
"histtype=\"bar\",\n",
"label=\"lost\",\n",
"range=[0, 10],\n",
")\n",
"ax.hist(\n",
"ak.to_numpy(\n",
"electrons[jcut](~electrons[jcut].lost) & (quality_cut)][\"photon_length\"]\n",
"),\n",
"bins=10,\n",
"density=True,\n",
"alpha=0.5,\n",
"color=\"blue\",\n",
"histtype=\"bar\",\n",
"label=\"found\",\n",
"range=[0, 10],\n",
")\n",
"ax.set_xlim(0, 10) # ax.set_ylim(0,1) # ax.set_yscale('log')\n",
"ax.set_title(\"Photon Cut: \" + str(np.round(jcut \\* 0.05, 2)) + f\"$E_0$\")\n",
"ax.set_xlabel(\"number of photons\")\n",
"ax.set_ylabel(\"a.u.\")\n",
2024-01-19 11:22:15 +01:00
"plt.suptitle(\"number of photons in lost and found\")\n",
"plt.legend()\n",
"plt.tight_layout()\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
2024-02-04 16:56:05 +01:00
"source": []
2024-01-19 11:22:15 +01:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "tuner",
"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.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}