Projektpraktikum/notebooks/trackinglosses_photons.ipynb

540 lines
55 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-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-08 17:43:22 +01:00
"execution_count": 6,
2024-01-19 11:22:15 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-02-08 17:43:22 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMEAAAOWCAYAAADm+IXMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB2uElEQVR4nOz9z29jaZon9j6KThjVsFtNRQEGhNBignLPphfdQ0U2UEs7SANem8xY9sIIcoBaXECwxY75AzpBDlrAXZQxZPSmcBfXkdTYuCsPSoy2gbsowBmipxa1ssXqRQR0YaBCLM0MKlEoi3eRTTZJURJ/iT+OPh9ACFE6fPkc8hwp+NXzvmer2+12AwAAAAAS7MmqCwAAAACAhyYEAwAAACDxhGAAAAAAJJ4QDAAAAIDEE4IBAAAAkHhCMAAAAAASTwgGAAAAQOIJwQAAAABIPCEYAAAAAIknBAMAAAAg8YRgAAAAACSeEAwAAACAxBOCAQAAAJB4QjAAAAAAEk8IBgAAAEDiCcEAAAAASDwhGAAAAACJJwQDAAAAIPGEYAAAAAAknhAMAAAAgMQTggEAAACQeEIwAAAAABJPCAZT6nQ6cXJysuoyAAAAgCkIwWCMVqsVW1tbYz92dnYilUqtukQAAABgCkIwGOPrr7++9XvpdDqy2ewSqwEAAADmtdXtdrurLgLWSbvdjv39/Wg0GmM7vtLpdKTT6eUXBgAAAMxMCAYjSqVSfP78ORqNxqpLAQAAABbki1UXAOuk0+lEvV4XgAEAAEDCWBMMBvTWAisUCrG1tRUHBwdRrVaj0+mstjAAAABgLkIw5tJutyOXy8XJyclc41Sr1cjlcrG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[
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",
" 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",
2024-02-08 17:43:22 +01:00
"# 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
}