{ "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": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "9389" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n", "\n", "\n", "\n", "#selektiere Kaonen und Pionen aus K*->Kpi - B->K*ee - und nur solche mit einem momentum von ueber 5 GeV \n", "allcolumns = file.arrays()\n", "found = allcolumns[((allcolumns.isKaon) | (allcolumns.isPion)) & (~allcolumns.lost) & (allcolumns.fromSignal)] #B:\n", "lost = allcolumns[((allcolumns.isKaon) | (allcolumns.isPion)) & (allcolumns.lost) & (allcolumns.fromSignal)] #B:\n", "\n", "ak.num(found, axis=0)\n", "#ak.count(found, axis=None)\n" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "0.9191385217816936" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def t_eff(found, lost):\n", " sel = found[\"energy\"]\n", " des = lost[\"energy\"]\n", " return ak.count(sel,axis=None)/(ak.count(sel,axis=None)+ak.count(des,axis=None))\n", "\n", "t_eff(found, lost)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'all_endvtx_types_length': 2,\n", " 'all_endvtx_types': [104.0, 100.0],\n", " 'all_endvtx_x_length': 2,\n", " 'all_endvtx_x': [-122.56659698486328, -262.1983947753906],\n", " 'all_endvtx_y_length': 2,\n", " 'all_endvtx_y': [-369.7253112792969, -555.62890625],\n", " 'all_endvtx_z_length': 2,\n", " 'all_endvtx_z': [7985.064453125, 11955.3134765625],\n", " 'brem_photons_pe_length': 0,\n", " 'brem_photons_pe': [],\n", " 'brem_photons_px_length': 0,\n", " 'brem_photons_px': [],\n", " 'brem_photons_py_length': 0,\n", " 'brem_photons_py': [],\n", " 'brem_photons_pz_length': 0,\n", " 'brem_photons_pz': [],\n", " 'brem_vtx_x_length': 0,\n", " 'brem_vtx_x': [],\n", " 'brem_vtx_y_length': 0,\n", " 'brem_vtx_y': [],\n", " 'brem_vtx_z_length': 0,\n", " 'brem_vtx_z': [],\n", " 'endvtx_type': 0,\n", " 'endvtx_x': nan,\n", " 'endvtx_y': nan,\n", " 'endvtx_z': nan,\n", " 'energy': 41648.0685636534,\n", " 'eta': 3.7532544452852883,\n", " 'event_count': 0,\n", " 'fromB': True,\n", " 'fromD': False,\n", " 'fromDecay': True,\n", " 'fromHadInt': False,\n", " 'fromPV': False,\n", " 'fromPairProd': False,\n", " 'fromSignal': True,\n", " 'fromStrange': False,\n", " 'isElectron': False,\n", " 'isKaon': True,\n", " 'isMuon': False,\n", " 'isPion': False,\n", " 'isProton': False,\n", " 'lost': False,\n", " 'lost_in_track_fit': False,\n", " 'match_fraction': 1.0,\n", " 'mcp_idx': 2236,\n", " 'mother_id': 313,\n", " 'mother_key': 226,\n", " 'originvtx_type': 2,\n", " 'originvtx_x': -0.1652,\n", " 'originvtx_y': -0.2848,\n", " 'originvtx_z': 81.7996,\n", " 'p': 41645.1425510635,\n", " 'phi': -1.6798078520364383,\n", " 'pid': 321,\n", " 'pt': 1951.3630462832896,\n", " 'px': -212.3,\n", " 'py': -1939.78,\n", " 'pz': 41599.4,\n", " 'scifi_hit_pos_x_length': 12,\n", " 'scifi_hit_pos_x': [-117.21600341796875,\n", " -119.53988647460938,\n", " -121.886474609375,\n", " -124.23180389404297,\n", " -140.34219360351562,\n", " -142.7511749267578,\n", " -145.18153381347656,\n", " -147.6049041748047,\n", " -164.2061004638672,\n", " -166.65792846679688,\n", " -169.12484741210938,\n", " -171.5793914794922],\n", " 'scifi_hit_pos_y_length': 12,\n", " 'scifi_hit_pos_y': [-362.2366638183594,\n", " -365.4982604980469,\n", " -368.7768859863281,\n", " -372.0390930175781,\n", " -394.123291015625,\n", " -397.38812255859375,\n", " -400.67279052734375,\n", " -403.93994140625,\n", " -426.20166015625,\n", " -429.4697265625,\n", " -432.75665283203125,\n", " -436.0249328613281],\n", " 'scifi_hit_pos_z_length': 12,\n", " 'scifi_hit_pos_z': [7824.794921875,\n", " 7894.58349609375,\n", " 7964.7724609375,\n", " 8034.56103515625,\n", " 8506.6796875,\n", " 8576.46875,\n", " 8646.6572265625,\n", " 8716.4462890625,\n", " 9191.564453125,\n", " 9261.353515625,\n", " 9331.5419921875,\n", " 9401.3310546875],\n", " 'track_p': 41440.5786745683,\n", " 'track_pt': 1942.8720147111794,\n", " 'tx': -0.005103438991908537,\n", " 'ty': -0.04662999947114622,\n", " 'ut_hit_pos_x_length': 4,\n", " 'ut_hit_pos_x': [-12.01840877532959,\n", " -12.332009315490723,\n", " -13.623125076293945,\n", " -13.947733879089355],\n", " 'ut_hit_pos_y_length': 4,\n", " 'ut_hit_pos_y': [-104.15756225585938,\n", " -106.72476959228516,\n", " -117.23506927490234,\n", " -119.80697631835938],\n", " 'ut_hit_pos_z_length': 4,\n", " 'ut_hit_pos_z': [2306.846435546875,\n", " 2361.846435546875,\n", " 2586.846435546875,\n", " 2641.846435546875],\n", " 'velo_hit_pos_x_length': 11,\n", " 'velo_hit_pos_x': [-0.8300145268440247,\n", " -0.9588174819946289,\n", " -1.0876154899597168,\n", " -1.345718502998352,\n", " -1.7327179908752441,\n", " -2.252721071243286,\n", " -2.775723934173584,\n", " -2.782417058944702,\n", " -3.040213108062744,\n", " -3.2965149879455566,\n", " -3.554213047027588],\n", " 'velo_hit_pos_y_length': 11,\n", " 'velo_hit_pos_y': [-6.3489580154418945,\n", " -7.5135650634765625,\n", " -8.679963111877441,\n", " -11.012066841125488,\n", " -14.511466026306152,\n", " -19.179668426513672,\n", " -23.845666885375977,\n", " -23.90557098388672,\n", " -26.240373611450195,\n", " -28.577774047851562,\n", " -30.914676666259766],\n", " 'velo_hit_pos_z_length': 11,\n", " 'velo_hit_pos_z': [211.85899353027344,\n", " 236.85899353027344,\n", " 261.8590087890625,\n", " 311.8590087890625,\n", " 386.8590087890625,\n", " 486.8590087890625,\n", " 586.8590087890625,\n", " 588.1409912109375,\n", " 638.1409912109375,\n", " 688.1409912109375,\n", " 738.1409912109375],\n", " 'velo_track_idx': 37,\n", " 'velo_track_tx': -0.005120465997606516,\n", " 'velo_track_ty': -0.04670485854148865,\n", " 'velo_track_x': -3.7022032737731934,\n", " 'velo_track_y': -32.40621566772461,\n", " 'velo_track_z': 770.0}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "found[0].tolist()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "env1", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" }, "orig_nbformat": 4 }, "nbformat": 4, "nbformat_minor": 2 }