2024-01-15 16:46:25 +01:00
{
"cells": [
{
"cell_type": "code",
2024-01-28 16:15:00 +01:00
"execution_count": 2,
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-28 16:15:00 +01:00
"execution_count": 3,
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-28 16:15:00 +01:00
"found = allcolumns[\n",
" (allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromB)\n",
"] # B: 9056\n",
"lost = allcolumns[\n",
" (allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromB)\n",
"] # 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-28 16:15:00 +01:00
"execution_count": 4,
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",
" 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",
2024-01-27 14:02:41 +01:00
" p_end_ut: float64,\n",
" p_end_velo: float64,\n",
2024-01-18 16:06:16 +01:00
" 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-28 16:15:00 +01:00
"execution_count": 4,
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-28 16:15:00 +01:00
"execution_count": 5,
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-28 16:15:00 +01:00
"execution_count": 5,
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-28 16:15:00 +01:00
"execution_count": 6,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
"photon_cut = 0\n",
2024-01-28 16:15:00 +01:00
"photon_cut_ratio = 0.2\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-28 16:15:00 +01:00
" if (\n",
" brem[itr, \"brem_vtx_z\", jentry] > 2700\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
" ):\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-28 16:15:00 +01:00
" if (\n",
" brem[itr, \"brem_vtx_z\", jentry] > 2700\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
" ):\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-28 16:15:00 +01:00
" if (\n",
" brem[itr, \"brem_vtx_z\", jentry] > 2700\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
" ):\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-28 16:15:00 +01:00
"execution_count": 7,
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-28 16:15:00 +01:00
"24758\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-28 16:15:00 +01:00
" brem_photons_pe: [2.62e+03, 2.54e+03, 1.86e+03],\n",
" brem_vtx_x: [-6.97, -52.9, -55.2],\n",
" brem_vtx_z: [112, 859, 895],\n",
" photon_length: 3}\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-28 16:15:00 +01:00
"execution_count": 7,
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-28 16:15:00 +01:00
"execution_count": 8,
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-28 16:15:00 +01:00
"execution_count": 9,
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-28 16:15:00 +01:00
"execution_count": 10,
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-28 16:15:00 +01:00
"execution_count": 10,
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-28 16:15:00 +01:00
"execution_count": 11,
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-28 16:15:00 +01:00
" ak.sum(ntuple[~ntuple.lost][\"brem_photons_pe\"], axis=-1,\n",
" keepdims=False)) / ak.to_numpy(ntuple[~ntuple.lost][\"energy\"])\n",
2024-01-16 21:48:53 +01:00
"Z_lost = ak.to_numpy(\n",
2024-01-28 16:15:00 +01:00
" ak.sum(ntuple[ntuple.lost][\"brem_photons_pe\"], axis=-1,\n",
" keepdims=False)) / ak.to_numpy(ntuple[ntuple.lost][\"energy\"])"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-28 16:15:00 +01:00
"execution_count": 12,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-28 16:15:00 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHOCAYAAAB0PWY+AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAq2ElEQVR4nO3dP2wbWYLn8Z9m904wILgpedIF7GI0mVFUJ5PYgMntZDORcjCdNUxioKyBYY03sZwsQWFTAVs0BrgDZgOJNA4X9rK8kJMNzmKNo9vD7ancgIO7oJuuMQQI2t0BL9CSLYoUVSKLZJHv+wGMsciqV89v3OTP7+9Kp9PpCAAAwEA/m3cFAAAA5oUgBAAAjEUQAgAAxiIIAQAAYxGEAACAsQhCAADAWAQhAABgLIIQAAAwFkEIAEYIgmDeVQAwRQQhABihUCgoDMN5VwPAlBCEACTO3t6e1tfXtbKyopWVFeVyud6vdDrde33afN+XZVlKpVKJrB+Ayf35vCsAAFeVy2WdnJyoVqupXC6rWq32vR8EgXK53NTr4bquSqVSYusHYHL0CAFIpOPjY0kaGigsy1I2m516HTzPu/Y5SagfgMm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iq9Vqb75QPp+X67oqlUoD9w3rXUoidpaeIXaWBgAkVb1eVyaTUalUUrPZlHQRZqrVql69etUbIjs8PJTjOL3QE4ahLMvq/dztOXJdV47jyPd95fP52f+BIoprZ2mCEABgMf1yd941mBnf93u9Ob7va29vT8ViUalUqjf
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-27 14:02:41 +01:00
"plt.yscale(\"log\")\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-28 16:15:00 +01:00
"execution_count": 13,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-28 16:15:00 +01:00
"found: 19848 , lost: 4910\n",
"0.2473800886739218\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",
2024-01-28 16:15:00 +01:00
" -133,\n",
2024-01-18 16:06:16 +01:00
" 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",
2024-01-18 16:06:16 +01:00
" ...,\n",
2024-01-26 11:34:42 +01:00
" 330,\n",
2024-01-28 16:15:00 +01:00
" -11.6,\n",
2024-01-18 16:06:16 +01:00
" -13.1,\n",
2024-01-28 16:15:00 +01:00
" -25.6,\n",
2024-01-18 16:06:16 +01:00
" -4.27,\n",
2024-01-28 16:15:00 +01:00
" -103,\n",
" 8.82,\n",
" 12.8,\n",
2024-01-18 16:06:16 +01:00
" -17.8]\n",
"---------------------\n",
2024-01-28 16:15:00 +01:00
"type: 19848 * float64</pre>"
2024-01-17 15:59:39 +01:00
],
"text/plain": [
2024-01-28 16:15:00 +01:00
"<Array [-3.61, -33.8, -133, ..., 8.82, 12.8, -17.8] type='19848 * float64'>"
2024-01-17 15:59:39 +01:00
]
},
2024-01-28 16:15:00 +01:00
"execution_count": 13,
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-28 16:15:00 +01:00
"execution_count": 14,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-28 16:15:00 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkgAAAL5CAYAAAD7Uaj9AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACypElEQVR4nOz9f5Qj533f+X5qhuK4Y3KIafpIEe2YQ7SUazmxLlkY/8g618NIwPF6vc690XQPN7F3NY5FYJnezSa8Vw0zc3ebEx+mg7EvvZtNWwZGicZ74vVygNGe2Md2EkA2xydObGtQpO0kdK7Z0FCyqFBH6oaGvG4NNT11/+gBCDTqeRpVAAq/3q9z+vRMfet56ltPFdDPgwdV5fi+7wsAAAAAAAAAAGCOHBl3AgAAAAAAAAAAAHFjggQAAAAAAAAAAMwdJkgAAAAAAAAAAMDcYYIEAAAAAAAAAADMHSZIAAAAAAAAAADA3GGCBAAAAAAAAAAAzB0mSAAAAAAAAAAAwNxhggQAAAAAAAAAAMwdJkgAAAAAAAAAAMDcYYIEAAAARs1mU5VKRSsrKzpx4oQ8zxt3SpgRtVpNuVxOJ06cUKVSGXc6AAAAAOYQEyQAAAAwKpVKKhaLqlQqajab404HMbh48WJ7QuzEiRPK5XJDP/aVSkXFYlGlUonzakI1m005jqNMJhOqTD6f19LSkhzH6fppnU8HlzuOo1KpNMI9GVylUlEmk1Emk1EqlVImk1GtVhta/Z7nKZPJ9DUBPattDAAAMC5MkAAAAMBobW1NxWJx3GlMtWazORWTAM1mU6lUSl/96ldVLpf1uc99TouLiyqVSkP/cHV5eVnlcnmodfZrWo7HuLWO+crKSt9lEom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93d8dGHddt338XnjhhYjZBmsdi6Bjkkwm25Mf169f77vOVq4Hj9Wo9nNU9Zr2Y2lpSdL+xMzB58z0e/xb52Rrkq5TawKm9VybFtuEXq1WU7PZjDyJ0Ww22/uZzWbl79+xQDs7O6pWq0okEu1JzFFJp9OqVquq1+tqNBo6ceJE+3U1CwZt49Z7cblcVrlcbk+SxDnBAwAAMEmYIAEAAMDAWt+SD3NlRmvddDqtra2tnp/WB3++7w/tIcOD1NP6xr3neV37WSwW9cwzzwyUV+eVOWGvHGnp5wPg1jbCXkEzKNPVIFGMaj/jbr/Oq4QuXrzY9aD1fiUSifZVVJ0Td60Hx7favTNmm9BrXc102EPiTa5cudL+d+eH9K0rUpLJ5ECTiWG4rqtyuaytrS1tb29raWmp78mZzonWzqtJDuqcVIjrQeiDtHE+n++ZgG1NlD355JMjyhgAAGCyMUECAACAgfV7S6BOrQ8ep+Wb3a7rtj/Qbn3g3Gg01Gw2I09qdGp90F2pVEJ/UN7ZhrYPdFvHybbOKDz44INDqWdU+zmu9qvX6+3j3mg0lMlktLKyEurb/K3JjNbVWNL+bbKWl5fbH4R3fqheKBSME3qt22tFPZ87b6cW9CF9XJMjBx12ZdlBne9ntmPROg/imhyRBmvjUqkk13V78k2n013nDwAAwDxhggQAAAADa33gFuaD1ai3uxqng898sD3LIYxGo9H+8LJzO/3q/ED34LMuOrWOU5QJrWFoXWkU1aj2c5zt17rVUavOSqVivCVdkHQ63c6rNRGysbHRfh5MMplUs9lUpVJpX/kS9Dpt3WIs6rN0JLUn9kwf0ke5dVxUjUZDKysrWlpa0vb2tra2ttpXyBwmkUi0j8dXv/pV43qtCYU4J36itrHneWo2m4Gvwdb51jmRBgAAMC+YIAEAAMDAWpMcpuc3BOn8kNn2MO3W7YImQefzVkqlkkql0kAfKLesrKyoUCi0HyzfaDS6Hnjfj1Z
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-28 16:15:00 +01:00
"execution_count": 15,
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-28 16:15:00 +01:00
"execution_count": 16,
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-28 16:15:00 +01:00
"execution_count": 16,
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-28 16:15:00 +01:00
"execution_count": 17,
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-28 16:15:00 +01:00
"VELO energy emission, eff: 0.19057048375279698\n",
"RICH1+UT energy emission, eff: 0.1271657986970555\n",
"Neither, eff: 0.513494782281539\n",
"total efficiency: 0.8312310647313914\n",
2024-01-26 11:34:42 +01:00
"efficiency: 0.8312310647313914\n",
2024-01-17 15:59:39 +01:00
"\n",
"found in velo/(found + lost in velo)\n",
2024-01-28 16:15:00 +01:00
"VELO energy emission, eff: 0.8275150472914875\n",
"RICH1+UT energy emission, eff: 0.7901082677165354\n",
"eff von e die nicht strahlen: 0.8435090915005041\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-28 16:15:00 +01:00
"eff_other = ak.num(electrons_found[electrons_found.quality == 0], 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-28 16:15:00 +01:00
"execution_count": 18,
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-28 16:15:00 +01:00
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"energy_emissions = energy_emissions[energy_emissions.energy >= 5e3]"
]
},
{
"cell_type": "code",
"execution_count": 20,
2024-01-16 22:04:43 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
2024-01-28 16:15:00 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHLCAYAAAAk8PeNAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA9EUlEQVR4nO3dTWgja57v+Z+ne8qdYPLIqtr0QEGd0KpmM0nYdRfFQBak4h6Y3ZCSE6YLelGkROHdmW4H7k1mblpI9NZQIXOhB4oBpyIZZlkdOk0mDA130orO2UwPPaM4Dbnou6gjRyWGbFd3lWaRHXEsOySHZL2EHN8PmEzHy6NHEZbj7+fl/2wMh8OhAAAAcui/WnUFAAAAVoVACAAA5BaBEAAAyC0CIQAAkFsEQgAAILcIhAAAQG4RCAEAgNwiEAIAALlFIATkhO/7arfbq67G2uB6AflAIAQsQRAE2t7eXsmDNQgCVatV7ezsyHGcpb/+uhl3vW66h77vy7ZtVatVlUoltVqtVPswu1V+rnB3/OGqKwDkQRiGCsNQ/X7/2r4gCFQsFlUoFFJtn5ZhGOp0OtrY2LhVOXkx7npNuoe+7+vRo0c6OzuTJNm2HR83aR/SS/o8TLonQFobrDUGrNbOzo46nY4Mw0i1fVYbGxsyTVO9Xm8u5d1101yvarUq3/cTH8iT9iG9eX8egAhdY8AKRQ/JtNuRTZPuFffx9vg8YJEIhAB9elhVq1VZlqVSqSTbtuN9YRiq3W7Lsiy1220FQSDLsrS9vS3LshSGoSSp1WqpVCppe3t75HxJcl1X1WpV1Wp1ZFv0y71er8e/7MdtT1PXy3Wu1+vx1zRjUtJci52dHbmuq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+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-28 16:15:00 +01:00
"diff_found = (\n",
" ak.to_numpy(\n",
" energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"velo\"\n",
" ]\n",
" )\n",
" - ak.to_numpy(\n",
" energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"rich\"\n",
" ]\n",
" )\n",
") / ak.to_numpy(\n",
" energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"energy\"\n",
" ]\n",
")\n",
"diff_lost = (\n",
" ak.to_numpy(\n",
" energy_emissions[(energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"velo\"\n",
" ]\n",
" )\n",
" - ak.to_numpy(\n",
" energy_emissions[(energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"rich\"\n",
" ]\n",
" )\n",
") / ak.to_numpy(\n",
" energy_emissions[(energy_emissions.lost) & (energy_emissions.quality == 1)][\n",
" \"energy\"\n",
" ]\n",
")\n",
2024-01-17 15:59:39 +01:00
"\n",
2024-01-28 16:15:00 +01:00
"xlim = 1\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",
2024-01-28 16:15:00 +01:00
"# plt.xlim(-20000, 20000)\n",
"# plt.yscale(\"log\")\n",
"plt.title(\"emitted energy difference ratio\")\n",
"plt.xlabel(r\"$(E_{VELO} - E_{RICH1+UT})/E_0$\")\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-27 14:02:41 +01:00
"execution_count": 19,
2024-01-15 16:46:25 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
2024-01-27 14:02:41 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHJCAYAAABpOFaGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAxrElEQVR4nO3dT4wb2WHn8Z8ijdqTCJ7q1hysvWxUDIwglx0UWz4Y2GhgsdYIfDCMIdu3zACGSBh9CQYIC8plpEuIInLIpQGTjQDa4zRpBHsIgoS0sfYCOew0K8plsVgsS7k5wHrYZUOx3PKf2oOmashuks1m8091v+8HaHiaxXr1WEV3/fTq/bkWx3EsAAAAA/3OuisAAACwLgQhAABgLIIQAAAwFkEIAAAYiyAEAACMRRACAADGIggBAABjEYQAAICxCELAJRKGoZrNpqIoWndV1iaKIjWbTYVhuO6qYMGCIFCz2Vx3NWAYghBwSdTrdeVyOVUqFQ0Gg3VXZyZBEMjzPJVKJeVyOdXr9QuV12w2dffuXVUqFaPD4DKEYajNzc21BJEwDFUqlZTP59VoNFZ+fJiNIARcEtVqVcVicd3VmFkQBHrw4IF831er1VKxWFS/379QmeVyWeVyeUE1/FwYhsYHqyiKFEXR2Gs06fws6rzZtq1Wq3XhcoB5EISAS2Rra2vdVZhZrVYbqa/v+wv51/7t27cvXMZJpVLp0rSyLYvjOIrjWL7vn9o26fxw3nAVEIQALEUQBOuuwkxKpdKlqes6TDo/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8ffpU77///oXLMTYI3blzR5K0v7+fLo+wDO+9956+//3vX9ryV3GMFy9e6P79+/rRj36kW7duLe04V+FccS3MOQbXIlvHWMX1uArnaRXHCIJADx8+TO/jF7W0IPTd735X29vb+s53vrOsQ1zIF77wBUnSl7/85aUGoTfffPNSl7+KY/z85z+XJL3zzjv64he/uLTjXIVzxbUw5xhci2wdYxXX4yqcp1Uc48WLF5I+v49f1FI6Sz9//lyNRoPhrwAAINOW0iJ09+5dNRqNM1dVBgAAWKelPRp7+PDhsooGAABYiKXNI/T1r39dz549W1bxAAAAFzZ3i9C3v/3tiduiKFK329XBwYHeeeedeQ8BAACwVHMHoVkWRmy1WvrLv/zLeQ+xEn/6p3+q3/3d3x27bXd3V7u7uxcq/6L7r7v8VR1jFa7CueJamHeMZbsq54lrcbWOsbe3p729vbHbfvGLX1y4/GFzrzW2s7Mj3/e1tbV1alu/31ez2dT3vve9C1dwWX784x+nc0L88R//8bqrY7Sf//zneuutt/Szn/1sqcOEcTauRXZwLbKF65Edi75/z91HqFKp6O7du3rrrbdO/TiOo3w+r7/4i7+4cAUBAACWZe4g9ODBg6nbbdtWo9GYt3gAAIClm7uP0LQRYWEYyvO8eYsGAABYibmDkOM4unbt2sTtcRyrXq/PWzwAAMDSzR2ELMvSzs6OLMs6te327dtyHOfMx2cAAADrNHcQ2t/f13vvvbfIugAAAKzU3J2lCUEAAOCyW9paY9/97ne1vb2t73znO8s6xIXcvHlz5H8vrX96vO4aXNjGq1/ro48+0sbGxrqrYryNjQ2uRUZwLbKF65Edi75/zz2h4jTPnz9XLpfT5uamPv3000UXvxBBECifz6vX68lxnHVXZ35XIAhJkr76eN01AABcAou+fy+lReju3btqNBqybXsZxQMAACzE0h6N7ezs6K233lpW8QAAABe2tCD0gx/8QJ988olqtdqyDrEQ7733nt58882x2xax6CoAADifaYuuvnz5cqHHulAfoR/+8IfqdDqKomjk9cFgoCAINBgM6CO0bPQRAgAYJDN9hPb391WpVKa+p1wuz1s8AAD
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",
2024-01-28 16:15:00 +01:00
" energy_emissions[energy_emissions.quality == 1][\"velo_length\"]\n",
")\n",
2024-01-26 11:34:42 +01:00
"number_rich = ak.to_numpy(\n",
2024-01-28 16:15:00 +01:00
" energy_emissions[energy_emissions.quality == 1][\"rich_length\"]\n",
")\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-27 14:02:41 +01:00
"execution_count": 20,
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-27 14:02:41 +01:00
"execution_count": 20,
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
}