{ "cells": [ { "cell_type": "code", "execution_count": 19, "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", "import mplhep\n", "from mpl_toolkits import mplot3d\n", "import itertools\n", "import awkward as ak\n", "from scipy.optimize import curve_fit\n", "import pandas as pd\n", "import seaborn as sns\n", "from matplotlib import colormaps\n", "\n", "mplhep.style.use([\"LHCbTex2\"])\n", "plt.rcParams[\"savefig.dpi\"] = 600\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "file = uproot.open(\n", " \"/work/cetin/LHCb/reco_tuner/data_matching/resolutions_and_effs_B_default_thesis.root:Track/MatchTrackChecker_8319528f/Match;1\",\n", ")\n", "\n", "P_recoed = file[\"07_long_electrons_P_reconstructed;1\"].to_numpy()\n", "P_recoable = file[\"07_long_electrons_P_reconstructible;1\"].to_numpy()\n", "\n", "Pt_recoed = file[\"07_long_electrons_Pt_reconstructed;1\"].to_numpy()\n", "Pt_recoable = file[\"07_long_electrons_Pt_reconstructible;1\"].to_numpy()" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "control eff: 0.6145546589237905\n", "new eff: 0.6155293168395326\n", "control eff: 0.6173168233870217\n", "new eff: 0.6176270902698983\n", "212152\n", "130379.0\n", "213171.0\n", "131213.0\n" ] } ], "source": [ "P_Velo_recoed = file[\"07_long_electrons_EndVelo_P_reconstructed;1\"].to_numpy()\n", "P_Velo_recoable = file[\n", " \"07_long_electrons_EndVelo_P_reconstructible;1\"].to_numpy()\n", "\n", "print(\"control eff: \", np.sum(P_recoed[0]) / np.sum(P_recoable[0]))\n", "print(\"new eff: \", np.sum(P_Velo_recoed[0]) / np.sum(P_Velo_recoable[0]))\n", "\n", "Pt_Velo_recoed = file[\"07_long_electrons_EndVelo_Pt_reconstructed;1\"].to_numpy(\n", ")\n", "Pt_Velo_recoable = file[\n", " \"07_long_electrons_EndVelo_Pt_reconstructible;1\"].to_numpy()\n", "\n", "print(\"control eff: \", np.sum(Pt_recoed[0]) / np.sum(Pt_recoable[0]))\n", "print(\"new eff: \", np.sum(Pt_Velo_recoed[0]) / np.sum(Pt_Velo_recoable[0]))\n", "\n", "print(np.sum(P_recoable[0], dtype=int))\n", "print(np.sum(P_recoed[0]))\n", "print(np.sum(P_Velo_recoable[0]))\n", "print(np.sum(P_Velo_recoed[0]))" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(array([[0.0000e+00, 0.0000e+00, 0.0000e+00, ..., 0.0000e+00, 0.0000e+00,\n", " 0.0000e+00],\n", " [4.1620e+03, 2.4200e+02, 8.7000e+01, ..., 0.0000e+00, 0.0000e+00,\n", " 0.0000e+00],\n", " [2.3471e+04, 2.7160e+03, 1.4720e+03, ..., 0.0000e+00, 0.0000e+00,\n", " 0.0000e+00],\n", " ...,\n", " [1.3000e+01, 0.0000e+00, 0.0000e+00, ..., 0.0000e+00, 1.0000e+00,\n", " 0.0000e+00],\n", " [1.3000e+01, 1.0000e+00, 1.0000e+00, ..., 0.0000e+00, 0.0000e+00,\n", " 0.0000e+00],\n", " [9.0000e+00, 3.0000e+00, 1.0000e+00, ..., 0.0000e+00, 0.0000e+00,\n", " 0.0000e+00]]),\n", " array([ 0., 1000., 2000., 3000., 4000., 5000., 6000.,\n", " 7000., 8000., 9000., 10000., 11000., 12000., 13000.,\n", " 14000., 15000., 16000., 17000., 18000., 19000., 20000.,\n", " 21000., 22000., 23000., 24000., 25000., 26000., 27000.,\n", " 28000., 29000., 30000., 31000., 32000., 33000., 34000.,\n", " 35000., 36000., 37000., 38000., 39000., 40000., 41000.,\n", " 42000., 43000., 44000., 45000., 46000., 47000., 48000.,\n", " 49000., 50000., 51000., 52000., 53000., 54000., 55000.,\n", " 56000., 57000., 58000., 59000., 60000., 61000., 62000.,\n", " 63000., 64000., 65000., 66000., 67000., 68000., 69000.,\n", " 70000., 71000., 72000., 73000., 74000., 75000., 76000.,\n", " 77000., 78000., 79000., 80000., 81000., 82000., 83000.,\n", " 84000., 85000., 86000., 87000., 88000., 89000., 90000.,\n", " 91000., 92000., 93000., 94000., 95000., 96000., 97000.,\n", " 98000., 99000., 100000.]),\n", " array([ 0., 100., 200., 300., 400., 500., 600., 700.,\n", " 800., 900., 1000., 1100., 1200., 1300., 1400., 1500.,\n", " 1600., 1700., 1800., 1900., 2000., 2100., 2200., 2300.,\n", " 2400., 2500., 2600., 2700., 2800., 2900., 3000., 3100.,\n", " 3200., 3300., 3400., 3500., 3600., 3700., 3800., 3900.,\n", " 4000., 4100., 4200., 4300., 4400., 4500., 4600., 4700.,\n", " 4800., 4900., 5000., 5100., 5200., 5300., 5400., 5500.,\n", " 5600., 5700., 5800., 5900., 6000., 6100., 6200., 6300.,\n", " 6400., 6500., 6600., 6700., 6800., 6900., 7000., 7100.,\n", " 7200., 7300., 7400., 7500., 7600., 7700., 7800., 7900.,\n", " 8000., 8100., 8200., 8300., 8400., 8500., 8600., 8700.,\n", " 8800., 8900., 9000., 9100., 9200., 9300., 9400., 9500.,\n", " 9600., 9700., 9800., 9900., 10000.]))" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "PdP_Velo_recoed = file[\"07_long_electrons_EndVelo_PdP_reconstructed;1\"].to_numpy()\n", "PdP_Velo_recoable = file[\"07_long_electrons_EndVelo_PdP_reconstructible;1\"].to_numpy()\n", "\n", "PdP_Velo_recoable" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/tmp/ipykernel_733517/2776815717.py:1: RuntimeWarning: invalid value encountered in divide\n", " effs = np.divide(PdP_Velo_recoed[0], PdP_Velo_recoable[0])\n" ] }, { "data": { "text/html": [ "
\n", " | 0 | \n", "1 | \n", "2 | \n", "3 | \n", "4 | \n", "5 | \n", "6 | \n", "7 | \n", "8 | \n", "9 | \n", "... | \n", "90 | \n", "91 | \n", "92 | \n", "93 | \n", "94 | \n", "95 | \n", "96 | \n", "97 | \n", "98 | \n", "99 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
1 | \n", "0.297453 | \n", "0.351240 | \n", "0.298851 | \n", "0.466667 | \n", "0.312500 | \n", "0.000000 | \n", "0.000000 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
2 | \n", "0.377146 | \n", "0.362297 | \n", "0.348505 | \n", "0.342369 | \n", "0.369942 | \n", "0.291339 | \n", "0.326471 | \n", "0.328205 | \n", "0.208333 | \n", "0.237500 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
3 | \n", "0.532556 | \n", "0.543753 | \n", "0.547119 | \n", "0.547350 | \n", "0.505400 | \n", "0.514877 | \n", "0.485997 | \n", "0.444846 | \n", "0.426966 | \n", "0.346939 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
4 | \n", "0.595858 | \n", "0.616777 | \n", "0.618738 | \n", "0.601467 | \n", "0.636095 | \n", "0.606115 | \n", "0.554913 | \n", "0.496689 | \n", "0.591224 | \n", "0.518625 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
95 | \n", "0.666667 | \n", "1.000000 | \n", "1.000000 | \n", "1.000000 | \n", "1.000000 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "1.000000 | \n", "1.000000 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
96 | \n", "1.000000 | \n", "NaN | \n", "1.000000 | \n", "NaN | \n", "1.000000 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "1.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
97 | \n", "0.923077 | \n", "NaN | \n", "NaN | \n", "1.000000 | \n", "1.000000 | \n", "NaN | \n", "0.000000 | \n", "1.000000 | \n", "1.000000 | \n", "0.000000 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "1.0 | \n", "NaN | \n", "
98 | \n", "0.846154 | \n", "1.000000 | \n", "1.000000 | \n", "NaN | \n", "NaN | \n", "1.000000 | \n", "1.000000 | \n", "NaN | \n", "1.000000 | \n", "1.000000 | \n", "... | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
99 | \n", "0.777778 | \n", "0.666667 | \n", "1.000000 | \n", "1.000000 | \n", "1.000000 | \n", "1.000000 | \n", "1.000000 | \n", "NaN | \n", "1.000000 | \n", "1.000000 | \n", "... | \n", "NaN | \n", "NaN | \n", "1.0 | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "NaN | \n", "
100 rows × 100 columns
\n", "