Projektpraktikum/trackinglosses_energy.ipynb

1138 lines
150 KiB
Plaintext
Raw Normal View History

2024-01-15 16:46:25 +01:00
{
"cells": [
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 65,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
"import uproot\t\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from mpl_toolkits import mplot3d\n",
"import awkward as ak\n",
"from scipy.optimize import curve_fit\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 66,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
2024-01-17 15:59:39 +01:00
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-26 11:34:42 +01:00
"41978 8523\n",
2024-01-18 16:06:16 +01:00
"50501\n"
2024-01-17 15:59:39 +01:00
]
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-26 11:34:42 +01:00
"# file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n",
2024-01-18 16:06:16 +01:00
"file = uproot.open(\n",
2024-01-26 11:34:42 +01:00
" \"tracking_losses_ntuple_B_EndVeloP.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\"\n",
2024-01-18 16:06:16 +01:00
")\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-16 21:48:53 +01:00
"# selektiere nur elektronen von B->K*ee\n",
2024-01-15 16:46:25 +01:00
"allcolumns = file.arrays()\n",
2024-01-26 11:34:42 +01:00
"found = allcolumns[(allcolumns.isElectron) & (~allcolumns.lost) &\n",
" (allcolumns.fromB)] # B: 9056\n",
"lost = allcolumns[(allcolumns.isElectron) & (allcolumns.lost) &\n",
" (allcolumns.fromB)] # B: 1466\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"electrons = allcolumns[(allcolumns.isElectron) & (allcolumns.fromB)]\n",
"\n",
"print(ak.num(found, axis=0), ak.num(lost, axis=0))\n",
2024-01-26 11:34:42 +01:00
"print(ak.num(electrons, axis=0))\n",
2024-01-16 21:48:53 +01:00
"# ak.count(found, axis=None)"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 67,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-18 16:06:16 +01:00
"outputs": [
{
"data": {
"text/html": [
"<pre>{all_endvtx_types_length: 7,\n",
" all_endvtx_types: [101, 101, 101, 101, 101, 101, 0],\n",
" all_endvtx_x_length: 7,\n",
" all_endvtx_x: [-6.97, -52.9, -52.9, ..., -1.71e+03, -2.14e+03, -3.57e+03],\n",
" all_endvtx_y_length: 7,\n",
" all_endvtx_y: [-0.89, -6.75, -6.75, -7.08, -66.1, -72.6, -39.5],\n",
" all_endvtx_z_length: 7,\n",
" all_endvtx_z: [112, 859, 859, 895, 8.7e+03, 9.68e+03, 1.26e+04],\n",
" brem_photons_pe_length: 6,\n",
" brem_photons_pe: [2.62e+03, 812, 2.54e+03, 1.86e+03, 3.12e+03, 241],\n",
" brem_photons_px_length: 6,\n",
" brem_photons_px: [-161, -49.7, -156, -114, -1.18e+03, -101],\n",
" brem_photons_py_length: 6,\n",
" brem_photons_py: [-18.9, -6.92, -21.6, -16.8, -20.9, -0.26],\n",
" brem_photons_pz_length: 6,\n",
" brem_photons_pz: [2.61e+03, 810, 2.54e+03, 1.86e+03, 2.89e+03, 219],\n",
" brem_vtx_x_length: 6,\n",
" brem_vtx_x: [-6.97, -52.9, -52.9, -55.2, -1.71e+03, -2.14e+03],\n",
" brem_vtx_y_length: 6,\n",
" ...}\n",
"---------------------------------------------------------------------------\n",
"type: {\n",
" all_endvtx_types_length: int32,\n",
" all_endvtx_types: var * float32,\n",
" all_endvtx_x_length: int32,\n",
" all_endvtx_x: var * float32,\n",
" all_endvtx_y_length: int32,\n",
" all_endvtx_y: var * float32,\n",
" all_endvtx_z_length: int32,\n",
" all_endvtx_z: var * float32,\n",
" brem_photons_pe_length: int32,\n",
" brem_photons_pe: var * float32,\n",
" brem_photons_px_length: int32,\n",
" brem_photons_px: var * float32,\n",
" brem_photons_py_length: int32,\n",
" brem_photons_py: var * float32,\n",
" brem_photons_pz_length: int32,\n",
" brem_photons_pz: var * float32,\n",
" brem_vtx_x_length: int32,\n",
" brem_vtx_x: var * float32,\n",
" brem_vtx_y_length: int32,\n",
" brem_vtx_y: var * float32,\n",
" brem_vtx_z_length: int32,\n",
" brem_vtx_z: var * float32,\n",
" endvtx_type: int32,\n",
" endvtx_x: float64,\n",
" endvtx_y: float64,\n",
" endvtx_z: float64,\n",
" energy: float64,\n",
" eta: float64,\n",
" event_count: int32,\n",
" fromB: bool,\n",
" fromD: bool,\n",
" fromDecay: bool,\n",
" fromHadInt: bool,\n",
" fromPV: bool,\n",
" fromPairProd: bool,\n",
" fromSignal: bool,\n",
" fromStrange: bool,\n",
2024-01-26 11:34:42 +01:00
" ideal_state_770_p: float64,\n",
2024-01-18 16:06:16 +01:00
" ideal_state_770_qop: float64,\n",
" ideal_state_770_tx: float64,\n",
" ideal_state_770_ty: float64,\n",
" ideal_state_770_x: float64,\n",
" ideal_state_770_y: float64,\n",
" ideal_state_770_z: float64,\n",
" ideal_state_9410_qop: float64,\n",
" ideal_state_9410_tx: float64,\n",
" ideal_state_9410_ty: float64,\n",
" ideal_state_9410_x: float64,\n",
" ideal_state_9410_y: float64,\n",
" ideal_state_9410_z: float64,\n",
" isElectron: bool,\n",
" isKaon: bool,\n",
" isMuon: bool,\n",
" isPion: bool,\n",
" isProton: bool,\n",
" lost: bool,\n",
" lost_in_track_fit: bool,\n",
" match_fraction: float32,\n",
" mc_chi2: float32,\n",
" mc_dSlope: float32,\n",
" mc_dSlopeY: float32,\n",
" mc_distX: float32,\n",
" mc_distY: float32,\n",
" mc_teta2: float32,\n",
" mc_zMag: float32,\n",
" mcp_idx: int32,\n",
" mother_id: int32,\n",
" mother_key: int32,\n",
" originvtx_type: int32,\n",
" originvtx_x: float64,\n",
" originvtx_y: float64,\n",
" originvtx_z: float64,\n",
" p: float64,\n",
" phi: float64,\n",
" pid: int32,\n",
" pt: float64,\n",
" px: float64,\n",
" py: float64,\n",
" pz: float64,\n",
" quality: int32,\n",
" rad_length_frac: float64,\n",
" scifi_hit_pos_x_length: int32,\n",
" scifi_hit_pos_x: var * float32,\n",
" scifi_hit_pos_y_length: int32,\n",
" scifi_hit_pos_y: var * float32,\n",
" scifi_hit_pos_z_length: int32,\n",
" scifi_hit_pos_z: var * float32,\n",
" track_p: float64,\n",
" track_pt: float64,\n",
" tx: float64,\n",
" ty: float64,\n",
" ut_hit_pos_x_length: int32,\n",
" ut_hit_pos_x: var * float32,\n",
" ut_hit_pos_y_length: int32,\n",
" ut_hit_pos_y: var * float32,\n",
" ut_hit_pos_z_length: int32,\n",
" ut_hit_pos_z: var * float32,\n",
" velo_hit_pos_x_length: int32,\n",
" velo_hit_pos_x: var * float32,\n",
" velo_hit_pos_y_length: int32,\n",
" velo_hit_pos_y: var * float32,\n",
" velo_hit_pos_z_length: int32,\n",
" velo_hit_pos_z: var * float32,\n",
" velo_track_idx: int32,\n",
" velo_track_tx: float64,\n",
" velo_track_ty: float64,\n",
" velo_track_x: float64,\n",
" velo_track_y: float64,\n",
" velo_track_z: float64\n",
"}</pre>"
],
"text/plain": [
"<Record {all_endvtx_types_length: 7, ...} type='{all_endvtx_types_length: i...'>"
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 67,
2024-01-18 16:06:16 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
2024-01-15 16:46:25 +01:00
"source": [
2024-01-18 16:06:16 +01:00
"electrons[0]"
2024-01-17 15:59:39 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 68,
2024-01-17 15:59:39 +01:00
"metadata": {},
2024-01-18 16:06:16 +01:00
"outputs": [
{
"data": {
"text/html": [
"<pre>{lost: True,\n",
" rad_length_frac: 0.129,\n",
" energy: 1.17e+04,\n",
" photon_length: 6,\n",
" brem_photons_pe: [2.62e+03, 812, 2.54e+03, 1.86e+03, 3.12e+03, 241],\n",
" brem_vtx_x: [-6.97, -52.9, -52.9, -55.2, -1.71e+03, -2.14e+03],\n",
" brem_vtx_z: [112, 859, 859, 895, 8.7e+03, 9.68e+03]}\n",
"---------------------------------------------------------------------\n",
"type: {\n",
" lost: bool,\n",
" rad_length_frac: float64,\n",
" energy: float64,\n",
" photon_length: int64,\n",
" brem_photons_pe: var * float64,\n",
" brem_vtx_x: var * float64,\n",
" brem_vtx_z: var * float64\n",
"}</pre>"
],
"text/plain": [
"<Record {lost: True, rad_length_frac: ..., ...} type='{lost: bool, rad_leng...'>"
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 68,
2024-01-18 16:06:16 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
2024-01-17 15:59:39 +01:00
"source": [
"lost_e = electrons[\"lost\"]\n",
"e = electrons[\"energy\"]\n",
"brem_pe = electrons[\"brem_photons_pe\"]\n",
"brem_z = electrons[\"brem_vtx_z\"]\n",
"brem_x = electrons[\"brem_vtx_x\"]\n",
"length = electrons[\"brem_vtx_z_length\"]\n",
2024-01-18 16:06:16 +01:00
"rad_length = electrons[\"rad_length_frac\"]\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"brem = ak.ArrayBuilder()\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"for itr in range(ak.num(electrons, axis=0)):\n",
" brem.begin_record()\n",
" brem.field(\"lost\").boolean(lost_e[itr])\n",
2024-01-18 16:06:16 +01:00
" brem.field(\"rad_length_frac\").append(rad_length[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"energy\"] energy\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"energy\").append(e[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"photon_length\"] number of vertices\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"photon_length\").integer(length[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"brem_photons_pe\",:] photon energy\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"brem_photons_pe\").append(brem_pe[itr])\n",
2024-01-16 21:48:53 +01:00
" # [:,\"brem_vtx_z\",:] brem vtx z\n",
2024-01-17 15:59:39 +01:00
" brem.field(\"brem_vtx_x\").append(brem_x[itr])\n",
" brem.field(\"brem_vtx_z\").append(brem_z[itr])\n",
" brem.end_record()\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-18 16:06:16 +01:00
"brem = ak.Array(brem)\n",
"brem[0]"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 69,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
"photon_cut = 0\n",
2024-01-26 11:34:42 +01:00
"photon_cut_ratio = 0.25\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"cut_brem = ak.ArrayBuilder()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"for itr in range(ak.num(brem, axis=0)):\n",
" cut_brem.begin_record()\n",
2024-01-18 16:06:16 +01:00
" cut_brem.field(\"event_id\").integer(itr)\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"lost\").boolean(brem[itr, \"lost\"])\n",
2024-01-18 16:06:16 +01:00
" cut_brem.field(\"rad_length_frac\").real(brem[itr, \"rad_length_frac\"])\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"energy\").real(brem[itr, \"energy\"])\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" ph_length = brem[itr, \"photon_length\"]\n",
2024-01-26 11:34:42 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" tmp_energy = brem[itr, \"energy\"]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"brem_photons_pe\")\n",
" cut_brem.begin_list()\n",
" for jentry in range(brem[itr, \"photon_length\"]):\n",
2024-01-26 11:34:42 +01:00
" if (brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\",\n",
" jentry] < photon_cut_ratio * tmp_energy):\n",
2024-01-17 15:59:39 +01:00
" ph_length -= 1\n",
2024-01-15 16:46:25 +01:00
" continue\n",
" else:\n",
2024-01-17 15:59:39 +01:00
" cut_brem.real(brem[itr, \"brem_photons_pe\", jentry])\n",
" tmp_energy -= brem[itr, \"brem_photons_pe\", jentry]\n",
" cut_brem.end_list()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" tmp_energy = brem[itr, \"energy\"]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"brem_vtx_x\")\n",
" cut_brem.begin_list()\n",
" for jentry in range(brem[itr, \"photon_length\"]):\n",
2024-01-26 11:34:42 +01:00
" if (brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\",\n",
" jentry] < photon_cut_ratio * tmp_energy):\n",
2024-01-15 16:46:25 +01:00
" continue\n",
" else:\n",
2024-01-17 15:59:39 +01:00
" cut_brem.real(brem[itr, \"brem_vtx_x\", jentry])\n",
" tmp_energy -= brem[itr, \"brem_photons_pe\", jentry]\n",
" cut_brem.end_list()\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" tmp_energy = brem[itr, \"energy\"]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"brem_vtx_z\")\n",
" cut_brem.begin_list()\n",
" for jentry in range(brem[itr, \"photon_length\"]):\n",
2024-01-26 11:34:42 +01:00
" if (brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\",\n",
" jentry] < photon_cut_ratio * tmp_energy):\n",
2024-01-15 16:46:25 +01:00
" continue\n",
" else:\n",
2024-01-17 15:59:39 +01:00
" cut_brem.real(brem[itr, \"brem_vtx_z\", jentry])\n",
" tmp_energy -= brem[itr, \"brem_photons_pe\", jentry]\n",
" cut_brem.end_list()\n",
2024-01-26 11:34:42 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.field(\"photon_length\").integer(ph_length)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" cut_brem.end_record()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"ntuple = ak.Array(cut_brem)"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 70,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
2024-01-17 15:59:39 +01:00
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-26 11:34:42 +01:00
"20636\n",
2024-01-18 16:06:16 +01:00
"50501\n"
2024-01-17 15:59:39 +01:00
]
},
2024-01-15 16:46:25 +01:00
{
"data": {
"text/html": [
2024-01-18 16:06:16 +01:00
"<pre>{event_id: 0,\n",
" lost: True,\n",
" rad_length_frac: 0.129,\n",
" energy: 1.17e+04,\n",
2024-01-26 11:34:42 +01:00
" brem_photons_pe: [],\n",
" brem_vtx_x: [],\n",
" brem_vtx_z: [],\n",
" photon_length: 0}\n",
"-----------------------------------\n",
2024-01-18 16:06:16 +01:00
"type: {\n",
" event_id: int64,\n",
" lost: bool,\n",
" rad_length_frac: float64,\n",
" energy: float64,\n",
" brem_photons_pe: var * float64,\n",
" brem_vtx_x: var * float64,\n",
" brem_vtx_z: var * float64,\n",
" photon_length: int64\n",
"}</pre>"
],
"text/plain": [
"<Record {event_id: 0, lost: True, ...} type='{event_id: int64, lost: bool, ...'>"
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 70,
2024-01-18 16:06:16 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"print(ak.sum(ak.num(ntuple[\"brem_photons_pe\"], axis=1)))\n",
2024-01-26 11:34:42 +01:00
"print(ak.num(ntuple, axis=0))\n",
2024-01-18 16:06:16 +01:00
"ntuple[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 71,
2024-01-18 16:06:16 +01:00
"metadata": {},
"outputs": [],
"source": [
"# nulltuple = ntuple[:7000]\n",
"# onetuple = ntuple[7000:14000]\n",
"# twotuple = ntuple[14000:21000]\n",
"# threetuple = ntuple[21000:28000]\n",
"# fourtuple = ntuple[28000:35000]\n",
"# fivetuple = ntuple[35000:42000]\n",
"# sixtuple = ntuple[42000:49000]\n",
"# seventuple = ntuple[49000:]\n",
"\n",
"# ntuple.nbytes"
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 72,
2024-01-18 16:06:16 +01:00
"metadata": {},
"outputs": [],
"source": [
"# cut = \"tenCut\"\n",
"# tree = \"Tree10\"\n",
"# with uproot.update(\"trackinglosses_B_photon_cuts.root\") as outFile:\n",
"# #outFile[\"README\"] = \"The Cuts are placed on the photons. noCut: 0*E, first: 0.05*E, second: 0.1*E, etc.\"\n",
"# outFile.mktree(tree, {cut + \"_event_id\": ntuple[\"event_id\"].type, cut + \"_lost\": ntuple[\"lost\"].type, cut + \"_rad_length_frac\": ntuple[\"rad_length_frac\"].type, cut + \"_energy\": ntuple[\"energy\"].type, cut + \"_brem_photons_pe\": ntuple[\"brem_photons_pe\"].type, cut + \"_brem_vtx_x\": ntuple[\"brem_vtx_x\"].type, cut + \"_brem_vtx_z\": ntuple[\"brem_vtx_z\"].type, cut + \"_photon_length\": ntuple[\"photon_length\"].type} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": nulltuple[\"event_id\"], cut + \"_lost\": nulltuple[\"lost\"], cut + \"_rad_length_frac\": nulltuple[\"rad_length_frac\"], cut + \"_energy\": nulltuple[\"energy\"], cut + \"_brem_photons_pe\": nulltuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": nulltuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": nulltuple[\"brem_vtx_z\"], cut + \"_photon_length\": nulltuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": onetuple[\"event_id\"], cut + \"_lost\": onetuple[\"lost\"], cut + \"_rad_length_frac\": onetuple[\"rad_length_frac\"], cut + \"_energy\": onetuple[\"energy\"], cut + \"_brem_photons_pe\": onetuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": onetuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": onetuple[\"brem_vtx_z\"], cut + \"_photon_length\": onetuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": twotuple[\"event_id\"], cut + \"_lost\": twotuple[\"lost\"], cut + \"_rad_length_frac\": twotuple[\"rad_length_frac\"], cut + \"_energy\": twotuple[\"energy\"], cut + \"_brem_photons_pe\": twotuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": twotuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": twotuple[\"brem_vtx_z\"], cut + \"_photon_length\": twotuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": threetuple[\"event_id\"], cut + \"_lost\": threetuple[\"lost\"], cut + \"_rad_length_frac\": threetuple[\"rad_length_frac\"], cut + \"_energy\": threetuple[\"energy\"], cut + \"_brem_photons_pe\": threetuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": threetuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": threetuple[\"brem_vtx_z\"], cut + \"_photon_length\": threetuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": fourtuple[\"event_id\"], cut + \"_lost\": fourtuple[\"lost\"], cut + \"_rad_length_frac\": fourtuple[\"rad_length_frac\"], cut + \"_energy\": fourtuple[\"energy\"], cut + \"_brem_photons_pe\": fourtuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": fourtuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": fourtuple[\"brem_vtx_z\"], cut + \"_photon_length\": fourtuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": fivetuple[\"event_id\"], cut + \"_lost\": fivetuple[\"lost\"], cut + \"_rad_length_frac\": fivetuple[\"rad_length_frac\"], cut + \"_energy\": fivetuple[\"energy\"], cut + \"_brem_photons_pe\": fivetuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": fivetuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": fivetuple[\"brem_vtx_z\"], cut + \"_photon_length\": fivetuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": sixtuple[\"event_id\"], cut + \"_lost\": sixtuple[\"lost\"], cut + \"_rad_length_frac\": sixtuple[\"rad_length_frac\"], cut + \"_energy\": sixtuple[\"energy\"], cut + \"_brem_photons_pe\": sixtuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": sixtuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": sixtuple[\"brem_vtx_z\"], cut + \"_photon_length\": sixtuple[\"photon_length\"]} )\n",
"# outFile[tree].extend( {cut + \"_event_id\": seventuple[\"event_id\"], cut + \"_lost\": seventuple[\"lost\"], cut + \"_rad_length_frac\": seventuple[\"rad_length_frac\"], cut + \"_energy\": seventuple[\"energy\"], cut + \"_brem_photons_pe\": seventuple[\"brem_photons_pe\"], cut + \"_brem_vtx_x\": seventuple[\"brem_vtx_x\"], cut + \"_brem_vtx_z\": seventuple[\"brem_vtx_z\"], cut + \"_photon_length\": seventuple[\"photon_length\"]} )"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 73,
2024-01-18 16:06:16 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"50501\n"
]
},
{
"data": {
"text/html": [
"<pre>{event_id: 1,\n",
" lost: False,\n",
" rad_length_frac: 0.148,\n",
" energy: 1.28e+04,\n",
" brem_photons_pe: [7.42e+03],\n",
" brem_vtx_x: [-3.61],\n",
" brem_vtx_z: [35.6],\n",
" photon_length: 1}\n",
2024-01-16 21:48:53 +01:00
"-----------------------------------\n",
2024-01-15 16:46:25 +01:00
"type: {\n",
2024-01-18 16:06:16 +01:00
" event_id: int64,\n",
2024-01-17 15:59:39 +01:00
" lost: bool,\n",
2024-01-18 16:06:16 +01:00
" rad_length_frac: float64,\n",
2024-01-15 16:46:25 +01:00
" energy: float64,\n",
" brem_photons_pe: var * float64,\n",
" brem_vtx_x: var * float64,\n",
2024-01-17 15:59:39 +01:00
" brem_vtx_z: var * float64,\n",
" photon_length: int64\n",
2024-01-15 16:46:25 +01:00
"}</pre>"
],
"text/plain": [
2024-01-18 16:06:16 +01:00
"<Record {event_id: 1, lost: False, ...} type='{event_id: int64, lost: bool,...'>"
2024-01-15 16:46:25 +01:00
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 73,
2024-01-15 16:46:25 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
2024-01-17 15:59:39 +01:00
"# data in cut_brem_found and cut_brem_lost\n",
"\n",
"length_found = ak.num(ntuple[~ntuple.lost][\"brem_photons_pe\"], axis=0)\n",
"length_lost = ak.num(ntuple[ntuple.lost][\"brem_photons_pe\"], axis=0)\n",
2024-01-26 11:34:42 +01:00
"print(length_found + length_lost)\n",
2024-01-17 15:59:39 +01:00
"ntuple[1]"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 74,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
2024-01-16 21:48:53 +01:00
"Z_found = ak.to_numpy(\n",
2024-01-17 15:59:39 +01:00
" ak.sum(ntuple[~ntuple.lost][\"brem_photons_pe\"], axis=-1, keepdims=False)\n",
") / ak.to_numpy(ntuple[~ntuple.lost][\"energy\"])\n",
2024-01-16 21:48:53 +01:00
"Z_lost = ak.to_numpy(\n",
2024-01-17 15:59:39 +01:00
" ak.sum(ntuple[ntuple.lost][\"brem_photons_pe\"], axis=-1, keepdims=False)\n",
") / ak.to_numpy(ntuple[ntuple.lost][\"energy\"])"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 75,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-26 11:34:42 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHOCAYAAABttoiYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAwWUlEQVR4nO3dz28baX7n8Y+S3VGMCO4yPZcssMB08TQ5GUX1JVjAA5hEH3cBkfIhA+QwMImBbkaiinKxfAlRRK4CUhQGmF30RSL9B0xYDtpYYIFFixXfAiTLcoA5zAIzTVcb2nXUSYZ70Fa1+Eui+LNKfL8AYSxW1cOnqz3kp5/nqe+z0ev1egIAAEip31l1BwAAAGZBmAEAAKlGmAEAAKlGmAEAAKlGmAEAAKlGmAEAAKlGmAEAAKlGmAEAAKlGmAFw5wVBsOouAFggwgyAO69UKikMw1V3A8CCEGYALEStVtODBw+0sbGhjY0NFQqF+CebzcavL5rv+zJNU4ZhJLJ/AGb371bdAQB30/7+vjqdjur1uvb39+U4Tt/xIAhUKBQW3g/XdVWpVBLbPwCzY2QGwMKcnZ1J0shQYJqm8vn8wvvged7Y90lC/wDMboNdswEsSjRNM+5jJgzDoemfeW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LkiV6/fh2Hj3q9rkKhIMdxtL+/L0l69uyZTNOMnyau1+vx+phisaivvvpKtVpNruvKNM2V/LOswlpNM+3s7OgP//APR/6MK6UMAMCiPXv
2024-01-15 16:46:25 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-01-26 11:34:42 +01:00
"xlim = 0\n",
2024-01-17 15:59:39 +01:00
"\n",
2024-01-16 21:48:53 +01:00
"plt.hist(\n",
" Z_lost,\n",
" bins=100,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"darkorange\",\n",
" label=\"lost\",\n",
2024-01-26 11:34:42 +01:00
" range=[xlim, 1],\n",
2024-01-16 21:48:53 +01:00
")\n",
"plt.hist(\n",
" Z_found,\n",
" bins=100,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"blue\",\n",
" label=\"found\",\n",
2024-01-26 11:34:42 +01:00
" range=[xlim, 1],\n",
2024-01-16 21:48:53 +01:00
")\n",
2024-01-15 16:46:25 +01:00
"plt.xlabel(r\"$E_\\gamma/E_0$\")\n",
"plt.ylabel(\"a.u.\")\n",
2024-01-16 21:48:53 +01:00
"plt.title(r\"$E_{ph}/E_0$\")\n",
2024-01-15 16:46:25 +01:00
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 76,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-26 11:34:42 +01:00
"found: 16049 , lost: 4587\n",
"0.2858122001370802\n"
2024-01-15 16:46:25 +01:00
]
2024-01-17 15:59:39 +01:00
},
{
"data": {
"text/html": [
2024-01-18 16:06:16 +01:00
"<pre>[-3.61,\n",
" -33.8,\n",
" 65.2,\n",
" -26.6,\n",
2024-01-26 11:34:42 +01:00
" 31.6,\n",
" -52.1,\n",
" -44.7,\n",
" -103,\n",
" -10.2,\n",
" -47.1,\n",
2024-01-18 16:06:16 +01:00
" ...,\n",
2024-01-26 11:34:42 +01:00
" -25.5,\n",
" -90.3,\n",
" 55.2,\n",
" 152,\n",
" -144,\n",
" 330,\n",
2024-01-18 16:06:16 +01:00
" -13.1,\n",
" -4.27,\n",
" -17.8]\n",
"---------------------\n",
2024-01-26 11:34:42 +01:00
"type: 16049 * float64</pre>"
2024-01-17 15:59:39 +01:00
],
"text/plain": [
2024-01-26 11:34:42 +01:00
"<Array [-3.61, -33.8, 65.2, ..., -13.1, -4.27, -17.8] type='16049 * float64'>"
2024-01-17 15:59:39 +01:00
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 76,
2024-01-17 15:59:39 +01:00
"metadata": {},
"output_type": "execute_result"
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-17 15:59:39 +01:00
"tuple_found = ntuple[~ntuple.lost]\n",
"tuple_lost = ntuple[ntuple.lost]\n",
"\n",
2024-01-15 16:46:25 +01:00
"brem_x_found = ak.to_numpy(ak.flatten(tuple_found[\"brem_vtx_x\"]))\n",
"brem_z_found = ak.to_numpy(ak.flatten(tuple_found[\"brem_vtx_z\"]))\n",
"\n",
"brem_x_lost = ak.to_numpy(ak.flatten(tuple_lost[\"brem_vtx_x\"]))\n",
"brem_z_lost = ak.to_numpy(ak.flatten(tuple_lost[\"brem_vtx_z\"]))\n",
"\n",
"n_found = len(brem_x_found)\n",
"n_lost = len(brem_x_lost)\n",
"print(\"found: \", n_found, \", lost: \", n_lost)\n",
2024-01-16 21:48:53 +01:00
"stretch_factor = n_lost / n_found\n",
2024-01-17 15:59:39 +01:00
"print(stretch_factor)\n",
"ak.flatten(tuple_found[\"brem_vtx_x\"])"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 77,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-26 11:34:42 +01:00
"image/png": "iVBORw0KGgoAAA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kk/wjXvP8zq2s1gs6sknnxworvaROf2OHAn0cgM4WEe/I2gGZRoNEsWotjPu8msfJbS9vd3xovVeJRKJ1iiq9o674MXxQbm3p9k69ILRTCe9JN7k8uXLrb/bb9IHI1KSyeRAnYn9cF1X5XJZu7u72tvb09LSUs+dM+0dre2jSY5r71SI60Xog5RxPp/v6oANOsoef/zxEUUMAAAw2eggAQAAwMB6fSRQu+DG47R8s9t13dYN7eCGc6PRULPZjNyp0S640V2pVPq+Ud5ehrYbusF+ss0zCnffffdQ8hnVdo6r/Or1emu/NxoNZTIZra2t9fVt/qAzIxiNJR09Jmt1dbV1I7z9pnqhUDB26AWP14p6PLc/Ti3sJn1cnSPHnTSy7Lj265ltXwTHQVydI9JgZVwqleS6ble86XS64/gBAACYJ3SQAAAAYGDBDbd+bqxGfdzVOB1/54PtXQ79aDQarZuX7evpVfsN3ePvumgX7KcoHVrDEIw0impU2znO8gsedRTkWalUjI+kC5NOp1txBR0hW1tbrffBJJNJNZtNVSqV1siXsPM0eMRY1HfpSGp17Jlu0kd5dFxUjUZDa2trWlpa0t7ennZ3d1sjZE6SSCRa++PNN980zhd0KMTZ8RO1jD3PU7PZDD0Hg+OtvSMNAABgXtBBAgAAgIEFnRym9zeEab/JbHuZdvC4oEnQ/r6VUqmkUqk00A3lwNramgqFQuvF8o1Go+OF970IytM2+iTYT4N2VPQr6HQYxkibUW1n3OX
2024-01-15 16:46:25 +01:00
"text/plain": [
"<Figure size 2000x800 with 3 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-01-17 15:59:39 +01:00
"vmax = 150\n",
2024-01-16 21:48:53 +01:00
"nbins = 100\n",
"\n",
"fig, ((ax0, ax1)) = plt.subplots(nrows=1, ncols=2, figsize=(20, 8))\n",
"\n",
"a0 = ax0.hist2d(\n",
" brem_z_found,\n",
" brem_x_found,\n",
" density=False,\n",
" bins=nbins,\n",
" cmap=plt.cm.jet,\n",
" cmin=1,\n",
" vmax=vmax,\n",
2024-01-17 15:59:39 +01:00
" range=[[-200, 3000], [-1000, 1000]],\n",
2024-01-16 21:48:53 +01:00
")\n",
2024-01-26 11:34:42 +01:00
"ax0.vlines([770, 990, 2700], -1000, 1000, colors=\"red\")\n",
2024-01-16 21:48:53 +01:00
"ax0.set_ylim(-1000, 1000)\n",
2024-01-17 15:59:39 +01:00
"ax0.set_xlim(-200, 3000)\n",
2024-01-15 16:46:25 +01:00
"ax0.set_xlabel(\"z [mm]\")\n",
"ax0.set_ylabel(\"x [mm]\")\n",
"ax0.set_title(r\"$e^\\pm$ found brem vertices\")\n",
"\n",
2024-01-16 21:48:53 +01:00
"a1 = ax1.hist2d(\n",
" brem_z_lost,\n",
" brem_x_lost,\n",
" density=False,\n",
" bins=nbins,\n",
" cmap=plt.cm.jet,\n",
" cmin=1,\n",
" vmax=vmax * stretch_factor,\n",
2024-01-17 15:59:39 +01:00
" range=[[-200, 3000], [-1000, 1000]],\n",
2024-01-16 21:48:53 +01:00
")\n",
2024-01-17 15:59:39 +01:00
"ax1.vlines([770, 990, 2700], -1000, 1000, colors=\"red\")\n",
2024-01-16 21:48:53 +01:00
"ax1.set_ylim(-1000, 1000)\n",
2024-01-17 15:59:39 +01:00
"ax1.set_xlim(-200, 3000)\n",
2024-01-15 16:46:25 +01:00
"ax1.set_xlabel(\"z [mm]\")\n",
"ax1.set_ylabel(\"x [mm]\")\n",
"ax1.set_title(r\"$e^\\pm$ lost brem vertices\")\n",
2024-01-16 21:48:53 +01:00
"# ax1.set(xlim=(0,4000), ylim=(-1000,1000))\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-19 11:22:15 +01:00
"plt.suptitle(\"brem vtx of photons w/ $E>0.1E_0$\")\n",
2024-01-15 16:46:25 +01:00
"plt.colorbar(a0[3], ax=ax1)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 78,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-18 16:06:16 +01:00
"50501\n"
2024-01-17 15:59:39 +01:00
]
}
],
2024-01-15 16:46:25 +01:00
"source": [
2024-01-17 15:59:39 +01:00
"energy_emissions = ak.ArrayBuilder()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"for jelec in range(ak.num(ntuple, axis=0)):\n",
" energy_emissions.begin_record()\n",
" energy_emissions.field(\"lost\").boolean(ntuple[jelec, \"lost\"])\n",
" energy_emissions.field(\"energy\").real(ntuple[jelec, \"energy\"])\n",
"\n",
" tmp_velo = 0\n",
" tmp_richut = 0\n",
" tmp_neither = 0\n",
" tmp_velo_length = 0\n",
" tmp_richut_length = 0\n",
" tmp_neither_length = 0\n",
2024-01-26 11:34:42 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" for jphoton in range(ak.num(ntuple[jelec][\"brem_photons_pe\"], axis=0)):\n",
" if ntuple[jelec, \"brem_vtx_z\", jphoton] <= 770:\n",
" tmp_velo += ntuple[jelec, \"brem_photons_pe\", jphoton]\n",
" tmp_velo_length += 1\n",
2024-01-26 11:34:42 +01:00
" elif (ntuple[jelec, \"brem_vtx_z\", jphoton]\n",
" > 770) and (ntuple[jelec, \"brem_vtx_z\", jphoton] <= 2700):\n",
2024-01-17 15:59:39 +01:00
" tmp_richut += ntuple[jelec, \"brem_photons_pe\", jphoton]\n",
" tmp_richut_length += 1\n",
" else:\n",
" tmp_neither += ntuple[jelec, \"brem_photons_pe\", jphoton]\n",
" tmp_neither_length += 1\n",
"\n",
" energy_emissions.field(\"velo_length\").integer(tmp_velo_length)\n",
" energy_emissions.field(\"velo\").real(tmp_velo)\n",
"\n",
" energy_emissions.field(\"rich_length\").integer(tmp_richut_length)\n",
" energy_emissions.field(\"rich\").real(tmp_richut)\n",
2024-01-26 11:34:42 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" energy_emissions.field(\"neither_length\").integer(tmp_neither_length)\n",
" energy_emissions.field(\"downstream\").real(tmp_neither)\n",
2024-01-26 11:34:42 +01:00
"\n",
" energy_emissions.field(\"photon_length\").integer(tmp_neither_length +\n",
" tmp_richut_length +\n",
" tmp_velo_length)\n",
"\n",
" if (tmp_velo == 0) and (tmp_richut == 0):\n",
2024-01-17 15:59:39 +01:00
" energy_emissions.field(\"quality\").integer(0)\n",
" else:\n",
" energy_emissions.field(\"quality\").integer(1)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
" energy_emissions.end_record()\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"energy_emissions = ak.Array(energy_emissions)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"print(ak.num(energy_emissions, axis=0))"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 79,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
2024-01-17 15:59:39 +01:00
"data": {
"text/html": [
"<pre>{lost: False,\n",
2024-01-18 16:06:16 +01:00
" energy: 5.09e+04,\n",
" velo_length: 0,\n",
" velo: 0,\n",
2024-01-17 15:59:39 +01:00
" rich_length: 0,\n",
" rich: 0,\n",
" neither_length: 0,\n",
" downstream: 0,\n",
2024-01-18 16:06:16 +01:00
" photon_length: 0,\n",
" quality: 0}\n",
2024-01-17 15:59:39 +01:00
"--------------------------\n",
"type: {\n",
" lost: bool,\n",
" energy: float64,\n",
" velo_length: int64,\n",
" velo: float64,\n",
" rich_length: int64,\n",
" rich: float64,\n",
" neither_length: int64,\n",
" downstream: float64,\n",
" photon_length: int64,\n",
" quality: int64\n",
"}</pre>"
],
"text/plain": [
2024-01-18 16:06:16 +01:00
"<Record {lost: False, energy: 5.09e+04, ...} type='{lost: bool, energy: flo...'>"
2024-01-17 15:59:39 +01:00
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 79,
2024-01-17 15:59:39 +01:00
"metadata": {},
"output_type": "execute_result"
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-17 15:59:39 +01:00
"energy_emissions[3]"
2024-01-16 21:48:53 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 80,
2024-01-16 21:48:53 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-26 11:34:42 +01:00
"found: 41978\n",
"lost: 8523\n",
2024-01-18 16:06:16 +01:00
"50501\n",
2024-01-26 11:34:42 +01:00
"VELO energy emission, eff: 0.15952159363180926\n",
"RICH1+UT energy emission, eff: 0.10419595651571256\n",
"Neither, eff: 0.5675135145838697\n",
"total efficiency: 0.8312310647313915\n",
"efficiency: 0.8312310647313914\n",
2024-01-17 15:59:39 +01:00
"\n",
"found in velo/(found + lost in velo)\n",
2024-01-26 11:34:42 +01:00
"VELO energy emission, eff: 0.8187823965850188\n",
"RICH1+UT energy emission, eff: 0.7830357142857143\n",
"eff von e die nicht strahlen: 0.8443815921277473\n"
2024-01-17 15:59:39 +01:00
]
}
],
2024-01-16 21:48:53 +01:00
"source": [
2024-01-17 15:59:39 +01:00
"# efficiency berechnen als found in velo oder rich über alle elektronen\n",
"# dann kann man zusammenrechnen mit velo, rich, und allen anderen elektronen\n",
"# expected eff = 81.19%\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"electrons_found = energy_emissions[~energy_emissions.lost]\n",
"electrons_lost = energy_emissions[energy_emissions.lost]\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"anz_found = ak.num(electrons[~electrons.lost], axis=0)\n",
"anz_lost = ak.num(electrons[electrons.lost], axis=0)\n",
"print(\"found: \", anz_found)\n",
2024-01-17 15:59:39 +01:00
"print(\"lost: \", anz_lost)\n",
"\n",
"num_velo_found = 0\n",
"num_rich_found = 0\n",
"num_no_up_rad_found = 0\n",
"for itr in range(ak.num(electrons_found, axis=0)):\n",
2024-01-26 11:34:42 +01:00
" if electrons_found[itr, \"quality\"] == 1:\n",
" if electrons_found[itr, \"velo\"] >= electrons_found[itr, \"rich\"]:\n",
2024-01-17 15:59:39 +01:00
" num_velo_found += 1\n",
" else:\n",
" num_rich_found += 1\n",
" else:\n",
" num_no_up_rad_found += 1\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"num_velo_lost = 0\n",
"num_rich_lost = 0\n",
"num_no_up_rad_lost = 0\n",
"for itr in range(ak.num(electrons_lost, axis=0)):\n",
2024-01-26 11:34:42 +01:00
" if electrons_lost[itr, \"quality\"] == 1:\n",
" if electrons_lost[itr, \"velo\"] >= electrons_lost[itr, \"rich\"]:\n",
2024-01-17 15:59:39 +01:00
" num_velo_lost += 1\n",
" else:\n",
" num_rich_lost += 1\n",
" else:\n",
" num_no_up_rad_lost += 1\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"denom = ak.num(electrons, axis=0)\n",
2024-01-17 15:59:39 +01:00
"print(denom)\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"eff_velo = num_velo_found / denom\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"eff_rich = num_rich_found / denom\n",
2024-01-17 15:59:39 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"eff_other = ak.num(electrons_found[electrons_found.quality == 0],\n",
" axis=0) / denom\n",
2024-01-17 15:59:39 +01:00
"\n",
"print(\"VELO energy emission, eff: \", eff_velo)\n",
"\n",
"print(\"RICH1+UT energy emission, eff: \", eff_rich)\n",
"\n",
"print(\"Neither, eff: \", eff_other)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"print(\"total efficiency: \", eff_velo + eff_rich + eff_other)\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"print(\"efficiency: \", anz_found / (anz_found + anz_lost))\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"print(\"\\nfound in velo/(found + lost in velo)\")\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"eff_velo = num_velo_found / (num_velo_found + num_velo_lost)\n",
"eff_rich = num_rich_found / (num_rich_found + num_rich_lost)\n",
2024-01-17 15:59:39 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"eff_no_rad = num_no_up_rad_found / (num_no_up_rad_found + num_no_up_rad_lost)\n",
2024-01-17 15:59:39 +01:00
"\n",
"print(\"VELO energy emission, eff: \", eff_velo)\n",
"\n",
"print(\"RICH1+UT energy emission, eff: \", eff_rich)\n",
"\n",
2024-01-26 11:34:42 +01:00
"print(\"eff von e die nicht strahlen: \", eff_no_rad)"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 81,
2024-01-16 21:48:53 +01:00
"metadata": {},
"outputs": [
{
2024-01-16 22:04:43 +01:00
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-26 11:34:42 +01:00
"41978\n",
"8523\n",
2024-01-18 16:06:16 +01:00
"50501\n"
2024-01-16 22:04:43 +01:00
]
2024-01-16 21:48:53 +01:00
}
],
"source": [
2024-01-26 11:34:42 +01:00
"print(ak.num(electrons[~electrons.lost], axis=0))\n",
"print(ak.num(electrons[electrons.lost], axis=0))\n",
"print(ak.num(electrons, axis=0))"
2024-01-16 21:48:53 +01:00
]
},
2024-01-16 22:04:43 +01:00
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 84,
2024-01-16 22:04:43 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
2024-01-26 11:34:42 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkEAAAHJCAYAAACCD+2FAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm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+M/+4wz/NUKBSmemUGAABIlkQlQc1mU61WS4ZhBNVKo3zBIQAAyI7EJEHNZlO1Wm2gjH2hUAjGAYT5/ve/r7/8y7/UL/3SL+nGjRtRhQoAAK7h1atX+sd//Ed94xvf0Je+9KX4AomrQNFF+Xx+aHG4YT744IPQYmp8+PDhw4cPn+R/Pvjgg3mnFyMl5umwk5OTS4+j9w9IDvPlL39ZkrS/vz/RoMg7d+7oyZMnc1t+3vs4OzvT7du39fTpU62srCQipij2wXFz3HHHFMU+OG6OO+6YotiH67ra3NwM7uOxmVd29bu/+7u9P/3TPx17ef9VBP7LDzudTs8wjJGvl3j69GlPUu/p06cTxfbLv/zLc11+3vv44Q9/2JPU++EPf5iYmKLYB8fNcccdUxT74Lg57rhjimIf096/Z20uLUEvXryQ4zh6/PixvvWtb421TrlcVqfTUb1e1/r6ukzT1IsXL4a+wLTfj370I718+XLs+D799NOB5ZeXl7W8vDz2+gAAZNn5+bnOz88Hpl28t47yox/9aB5hTWwuSdA777wjx3EmfrWE4zh69uyZXNcNqsAWi8Ur1/uN3/iNiWP84he/GPz/wYMHevjw4cTbAAAgi2q1mh49enRpev+9dRHMbUzQ5ubmxOsUCgVVKhWZpqlSqaRSqaRGo3FlIvQXf/EX+tVf/dWx9/P
2024-01-17 15:59:39 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# energyspektren angucken von velo und rich\n",
2024-01-26 11:34:42 +01:00
"diff_found = ak.to_numpy(energy_emissions[(~energy_emissions.lost) & (\n",
" energy_emissions.quality == 1)][\"velo\"]) - ak.to_numpy(energy_emissions[\n",
" (~energy_emissions.lost) & (energy_emissions.quality == 1)][\"rich\"])\n",
"diff_lost = ak.to_numpy(energy_emissions[(energy_emissions.lost) & (\n",
" energy_emissions.quality == 1)][\"velo\"]) - ak.to_numpy(energy_emissions[\n",
" (energy_emissions.lost) & (energy_emissions.quality == 1)][\"rich\"])\n",
2024-01-17 15:59:39 +01:00
"\n",
"xlim = 20000\n",
2024-01-26 11:34:42 +01:00
"nbins = 80\n",
2024-01-17 15:59:39 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"plt.hist(\n",
" diff_lost,\n",
" bins=nbins,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"darkorange\",\n",
" label=\"lost\",\n",
" range=[-xlim, xlim],\n",
")\n",
"plt.hist(\n",
" diff_found,\n",
" bins=nbins,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"blue\",\n",
" label=\"found\",\n",
" range=[-xlim, xlim],\n",
")\n",
"plt.xlim(-20000, 20000)\n",
2024-01-19 11:22:15 +01:00
"plt.title(\"emitted energy difference\")\n",
2024-01-26 11:34:42 +01:00
"plt.xlabel(r\"$E_{VELO} - E_{RICH1+UT}$ [MeV]\")\n",
2024-01-17 15:59:39 +01:00
"plt.ylabel(\"a.u.\")\n",
"plt.legend()\n",
"plt.show()"
]
2024-01-16 22:04:43 +01:00
},
2024-01-16 21:48:53 +01:00
{
2024-01-17 15:59:39 +01:00
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 43,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
2024-01-26 11:34:42 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHJCAYAAABpOFaGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAxvklEQVR4nO3dT2wj6WH3+V+ne1qepOEpqefgOW26GBhBLjsoqn0IsOlBmhUj8CEwhtTcMgMYTcLQJRgkLHQu030JUUIOuQhwUQjQm9s0abzYQxAkpI3XXiCHtVjpXBaLxbI6wHtIgNdDlY2222r/qT30VA0pkRRF8U9Jz/cDCNNisZ56VMVR/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Hb7+/va398fu+3nP//5Qo81dxCyLEs7OzuyLOvUttu3b8txnDMfn+XBP/zDP9BZGgCAHJnWEJF2ll6UuYPQwcGB3n///YVVBAAAYNXm7ixNCAIAAJfd0tYa+/a3v63t7W1961vfWtYhLuTmzZsj/720/vXRumtwYRuvfqVPPvlEGxsb666K8TY2NrgWOcG1yBeuR34s+v4994SK0zx//lyFQkGbm5v67LPPFl38QoRhqGKxqF6vJ8dx1l2d+V2BICRJ+sNH664BAOASWPT9eyktQnfu3FEQBLJtexnFAwAALMTSHo3t7OzorbfeWlbxAAAAFzZ3Z+mzfO9739PDhw+XVTwAAMCFXahF6Pvf/746nY7iOB55fTAYKAxDDQYDNRqNixwCAABgaS40j1CtVpv6nmq1Om/xAAAASzf3o7EgCNTpdHR
2024-01-17 15:59:39 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# number of brem vtx with E>x*E_0\n",
"\n",
2024-01-26 11:34:42 +01:00
"number_velo = ak.to_numpy(\n",
" energy_emissions[energy_emissions.quality == 1][\"velo_length\"])\n",
"number_rich = ak.to_numpy(\n",
" energy_emissions[energy_emissions.quality == 1][\"rich_length\"])\n",
2024-01-17 15:59:39 +01:00
"\n",
2024-01-26 11:34:42 +01:00
"plt.hist(\n",
" number_velo,\n",
" bins=10,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"darkorange\",\n",
" label=\"velo\",\n",
" range=[0, 10],\n",
")\n",
"plt.hist(\n",
" number_rich,\n",
" bins=10,\n",
" density=True,\n",
" alpha=0.5,\n",
" histtype=\"bar\",\n",
" color=\"blue\",\n",
" label=\"rich\",\n",
" range=[0, 10],\n",
")\n",
"plt.xlim(0, 10)\n",
2024-01-17 15:59:39 +01:00
"plt.title(\"number of photons emitted\")\n",
"plt.xlabel(\"number of photons\")\n",
"plt.ylabel(\"a.u.\")\n",
"plt.legend()\n",
"plt.show()"
]
2024-01-15 16:46:25 +01:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
2024-01-26 11:34:42 +01:00
"execution_count": 44,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
"text/plain": [
"' \\nphoton cut = x*E_0\\neffs, all photons included: x=0\\nfound in velo/(found + lost in velo)\\nVELO energy emission, eff: 0.8446167611094543\\nRICH1+UT energy emission, eff: 0.7961586121437423\\neff von e die nicht strahlen: 0.7954674220963173\\n'"
]
},
2024-01-26 11:34:42 +01:00
"execution_count": 44,
2024-01-17 15:59:39 +01:00
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"\"\"\" \n",
"photon cut = x*E_0\n",
"effs, all photons included: x=0\n",
"found in velo/(found + lost in velo)\n",
"VELO energy emission, eff: 0.8446167611094543\n",
"RICH1+UT energy emission, eff: 0.7961586121437423\n",
"eff von e die nicht strahlen: 0.7954674220963173\n",
"\"\"\""
]
2024-01-15 16:46:25 +01:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": null,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
2024-01-17 15:59:39 +01:00
"source": []
2024-01-15 16:46:25 +01:00
},
{
"cell_type": "code",
2024-01-17 15:59:39 +01:00
"execution_count": null,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [],
"source": []
2024-01-15 16:46:25 +01:00
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "tuner",
"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.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 2
}