Projektpraktikum/trackinglosses_energy.ipynb

810 lines
122 KiB
Plaintext
Raw Normal View History

2024-01-15 16:46:25 +01:00
{
"cells": [
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 173,
2024-01-15 16:46:25 +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",
"%matplotlib inline"
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 174,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
2024-01-17 15:59:39 +01:00
"name": "stdout",
"output_type": "stream",
"text": [
"10923 2390\n",
"13313\n"
]
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-17 15:59:39 +01:00
"file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n",
"#file = uproot.open(\n",
"# \"tracking_losses_ntuple_B_default.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\"\n",
"#)\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-16 21:48:53 +01:00
"# selektiere nur elektronen von B->K*ee\n",
2024-01-15 16:46:25 +01:00
"allcolumns = file.arrays()\n",
2024-01-16 21:48:53 +01:00
"found = allcolumns[\n",
2024-01-17 15:59:39 +01:00
" (allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromB)\n",
2024-01-16 21:48:53 +01:00
"] # B: 9056\n",
"lost = allcolumns[\n",
2024-01-17 15:59:39 +01:00
" (allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromB)\n",
2024-01-16 21:48:53 +01:00
"] # B: 1466\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"electrons = allcolumns[(allcolumns.isElectron) & (allcolumns.fromB)]\n",
"\n",
"print(ak.num(found, axis=0), ak.num(lost, axis=0))\n",
"print(ak.num(electrons,axis=0))\n",
2024-01-16 21:48:53 +01:00
"# ak.count(found, axis=None)"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 175,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
2024-01-17 15:59:39 +01:00
"#electrons[0]"
]
},
{
"cell_type": "code",
"execution_count": 176,
"metadata": {},
"outputs": [],
"source": [
"lost_e = electrons[\"lost\"]\n",
"e = electrons[\"energy\"]\n",
"brem_pe = electrons[\"brem_photons_pe\"]\n",
"brem_z = electrons[\"brem_vtx_z\"]\n",
"brem_x = electrons[\"brem_vtx_x\"]\n",
"length = electrons[\"brem_vtx_z_length\"]\n",
2024-01-15 16:46:25 +01:00
"\n",
"\n",
"\n",
2024-01-17 15:59:39 +01:00
"brem = ak.ArrayBuilder()\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"for itr in range(ak.num(electrons, axis=0)):\n",
" brem.begin_record()\n",
" brem.field(\"lost\").boolean(lost_e[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"energy\"] energy\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"energy\").append(e[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"photon_length\"] number of vertices\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"photon_length\").integer(length[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"brem_photons_pe\",:] photon energy\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"brem_photons_pe\").append(brem_pe[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"brem_vtx_z\",:] brem vtx z\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"brem_vtx_x\").append(brem_x[itr])\n",
" brem.field(\"brem_vtx_z\").append(brem_z[itr])\n",
" brem.end_record()\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"brem = ak.Array(brem)"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 177,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
"photon_cut = 0\n",
2024-01-17 15:59:39 +01:00
"photon_cut_ratio = 0.2\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"cut_brem = ak.ArrayBuilder()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"for itr in range(ak.num(brem, axis=0)):\n",
" cut_brem.begin_record()\n",
" cut_brem.field(\"lost\").boolean(brem[itr, \"lost\"])\n",
" cut_brem.field(\"energy\").real(brem[itr, \"energy\"])\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" ph_length = brem[itr, \"photon_length\"]\n",
" \n",
" tmp_energy = brem[itr, \"energy\"]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"brem_photons_pe\")\n",
" cut_brem.begin_list()\n",
" for jentry in range(brem[itr, \"photon_length\"]):\n",
2024-01-16 21:48:53 +01:00
" if (\n",
2024-01-17 15:59:39 +01:00
" brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
2024-01-16 21:48:53 +01:00
" ):\n",
2024-01-17 15:59:39 +01:00
" ph_length -= 1\n",
2024-01-15 16:46:25 +01:00
" continue\n",
" else:\n",
2024-01-17 15:59:39 +01:00
" cut_brem.real(brem[itr, \"brem_photons_pe\", jentry])\n",
" tmp_energy -= brem[itr, \"brem_photons_pe\", jentry]\n",
" cut_brem.end_list()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" tmp_energy = brem[itr, \"energy\"]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"brem_vtx_x\")\n",
" cut_brem.begin_list()\n",
" for jentry in range(brem[itr, \"photon_length\"]):\n",
2024-01-16 21:48:53 +01:00
" if (\n",
2024-01-17 15:59:39 +01:00
" brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
2024-01-16 21:48:53 +01:00
" ):\n",
2024-01-15 16:46:25 +01:00
" continue\n",
" else:\n",
2024-01-17 15:59:39 +01:00
" cut_brem.real(brem[itr, \"brem_vtx_x\", jentry])\n",
" tmp_energy -= brem[itr, \"brem_photons_pe\", jentry]\n",
" cut_brem.end_list()\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" tmp_energy = brem[itr, \"energy\"]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"brem_vtx_z\")\n",
" cut_brem.begin_list()\n",
" for jentry in range(brem[itr, \"photon_length\"]):\n",
2024-01-16 21:48:53 +01:00
" if (\n",
2024-01-17 15:59:39 +01:00
" brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
2024-01-16 21:48:53 +01:00
" ):\n",
2024-01-15 16:46:25 +01:00
" continue\n",
" else:\n",
2024-01-17 15:59:39 +01:00
" cut_brem.real(brem[itr, \"brem_vtx_z\", jentry])\n",
" tmp_energy -= brem[itr, \"brem_photons_pe\", jentry]\n",
" cut_brem.end_list()\n",
" \n",
" cut_brem.field(\"photon_length\").integer(ph_length)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.end_record()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"ntuple = ak.Array(cut_brem)\n",
"\n"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 178,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
2024-01-17 15:59:39 +01:00
"name": "stdout",
"output_type": "stream",
"text": [
"13313\n"
]
},
2024-01-15 16:46:25 +01:00
{
"data": {
"text/html": [
2024-01-17 15:59:39 +01:00
"<pre>{lost: False,\n",
" energy: 3.63e+03,\n",
2024-01-16 21:48:53 +01:00
" brem_photons_pe: [],\n",
" brem_vtx_x: [],\n",
2024-01-17 15:59:39 +01:00
" brem_vtx_z: [],\n",
" photon_length: 0}\n",
2024-01-16 21:48:53 +01:00
"-----------------------------------\n",
2024-01-15 16:46:25 +01:00
"type: {\n",
2024-01-17 15:59:39 +01:00
" lost: bool,\n",
2024-01-15 16:46:25 +01:00
" energy: float64,\n",
" brem_photons_pe: var * float64,\n",
" brem_vtx_x: var * float64,\n",
2024-01-17 15:59:39 +01:00
" brem_vtx_z: var * float64,\n",
" photon_length: int64\n",
2024-01-15 16:46:25 +01:00
"}</pre>"
],
"text/plain": [
2024-01-17 15:59:39 +01:00
"<Record {lost: False, energy: 3.63e+03, ...} type='{lost: bool, energy: flo...'>"
2024-01-15 16:46:25 +01:00
]
},
2024-01-17 15:59:39 +01:00
"execution_count": 178,
2024-01-15 16:46:25 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2024-01-17 15:59:39 +01:00
"# data in cut_brem_found and cut_brem_lost\n",
"\n",
"length_found = ak.num(ntuple[~ntuple.lost][\"brem_photons_pe\"], axis=0)\n",
"length_lost = ak.num(ntuple[ntuple.lost][\"brem_photons_pe\"], axis=0)\n",
"print(length_found+length_lost)\n",
"ntuple[1]"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 179,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
2024-01-16 21:48:53 +01:00
"Z_found = ak.to_numpy(\n",
2024-01-17 15:59:39 +01:00
" ak.sum(ntuple[~ntuple.lost][\"brem_photons_pe\"], axis=-1, keepdims=False)\n",
") / ak.to_numpy(ntuple[~ntuple.lost][\"energy\"])\n",
2024-01-16 21:48:53 +01:00
"Z_lost = ak.to_numpy(\n",
2024-01-17 15:59:39 +01:00
" ak.sum(ntuple[ntuple.lost][\"brem_photons_pe\"], axis=-1, keepdims=False)\n",
") / ak.to_numpy(ntuple[ntuple.lost][\"energy\"])"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 180,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-17 15:59:39 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHOCAYAAABttoiYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAvUUlEQVR4nO3dz28baWLm8UdJthUjgrtMz2GzQIBx8ZQ5GUX1JVjAA5hM/wEm5UMGyKHXLAx0a2BYoyCA5RNBIlcBKQoBZhd9kUjf9jJhOWhjgQALizU+JUCyLAeYwyww3XS1ocRRZwLl4FS1+Eui+LNK/H4AoU1W1Vuv31aTT7/vW++7cX5+fi4AAICU+q1VVwAAAGAWhBkAAJBqhBkAAJBqhBkAAJBqhBkAAJBqhBkAAJBqhBkAAJBqhBkAAJBqhBkAN14QBKuuAoAFIswAuPFKpZLCMFx1NQAsCGEGwELU63XduXNHGxsb2tjYUKFQiH+y2Wz8/qL5vi/TNGUYRiLrB2B2v7PqCgC4mSqVirrdrhqNhiqVimq1Wt/xIAhUKBQWXg/XdWXbdmLrB2B29MwAWJiTkxNJGhkKTNNUPp9feB08zxt7nyTUD8DsNtg1G8CiRMM04z5mwjAcGv6Zp1arpXa7Ldd1Rx5fdf0AzAc9MwAWwvM8SRrq3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eFma2tLd2+fXvqOgIAMG9BEMj3/bj35SLbtmXbtlzXVa1Wk2maqtfrunv3bnz+qOuSYtbpGVtbWxOdl5iemeiJpGgoaVAmk4nPGZwbE72
2024-01-15 16:46:25 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-01-17 15:59:39 +01:00
"xlim=0\n",
"\n",
2024-01-16 21:48:53 +01:00
"plt.hist(\n",
" Z_lost,\n",
" bins=100,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"darkorange\",\n",
" label=\"lost\",\n",
2024-01-17 15:59:39 +01:00
" range=[xlim,1]\n",
2024-01-16 21:48:53 +01:00
")\n",
"plt.hist(\n",
" Z_found,\n",
" bins=100,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"blue\",\n",
" label=\"found\",\n",
2024-01-17 15:59:39 +01:00
" range=[xlim,1]\n",
2024-01-16 21:48:53 +01:00
")\n",
2024-01-15 16:46:25 +01:00
"plt.xlabel(r\"$E_\\gamma/E_0$\")\n",
"plt.ylabel(\"a.u.\")\n",
2024-01-16 21:48:53 +01:00
"plt.title(r\"$E_{ph}/E_0$\")\n",
2024-01-15 16:46:25 +01:00
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 181,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-17 15:59:39 +01:00
"found: 4943 , lost: 1757\n",
"0.3554521545620069\n"
2024-01-15 16:46:25 +01:00
]
2024-01-17 15:59:39 +01:00
},
{
"data": {
"text/html": [
"<pre>[-26.5,\n",
" 19.5,\n",
" 34.7,\n",
" 36.4,\n",
" 532,\n",
" 95.5,\n",
" 3.25,\n",
" 4.11,\n",
" -3.04,\n",
" -112,\n",
" ...,\n",
" 3.61,\n",
" 8.6,\n",
" 54.6,\n",
" 26.1,\n",
" 26.2,\n",
" 23.6,\n",
" 31.5,\n",
" -67.7,\n",
" 25]\n",
"--------------------\n",
"type: 4943 * float64</pre>"
],
"text/plain": [
"<Array [-26.5, 19.5, 34.7, 36.4, ..., 31.5, -67.7, 25] type='4943 * float64'>"
]
},
"execution_count": 181,
"metadata": {},
"output_type": "execute_result"
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-17 15:59:39 +01:00
"tuple_found = ntuple[~ntuple.lost]\n",
"tuple_lost = ntuple[ntuple.lost]\n",
"\n",
2024-01-15 16:46:25 +01:00
"brem_x_found = ak.to_numpy(ak.flatten(tuple_found[\"brem_vtx_x\"]))\n",
"brem_z_found = ak.to_numpy(ak.flatten(tuple_found[\"brem_vtx_z\"]))\n",
"\n",
"brem_x_lost = ak.to_numpy(ak.flatten(tuple_lost[\"brem_vtx_x\"]))\n",
"brem_z_lost = ak.to_numpy(ak.flatten(tuple_lost[\"brem_vtx_z\"]))\n",
"\n",
"n_found = len(brem_x_found)\n",
"n_lost = len(brem_x_lost)\n",
"print(\"found: \", n_found, \", lost: \", n_lost)\n",
2024-01-16 21:48:53 +01:00
"stretch_factor = n_lost / n_found\n",
2024-01-17 15:59:39 +01:00
"print(stretch_factor)\n",
"ak.flatten(tuple_found[\"brem_vtx_x\"])"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 182,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-17 15:59:39 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkgAAALACAYAAADYJP6YAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACQo0lEQVR4nOz9f3Bk2X0Y9n57Z8XRxMtdLFaRSnJ+cBuUI7pih9s9ceznSpY20fZT+anyogF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j1aZ3Nz8yj/crnc9Rivrq6mrtNqtZL5+fkkIpKZmZlkc3PzKO7D/VlYWEharVays7OTLCwsHK3by/k8PEZpsmI8yz5WKpVkZmbmqIxWq3UU6+E5efK4HZ7HSqVy4no5LaYkSZL5+fmjc3nt2rVkYWHhWBkAAPRmWO2HJ+uKZ2k7nKUu+GQdNY16/9n3Ub0f4PxKSZIkg+6EAQAAAAAAGCWm2AIAAAAAAKbO08MOoF/29vZiZWUlIo4/MOpQu92OlZWVKJfLsbe3F7Va7cSDvfq1DgAAwKjRZgIAgOMmooOk2WzG+vp6bG1txdLS0on0TqcT1Wo1Wq3W0UOH5+bmYnd392j9fq0DAAAwarSZAADgpIl6BkmpVIqlpaVYX18/trxWq0VExPb29tGyjY2NqNfrcbj7/VoHAABgVGkzAQDAd038M0j29vai2WweVdQPXb58OSIeVdb7tQ4AAMC40WYCAGBaTXwHyZ07dyIiolwuH1t+ONx7e3u7b+sAAACMG20mAACm1UQ8gyRLp9OJiIiZmZnU9H6tk+Wb3/xm/M2/+TfjB3/
2024-01-15 16:46:25 +01:00
"text/plain": [
"<Figure size 2000x800 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-01-17 15:59:39 +01:00
"vmax = 150\n",
2024-01-16 21:48:53 +01:00
"nbins = 100\n",
"\n",
"fig, ((ax0, ax1)) = plt.subplots(nrows=1, ncols=2, figsize=(20, 8))\n",
"\n",
"a0 = ax0.hist2d(\n",
" brem_z_found,\n",
" brem_x_found,\n",
" density=False,\n",
" bins=nbins,\n",
" cmap=plt.cm.jet,\n",
" cmin=1,\n",
" vmax=vmax,\n",
2024-01-17 15:59:39 +01:00
" range=[[-200, 3000], [-1000, 1000]],\n",
2024-01-16 21:48:53 +01:00
")\n",
2024-01-17 15:59:39 +01:00
"ax0.vlines([770, 990, 2700], -1000, 1000,colors=\"red\")\n",
2024-01-16 21:48:53 +01:00
"ax0.set_ylim(-1000, 1000)\n",
2024-01-17 15:59:39 +01:00
"ax0.set_xlim(-200, 3000)\n",
2024-01-15 16:46:25 +01:00
"ax0.set_xlabel(\"z [mm]\")\n",
"ax0.set_ylabel(\"x [mm]\")\n",
"ax0.set_title(r\"$e^\\pm$ found brem vertices\")\n",
"\n",
2024-01-16 21:48:53 +01:00
"a1 = ax1.hist2d(\n",
" brem_z_lost,\n",
" brem_x_lost,\n",
" density=False,\n",
" bins=nbins,\n",
" cmap=plt.cm.jet,\n",
" cmin=1,\n",
" vmax=vmax * stretch_factor,\n",
2024-01-17 15:59:39 +01:00
" range=[[-200, 3000], [-1000, 1000]],\n",
2024-01-16 21:48:53 +01:00
")\n",
2024-01-17 15:59:39 +01:00
"ax1.vlines([770, 990, 2700], -1000, 1000, colors=\"red\")\n",
2024-01-16 21:48:53 +01:00
"ax1.set_ylim(-1000, 1000)\n",
2024-01-17 15:59:39 +01:00
"ax1.set_xlim(-200, 3000)\n",
2024-01-15 16:46:25 +01:00
"ax1.set_xlabel(\"z [mm]\")\n",
"ax1.set_ylabel(\"x [mm]\")\n",
"ax1.set_title(r\"$e^\\pm$ lost brem vertices\")\n",
2024-01-16 21:48:53 +01:00
"# ax1.set(xlim=(0,4000), ylim=(-1000,1000))\n",
2024-01-15 16:46:25 +01:00
"\n",
"plt.colorbar(a0[3], ax=ax1)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 183,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"13313\n"
]
}
],
2024-01-15 16:46:25 +01:00
"source": [
2024-01-17 15:59:39 +01:00
"energy_emissions = ak.ArrayBuilder()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"for jelec in range(ak.num(ntuple, axis=0)):\n",
" energy_emissions.begin_record()\n",
" energy_emissions.field(\"lost\").boolean(ntuple[jelec, \"lost\"])\n",
" energy_emissions.field(\"energy\").real(ntuple[jelec, \"energy\"])\n",
"\n",
" 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",
" \n",
" for jphoton in range(ak.num(ntuple[jelec][\"brem_photons_pe\"], axis=0)):\n",
" if ntuple[jelec, \"brem_vtx_z\", jphoton] <= 770:\n",
" tmp_velo += ntuple[jelec, \"brem_photons_pe\", jphoton]\n",
" tmp_velo_length += 1\n",
" elif (ntuple[jelec, \"brem_vtx_z\", jphoton] > 770) and (\n",
" ntuple[jelec, \"brem_vtx_z\", jphoton] <= 2700\n",
" ):\n",
" tmp_richut += ntuple[jelec, \"brem_photons_pe\", jphoton]\n",
" tmp_richut_length += 1\n",
" else:\n",
" tmp_neither += ntuple[jelec, \"brem_photons_pe\", jphoton]\n",
" tmp_neither_length += 1\n",
"\n",
" energy_emissions.field(\"velo_length\").integer(tmp_velo_length)\n",
" energy_emissions.field(\"velo\").real(tmp_velo)\n",
"\n",
" energy_emissions.field(\"rich_length\").integer(tmp_richut_length)\n",
" energy_emissions.field(\"rich\").real(tmp_richut)\n",
" \n",
" energy_emissions.field(\"neither_length\").integer(tmp_neither_length)\n",
" energy_emissions.field(\"downstream\").real(tmp_neither)\n",
" \n",
" energy_emissions.field(\"photon_length\").integer(tmp_neither_length+tmp_richut_length+tmp_velo_length)\n",
" \n",
" if (tmp_velo==0) and (tmp_richut==0):\n",
" energy_emissions.field(\"quality\").integer(0)\n",
" else:\n",
" energy_emissions.field(\"quality\").integer(1)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" energy_emissions.end_record()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"energy_emissions = ak.Array(energy_emissions)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"print(ak.num(energy_emissions,axis=0))\n"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 184,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
2024-01-17 15:59:39 +01:00
"data": {
"text/html": [
"<pre>{lost: False,\n",
" energy: 9.36e+03,\n",
" velo_length: 3,\n",
" velo: 6.51e+03,\n",
" rich_length: 0,\n",
" rich: 0,\n",
" neither_length: 0,\n",
" downstream: 0,\n",
" photon_length: 3,\n",
" quality: 1}\n",
"--------------------------\n",
"type: {\n",
" lost: bool,\n",
" energy: float64,\n",
" velo_length: int64,\n",
" velo: float64,\n",
" rich_length: int64,\n",
" rich: float64,\n",
" neither_length: int64,\n",
" downstream: float64,\n",
" photon_length: int64,\n",
" quality: int64\n",
"}</pre>"
],
"text/plain": [
"<Record {lost: False, energy: 9.36e+03, ...} type='{lost: bool, energy: flo...'>"
]
},
"execution_count": 184,
"metadata": {},
"output_type": "execute_result"
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-17 15:59:39 +01:00
"energy_emissions[3]"
2024-01-16 21:48:53 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 185,
2024-01-16 21:48:53 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"found: 10923\n",
"lost: 2390\n",
"13313\n",
"VELO energy emission, eff: 0.1835048448884549\n",
"RICH1+UT energy emission, eff: 0.1139487718771126\n",
"Neither, eff: 0.5230226094794562\n",
"total efficiency: 0.8204762262450237\n",
"efficiency: 0.8204762262450237\n",
"\n",
"found in velo/(found + lost in velo)\n",
"VELO energy emission, eff: 0.8151484818151484\n",
"RICH1+UT energy emission, eff: 0.737481769567331\n",
"eff von e die nicht strahlen: 0.8430802760624773\n"
]
}
],
2024-01-16 21:48:53 +01:00
"source": [
2024-01-17 15:59:39 +01:00
"# efficiency berechnen als found in velo oder rich über alle elektronen\n",
"# dann kann man zusammenrechnen mit velo, rich, und allen anderen elektronen\n",
"# expected eff = 81.19%\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"electrons_found = energy_emissions[~energy_emissions.lost]\n",
"electrons_lost = energy_emissions[energy_emissions.lost]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"anz_found = ak.num(electrons[~electrons.lost],axis=0)\n",
"anz_lost = ak.num(electrons[electrons.lost],axis=0)\n",
"print(\"found: \",anz_found)\n",
"print(\"lost: \", anz_lost)\n",
"\n",
"num_velo_found = 0\n",
"num_rich_found = 0\n",
"num_no_up_rad_found = 0\n",
"for itr in range(ak.num(electrons_found, axis=0)):\n",
" if (electrons_found[itr, \"quality\"]==1):\n",
" if (electrons_found[itr, \"velo\"] >= electrons_found[itr, \"rich\"]):\n",
" num_velo_found += 1\n",
" else:\n",
" num_rich_found += 1\n",
" else:\n",
" num_no_up_rad_found += 1\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"num_velo_lost = 0\n",
"num_rich_lost = 0\n",
"num_no_up_rad_lost = 0\n",
"for itr in range(ak.num(electrons_lost, axis=0)):\n",
" if (electrons_lost[itr, \"quality\"]==1):\n",
" if (electrons_lost[itr, \"velo\"] >= electrons_lost[itr, \"rich\"]):\n",
" num_velo_lost += 1\n",
" else:\n",
" num_rich_lost += 1\n",
" else:\n",
" num_no_up_rad_lost += 1\n",
2024-01-16 21:48:53 +01:00
"\n",
"\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"denom = ak.num(electrons,axis=0)\n",
"print(denom)\n",
2024-01-15 16:46:25 +01:00
"\n",
"\n",
2024-01-17 15:59:39 +01:00
"eff_velo = num_velo_found/denom\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"eff_rich = num_rich_found/denom\n",
"\n",
"eff_other = ak.num(electrons_found[electrons_found.quality==0],axis=0)/denom\n",
"\n",
"print(\"VELO energy emission, eff: \", eff_velo)\n",
"\n",
"print(\"RICH1+UT energy emission, eff: \", eff_rich)\n",
"\n",
"print(\"Neither, eff: \", eff_other)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"print(\"total efficiency: \", eff_velo + eff_rich + eff_other)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"print(\"efficiency: \", anz_found/(anz_found+anz_lost))\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"print(\"\\nfound in velo/(found + lost in velo)\")\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"eff_velo = num_velo_found/(num_velo_found+num_velo_lost)\n",
"eff_rich = num_rich_found/(num_rich_found+num_rich_lost)\n",
"\n",
"eff_no_rad = num_no_up_rad_found/(num_no_up_rad_found+num_no_up_rad_lost)\n",
"\n",
"print(\"VELO energy emission, eff: \", eff_velo)\n",
"\n",
"print(\"RICH1+UT energy emission, eff: \", eff_rich)\n",
"\n",
"print(\"eff von e die nicht strahlen: \", eff_no_rad )"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 186,
2024-01-16 21:48:53 +01:00
"metadata": {},
"outputs": [
{
2024-01-16 22:04:43 +01:00
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-17 15:59:39 +01:00
"10923\n",
"2390\n",
"13313\n"
2024-01-16 22:04:43 +01:00
]
2024-01-16 21:48:53 +01:00
}
],
"source": [
2024-01-17 15:59:39 +01:00
"print(ak.num(electrons[~electrons.lost],axis=0))\n",
"print(ak.num(electrons[electrons.lost],axis=0))\n",
"print(ak.num(electrons,axis=0))\n",
"\n"
2024-01-16 21:48:53 +01:00
]
},
2024-01-16 22:04:43 +01:00
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 187,
2024-01-16 22:04:43 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAA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O/X5/5PoslmUFx8tfpq+nLF/+Veo4ztCyrNDp92HLJ8XqazabwTb+tUts2x7u7+/fOFX4pmPh/+K2bTtoffKnrfv1m2Zfl6+1cl09/Lj9fV/+s2079Ne9/4t7Fjcdr+vO4eVruPjvxcuth9etW8axWeZ58sv0n+M4TmgLxzSvvZv4cVznpnpdrcPVVlj/kgelUmlYKpVW8nk16fzc9H6fdJzb7XZwSQD/cgFXz9tNvQMwx8ZwOOfNWRLIb/nxp3L6s7FusrGxMTZl3Z/B1e12x349bWxsKJfLTb1/IE6u6+rx48c6ODjQ2dnZyK/hdrsdOkux1+up3W6n5jIOABAmVVPk/cSkWCwuPCDPH2B4XRdDlNOBgXn5l3k4Pz8PumQus207dCBsmrprAeA6az8m6LJeryfXddVutxeemnnddTH8x9lsdqH9A1HwX697e3sjY4D86e/NZjOY/eWP5fH/XYc7jQPAIlLTEuR3hV3uosrn83N3WVmWJcdx1O12R7oK/F/NVwckAkmUy+VUr9dVq9VGpk07jqN6vT6SAF2eXLDsK3UDQBKlYkxQWAIkvblWxk1jgwaDgba2tkJvY+G6rrLZrE5PT4Pur0wmo3K5nIorPcMs/lig67pyq9WqPM/TwcEBrUAAjLD2SdBgMNDe3t61F8/qdDp69uzZtfcFazabarVasixLR0dHI/cb8rfx7x3meZ7y+fxct8wAAADJsvZJEAAAwDzWekzQL37xC/3t3/6tfvd3f1ebm5t
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# energyspektren angucken von velo und rich\n",
"diff_found = ak.to_numpy(energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality==1)][\"velo\"]) - ak.to_numpy(energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality==1)][\"rich\"])\n",
"diff_lost = ak.to_numpy(energy_emissions[(energy_emissions.lost) & (energy_emissions.quality==1)][\"velo\"]) - ak.to_numpy(energy_emissions[(energy_emissions.lost) & (energy_emissions.quality==1)][\"rich\"])\n",
"\n",
"xlim = 20000\n",
"\n",
"plt.hist(diff_lost,bins=100,density=True,alpha=0.5,histtype=\"bar\",color=\"darkorange\",label=\"lost\",range=[-xlim,xlim])\n",
"plt.hist(diff_found,bins=100,density=True,alpha=0.5,histtype=\"bar\",color=\"blue\",label=\"found\", range=[-xlim,xlim])\n",
"plt.xlim(-20000,20000)\n",
"plt.title(\"emitted energy difference velo - rich\")\n",
"plt.xlabel(r\"$E_{velo} - E_{rich}$\")\n",
"plt.ylabel(\"a.u.\")\n",
"plt.legend()\n",
"plt.show()"
]
2024-01-16 22:04:43 +01:00
},
2024-01-16 21:48:53 +01:00
{
2024-01-17 15:59:39 +01:00
"cell_type": "code",
"execution_count": 188,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHJCAYAAABpOFaGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAx5ElEQVR4nO3dT2wj2WHv+5/SPS1P0vCU1LPwrF66GBhBNndQVHth4KUHafIagReBMaS8ywxgDAuGNsEAYaGzme5NiCKyyEaASSFAv+xGpHFxF0GQkDbu+AJZ3BErnc3Dw8NjdXYJcD1UedB2W+0/9RY9VUNKJEVR/FPS+X4AwSMW69RhFa369anzZyOO41gAAAAG+p11VwAAAGBdCEIAAMBYBCEAAGAsghAAADAWQQgAABiLIAQAAIxFEAIAAMYiCAEAAGMRhIArJAxDNZtNRVG07qqsTRRFajabCsNw3VXBggVBoGazue5qwDAEIeCKqNfryuVycl1Xg8Fg3dWZSRAE8jxP5XJZuVxO9Xr9UuU1m03dvXtXrusaHQaXIQxDbW1trSWIhGGocrmsfD6vRqOx8uPDbAQh4IqoVqsqlUrrrsbMgiDQgwcP5Pu+Wq2WSqWS+v3+pcqsVCqqVCo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NAYAAIxFEAIAAMYiCAFYuyiK0pmjr8LEgQCuD/oIAVi7caOEZll+AgAuiyAEAACMxaMxAABgLGMXXf3pT3+qf/qnf9Lv//7v6/XXX193dQAAwAxevHihf//3f9e3vvUtvfnmm5cuz9gg9A//8A96//33110NAAAwhydPnui99967dDnGBqG33npLknRwcJAuj7AM7777rn74wx9e2fJXcYznz5/r/v37+uSTT3T79u2lHec6nCuuhTnH4Fpk6xiruB7X4Tyt4hhBEOiDDz5I7+OXtbQg9P3vf187Ozv63ve+t6xDXMpXvvIVSdLXv/71pQah119//UqXv4pjfP7555Kkt99+W1/96leXdpzrcK64FuYcg2uRrWOs4npch/O0imM8f/5c0pf38ctaSmfpZ8+eqdFoMPwVAABk2lJahO7evatGo3HuqsoAAADrtLRHYx988MGyigYAAFiIpc0j9K1vfUtPnz5dVvEAAACXNneL0He/+92J26IoUrfb1eHhod5+++15D7ESf/7nf67f/d3fHbttb29Pe3t7K64RAABm29/f1/7+/thtv/jFLxZ6rLmD0CwLI7ZaLf31X//1vIdYib//+7/XH//xHy+t/GUHqVUEtesSBq/DueJamHeMZbsu54lrcb2OMa0h4ic/+Ynu379/6WMk5l5rbHd3V77va3t7+8y2fr+vZrOpH/zgB5eu4LIkJ/KTTz5ZahDC+T7//HO98cYb+tnPfrbUYcI4H9ciO7gW2cL1yI5F37/n7iPkuq7u3r2rN95448yP4zjK5/P6q7/6q0tXEAAAYFnmDkIPHjyYut22bTUajXmLBwAAWLq5+whNGxEWhqE8z5u3aAAAgJWYOwg5jqONjY2J2+M4Vr1en7d4AACApZs7CFmWpd3dXVmWdWbbnTt35DjOuY/PAAAA1mnuIHRwcKB33313kXUBAABYqbk7SxOCAADAVbe0tca+//3va2dnR9/73veWdYhLuXXr1sj/Xln/8mjdNbi0zZe/1kcffaTNzc11V8V4m5ubXIuM4FpkC9cjOxZ9/557QsVpnj17plwup62tLX322WeLLn4hgiBQPp9Xr9eT4zjrrs78rkEQkiR989G6awAAuAIWff9eSovQ3bt31Wg0ZNv2MooHAABYiKU9Gtvd3dUbb7yxrOIX5t1339Xrr78+dhuLrgIAsHrTFl198eLFQo+1tCD0ox/9SJ9++qlqtdqyDrEQP/zhD6/2ozEAAK6ZaQ0RyaOxRblUEPrxj3+sTqejKIpGXh8
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# number of brem vtx with E>x*E_0\n",
"\n",
"number_velo = ak.to_numpy(energy_emissions[energy_emissions.quality==1][\"velo_length\"])\n",
"number_rich = ak.to_numpy(energy_emissions[energy_emissions.quality==1][\"rich_length\"])\n",
"\n",
"\n",
"plt.hist(number_velo,bins=10,density=True,alpha=0.5,histtype=\"bar\",color=\"darkorange\",label=\"velo\",range=[0,10])\n",
"plt.hist(number_rich,bins=10,density=True,alpha=0.5,histtype=\"bar\",color=\"blue\",label=\"rich\",range=[0,10])\n",
"plt.xlim(0,10)\n",
"plt.title(\"number of photons emitted\")\n",
"plt.xlabel(\"number of photons\")\n",
"plt.ylabel(\"a.u.\")\n",
"plt.legend()\n",
"plt.show()"
]
2024-01-15 16:46:25 +01:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": 189,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
"text/plain": [
"' \\nphoton cut = x*E_0\\neffs, all photons included: x=0\\nfound in velo/(found + lost in velo)\\nVELO energy emission, eff: 0.8446167611094543\\nRICH1+UT energy emission, eff: 0.7961586121437423\\neff von e die nicht strahlen: 0.7954674220963173\\n'"
]
},
"execution_count": 189,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\" \n",
"photon cut = x*E_0\n",
"effs, all photons included: x=0\n",
"found in velo/(found + lost in velo)\n",
"VELO energy emission, eff: 0.8446167611094543\n",
"RICH1+UT energy emission, eff: 0.7961586121437423\n",
"eff von e die nicht strahlen: 0.7954674220963173\n",
"\"\"\""
]
2024-01-15 16:46:25 +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",
2024-01-17 15:59:39 +01:00
"execution_count": null,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
2024-01-17 15:59:39 +01:00
"source": []
2024-01-15 16:46:25 +01:00
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": null,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [],
"source": []
2024-01-15 16:46:25 +01:00
},
{
"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
}