{ "cells": [ { "cell_type": "code", "execution_count": 1, "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", "from mpl_toolkits import mplot3d\n", "import itertools\n", "import awkward as ak\n", "from scipy.optimize import curve_fit\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "51" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "file = uproot.open(\"tracking_losses_ntuple_Dst0ToD0EE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n", "\n", "\n", "#selektiere nur elektronen von D*0->D0ee und nur solche mit einem momentum von unter 5 GeV \n", "allcolumns = file.arrays()\n", "found = allcolumns[(allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p < 5e3)] #D: 2591\n", "lost = allcolumns[(allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p < 5e3)] #D: 1908\n", "\n", "#ak.num(lost, axis=0)\n", "ak.num(allcolumns[(allcolumns.fromPairProd) & (allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromSignal)],axis=0)\n", "#found[0]" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "eff all = 0.5759057568348522 +/- 0.007367987865301135\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": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.7960893854748603" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "#statistics\n", "\n", "nobrem_found = found[found[\"brem_photons_pe_length\"]==0]\n", "nobrem_lost = lost[lost[\"brem_photons_pe_length\"]==0]\n", "\n", "\"\"\"\n", "die effizienz mit der wir elektronen finden, die keine bremsstrahlung gemacht haben, ist nicht besonders gut, aber trotzdem besser als\n", "für alle elektronen.\n", "Auch hier handelt es sich um eine recht geringe sample size (~350)\n", "\"\"\"\n", "\n", "t_eff(nobrem_found, nobrem_lost)\n", "#ak.num(nobrem_lost, axis=0)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
{energy: 2.04e+03,\n", " photon_length: 4,\n", " brem_photons_pe: [519, 484, 173, 466],\n", " brem_vtx_z: [9.84e+03, 9.84e+03, 9.85e+03, 9.85e+03]}\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": [ "
[{energy: 4.19e+03, brem_photons_pe: [1e+03, ..., 158], brem_vtx_z: [...]},\n", " {energy: 4.12e+03, brem_photons_pe: [278, 468], brem_vtx_z: [...]},\n", " {energy: 4.53e+03, brem_photons_pe: [445], brem_vtx_z: [9.33e+03]},\n", " {energy: 4.22e+03, brem_photons_pe: [426, ..., 207], brem_vtx_z: [...]},\n", " {energy: 2.54e+03, brem_photons_pe: [362, ...], brem_vtx_z: [...]},\n", " {energy: 3.59e+03, brem_photons_pe: [715], brem_vtx_z: [2.59e+03]},\n", " {energy: 3.78e+03, brem_photons_pe: [198, ..., 180], brem_vtx_z: [...]},\n", " {energy: 3.07e+03, brem_photons_pe: [1.26e+03, ...], brem_vtx_z: [...]},\n", " {energy: 3.89e+03, brem_photons_pe: [486], brem_vtx_z: [5.2e+03]},\n", " {energy: 4.66e+03, brem_photons_pe: [906, ..., 538], brem_vtx_z: [...]},\n", " ...,\n", " {energy: 3.08e+03, brem_photons_pe: [575, 337], brem_vtx_z: [...]},\n", " {energy: 2.39e+03, brem_photons_pe: [163, 971], brem_vtx_z: [...]},\n", " {energy: 2.57e+03, brem_photons_pe: [184, 798], brem_vtx_z: [...]},\n", " {energy: 2.19e+03, brem_photons_pe: [161, 337], brem_vtx_z: [...]},\n", " {energy: 3.62e+03, brem_photons_pe: [1.19e+03], brem_vtx_z: [3.98e+03]},\n", " {energy: 3.96e+03, brem_photons_pe: [135, ...], brem_vtx_z: [...]},\n", " {energy: 3.48e+03, brem_photons_pe: [3.17e+03], brem_vtx_z: [8.58e+03]},\n", " {energy: 3.19e+03, brem_photons_pe: [240, ...], brem_vtx_z: [...]},\n", " {energy: 3.6e+03, brem_photons_pe: [142, ...], brem_vtx_z: [...]}]\n", "---------------------------------------------------------------------------\n", "type: 1452 * {\n", " energy: float64,\n", " brem_photons_pe: var * float64,\n", " brem_vtx_z: var * float64\n", "}" ], "text/plain": [ "