tracking-parametrisation-tuner/parameterisations/notebooks/bend_y_params.ipynb

690 lines
419 KiB
Plaintext
Raw Permalink Normal View History

2023-12-19 13:00:59 +01:00
{
"cells": [
{
"cell_type": "code",
"execution_count": 106,
2023-12-19 13:00:59 +01:00
"metadata": {},
"outputs": [],
"source": [
"import uproot\n",
"import awkward as ak\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
2023-12-19 13:00:59 +01:00
"import numpy as np\n",
"import mplhep\n",
"\n",
"from sklearn.preprocessing import PolynomialFeatures\n",
"from sklearn.linear_model import LinearRegression, Lasso, Ridge, ElasticNet\n",
"from sklearn.model_selection import train_test_split\n",
"from sklearn.pipeline import Pipeline\n",
"from sklearn.metrics import mean_squared_error\n",
"\n",
"mplhep.style.use([\"LHCbTex2\"])\n",
"input_tree = uproot.open(\n",
" {\n",
" \"/work/cetin/LHCb/reco_tuner/data/tracking_losses_ntuple_B_BJpsi_def_selected.root\": \"Selected\"\n",
" }\n",
")\n",
2023-12-19 13:00:59 +01:00
"array = input_tree.arrays()\n",
"\n",
"array[\"yStraightOut\"] = array[\"ideal_state_770_y\"] + array[\"ideal_state_770_ty\"] * (\n",
" array[\"ideal_state_10000_z\"] - array[\"ideal_state_770_z\"]\n",
")\n",
"array[\"yDiffOut\"] = array[\"ideal_state_10000_y\"] - array[\"yStraightOut\"]\n",
"array[\"yStraightEndT\"] = array[\"ideal_state_770_y\"] + array[\"ideal_state_770_ty\"] * (\n",
" 9410.0 - array[\"ideal_state_770_z\"]\n",
")\n",
"array[\"yDiffEndT\"] = array[\"ideal_state_9410_y\"] - array[\"yStraightEndT\"]\n",
"\n",
"array[\"dSlope_xEndT\"] = array[\"ideal_state_9410_tx\"] - array[\"ideal_state_770_tx\"]\n",
"array[\"dSlope_yEndT\"] = array[\"ideal_state_9410_ty\"] - array[\"ideal_state_770_ty\"]\n",
2023-12-19 13:00:59 +01:00
"array[\"dSlope_xEndT_abs\"] = abs(array[\"dSlope_xEndT\"])\n",
"array[\"dSlope_yEndT_abs\"] = abs(array[\"dSlope_yEndT\"])\n",
"\n",
"sel_array = array[(array[\"yDiffOut\"] < 100) & (array[\"yDiffOut\"] > -100)]\n",
"# sel_array = array\n",
"\n",
2023-12-19 13:00:59 +01:00
"\n",
"def format_array(name, coef):\n",
" coef = [str(c) + \"f\" for c in coef if c != 0.0]\n",
2023-12-19 13:00:59 +01:00
" code = f\"constexpr std::array {name}\"\n",
" code += \"{\" + \", \".join(list(coef)) + \"};\"\n",
2023-12-19 13:00:59 +01:00
" return code"
]
},
{
"cell_type": "code",
"execution_count": 107,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOWCAYAAAANzz7PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACkdklEQVR4nOz9T0xj+b3n/78OyWKk0YUDNboSAuk2x12z+GVT2FT2KexOtrfLhl4njV11VxFJ4aL305Td3fyyuimb6qynMFW9zS2b6n0an6peZJX2gZZAlmZUcHA00mzC+S4Y+2L+GGMbn+Pi+ZCsYPj483kbipZ45f35fAzP8zwBAAAAAAAA77khvwsAAAAAAAAA+oEgDAAAAAAAADcCQRgAAAAAAABuBIIwAAAAAAAA3AgEYQAAAAAAALgRCMIAAAAAAABwIxCEAQAAAAAA4EYgCAMAAAAAAMCNQBAGAAAAAACAG4EgDAAAAAAAADcCQRgAAAAAAABuBIIwAAAAAAAA3AgEYQAAAAAAALgRCMIAAAAAAABwIxCEAQAAAAAA4EYgCAMAAAAAAMCNQBAGAAAAAACAG4EgDAAAAAAAADcCQRgAAAAAAABuBIIwAAAAAAAA3AgEYQAAAAAAALgRCMIAAAAAAABwIxCEAQAAAAAA4EYgCAMAAAAAAMCNQBAGAAAAAACAG4EgDAAAAAAAADcCQRgAAAAAAABuBIIwAAAAAAAA3Ag/9bsA4L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NnUvz8/Nd1RSJRJqetxsAnd6CWA/n/F77dAdYu+Ha6QCtk1swAQAAAAAA+in
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig = plt.figure()\n",
"plt.hist(\n",
" sel_array[\"yDiffOut\"],\n",
" bins=100,\n",
" # range=[5100, 5700],\n",
" color=\"#2A9D8F\",\n",
" density=True,\n",
")\n",
"plt.xlabel(r\"$y_{corr}$ [mm]\")\n",
"plt.ylabel(\"Number of Tracks (normalised)\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
"plt.show()\n",
"# plt.savefig(\n",
"# \"/work/cetin/LHCb/reco_tuner/parameterisations/plots/magnet_kink_dist.pdf\",\n",
"# format=\"PDF\",\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 108,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOWCAYAAAANzz7PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACbPElEQVR4nOz9T2xbZ57n/35IO4HzS4qi5MYAhAjc8lHXIIVZdIuUe5G7mhY5PcCNJ+kJaRcqY2fRZSoVBDMAG0XGlXXsUDNN4N65yDWZqsU4NwuHSnWCZICaiMmsfitLdM3OmCrSKUACgcHEotnJL0b+8PwWarJF/Tk8lA55DnneL4AYyfrq4Vf/Ms1PfZ/nCZimaQoAAAAAAACYckG3GwAAAAAAAADGgSAMAAAAAAAAvkAQBgAAAAAAAF8gCAMAAAAAAIAvEIQBAAAAAADAFwjCAAAAAAAA4AsEYQAAAAAAAPAFgjAAAAAAAAD4AkEYAAAAAAAAfIEgDAAAAAAAAL5AEAYAAAAAAABfIAgDAAAAAACALxCEAQAAAAAAwBcIwgAAAAAAAOALBGEAAAAAAADwBYIwAAAAAAAA+AJB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BVy6X06VLl2QYhu2vJ5/Pa3V19cC/p1Kp3lrd9RqNhhqNhiqVit57771eOLb/d3n/19y96EGSFhYWHDtjEAAAAAAw+TwdhF2/fl13797tvW+a5qEvou0wTVOBQMCp1jyjG/AZhtEXAOy3P9CwexPn/rparWZ7mswvwuGwYrGYKpWKVlZWDr1YIJVKWf58TsIwDGUyGSUSCS0sLBxas7m5aTusCofDSiQSSiQSisfjh05
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = np.linspace(-200, 200, 50)\n",
"sns.regplot(\n",
" x=ak.to_numpy(sel_array[\"ideal_state_770_y\"]),\n",
" y=ak.to_numpy(sel_array[\"yDiffOut\"]),\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
")\n",
"plt.xlabel(\"y (VELO)\")\n",
"plt.ylabel(\"$y_{corr}$ [mm]\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 109,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOWCAYAAAANzz7PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACQSklEQVR4nOz90W+j95kn+D6U3TkOkmZR5cECggRsmxoDCc7FnqLKe5G7nRJn5iJG0hPJHiSIA5zZktxBsBfajZTqXMyVU1E1WjcLZCw6fS4cGBhbSjZBctET0Zk/wBIrexdsr2g3IIHAYlKi2QlipG3yXFRLLakkipJe8X0pfj6AAKn08H0fipK7+c3v9/xynU6nEwAAAABwzY2k3QAAAAAA9IMgDAAAAIChIAgDAAAAYCgIwgAAAAAYCoIwAAAAAIaCIAwAAACAoSAIAwAAAGAoCMIAAAAAGAqCMAAAAACGgiAMAAAAgKEgCA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CwVV58XPnq//iP9XPz5+8TfK0f09SsViMUqn0xL/PzMxceAXaaX2fJwSrVqtPrMwqFAqxtbXVcwgW8XgF2vb29hPP5dGjR6c+xgmRAAAAwyHTQdj+m+tcLncQiF30A67C10sRn/mT3mo/+6mIV/4pfzpt22G37YhJOuk+l7n3SY89T7hUq9WiXC4/8fh33333xNCul37ef//9Iz0Yhg8AAECmZ4TduHEjSqVSPHz4MJaXl6NUKsXNmzfPfZ16vR7f+9734te//nXyTTLUbjwT8YMvRXyjh7nxr385Iv/M489PC4ku8vs96Or1ety5c+eJf19
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = np.linspace(-200, 200, 50)\n",
"sns.regplot(\n",
" x=ak.to_numpy(sel_array[\"ideal_state_9410_y\"]),\n",
" y=ak.to_numpy(sel_array[\"yDiffOut\"]),\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
")\n",
"plt.xlabel(\"y (T)\")\n",
"plt.ylabel(\"$y_{corr}$ [mm]\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 110,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOWCAYAAAANzz7PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB2LUlEQVR4nOz9T2zj6Z0n9n+oLhvt2FFR1YMFCtJhipoOHOSwU1R1DptTtqgkQOyMd5uqGoxj+7BTkmew2ABKTE3bh2wO7jIVjC4BZprqmcPP3jlUU/bYsBfIWOzOeVES27kZmRG7B6iCgAW6xNbYcMPuFn8HrTiSSn8oieSX5Pf1AogmSw+/z+dLPsUW3/U8zzfTarVaAQAAAAAjbizpAgAAAACgHwRhAA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aLR48eRa1WMwsMAACAtoEPwnK5XLzxxhvxh3/4h1cKwj788MMjAVEa3blz58jjToOww0HCQUDBvtXV1VhYWLjw8/L5fFcugpDJZC78nGw2Gzs7Oyf+bG5uLtbW1i58zPX19Y4D0mazGQ8fPozl5eUz2xz8fa3Vau22+Xw+CoVCTE9Px/r6eqytrT03hh88eBCNRiP1f98BAAB43kAHYT/4wQ8iIuK3fuu3YmJiIl5++eX27KaLaDab8dZbb3W7vJ4pl8tRLpc7bj89Pd3eR61arZ76GuXz+SNXjnz8+HFHr+fGxkb7/vEwLe3m5+fj3r170Wg04uHDh2eGSIVCIZaWluLOnTtd22ftYA+9Wq0WS0tLp85+yuVysbS0FIVC4cwgs1qtRrPZjI2NjSiXy2fOSiyVSnH
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bins = np.linspace(-1, 1, 50)\n",
"sns.regplot(\n",
" x=ak.to_numpy(sel_array[\"ideal_state_9410_ty\"]),\n",
" y=ak.to_numpy(sel_array[\"yDiffOut\"]),\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
")\n",
"plt.xlabel(\"ty (T)\")\n",
"plt.ylabel(\"$y_{corr}$ [mm]\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 111,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMEAAAOWCAYAAADm+IXMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACJfklEQVR4nOz9XWyj6XkneF9Ul4322sOiqoMFBBJ401Q8cDAHM0VV58B7tFPUeIF1T5xpqTqI021gk5Jsv35nAe1actnHdlmVjU6ym1hsZ4Dpjg+6JXtsxAN4LLb3bIFB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isRjT09MX+vteVXfn5uIP//BOVKvVuH//ftsAqVgsxtLSUty6datr+1K1Wq2DveOWlpZOnfV0eF+5docbrK2tRb1ej4cPH8by8nKUy+VTaxcXF+PFF1+MfD7f8e+ztLR0Yvg1MzNzMNb+ePtLe9fW1uKNN944+HwfD7eO/86HlztOTk52bT9BAAAARl+q1Wq1Bt3EaW7duhVvv/32wfetVutCs18Ov/aDDz7oVntD5cGDB7G0tBQREbu7u22Dienp6bYBx8zMTNy7d+/cM9E6kcvlYmdnJ7LZbGxvb3d9/G75oBlx7Wvta97/esRTh85XnZ+fj1Kp9ETdzMxMz/eiqlarMTk5eeJzZ30eTjM1NXXijKrV1dWYm5s7V2/T09NPBFJzc3MdL8c9/Pk+LJ/Px9bW1omvOf5+9ON9AAAASJpRuY/vxNjZJYNz586daLVasZ/TXTQAuwr2l0IWCoW2gcf+zKF21tfXY2pqKubnz7/
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-02-29 15:54:19 +01:00
"bins = np.linspace(-0.5, 0.5, 50)\n",
"sns.regplot(\n",
" x=ak.to_numpy(sel_array[\"ideal_state_770_ty\"]),\n",
" y=ak.to_numpy(sel_array[\"yDiffOut\"]),\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
")\n",
2024-02-29 15:54:19 +01:00
"plt.xlabel(\"$t_y$\")\n",
"plt.ylabel(\"$y_{corr}$ [mm]\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
2024-02-29 15:54:19 +01:00
"plt.show()\n",
"# plt.savefig(\n",
"# \"/work/cetin/LHCb/reco_tuner/parameterisations/plots/bend_y_ty_dist.pdf\",\n",
"# format=\"PDF\",\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 112,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOVCAYAAACLW0xhAAAAOXRFWHRTb2Z0d2FyZQB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B2ERzzbKz+fzMT09faF+3nvvvbbNLAMAAADg8rnS6wKasb6+Hrdu3YqXXnopFhYW4tq1a0097smTJ1Gr1aJSqcSbb77Z4SoBAACAi0qSiL2kcZuhTEQm0516GCyXIgh7++23IyKiUqnE7OzsufpIkiQy/i8BAACAvraXRFz5euM2v/lGxHNO8TmHvg/CvvzlL8fq6mpERGQymUiSM2LhEwjAAAAAAOjrPcJef/31WFlZqYdf5wnBLvI4AAAAAAZHX88I27/K4/5MsEKhEJOTk5HNZlveJ+y1116L999/v4PVAgAAANDP+joIK5fLkclkIpvNxsbGRty4cePcfd27dy9efPHFNlYHAAAAwGXS10sjs9lsRETcv3//QiHYfl83b95sQ1UAAAAAXEZ9HYRNTExEREQul2tLf6+//npb+gGIiKjVar0uAQAAgBb0dRA2OzsbSZJEtVptS39mhAEXVS6XY2FhIUZGRuLevXu9LgcAAIAW9PUeYVNTU3Hz5s14+PBh/Kf/9J8u3N8PfvCD+MM//MM2VAb0o3K5HA8fPoxyuRzVarV+sYxsNhu5XC6uXbsW+Xw+Jicno1AoHHv89PR0VKvV2NzcrH+vVqtFqVSKhw8fRqlUMgsMAADgEuvrICwiolgsxic+8Yn467/+6/iDP/iDC/X14MEDQRh9bXV1NWZnZ1t+XD6fPxTenFcmk2n5MdlsNnZ2dk782fT0dKytrbX
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-02-29 15:54:19 +01:00
"bins = np.linspace(-0.5, 0.5, 100)\n",
"sns.regplot(\n",
" x=ak.to_numpy(sel_array[\"dSlope_yEndT\"]),\n",
" y=ak.to_numpy(sel_array[\"yDiffOut\"]),\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
")\n",
2024-02-29 15:54:19 +01:00
"plt.xlabel(\"$\\Delta t_y$\")\n",
"plt.ylabel(\"$y_{corr}$ [mm]\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
2024-02-29 15:54:19 +01:00
"plt.show()\n",
"# plt.savefig(\n",
"# \"/work/cetin/LHCb/reco_tuner/parameterisations/plots/bend_y_deltaty_dist.pdf\",\n",
"# format=\"PDF\",\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 113,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOVCAYAAACLW0xhAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAB3oUlEQVR4nOz9X2yk530nev6K3Qlk2GEXW8EABAlMuhgdKNiLc7rYmgvfzXRxcy6iTTIipSBe2cCeNOlkjbMHnDHptm9mLqQ2OQiB3VlkRMq+WAe+aJH2xIgvMmLZ5+pcDNQs+dwZx6mSBuheAgO4WWLstZBIrL3oIcO/xSL5Vr1v1fv5AAWRzaee91dkvUXVl7/neQutVqsVAAAAADDghtIuAAAAAAB6QRAGAAAAQC4IwgAAAADIBUEYAAAAALkgCAMAAAAgFwRhAAAAAOSCIAwAAACAXBCEAQAAAJALgjAAAAAAckEQBgAAAEAuCMIAAAAAyAVBGAAAAAC5IAgDAAAAIBcEYQAAAADkgiAMAAAAgFwQhAEAAACQC4IwAAAAAHJBEAYAAABALgjCAAAAAMgFQRgAAAAAuSAIAwAAACAXBGEAAAAA5IIgDAAAAIBcEIQBAAAAkAuCMAAAAAByQRAGAAAAQC4IwgAAAADIBUEYAAAAALkgCAMAAAAgFwRhfaTRaMTU1FRsbGxcaZ7l5eWYmpqKkZGRKBQKMTExETMzM1GtVhOqFAAAACB7BGF9oNlsxszMTExMTES1Wo2nT59eap5qtRojIyOxuLgYERHr6+tRr9djaWkparVaTE1NxdTUVDSbzQSrBwAAAMiG62kXwNmazWY8ePAglpeXrzxXtVqNqampiIiYnZ2N1dXVg6+VSqWYnp6OycnJqFarMTk5GVtbW1EsFq98XAAAAICs0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WpFqVSKcrkcpVIpIiKef/75c+f4+c9/Hs1mM95555346KOPulovAAAAANmV6SBs/+qIERGbm5tx9+7dS8+1sLAQL7zwQlKlAQAAANBnhtIuoJ1isRgRz0Ksq4RgERGlUilu3bqVQFUAAAAA9KNMB2H7SyBfeumlROZbXV1NZB4AAAAA+k+mg7D9LrCnT58mOh8AAAAA+ZPpIOzrX/96tFqtqNVqicz3rW99K5F5AAAAAOg/mQ7Cbty4Ed/85jfj4cOH8Xd/93dXns/SSAAAAID8ynQQFvFso/xyuRwzMzNXmueDDz5IrLMMAAAAgP5zPe0COrG5uRl37tyJF154IRYXF+PmzZsd3e/p06fRbDajXq/HO++80+UqAQAAAP5RqxWx12o/ZqgQUSj0ph76JAj78Y9/HBER9Xo95ubmLjVHq9WKgmcWAAAA0CN7rYjr32g/5pM3Iq6JK3om80HYn/7pn8ba2lpERBQKhWi1zolSTyEAAwAAACDTe4S9/fbbsbq6ehB+XSYEu8r9AAAAABgcme4I27/K434nWKVSiampqSgWixfeJ+ytt96KDz/8sIvVAgAAAJBlmQ7CarVaFAqFKBaL8ejRo7h169al57p37148//zzCVYHAAAAQD/J9NLIYrEYERH379+/Ugi2P9ft27cTqAoAAACAfpTpIGxycjIiIkqlUiLzvf3224nMA/SnZrOZdgkAAACkKNNB2NzcXLRarWg0GonMpyMM8qdWq8Xi4mKMjIzEvXv30i4HAACAFGV6j7Dp6em4fft2PHz4MP71v/7XV57v+9//fvzLf/kvE6iMq9re3o7x8fG2Y+bn52N+fr5HFZGGWq0WDx8+jFqtFo1G4+DiFsViMUqlUty8eTPK5XJMTU1FpVI5cf+ZmZloNBqxtbV18G/NZjOq1Wo8fPgwqtWqLjAAAIAeWllZiZWVlbZjtre3e1TNSZkOwiIi1tfX47d
"text/plain": [
"<Figure size 1200x900 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-02-29 15:54:19 +01:00
"bins = np.linspace(-1.0, 1.0, 50)\n",
"sns.regplot(\n",
" x=ak.to_numpy(sel_array[\"dSlope_xEndT\"]),\n",
" y=ak.to_numpy(sel_array[\"yDiffOut\"]),\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
")\n",
2024-02-29 15:54:19 +01:00
"plt.xlabel(\"$\\Delta t_x$\")\n",
"plt.ylabel(\"$y_{corr}$ [mm]\")\n",
"mplhep.lhcb.text(\"Simulation\")\n",
2024-02-29 15:54:19 +01:00
"plt.show()\n",
"# plt.savefig(\n",
"# \"/work/cetin/LHCb/reco_tuner/parameterisations/plots/bend_y_deltatx_dist.pdf\",\n",
"# format=\"PDF\",\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 119,
2023-12-19 13:00:59 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"intercept= 0.0\n",
"coef= {'dSlope_yEndT': 4089.1594362560113, 'dSlope_xEndT dSlope_yEndT': 25.0456971896117, 'ideal_state_770_ty dSlope_xEndT^2': 1049.7443418962382, 'ideal_state_770_ty dSlope_yEndT^2': 77388.96417801932}\n",
"r2 score= 0.7591964011096296\n",
"RMSE = 9.026349818744066\n"
2023-12-19 13:00:59 +01:00
]
}
],
"source": [
"features = [\n",
" \"ideal_state_770_ty\",\n",
" # \"ideal_state_9410_ty\",\n",
" # \"ideal_state_770_y\",\n",
" # \"ideal_state_9410_y\",\n",
" \"dSlope_xEndT\",\n",
" \"dSlope_yEndT\",\n",
"]\n",
"target_feat = \"yDiffOut\"\n",
"order = 3\n",
"\n",
"data = np.column_stack([ak.to_numpy(sel_array[feat]) for feat in features])\n",
"target = ak.to_numpy(sel_array[target_feat])\n",
"X_train, X_test, y_train, y_test = train_test_split(data,\n",
" target,\n",
" test_size=0.2,\n",
" random_state=42)\n",
"\n",
"poly = PolynomialFeatures(degree=order, include_bias=False)\n",
"X_train_model = poly.fit_transform(X_train)\n",
"X_test_model = poly.fit_transform(X_test)\n",
"\n",
"poly_features = poly.get_feature_names_out(input_features=features)\n",
"\n",
"# keep = [\n",
"# \"ideal_state_770_ty\", #\n",
"# \"dSlope_xEndT\", #\n",
"# \"dSlope_yEndT\", # keep\n",
"# \"ideal_state_770_ty^2\", #\n",
"# \"ideal_state_770_ty dSlope_xEndT\", #\n",
"# \"ideal_state_770_ty dSlope_yEndT\", #\n",
"# \"dSlope_xEndT^2\", # do not keep\n",
"# \"dSlope_xEndT dSlope_yEndT\", # keep\n",
"# \"dSlope_yEndT^2\", #\n",
"# \"ideal_state_770_ty^3\",\n",
"# \"ideal_state_770_ty^2 dSlope_xEndT\", #\n",
"# \"ideal_state_770_ty^2 dSlope_yEndT\",\n",
"# \"ideal_state_770_ty dSlope_xEndT^2\", # keep\n",
"# \"ideal_state_770_ty dSlope_xEndT dSlope_yEndT\", #\n",
"# \"ideal_state_770_ty dSlope_yEndT^2\", # keep\n",
"# \"dSlope_xEndT^3\", # do not keep\n",
"# \"dSlope_xEndT^2 dSlope_yEndT\", #\n",
"# \"dSlope_xEndT dSlope_yEndT^2\", #\n",
"# \"dSlope_yEndT^3\",\n",
"# \"ideal_state_770_ty^4\",\n",
"# \"ideal_state_770_ty^3 dSlope_xEndT\",\n",
"# \"ideal_state_770_ty^3 dSlope_yEndT\",\n",
"# \"ideal_state_770_ty^2 dSlope_xEndT^2\", #\n",
"# \"ideal_state_770_ty^2 dSlope_xEndT dSlope_yEndT\",\n",
"# \"ideal_state_770_ty^2 dSlope_yEndT^2\",\n",
"# \"ideal_state_770_ty dSlope_xEndT^3\", # do not keep\n",
"# \"ideal_state_770_ty dSlope_xEndT^2 dSlope_yEndT\", #\n",
"# \"ideal_state_770_ty dSlope_xEndT dSlope_yEndT^2\",\n",
"# \"ideal_state_770_ty dSlope_yEndT^3\",\n",
"# \"dSlope_xEndT^4\", #\n",
"# \"dSlope_xEndT^3 dSlope_yEndT\", # keep\n",
"# \"dSlope_xEndT^2 dSlope_yEndT^2\", #\n",
"# \"dSlope_xEndT dSlope_yEndT^3\",\n",
"# \"dSlope_yEndT^4\",\n",
"# \"ideal_state_770_ty^5\",\n",
"# \"ideal_state_770_ty^4 dSlope_xEndT\",\n",
"# \"ideal_state_770_ty^4 dSlope_yEndT\",\n",
"# \"ideal_state_770_ty^3 dSlope_xEndT^2\",\n",
"# \"ideal_state_770_ty^3 dSlope_xEndT dSlope_yEndT\",\n",
"# \"ideal_state_770_ty^3 dSlope_yEndT^2\",\n",
"# \"ideal_state_770_ty^2 dSlope_xEndT^3\", #\n",
"# \"ideal_state_770_ty^2 dSlope_xEndT^2 dSlope_yEndT\",\n",
"# \"ideal_state_770_ty^2 dSlope_xEndT dSlope_yEndT^2\",\n",
"# \"ideal_state_770_ty^2 dSlope_yEndT^3\",\n",
"# \"ideal_state_770_ty dSlope_xEndT^4\", # keep\n",
"# \"ideal_state_770_ty dSlope_xEndT^3 dSlope_yEndT\", #\n",
"# \"ideal_state_770_ty dSlope_xEndT^2 dSlope_yEndT^2\",\n",
"# \"ideal_state_770_ty dSlope_xEndT dSlope_yEndT^3\",\n",
"# \"ideal_state_770_ty dSlope_yEndT^4\",\n",
"# \"dSlope_xEndT^5\", #\n",
"# \"dSlope_xEndT^4 dSlope_yEndT\", # keep\n",
"# \"dSlope_xEndT^3 dSlope_yEndT^2\", #\n",
"# \"dSlope_xEndT^2 dSlope_yEndT^3\",\n",
"# \"dSlope_xEndT dSlope_yEndT^4\",\n",
"# \"dSlope_yEndT^5\",\n",
"# ]\n",
"\n",
"keep = [\n",
" \"dSlope_yEndT\", # keep\n",
" \"dSlope_xEndT dSlope_yEndT\", # keep\n",
" \"ideal_state_770_ty dSlope_xEndT^2\", # keep\n",
" \"ideal_state_770_ty dSlope_yEndT^2\", # keep\n",
" # \"dSlope_xEndT^3 dSlope_yEndT\", # do not keep\n",
" # \"ideal_state_770_ty dSlope_xEndT^4\", # keep\n",
" # \"dSlope_xEndT^4 dSlope_yEndT\", # keep\n",
" ###\n",
" # \"ideal_state_770_ty^5\",\n",
" # \"dSlope_xEndT^5\",\n",
" # \"dSlope_yEndT^5\",\n",
"]\n",
"\n",
"# keep = [\n",
"# \"ideal_state_770_ty dSlope_yEndT^2\",\n",
"# \"ideal_state_770_ty dSlope_xEndT^2\",\n",
"# ]\n",
"remove = [i for i, f in enumerate(poly_features) if f not in keep]\n",
"\n",
"X_train_model = np.delete(X_train_model, remove, axis=1)\n",
"X_test_model = np.delete(X_test_model, remove, axis=1)\n",
"poly_features = np.delete(poly_features, remove)\n",
"# print(poly_features)\n",
"lin_reg = LinearRegression(fit_intercept=False)\n",
"# lin_reg = Lasso(fit_intercept=False, alpha=0.000001)\n",
"# lin_reg = Lasso(alpha=0.1)\n",
"# lin_reg = LassoCV(max_iter=2000)\n",
"# lin_reg = ElasticNet(alpha=0.1)\n",
"# lin_reg = Ridge(alpha=0.1)\n",
"lin_reg.fit(X_train_model, y_train)\n",
"y_pred_test = lin_reg.predict(X_test_model)\n",
"print(\"intercept=\", lin_reg.intercept_)\n",
"print(\"coef=\", dict(zip(poly_features, lin_reg.coef_)))\n",
"print(\"r2 score=\", lin_reg.score(X_test_model, y_test))\n",
"print(\"RMSE =\", mean_squared_error(y_test, y_pred_test, squared=False))"
]
},
{
"cell_type": "code",
"execution_count": 115,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[]"
]
},
"execution_count": 115,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"koeffs = dict(zip(poly_features, lin_reg.coef_))\n",
2023-12-19 13:00:59 +01:00
"\n",
"remove = []\n",
"for itr in koeffs.items():\n",
" if abs(itr[1]) < 1.0:\n",
" remove.append(itr[0])\n",
"remove"
]
},
{
"cell_type": "code",
"execution_count": 116,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['dSlope_yEndT',\n",
" 'dSlope_xEndT dSlope_yEndT',\n",
" 'ideal_state_770_ty dSlope_xEndT^2',\n",
" 'ideal_state_770_ty dSlope_yEndT^2',\n",
" 'ideal_state_770_ty dSlope_xEndT^4',\n",
" 'dSlope_xEndT^4 dSlope_yEndT']"
]
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ls_koeffs = []\n",
"for itr in koeffs.items():\n",
" ls_koeffs.append(itr[0])\n",
"ls_koeffs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 120,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAABMIAAAOWCAYAAAANzz7PAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAADmdUlEQVR4nOz9XWyb6Z3nff4oV2crmI50S+6DHdiLWLfsQXoXeNq6KQfoxvZBLLJqFkjQqZiUCx0kOUiJtNO9c6DEolTBYAYYxBLlig96thOTch1s+gkQibQrjeTBJialOllsY2KRcmaAQZ6u4i011sbMiUWK6UZnOynde6CQ0Stfb77q+wGE1svF6/rTtNzhr67rf3kcx3EEAAAAAAAA9LmBThcAAAAAAAAAtANBGAAAAAAAAM4EgjAAAAAAAACcCQRhAAAAAAAAOBMIwgAAAAAAAHAmEIQBAAAAAADgTCAIAwAAAAAAwJlAEAYAAAAAAIAzgSAMAAAAAAAAZwJBGAAAAAAAAM4EgjAAAAAAAACcCQRhAAAAAAAAOBMIwgAAAAAAAHAmEIQBAAAAAADgTCAIAwAAAAAAwJlAEAYAAAAAAIAzgSAMAAAAAAAAZwJBGAAAAAAAAM4EgjAAAAAAAACcCQRhAAAAAAAAOBMIwgAAAAAAAHAmEIQBAAAAAADgTCAIAwAAAAAAwJlAEAYAAAAAAIAzgSAMAAAAAAAAZwJBGAAAAAAAAM4EgjAAAAAAAACcCQRhADquUCh0ugQAAAAAwBlAEAagI7LZrCKRiIaHhzU9Pd3pcgAAAAAAZ8ArnS4AQPfJZrNaWVlRNpuVbdva2dlRoVCQYRgyTVMjIyOyLEt+v18+n+/Y44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[
"<Figure size 1200x900 with 2 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-02-29 15:54:19 +01:00
"bins = np.linspace(-40, 40, 41)\n",
"ax = sns.regplot(\n",
" x=y_test,\n",
2024-02-29 15:54:19 +01:00
" y=y_test - y_pred_test,\n",
" x_bins=bins,\n",
" fit_reg=None,\n",
" x_estimator=np.mean,\n",
" label=\"bla\",\n",
")\n",
"ax2 = ax.twinx()\n",
2024-02-29 15:54:19 +01:00
"ax2.hist(\n",
" y_test,\n",
" bins=30,\n",
" range=[-40, 40],\n",
" color=\"#2A9D8F\",\n",
" alpha=0.5,\n",
" align=\"mid\",\n",
" density=True,\n",
")\n",
"ax.set_xlabel(r\"$y_{\\mathrm{corr}}$ [mm]\")\n",
"ax.set_ylabel(\n",
" r\"$\\left\\langle y_{\\mathrm{corr}}-y_{\\mathrm{corr}}^{\\mathrm{pred}}\\right\\rangle$ [mm]\"\n",
")\n",
"ax2.set_ylabel(\"Number of Tracks (normalised)\")\n",
"mplhep.lhcb.text(\"Simulation\", loc=0)\n",
"plt.show()\n",
"# plt.savefig(\n",
"# \"/work/cetin/LHCb/reco_tuner/parameterisations/plots/bend_y_regression_plot.pdf\",\n",
"# format=\"PDF\",\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
2024-02-29 15:54:19 +01:00
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
2023-12-19 13:00:59 +01:00
"features = [\n",
" \"ideal_state_770_ty\",\n",
" \"ideal_state_770_tx\",\n",
2023-12-19 13:00:59 +01:00
" \"dSlope_xEndT\",\n",
" \"dSlope_yEndT\",\n",
" \"dSlope_xEndT_abs\",\n",
" \"dSlope_yEndT_abs\",\n",
"]\n",
"target_feat = \"yDiffEndT\"\n",
"\n",
"data = np.column_stack([ak.to_numpy(array[feat]) for feat in features])\n",
"target = ak.to_numpy(array[target_feat])\n",
2024-02-29 15:54:19 +01:00
"X_train, X_test, y_train, y_test = train_test_split(data,\n",
" target,\n",
" test_size=0.2,\n",
" random_state=42)\n",
2023-12-19 13:00:59 +01:00
"\n",
"poly = PolynomialFeatures(degree=6, include_bias=False)\n",
"X_train_model = poly.fit_transform(X_train)\n",
"X_test_model = poly.fit_transform(X_test)\n",
2023-12-19 13:00:59 +01:00
"poly_features = poly.get_feature_names_out(input_features=features)\n",
"keep = [\n",
" #'dSlope_xEndT',\n",
" \"dSlope_yEndT\", # keep\n",
2023-12-19 13:00:59 +01:00
" #'dSlope_yEndT_abs',\n",
" #'ty dSlope_xEndT',\n",
" #'ty dSlope_yEndT',\n",
" \"ideal_state_770_ty dSlope_xEndT_abs\", # keep\n",
" \"ideal_state_770_ty dSlope_yEndT_abs\", # keep\n",
" \"ideal_state_770_ty dSlope_yEndT^2\", # keep\n",
" \"ideal_state_770_ty dSlope_xEndT^2\", # keep\n",
2023-12-19 13:00:59 +01:00
" #'tx dSlope_xEndT',\n",
" #'tx dSlope_xEndT_abs',\n",
" #'tx dSlope_yEndT',\n",
" \"ideal_state_770_ty ideal_state_770_tx dSlope_xEndT\", # keep\n",
" \"ideal_state_770_tx^2 dSlope_yEndT\", # keep\n",
2023-12-19 13:00:59 +01:00
" #'ty^2 dSlope_xEndT',\n",
" #'ty^2 dSlope_yEndT',\n",
2023-12-19 13:00:59 +01:00
" #'ty^2 dSlope_xEndT_abs',\n",
" #'ty^2 tx dSlope_xEndT',\n",
" #'ty tx^2 dSlope_yEndT',\n",
" \"ideal_state_770_ty ideal_state_770_tx^2 dSlope_xEndT_abs\", # keep\n",
" \"ideal_state_770_ty^3 ideal_state_770_tx dSlope_xEndT\", # keep\n",
2023-12-19 13:00:59 +01:00
" #'ty tx^3 dSlope_xEndT',\n",
" #'ty^3 dSlope_yEndT_abs',\n",
"]\n",
"do_not_keep = [\n",
" \"dSlope_xEndT\",\n",
" \"dSlope_yEndT_abs\",\n",
" \"ideal_state_770_ty dSlope_xEndT\",\n",
" \"ideal_state_770_tx dSlope_xEndT\",\n",
" \"ideal_state_770_tx dSlope_xEndT_abs\",\n",
" \"ideal_state_770_tx dSlope_yEndT\",\n",
" \"ideal_state_770_ty^2 dSlope_xEndT\",\n",
" \"ideal_state_770_ty^3 dSlope_yEndT_abs\",\n",
" \"ideal_state_770_ty ideal_state_770_tx dSlope_yEndT\",\n",
" \"ideal_state_770_ty ideal_state_770_tx^3 dSlope_xEndT\",\n",
" \"ideal_state_770_ty ideal_state_770_tx^2 dSlope_yEndT\",\n",
2023-12-19 13:00:59 +01:00
"]\n",
"reduce = True\n",
"if reduce:\n",
2024-02-29 15:54:19 +01:00
" remove = [\n",
" i for i, f in enumerate(poly_features) if (keep and f not in keep)\n",
" ]\n",
" X_train_model = np.delete(X_train_model, remove, axis=1)\n",
" X_test_model = np.delete(X_test_model, remove, axis=1)\n",
" poly_features = np.delete(poly_features, remove)\n",
2023-12-19 13:00:59 +01:00
" print(poly_features)\n",
"if not reduce:\n",
" remove = [\n",
2024-02-29 15:54:19 +01:00
" i for i, f in enumerate(poly_features)\n",
" if (\"dSlope_\" not in f) or (\"EndT^\" in f) or (\"abs^\" in f) or (\n",
" \"EndT dSlope\" in f) or (\"abs dSlope\" in f)\n",
" ]\n",
" X_train_model = np.delete(X_train_model, remove, axis=1)\n",
" X_test_model = np.delete(X_test_model, remove, axis=1)\n",
" poly_features = np.delete(poly_features, remove)\n",
" # print(poly_features)\n",
2023-12-19 13:00:59 +01:00
" lin_reg = Lasso(fit_intercept=False, alpha=0.000001)\n",
"else:\n",
" lin_reg = LinearRegression(fit_intercept=False)\n",
"lin_reg.fit(X_train_model, y_train)\n",
"y_pred_test = lin_reg.predict(X_test_model)\n",
2023-12-19 13:00:59 +01:00
"print(\"intercept=\", lin_reg.intercept_)\n",
"print(\n",
" \"coef=\",\n",
" {\n",
" k: v\n",
" for k, v in zip(poly_features, lin_reg.coef_)\n",
" if abs(v) > 1.0 and k not in keep and k not in do_not_keep\n",
" },\n",
")\n",
2023-12-19 13:00:59 +01:00
"print(\"r2 score=\", lin_reg.score(X_test_model, y_test))\n",
"print(\"RMSE =\", mean_squared_error(y_test, y_pred_test, squared=False))\n",
"print(\n",
" \"straight RMSE =\",\n",
" mean_squared_error(\n",
" array[\"ideal_state_9410_y\"],\n",
2024-02-29 15:54:19 +01:00
" array[\"ideal_state_770_y\"] + array[\"ideal_state_770_ty\"] *\n",
" (array[\"ideal_state_9410_z\"] - array[\"ideal_state_770_z\"]),\n",
" squared=False,\n",
" ),\n",
")\n",
2023-12-19 13:00:59 +01:00
"print(format_array(\"y_xEndT_diff\", lin_reg.coef_))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.6 (conda)",
"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"
2023-12-19 13:00:59 +01:00
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "a2eff8b4da8b8eebf5ee2e5f811f31a557e0a202b4d2f04f849b065340a6eda6"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}