{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import uproot\t\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", "from mpl_toolkits.axes_grid1 import ImageGrid\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'/home/lhcb/cetin/.config/matplotlib/matplotlibrc'" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "matplotlib.matplotlib_fname()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "10522" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n", "\n", "#selektiere nur elektronen von B->K*ee und nur solche mit einem momentum von ueber 5 GeV \n", "allcolumns = file.arrays()\n", "found = allcolumns[(allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p > 5e3)] #B: 9056\n", "lost = allcolumns[(allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p > 5e3)] #B: 1466\n", "\n", "ak.num(found, axis=0) + ak.num(lost, axis=0)\n", "#ak.count(found, axis=None)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "10 10\n", "10 10\n", "10 10\n", "15 15\n", "7 7\n", "7 7\n", "8 8\n", "3 3\n", "5 5\n", "15 15\n" ] } ], "source": [ "for i in range(10):\n", "\tprint(found[\"brem_vtx_x_length\"][i], found[\"brem_vtx_z_length\"][i])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "eff all = 0.8606728758791105 +/- 0.003375885792719708\n" ] } ], "source": [ "def t_eff(found, lost, axis = 0):\n", " sel = ak.num(found, axis=axis)\n", " des = ak.num(lost, axis=axis)\n", " return sel/(sel + des)\n", "\n", "def eff_err(found, lost):\n", " n_f = ak.num(found, axis=0)\n", " n_all = ak.num(found, axis=0) + ak.num(lost,axis=0)\n", " return 1/n_all * np.sqrt(np.abs(n_f*(1-n_f/n_all)))\n", "\n", "\n", "print(\"eff all = \", t_eff(found, lost), \"+/-\", eff_err(found, lost))" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
{energy: 4.62e+04,\n", " photon_length: 10,\n", " brem_photons_pe: [3.26e+03, 4.45e+03, 178, ..., 825, 8.99e+03, 3.48e+03],\n", " brem_vtx_z: [162, 187, 387, 487, ..., 9.49e+03, 1.21e+04, 1.21e+04, 1.21e+04],\n", " brem_vtx_x: [-5.37, -7, -20, -26.5, ..., -1.24e+03, -1.24e+03, -1.25e+03]}\n", "-------------------------------------------------------------------------------\n", "type: {\n", " energy: float64,\n", " photon_length: int64,\n", " brem_photons_pe: var * float64,\n", " brem_vtx_z: var * float64,\n", " brem_vtx_x: var * float64\n", "}" ], "text/plain": [ "
[{energy: 2.58e+04, brem_photons_pe: [9.97e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 8.03e+04, brem_photons_pe: [4.91e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 5.6e+03, brem_photons_pe: [320, ..., 392], brem_vtx_z: [...], ...},\n", " {energy: 6.36e+03, brem_photons_pe: [273, ...], brem_vtx_z: [...], ...},\n", " {energy: 4.67e+04, brem_photons_pe: [8.96e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 7.16e+04, brem_photons_pe: [544, ..., 142], brem_vtx_z: [...], ...},\n", " {energy: 5.15e+04, brem_photons_pe: [384, ...], brem_vtx_z: [...], ...},\n", " {energy: 4.07e+04, brem_photons_pe: [2.7e+04, ...], brem_vtx_z: [...], ...},\n", " {energy: 2.77e+04, brem_photons_pe: [2.24e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 6.4e+04, brem_photons_pe: [686, ..., 796], brem_vtx_z: [...], ...},\n", " ...,\n", " {energy: 5.59e+03, brem_photons_pe: [901, ...], brem_vtx_z: [...], ...},\n", " {energy: 2.13e+04, brem_photons_pe: [787, ...], brem_vtx_z: [...], ...},\n", " {energy: 9.34e+03, brem_photons_pe: [762, ...], brem_vtx_z: [...], ...},\n", " {energy: 5.08e+04, brem_photons_pe: [711, ...], brem_vtx_z: [...], ...},\n", " {energy: 6.41e+04, brem_photons_pe: [4.17e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 1.01e+04, brem_photons_pe: [220, ..., 156], brem_vtx_z: [...], ...},\n", " {energy: 1.96e+04, brem_photons_pe: [1.66e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 2.98e+04, brem_photons_pe: [8.32e+03, ...], brem_vtx_z: [...], ...},\n", " {energy: 3.97e+04, brem_photons_pe: [9.36e+03, ...], brem_vtx_z: [...], ...}]\n", "------------------------------------------------------------------------------\n", "type: 1430 * {\n", " energy: float64,\n", " brem_photons_pe: var * float64,\n", " brem_vtx_z: var * float64,\n", " brem_vtx_x: var * float64\n", "}" ], "text/plain": [ "