2023-09-25 10:22:31 +02:00
{
"cells": [
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 1,
2023-09-25 10:22:31 +02:00
"metadata": {},
"outputs": [],
"source": [
"import uproot\n",
"import numpy as np\n",
"import sys\n",
"import os\n",
"import matplotlib\n",
"import matplotlib.pyplot as plt\n",
"from mpl_toolkits import mplot3d\n",
"import itertools\n",
"import awkward as ak\n",
"from scipy.optimize import curve_fit\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 2,
2023-09-25 10:22:31 +02:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
2023-09-25 11:05:16 +02:00
"410"
2023-09-25 10:22:31 +02:00
]
},
2023-09-25 15:57:26 +02:00
"execution_count": 2,
2023-09-25 10:22:31 +02:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n",
"\n",
"\n",
"\n",
"#selektiere Kaonen und Pionen aus K*->Kpi - B->K*ee - und nur solche mit einem momentum von ueber 5 GeV \n",
"allcolumns = file.arrays()\n",
2023-09-25 11:05:16 +02:00
"found = allcolumns[((allcolumns.isPion) | (allcolumns.isKaon)) & (~allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p>5e3)] #B: 8126\n",
"lost = allcolumns[((allcolumns.isPion) | (allcolumns.isKaon)) & (allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p>5e3)] #B: 410\n",
2023-09-25 10:22:31 +02:00
"\n",
2023-09-25 11:05:16 +02:00
"ak.num(lost, axis=0)\n",
2023-09-25 10:22:31 +02:00
"#ak.count(found, axis=None)\n"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 3,
2023-09-25 10:22:31 +02:00
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
2023-09-25 11:05:16 +02:00
"0.9519681349578257"
2023-09-25 10:22:31 +02:00
]
},
2023-09-25 15:57:26 +02:00
"execution_count": 3,
2023-09-25 10:22:31 +02:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def t_eff(found, lost):\n",
" sel = found[\"energy\"]\n",
" des = lost[\"energy\"]\n",
" return ak.count(sel,axis=None)/(ak.count(sel,axis=None)+ak.count(des,axis=None))\n",
"\n",
2023-09-25 12:14:19 +02:00
"t_eff(found, lost)\n"
2023-09-25 10:22:31 +02:00
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 4,
2023-09-25 11:05:16 +02:00
"metadata": {},
"outputs": [],
"source": [
"#ist die shape der teilspur im scifi anders? (koenntest du zum beispiel durch vergleich der verteilungen der fit parameter studieren,\n",
"#in meiner thesis findest du das fitmodell -- ist einfach ein polynom dritten grades)\n",
"z_ref=8520 #mm\n",
"\n",
"def scifi_track(z, a, b, c, d):\n",
" return a + b*(z-z_ref) + c*(z-z_ref)**2 + d*(z-z_ref)**3\n",
"\n",
"def z_mag(xv, zv, tx, a, b):\n",
" \"\"\" optical centre of the magnet is defined as the intersection between the trajectory tangents before and after the magnet\n",
"\n",
" Args:\n",
" xv (double): velo x track\n",
" zv (double): velo z track\n",
" tx (double): velo x slope\n",
" a (double): ax parameter of track fit\n",
" b (double): bx parameter of track fit\n",
"\n",
" Returns:\n",
" double: z_mag\n",
" \"\"\"\n",
" return (xv-tx*zv-a+b*z_ref)/(b-tx)"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 5,
2023-09-25 11:05:16 +02:00
"metadata": {},
"outputs": [],
"source": [
"scifi_found = found[found[\"scifi_hit_pos_x_length\"]>3]\n",
"scifi_lost = lost[lost[\"scifi_hit_pos_x_length\"]>3]\n",
"\n",
"scifi_x_found = scifi_found[\"scifi_hit_pos_x\"]\n",
"scifi_z_found = scifi_found[\"scifi_hit_pos_z\"]\n",
"\n",
"tx_found = scifi_found[\"velo_track_tx\"]\n",
"\n",
"scifi_x_lost = scifi_lost[\"scifi_hit_pos_x\"]\n",
"scifi_z_lost = scifi_lost[\"scifi_hit_pos_z\"]\n",
"\n",
"tx_lost = scifi_lost[\"velo_track_tx\"]\n",
"\n",
"xv_found = scifi_found[\"velo_track_x\"]\n",
"zv_found = scifi_found[\"velo_track_z\"]\n",
"\n",
"xv_lost = scifi_lost[\"velo_track_x\"]\n",
"zv_lost = scifi_lost[\"velo_track_z\"]\n",
"\n",
"\n",
"\n",
"#ak.num(scifi_found[\"energy\"], axis=0)\n",
"#scifi_found.snapshot()"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 6,
2023-09-25 11:05:16 +02:00
"metadata": {},
"outputs": [],
"source": [
"scifi_fitpars_found = ak.ArrayBuilder()\n",
"\n",
"for i in range(0,ak.num(scifi_found[\"energy\"], axis=0)):\n",
" popt, pcov = curve_fit(scifi_track,ak.to_numpy(scifi_z_found[i,:]),ak.to_numpy(scifi_x_found[i,:]))\n",
" scifi_fitpars_found.begin_list()\n",
" scifi_fitpars_found.real(popt[0])\n",
" scifi_fitpars_found.real(popt[1])\n",
" scifi_fitpars_found.real(popt[2])\n",
" scifi_fitpars_found.real(popt[3])\n",
" scifi_fitpars_found.end_list()\n",
"\n",
"scifi_fitpars_lost = ak.ArrayBuilder()\n",
"\n",
"for i in range(0,ak.num(scifi_lost[\"energy\"], axis=0)):\n",
" popt, pcov = curve_fit(scifi_track,ak.to_numpy(scifi_z_lost[i,:]),ak.to_numpy(scifi_x_lost[i,:]))\n",
" scifi_fitpars_lost.begin_list()\n",
" scifi_fitpars_lost.real(popt[0])\n",
" scifi_fitpars_lost.real(popt[1])\n",
" scifi_fitpars_lost.real(popt[2])\n",
" scifi_fitpars_lost.real(popt[3])\n",
" scifi_fitpars_lost.end_list()\n",
"\n",
"\n",
"scifi_fitpars_lost = scifi_fitpars_lost.to_numpy()\n",
"scifi_fitpars_found = scifi_fitpars_found.to_numpy()\n"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 7,
2023-09-25 10:22:31 +02:00
"metadata": {},
"outputs": [
{
"data": {
2023-09-25 11:05:16 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABPwAAANVCAYAAADsieBeAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAADt1ElEQVR4nOzdeVyU5f7/8ffI7oY7iyuaG26VpEEqmKm5ZaVHrY5ZqWVmplQmpom22GL+yHLJssjK5ZxjVqfM1I6QJi0qmqZtHhQjyMwUNWWR6/eHX+Y4MCDgwAzD6/l4zKPui899Xdd93zPw8TP3YjHGGAEAAAAAAABwC9WcPQEAAAAAAAAAjkPBDwAAAAAAAHAjFPwAAAAAAAAAN0LBDwAAAAAAAHAjFPwAAAAAAAAAN0LBDwAAAAAAAHAjFPwAAAAAAAAAN0LBDwAAAAAAAHAjFPwAAAAAAAAAN0LBD6ik1qxZow4dOsjPz08Wi0W7d+9WbGysLBaLTdzixYsVHx/vnEm6uJUrVyouLs7Z07hsCQkJslgsSkhIcPZUSiw+Pl4Wi0WHDh2yaZ85c6aaNWsmT09P1alTR5IUFRWlqKioS/bpCu91i8WiSZMmOXUOAIDKjzzv8jkjz4uKilLHjh0d3m+LFi101113Obzf8mSxWBQbG2vT9tlnnyksLEw1atSQxWLR+++/X2ROWND27dsVGxurEydOlNucL+Wuu+5SzZo1nTY+UFoU/IBK6Pfff9fo0aPVqlUrbdiwQUlJSWrTpo3GjRunpKQkm1gSwaK5S8GvMho0aJCSkpIUFBRkbfvggw/09NNP684771RiYqI2b94s6cJ7ePHixZfsk/c6AMAdkOc5BnmecyUlJWncuHHWZWOMRowYIS8vL3344YdKSkpSZGSk3ZzQnu3bt2vOnDlOLfgBlY2nsycAoPR+/PFH5eTk6O9//7siIyOt7dWrV1eTJk2cOLPCzp49K19f30LfSLuzs2fPys/Pz9nTKLO//vpL1atXL9cxGjZsqIYNG9q07du3T5I0efJkNWrUyNoeGhrq8PFzcnJksVjk6cmfQQCAayHPc22VPc87f/68cnNz5ePjU67jXHvttTbLv/76q44fP65bbrlFffr0sflZwZzQESr7cQIcgTP8gErmrrvuUo8ePSRJI0eOlMVisV7uWPBSjxYtWui7775TYmKiLBaLLBaLWrRoIel/l4G+8847io6OVmBgoPz8/BQZGank5GSbMXfs2KFRo0apRYsW8vPzU4sWLXTbbbfp8OHDNnH5p+Rv3LhR99xzjxo2bKjq1asrKytLP//8s+6++261bt1a1atXV+PGjTVkyBDt3bvXpo/8ea1cuVKPPfaYgoKCVLNmTQ0ZMkS//fabTp06pXvvvVcNGjRQgwYNdPfdd+v06dM2fRhjtHjxYl155ZXy8/NT3bp1NXz4cP33v/+1xkRFRenjjz/W4cOHrfvm4n2XnZ2tp556Su3atZOPj48aNmyou+++W7///rvNWC1atNDgwYP13nvv6aqrrpKvr6/mzJlT5PHbtGmThg4dqiZNmsjX11dXXHGF7rvvPh07dqzIdS72/fff68Ybb1T16tXVoEEDTZgwQadOnbIbu3nzZvXp00e1a9dW9erVdd111+mzzz6zicl/z+zatUvDhw9X3bp11apVqyLH/+uvv/TII48oJCREvr6+qlevnsLCwrRq1SqbuK+++kpDhgxR/fr15evrq1atWmnKlCnWnxe8fKNFixaaOXOmJCkgIMDmMpCSXNJbkvf622+/rYcffliNGzeWj4+Pfv75Z/3++++aOHGiQkNDVbNmTTVq1EjXX3+9tm7dWmiMrKwszZ07V+3bt5evr6/q16+v3r17a/v27UXOyxijGTNmyMvLS6+99lqx2wAAAHle5c7z8m3dulXXXnut/Pz81LhxY82aNUvnz5+/5Ho5OTmaNm2aAgMDVb16dfXo0UNff/213diMjAzdd999atKkiby9vRUSEqI5c+YoNzfXGnPo0CFZLBY9//zzeuqppxQSEiIfHx9t2bKlyDn885//VPfu3eXv76/q1aurZcuWuueee2xiTpw4oYcfflgtW7aUj4+PGjVqpIEDB+r777+3xlycy8XGxlqL1Y899pjNe7Ukl/TGxsbq0UcflSSFhIRYj2f+7WyKO06LFi1Sr1691KhRI9WoUUOdOnXS888/r5ycnELjbNiwQX369LFue/v27TVv3rwi5yVJX3zxhRo0aKDBgwfrzJkzxcYCFY1TG4BKZtasWerWrZseeOABPfPMM+rdu7dq165tN3bdunUaPny4/P39rZdEFvw2b8aMGbr66qv1+uuv6+TJk4qNjVVUVJSSk5PVsmVLSReShbZt22rUqFGqV6+e0tPTtWTJEl1zzTXav3+/GjRoYNPnPffco0GDBuntt9/WmTNn5OXlpV9//VX169fXs88+q4YNG+r48eN666231L17dyUnJ6tt27aF5tW7d2/Fx8fr0KFDeuSRR3TbbbfJ09NTXbp00apVq5ScnKwZM2aoVq1aWrhwoXXd++67T/Hx8Zo8ebKee+45HT9+XHPnzlVERIT27NmjgIAALV68WPfee68OHjyodevW2Yydl5enoUOHauvWrZo2bZoiIiJ0+PBhzZ49W1FRUdqxY4fNN4a7du3SgQMHNHPmTIWEhKhGjRpFHr+DBw8qPDxc48aNk7+/vw4dOqQFCxaoR48e2rt3r7y8vIpc97ffflNkZKS8vLy0ePFiBQQE6N1337V7z7h33nlHd955p4YOHaq33npLXl5eevXVV9W/f399+umnhb5ZvfXWWzVq1ChNmDCh2GQlOjpab7/9tp566ildddVVOnPmjPbt26c//vjDGvPpp59qyJAhat++vRYsWKBmzZrp0KFD2rhxY5H9rlu3TosWLdLy5cu1YcMG+fv7l+oshpK812NiYhQeHq6lS5eqWrVqatSokTWxnz17tgIDA3X69GmtW7dOUVFR+uyzz6z/yMrNzdWAAQO0detWTZkyRddff71yc3P15ZdfKjU1VREREYXmlJWVpbvuuksff/yx/v3vf+vGG28s8fYAAKom8rzKnedJFwpxo0aN0vTp0zV37lx9/PHHeuqpp/Tnn3/qlVdeKXbd8ePHa8WKFXrkkUfUt29f7du3T7feemuhL3czMjLUrVs3VatWTU888YRatWqlpKQkPfXUUzp06JDefPNNm/iFCxeqTZs2mj9/vmrXrq3WrVvbHT8pKUkjR47UyJEjFRsbK19fXx0+fFj/+c9/rDGnTp1Sjx49dOjQIT322GPq3r27Tp8+rc8//1zp6elq165doX7HjRunLl266NZbb9WDDz6o22+/vVRnGI4bN07Hjx/Xyy+/rPfee896+e/FV4EUdZwOHjyo22+/XSEhIfL29taePXv09NNP6/vvv9cbb7xhXX/58uUaP368IiMjtXTpUjVq1Eg//vij9QoUe/7xj3/ozjvv1D333KOXX35ZHh4eJd4moEIYAJXOli1bjCTzz3/+06Z99uzZpuDHukOHDiYyMrLIPq6++mqTl5dnbT906JDx8vIy48aNK3L83Nxcc/r0aVOjRg3z0ksvWdvffPNNI8nceeedl9yG3Nxck52dbVq3bm2mTp1aaF5DhgyxiZ8yZYqRZCZPnmzTfvPNN5t69epZl5OSkowk8+KLL9rEHTlyxPj5+Zlp06ZZ2wYNGmSaN29eaG6rVq0ykszatWtt2r/55hsjySxevNja1rx5c+Ph4WF++OGHS25zQXl5eSYnJ8ccPnzYSDIffPBBsfGPPfaYsVgsZvfu3Tbtffv2NZLMli1bjDHGnDlzxtSrV6/QPjx//rzp0qWL6datm7Ut/z3zxBNPlGjOHTt2NDfffHOxMa1atTKtWrUyZ8+eLTIm/72SkpJSaC6///67TWxkZKTd93BBl3qv9+rV65J95ObmmpycHNOnTx9zyy23WNtXrFhhJJnXXnut2PUlmQceeMD88ccfpkePHqZx48aFjhcAAMUhz/ufypbnRUZG2s3pxo8fb6pVq2YOHz5c5LoHDhwwkmz
2023-09-25 10:22:31 +02:00
"text/plain": [
2023-09-25 11:05:16 +02:00
"<Figure size 1500x1000 with 4 Axes>"
2023-09-25 10:22:31 +02:00
]
},
"metadata": {},
2023-09-25 11:05:16 +02:00
"output_type": "display_data"
2023-09-25 10:22:31 +02:00
}
],
"source": [
2023-09-25 11:05:16 +02:00
"fig, ((ax0, ax1), (ax2, ax3)) = plt.subplots(nrows=2, ncols=2, figsize=(15,10))\n",
"\n",
"ax0.hist(scifi_fitpars_found[:,0], bins=100, density=True, alpha=0.5, histtype='bar', color=\"blue\", label=r\"$a_x$ found\")\n",
"ax0.hist(scifi_fitpars_lost[:,0], bins=100, density=True, alpha=0.5, histtype='bar', color=\"darkorange\", label=r\"$a_x$ lost\")\n",
"ax0.set_xlabel(\"a\")\n",
"ax0.set_ylabel(\"normed\")\n",
"ax0.set_title(\"fitparameter a der scifi track\")\n",
"ax0.legend()\n",
"\n",
"ax1.hist(scifi_fitpars_found[:,1], bins=100, density=True, alpha=0.5, histtype='bar', color=\"blue\", label=r\"$b_x$ found\")\n",
"ax1.hist(scifi_fitpars_lost[:,1], bins=100, density=True, alpha=0.5, histtype='bar', color=\"darkorange\", label=r\"$b_x$ lost\")\n",
"ax1.set_xlabel(\"b\")\n",
"ax1.set_ylabel(\"normed\")\n",
"ax1.set_title(\"fitparameter b der scifi track\")\n",
"ax1.legend()\n",
"\n",
"ax2.hist(scifi_fitpars_found[:,2], bins=200, density=True, alpha=0.5, histtype='bar', color=\"blue\", label=r\"$c_x$ found\")\n",
"ax2.hist(scifi_fitpars_lost[:,2], bins=200, density=True, alpha=0.5, histtype='bar', color=\"darkorange\", label=r\"$c_x$ lost\")\n",
"ax2.set_xlim([-1e-5,1e-5])\n",
"ax2.set_xticks(np.arange(-1e-5,1.5e-5,5e-6),minor=False)\n",
"ax2.set_xlabel(\"c\")\n",
"ax2.set_ylabel(\"normed\")\n",
"ax2.set_title(\"fitparameter c der scifi track\")\n",
"ax2.legend()\n",
"\n",
"ax3.hist(scifi_fitpars_found[:,3], bins=200, density=True, alpha=0.5, histtype='bar', color=\"blue\", label=r\"$d_x$ found\")\n",
"ax3.hist(scifi_fitpars_lost[:,3], bins=200, density=True, alpha=0.5, histtype='bar', color=\"darkorange\", label=r\"$d_x$ lost\")\n",
"ax3.set(xlim=(-2e-8,2e-8))\n",
"ax3.set_xlabel(\"d\")\n",
"ax3.set_ylabel(\"normed\")\n",
"ax3.set_title(\"fitparameter d der scifi track\")\n",
"ax3.legend()\n",
"\n",
"\"\"\"\n",
"a_x: virtual hit on the reference plane\n",
"\"\"\"\n",
"\n",
"plt.show()"
2023-09-25 10:22:31 +02:00
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 8,
2023-09-25 11:05:16 +02:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"found\n",
"a = 1.3758753561567658\n",
"b = 1.4867317350363123e-05\n",
"c = 1.0611928711675984e-09\n",
"d = 2.524323901023556e-12\n",
"lost\n",
"a = 19.655460959039587\n",
"b = -0.0007972008149349264\n",
"c = -1.6113881305735422e-07\n",
"d = 8.074893917737833e-11\n"
]
}
],
"source": [
"\"\"\"\n",
"Electrons\n",
"found\n",
"a = -0.6718207391527037 b = 0.0013778237292529144 c = 3.3126998287416195e-08 d = -1.0330674442255529e-10\n",
"lost\n",
"a = -36.98764338200992 b = -0.015685137956233643 c = -8.265859479503501e-07 d = -1.541510766903436e-11\n",
"\n",
"Kaon and Pions\n",
"found\n",
"a = 1.3758753561567658 b = 1.4867317350363123e-05 c = 1.0611928711675984e-09 d = 2.524323901023556e-12\n",
"lost\n",
"a = 19.655460959039587 b = -0.0007972008149349264 c = -1.6113881305735422e-07 d = 8.074893917737833e-11\n",
"\n",
"Kaons\n",
"found\n",
"a = 1.553371699292705\t\tb = 8.625619976952656e-05\t\tc = 3.1024420569192613e-09\t\td = -2.028183118694356e-13\n",
"lost\n",
"a = 50.918713410777336\t\tb = 0.005102900113795297\t\tc = -7.416239379215659e-09\t\td = 5.64633728533602e-11\n",
"\n",
"Pions\n",
"found\n",
"a = 1.1512709788236055\t\tb = -7.54683774644083e-05\t\tc = -1.5218096529826036e-09\t\td = 5.975257412125118e-12\n",
"lost\n",
"a = -3.625684483743866\t\tb = -0.005190892995904242\t\tc = -2.7561307005171267e-07\t\td = 9.883393537611524e-11\n",
"\"\"\"\n",
"\n",
"print(\"found\")\n",
"print(\"a = \", str(np.mean(scifi_fitpars_found[:,0])))\n",
"print(\"b = \", str(np.mean(scifi_fitpars_found[:,1])))\n",
"print(\"c = \", str(np.mean(scifi_fitpars_found[:,2])))\n",
"print(\"d = \", str(np.mean(scifi_fitpars_found[:,3])))\n",
"\n",
"print(\"lost\")\n",
"print(\"a = \", str(np.mean(scifi_fitpars_lost[:,0])))\n",
"print(\"b = \", str(np.mean(scifi_fitpars_lost[:,1])))\n",
"print(\"c = \", str(np.mean(scifi_fitpars_lost[:,2])))\n",
"print(\"d = \", str(np.mean(scifi_fitpars_lost[:,3])))\n"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 9,
2023-09-25 11:05:16 +02:00
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABQEAAAIhCAYAAAD+cXzUAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAAEAAElEQVR4nOzdd5gcV5X4/W/nnKd7ctaMsjSyspMsy3KSwcY2wYADmTWwGLwsLPsDTFgbzO7Cy4JhEzmYZddEY4NzkmRla0YTNTl2T+fcVV1V7x9jDRaSbVkOsuT7eR4/fqa6uupWd4/6zKl7z9FpmqYhCIIgCIIgCIIgCIIgCMIZS3+qByAIgiAIgiAIgiAIgiAIwqtLJAEFQRAEQRAEQRAEQRAE4QwnkoCCIAiCIAiCIAiCIAiCcIYTSUBBEARBEARBEARBEARBOMOJJKAgCIIgCIIgCIIgCIIgnOFEElAQBEEQBEEQBEEQBEEQznAiCSgIgiAIgiAIgiAIgiAIZziRBBQEQRAEQRAEQRAEQRCEM5xIAgqCIAiCIAiCIAiCIAjCGU4kAQXhDeaXv/wlS5cuxWazodPpOHDgwKke0nHddttt6HS6F93v5z//Od/85jdf/QG9gKamJq644opTOgaAeDzOO97xDkKhEDqdjquuuupVP2dTUxM33XTTUdv279/Ppk2b8Hg86HQ6vvnNb/Loo4+i0+l49NFHX/B4P/zhD9Hp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rr76aqampo/Z57nLgkZERgsEgAF/84hfnz31kbLOzs3zwgx+kvr4ei8VCMBjknHPO4cEHHzyh8QiCIAjCmer73/8+K1euxGq14vf7ectb3kJPT89R+wwNDfGOd7yDmpoaLBYLlZWVbNmyZb6sTFNTE4cOHeKxxx6b/w5+oRldOp2OXC7Hj370o/n9j3ynH4kn/vznP/Pe976XYDCI3W6nVCpx+PBh3vOe99DW1obdbqe2tpY3velNdHZ2HnOOZDLJrbfeSktLCxaLhVAoxOWXX05vb+/zjkuWZW688UacTud8zJrP5/m7v/s7mpub51+jNWvW8Itf/OJFX9uuri6uvPJKfD4fVquVjo4OfvSjH80//kKx0/M5kXhycnJyPu4xm83U1NRw7bXXEg6HgWOXA7/Q3wknuhz4iMOHD3P55ZfjdDqpr6/n1ltvnY9Zj3jucuAf/vCHvPWtbwVg8+bN86/BkbHt37+fK664glAohMVioaamhm3btjExMXHCYxIE4S/ETEBBeIP43Oc+x7p16/jIRz7C7bffzubNm+eXcf785z/nXe96FxdffDG/+MUvKJVK3HnnnVxwwQU89NBD80HBS3Xvvfeye/duvvSlL+F0Ornzzjt5y1veQl9fHy0tLQA89NBDXHnllWzcuJG7774bRVG4884754OUF3LXXXfxwQ9+kMHBQX79618fd59vfetbtLe388///M+43W7a2toolUrE43H+7u/+jtraWiRJ4sEHH+Tqq6/mBz/4ATfccMP882+66SZ++tOf8r73vY8vfelLmM1m9u3b97w1SzRN41Of+hTf+ta3+K//+q/5JNTdd9/NzTffzMc+9jH++Z//Gb1ez+HDh+nu7n7BaywWi2zevJnBwUG++MUvsmLFCp544gnuuOMODhw4wL333ju/pOPmm28mlUrxs5/9DHj+mXIjIyNs27aN8847j+9///t4vV4mJye5//77kSQJu91OuVzmsssu44knnuCWW27hwgsvpFwus3PnTsbGxjj77LOPOe62bdvYsWMHGzdu5Nprr+XWW299wWt7Ie9///vZtm0bP//5zxkfH+dTn/oU7373u3n44YePu391dTX3338/l156Ke973/t4//vfDzCfGLz++uvZt28f//RP/0R7ezvJZJJ9+/YRi8VOeoyCIAiCcLq74447+OxnP8t1113HHXfcQSwW47bbbmPjxo3s3r2btrY2AC6//PL5GK2hoYFoNMr27dtJJpPAXHmQa6+9Fo/HM1+u44VWXuzYsYMLL7yQzZs387nPfQ7guOVFtm3bxk9+8hNyuRwmk4mpqSkCgQBf/epXCQaDxONxfvSjH7F+/Xr279/PwoULgbmbieeeey4jIyN8+tOfZv369WSzWR5//HGmp6dZtGjRMWNKJpNcffXV9PT08Nhjj7F69WoAPvnJT/KTn/yEr3zlK6xatYpcLkdXV9eLxhB9fX2cffbZhEIhvvWtbxEIBPjpT3/KTTfdRDgc5u///u9fcux0IvHk5OQka9euRZZlPvvZz7JixQpisRh/+tOfSCQSVFZWHnPcF/o74aWQZZk3v/nNvO997+PWW2/l8ccf58tf/jIej4fPf/7zx33Otm3buP322/nsZz/Ld77zHc466ywAWltbyeVybN26lebmZr7zne9QWVnJzMwMjzzyCJlM5iWPTxAEQBME4Q3jkUce0QDtV7/61fw2RVG0mpoabfny5ZqiKPPbM5mMFgqFtLPPPnt+24033qg1NjYec9wvfOEL2l//cwJolZWVWjqdnt82MzOj6fV67Y477pjftn79eq2mpkYrFArz29LptOb3+4855vFs27btuGMaHh7WAK21tVWTJOkFj1EulzVZlrX3ve992qpVq+a3P/744xqg/eM//uMLPr+xsVHbtm2bls/ntWuuuUbzeDzagw8+eNQ+H/3oRzWv1/ui1/PXvve972mA9j//8z9Hbf/a176mAdqf//zn+W2bNm3Sli5d+qLH/N///V8N0A4cOPC8+/z4xz/WAO0///M/X/BYjY2N2o033njUNkD7yEc+ctS2I5+9Rx555AWP94Mf/EADtJtvvvmo7XfeeacGaNPT0/PbNm3apG3atGn+59nZWQ3QvvCFLxxzXKfTqd1yyy0veG5BEARBOJMd+Y4dHh7WNE3TEomEZrPZtMsvv/yo/cbGxjSLxaK9853v1DRN06LRqAZo3/zmN1/w+EuXLj3
"text/plain": [
"<Figure size 1500x600 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig, ((ax0, ax1)) = plt.subplots(nrows=1, ncols=2, figsize=(15,6))\n",
"\n",
"for i in range(0,ak.num(scifi_found[\"energy\"], axis=0)):\n",
" z_coord = np.linspace(scifi_z_found[i,0],12000,300)\n",
" fit = scifi_track(z_coord, *scifi_fitpars_found[i])\n",
" ax0.plot(z_coord, fit, \"-\", lw=0.5)\n",
" ax0.errorbar(ak.to_numpy(scifi_z_found[i,:]),ak.to_numpy(scifi_x_found[i,:]),fmt=\".\",ms=2)\n",
"\n",
"#ax0.legend()\n",
"ax0.set_xlabel(\"z [mm]\")\n",
"ax0.set_ylabel(\"x [mm]\")\n",
"ax0.set_title(\"found tracks of scifi hits\")\n",
"ax0.set(xlim=(7e3,12000), ylim=(-4000,4000))\n",
"ax0.grid()\n",
"\n",
"for i in range(0,ak.num(scifi_lost[\"energy\"], axis=0)):\n",
" z_coord = np.linspace(scifi_z_lost[i,0],12000,300)\n",
" fit = scifi_track(z_coord, *scifi_fitpars_lost[i])\n",
" ax1.plot(z_coord, fit, \"-\", lw=0.5)\n",
" ax1.errorbar(ak.to_numpy(scifi_z_lost[i,:]),ak.to_numpy(scifi_x_lost[i,:]),fmt=\".\",ms=2)\n",
"\n",
"#ax1.legend()\n",
"ax1.set_xlabel(\"z [mm]\")\n",
"ax1.set_ylabel(\"x [mm]\")\n",
"ax1.set_title(\"lost tracks of scifi hits\")\n",
"ax1.set(xlim=(7e3,12000), ylim=(-4000,4000))\n",
"ax1.grid()\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 10,
2023-09-25 10:22:31 +02:00
"metadata": {},
2023-09-25 11:39:04 +02:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"found \n",
"zmag = 5196.312017664934\n",
"lost \n",
"zmag = 5200.71031871899\n"
]
}
],
2023-09-25 11:05:16 +02:00
"source": [
"#vergleich der zmag werte\n",
"zmag_found = z_mag(xv_found, zv_found, tx_found, scifi_fitpars_found[:,0], scifi_fitpars_found[:,1])\n",
"zmag_lost = z_mag(xv_lost, zv_lost, tx_lost, scifi_fitpars_lost[:,0], scifi_fitpars_lost[:,1])\n",
"zmag_lost = zmag_lost[~np.isnan(zmag_lost)]\n",
2023-09-25 11:39:04 +02:00
"zmag_found = zmag_found[~np.isnan(zmag_found)]\n",
"\n",
"print(\"found \\nzmag = \", str(np.mean(zmag_found)))\n",
"print(\"lost \\nzmag = \", str(np.mean(zmag_lost)))"
2023-09-25 11:05:16 +02:00
]
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": null,
2023-09-25 11:39:04 +02:00
"metadata": {},
2023-09-25 15:57:26 +02:00
"outputs": [],
2023-09-25 11:39:04 +02:00
"source": []
},
{
"cell_type": "code",
2023-09-25 15:57:26 +02:00
"execution_count": 12,
2023-09-25 11:05:16 +02:00
"metadata": {},
"outputs": [
{
"data": {
2023-09-25 15:57:26 +02:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAmMAAAHNCAYAAABSNnx+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8pXeV/AAAACXBIWXMAAA9hAAAPYQGoP6dpAABaR0lEQVR4nO3de1hU5do/8O/EYRBEFBAGkpNaCaFZYChFoCmKpbs0xSyMlNpsKQOydmi+krvSjAzdovwsj7tM3kLdpaRiClmiIQdFobJCMWVCSMEjx+f3hy8rBgYYxoHF4fu5rnXJPOtez7rXejjcrvXMGoUQQoCIiIiIZHGH3AkQERER9WQsxoiIiIhkxGKMiIiISEYsxoiIiIhkxGKMiIiISEYsxoiIiIhkxGKMiIiISEYsxoiIiIhkxGKMiIiISEYsxoiIiIhkxGKMiIiISEYsxoi6oMOHDyM2NhaXL1/WKT42NhYKhQKlpaUtxm3atAkKhQJnzpxpUz669t9ZaDvO5s6pvuekp0hKSsK9996LXr16QaFQIDc3t933mZKSA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RFpaGt555x14enq2OV99zk9b5r5lZ2fjvvvug7GxMT766CM8+OCDmDlzps7PN9Pl57st6n8XaPu51+V3QU5ODgDNwisrKwumpqZtmgdKXRuLMaJGFApFk4npu3fvxvnz56XXFhYW8Pb2xs6dO1FVVSW1X716Fbt27dJrv+bm5hg9ejR
2023-09-25 11:05:16 +02:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.hist(zmag_found, bins=2000, density=True, alpha=0.5, histtype='bar', color=\"blue\", label=\"found\")\n",
"plt.hist(zmag_lost, bins=500, density=True, alpha=0.5, histtype=\"bar\",color=\"darkorange\", label=\"lost\")\n",
"plt.xlabel(\"$z_{mag}$ [mm]\")\n",
"plt.ylabel(\"normed\")\n",
2023-09-25 15:57:26 +02:00
"plt.title(\"magnet kick position $z_{mag}$ for $K$ and $\\pi$\")\n",
2023-09-25 11:05:16 +02:00
"plt.legend()\n",
2023-09-25 15:57:26 +02:00
"plt.xticks(np.arange(4900,5405,5), minor=True)\n",
2023-09-25 11:05:16 +02:00
"plt.yticks(np.arange(0,0.015,0.001), minor=True)\n",
2023-09-25 15:57:26 +02:00
"plt.xlim(4900,5400)\n",
2023-09-25 11:05:16 +02:00
"\n",
"\"\"\"\n",
2023-09-25 15:57:26 +02:00
"the distribution for lost K and pi has a peak at around the same zmag value as found but its less compact and seems chaotic outside the range of the peak.\n",
"the distribution for found particles appears compact around the peak.\n",
"\n",
2023-09-25 11:05:16 +02:00
"\"\"\"\n",
"\n",
"plt.show()"
]
2023-09-25 10:22:31 +02:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "env1",
"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.11.5"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}