{ "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": [ "10522" ] }, "execution_count": 2, "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": 3, "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": 36, "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", "-------------------------------------------------------------------------------\n", "type: {\n", " energy: float64,\n", " photon_length: int64,\n", " brem_photons_pe: var * float64,\n", " brem_vtx_z: var * float64\n", "}" ], "text/plain": [ "