Projektpraktikum/notebooks/trackinglosses_photons.ipynb

549 lines
55 KiB
Plaintext
Raw Normal View History

2024-01-19 11:22:15 +01:00
{
"cells": [
{
"cell_type": "code",
2024-02-05 15:44:27 +01:00
"execution_count": 2,
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-05 15:44:27 +01:00
"execution_count": 3,
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-05 15:44:27 +01:00
"execution_count": 4,
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-05 15:44:27 +01:00
"execution_count": 4,
2024-01-19 11:22:15 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"allcolumns[1][1]"
]
},
{
"cell_type": "code",
2024-02-05 15:44:27 +01:00
"execution_count": 5,
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-05 15:44:27 +01:00
"execution_count": 6,
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-05 15:44:27 +01:00
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"lost\"]\n",
" )\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"rad_length_frac\").real(\n",
2024-02-05 15:44:27 +01:00
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"rad_length_frac\"]\n",
" )\n",
2024-02-04 16:56:05 +01:00
" energy_emissions.field(\"energy\").real(\n",
2024-02-05 15:44:27 +01:00
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"energy\"]\n",
" )\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-05 15:44:27 +01:00
" ak.num(\n",
" allcolumns[jcut][jelec][Cuts[str(jcut)] + \"Cut_\" + \"brem_photons_pe\"],\n",
" axis=0,\n",
" )\n",
" ):\n",
" if (\n",
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_vtx_z\", jphoton]\n",
" <= 770\n",
" ):\n",
" tmp_velo += allcolumns[jcut][\n",
" jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_photons_pe\", jphoton\n",
" ]\n",
2024-02-04 16:56:05 +01:00
" tmp_velo_length += 1\n",
2024-02-05 15:44:27 +01:00
" elif (\n",
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_vtx_z\", jphoton]\n",
" > 770\n",
" ) and (\n",
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_vtx_z\", jphoton]\n",
" <= 2700\n",
" ):\n",
" tmp_richut += allcolumns[jcut][\n",
" jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_photons_pe\", jphoton\n",
" ]\n",
2024-02-04 16:56:05 +01:00
" tmp_richut_length += 1\n",
" else:\n",
2024-02-05 15:44:27 +01:00
" tmp_neither += allcolumns[jcut][\n",
" jelec, Cuts[str(jcut)] + \"Cut_\" + \"brem_photons_pe\", jphoton\n",
" ]\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-05 15:44:27 +01:00
" energy_emissions.field(\"photon_length\").integer(tmp_richut_length + tmp_velo_length)\n",
2024-02-04 16:56:05 +01:00
"\n",
2024-02-05 15:44:27 +01:00
" if (\n",
" (tmp_velo == 0)\n",
" and (tmp_richut == 0)\n",
" or (\n",
" allcolumns[jcut][jelec, Cuts[str(jcut)] + \"Cut_\" + \"energy\"] - tmp_velo\n",
" < 3000\n",
" )\n",
" ):\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-05 15:44:27 +01:00
"execution_count": 7,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-02-05 15:44:27 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABLsAAAOWCAYAAAAHk5CdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB29ElEQVR4nOz9wW9jaZon5r6KThjVsFtNRQEGhNBignLPphfdQ0U2UEs7SANem8xY9sIIcoBaXECwxQ7/AZ0gBy3gLsoYMnpTuIvrSHJs3JUHJUbbwF0U4AzRU4ta2WL1IgK6MFAhlmYGlSiUxbtIk0VSFEWKlEgePQ8ghCgdfnwPeY4U/On9vrPV6/V6AQAAAAAJ8GTVBQAAAADAsgi7AAAAAEgMYRcAAAAAiSHsAgAAACAxhF0AAAAAJIawCwAAAIDEEHYBAAAAkBjCLgAAAAASQ9gFAAAAQGIIuwAAAABIDGEXAAAAAIkh7AIAAAAgMYRdAAAAACSGsAsAAACAxBB2AQAAAJAYwi4AAAAAEkPYBQAAAEBiCLsAAAAASAxhFwAAAACJIewCAAAAIDGEXQAAAAAkhrALAAAAgMQQdsGcut1uNJvNVZcBAAAATCDsggna7XZsbW1N/NjZ2YlUKrXqEgEAAIAJhF0wwddff33j99LpdGSz2QesBgAAAJjVVq/X6626CFgnnU4n9vf3o9FoTOzgSqfTkU6nH74wAAAA4FbCLhhTKpXi8+fP0Wg0Vl0KAAAAMKcvVl0ArJNutxv1el3QBQAAABvKml0wpL9WV6FQiK2trTg4OIhqtRrdbne1hQEAAAAzEXaxkE6nE7lcLprN5kLjV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 1200x900 with 1 Axes>"
2024-01-19 11:22:15 +01:00
]
},
"metadata": {},
"output_type": "display_data"
2024-02-05 15:44:27 +01:00
},
{
"data": {
"text/plain": [
"<Figure size 1200x900 with 0 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
2024-01-19 11:22:15 +01:00
}
],
2024-02-04 16:56:05 +01:00
"source": [
"velo_found = ak.to_numpy(\n",
" energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality == 1)][\"velo\"]\n",
")\n",
"rich_found = ak.to_numpy(\n",
" energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality == 1)][\"rich\"]\n",
")\n",
"energy_found = ak.to_numpy(\n",
" energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"energy\"\n",
" ]\n",
")\n",
"\n",
"velo_lost = ak.to_numpy(\n",
" energy_emissions[(energy_emissions.lost) & (energy_emissions.quality == 1)][\"velo\"]\n",
")\n",
"rich_lost = ak.to_numpy(\n",
" energy_emissions[(energy_emissions.lost) & (energy_emissions.quality == 1)][\"rich\"]\n",
")\n",
"energy_lost = ak.to_numpy(\n",
" energy_emissions[(energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"energy\"\n",
" ]\n",
")\n",
"\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-04 16:56:05 +01:00
"plt.ylabel(\"a.u.\")\n",
"plt.legend(title=\"LHCb Simulation\")\n",
"plt.show()\n",
2024-02-05 15:44:27 +01:00
"plt.savefig(\n",
" \"/work/cetin/Projektpraktikum/thesis/emitted_energy_difference.pdf\", format=\"PDF\"\n",
")"
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
}