You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

172 lines
5.7 KiB

8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 1,
  6. "metadata": {},
  7. "outputs": [],
  8. "source": [
  9. "import uproot\n",
  10. "import numpy as np\n",
  11. "import sys\n",
  12. "import os\n",
  13. "import matplotlib\n",
  14. "import matplotlib.pyplot as plt\n",
  15. "import mplhep\n",
  16. "from mpl_toolkits import mplot3d\n",
  17. "import itertools\n",
  18. "import awkward as ak\n",
  19. "from scipy.optimize import curve_fit\n",
  20. "from utils.components import unique_name_ext_re\n",
  21. "mplhep.style.use([\"LHCbTex2\"])\n",
  22. "plt.rcParams[\"savefig.dpi\"] = 600\n",
  23. "%matplotlib inline"
  24. ]
  25. },
  26. {
  27. "cell_type": "code",
  28. "execution_count": 2,
  29. "metadata": {},
  30. "outputs": [],
  31. "source": [
  32. "file = uproot.open(\n",
  33. " \"/work/cetin/LHCb/reco_tuner/data/resolutions_and_effs_B_thesis.root:Track/MatchTrackChecker_8319528f/Match;1\",\n",
  34. ")\n",
  35. "\n",
  36. "P_recoed = file[\"01_long_P_reconstructed;1\"].to_numpy()\n",
  37. "P_recoable = file[\"01_long_P_reconstructible;1\"].to_numpy()\n",
  38. "\n",
  39. "Pt_recoed = file[\"01_long_Pt_reconstructed;1\"].to_numpy()\n",
  40. "Pt_recoable = file[\"01_long_Pt_reconstructible;1\"].to_numpy()"
  41. ]
  42. },
  43. {
  44. "cell_type": "code",
  45. "execution_count": 3,
  46. "metadata": {},
  47. "outputs": [
  48. {
  49. "name": "stdout",
  50. "output_type": "stream",
  51. "text": [
  52. "control eff: 0.8626619913200968\n",
  53. "new eff: 0.8626619913200968\n",
  54. "control eff: 0.8629752409817771\n",
  55. "new eff: 0.8629752409817771\n"
  56. ]
  57. }
  58. ],
  59. "source": [
  60. "P_Velo_recoed = file[\"01_long_EndVelo_P_reconstructed;1\"].to_numpy()\n",
  61. "P_Velo_recoable = file[\"01_long_EndVelo_P_reconstructible;1\"].to_numpy()\n",
  62. "\n",
  63. "print(\"control eff: \", np.sum(P_recoed[0]) / np.sum(P_recoable[0]))\n",
  64. "print(\"new eff: \", np.sum(P_Velo_recoed[0]) / np.sum(P_Velo_recoable[0]))\n",
  65. "\n",
  66. "Pt_Velo_recoed = file[\"01_long_EndVelo_Pt_reconstructed;1\"].to_numpy()\n",
  67. "Pt_Velo_recoable = file[\"01_long_EndVelo_Pt_reconstructible;1\"].to_numpy()\n",
  68. "\n",
  69. "print(\"control eff: \", np.sum(Pt_recoed[0]) / np.sum(Pt_recoable[0]))\n",
  70. "print(\"new eff: \", np.sum(Pt_Velo_recoed[0]) / np.sum(Pt_Velo_recoable[0]))"
  71. ]
  72. },
  73. {
  74. "cell_type": "code",
  75. "execution_count": 4,
  76. "metadata": {},
  77. "outputs": [
  78. {
  79. "data": {
  80. "text/plain": [
  81. "(array([ 0., 39546., 175333., 205172., 179814., 156192., 131918.,\n",
  82. " 111561., 96269., 82605., 72104., 62481., 54880., 48023.,\n",
  83. " 43043., 37810., 34533., 31242., 27997., 25422., 23137.,\n",
  84. " 20994., 19297., 17662., 16196., 14804., 13679., 12636.,\n",
  85. " 11687., 10738., 10125., 9329., 8681., 8080., 7424.,\n",
  86. " 6950., 6416., 6048., 5771., 5304., 4963., 4611.,\n",
  87. " 4379., 4095., 3844., 3512., 3303., 3104., 3020.,\n",
  88. " 2839., 2717., 2549., 2297., 2287., 2076., 2030.,\n",
  89. " 1875., 1791., 1684., 1557., 1559., 1418., 1389.,\n",
  90. " 1321., 1245., 1164., 1122., 1055., 1008., 961.,\n",
  91. " 920., 899., 833., 839., 746., 744., 725.,\n",
  92. " 656., 657., 673., 601., 547., 552., 504.,\n",
  93. " 524., 452., 440., 427., 438., 395., 412.,\n",
  94. " 408., 392., 349., 328., 328., 289., 308.,\n",
  95. " 271., 297.]),\n",
  96. " array([ 0., 1000., 2000., 3000., 4000., 5000., 6000.,\n",
  97. " 7000., 8000., 9000., 10000., 11000., 12000., 13000.,\n",
  98. " 14000., 15000., 16000., 17000., 18000., 19000., 20000.,\n",
  99. " 21000., 22000., 23000., 24000., 25000., 26000., 27000.,\n",
  100. " 28000., 29000., 30000., 31000., 32000., 33000., 34000.,\n",
  101. " 35000., 36000., 37000., 38000., 39000., 40000., 41000.,\n",
  102. " 42000., 43000., 44000., 45000., 46000., 47000., 48000.,\n",
  103. " 49000., 50000., 51000., 52000., 53000., 54000., 55000.,\n",
  104. " 56000., 57000., 58000., 59000., 60000., 61000., 62000.,\n",
  105. " 63000., 64000., 65000., 66000., 67000., 68000., 69000.,\n",
  106. " 70000., 71000., 72000., 73000., 74000., 75000., 76000.,\n",
  107. " 77000., 78000., 79000., 80000., 81000., 82000., 83000.,\n",
  108. " 84000., 85000., 86000., 87000., 88000., 89000., 90000.,\n",
  109. " 91000., 92000., 93000., 94000., 95000., 96000., 97000.,\n",
  110. " 98000., 99000., 100000.]))"
  111. ]
  112. },
  113. "execution_count": 4,
  114. "metadata": {},
  115. "output_type": "execute_result"
  116. }
  117. ],
  118. "source": [
  119. "P_recoed"
  120. ]
  121. },
  122. {
  123. "cell_type": "code",
  124. "execution_count": null,
  125. "metadata": {},
  126. "outputs": [],
  127. "source": []
  128. },
  129. {
  130. "cell_type": "code",
  131. "execution_count": null,
  132. "metadata": {},
  133. "outputs": [],
  134. "source": []
  135. },
  136. {
  137. "cell_type": "code",
  138. "execution_count": null,
  139. "metadata": {},
  140. "outputs": [],
  141. "source": []
  142. },
  143. {
  144. "cell_type": "code",
  145. "execution_count": null,
  146. "metadata": {},
  147. "outputs": [],
  148. "source": []
  149. }
  150. ],
  151. "metadata": {
  152. "kernelspec": {
  153. "display_name": "tuner",
  154. "language": "python",
  155. "name": "python3"
  156. },
  157. "language_info": {
  158. "codemirror_mode": {
  159. "name": "ipython",
  160. "version": 3
  161. },
  162. "file_extension": ".py",
  163. "mimetype": "text/x-python",
  164. "name": "python",
  165. "nbconvert_exporter": "python",
  166. "pygments_lexer": "ipython3",
  167. "version": "3.1.0"
  168. }
  169. },
  170. "nbformat": 4,
  171. "nbformat_minor": 2
  172. }