Projektpraktikum/trackinglosses_energy.ipynb

1104 lines
155 KiB
Plaintext
Raw Normal View History

2024-01-15 16:46:25 +01:00
{
"cells": [
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 1,
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-19 11:22:15 +01:00
"execution_count": 2,
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-18 16:06:16 +01:00
"40402 10099\n",
"50501\n"
2024-01-17 15:59:39 +01:00
]
2024-01-15 16:46:25 +01:00
}
],
"source": [
2024-01-18 16:06:16 +01:00
"#file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n",
"file = uproot.open(\n",
2024-01-20 15:37:00 +01:00
" \"tracking_losses_ntuple_B_default_radlength_endVelo.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-16 21:48:53 +01:00
"found = allcolumns[\n",
2024-01-17 15:59:39 +01:00
" (allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromB)\n",
2024-01-16 21:48:53 +01:00
"] # B: 9056\n",
"lost = allcolumns[\n",
2024-01-17 15:59:39 +01:00
" (allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromB)\n",
2024-01-16 21:48:53 +01:00
"] # 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",
"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-19 11:22:15 +01:00
"execution_count": 3,
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",
" 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-19 11:22:15 +01:00
"execution_count": 3,
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-19 11:22:15 +01:00
"execution_count": 4,
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-19 11:22:15 +01:00
"execution_count": 4,
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",
"\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-19 11:22:15 +01:00
"execution_count": 5,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [],
"source": [
"photon_cut = 0\n",
2024-01-18 16:06:16 +01:00
"photon_cut_ratio = 0.1\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",
" \n",
" 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-16 21:48:53 +01:00
" if (\n",
2024-01-17 15:59:39 +01:00
" brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
2024-01-16 21:48:53 +01:00
" ):\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-16 21:48:53 +01:00
" if (\n",
2024-01-17 15:59:39 +01:00
" brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
2024-01-16 21:48:53 +01:00
" ):\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-16 21:48:53 +01:00
" if (\n",
2024-01-17 15:59:39 +01:00
" brem[itr, \"brem_vtx_z\", jentry] > 3000\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut\n",
" or brem[itr, \"brem_photons_pe\", jentry] < photon_cut_ratio * tmp_energy\n",
2024-01-16 21:48:53 +01:00
" ):\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",
" \n",
" 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-17 15:59:39 +01:00
"ntuple = ak.Array(cut_brem)\n",
"\n"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 6,
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-18 16:06:16 +01:00
"44163\n",
"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",
" 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",
"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-19 11:22:15 +01:00
"execution_count": 6,
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",
"print(ak.num(ntuple,axis=0))\n",
"ntuple[0]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 7,
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-19 11:22:15 +01:00
"execution_count": 8,
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-19 11:22:15 +01:00
"execution_count": 9,
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-19 11:22:15 +01:00
"execution_count": 9,
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",
"print(length_found+length_lost)\n",
"ntuple[1]"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 10,
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-19 11:22:15 +01:00
"execution_count": 11,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-18 16:06:16 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAHOCAYAAABttoiYAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAtaUlEQVR4nO3dT2wjWWLf8Z/Wk5UFN7op9ebgAAGmi6edU6NK44MRYBZo0nPJIQnJ7sMu4ACbJrHRbQCr0r6M5kRT8JWASWGBQTA5SKISIMhlzWpjBgEMxC2W+7QG7Kh6gTlsgJ1h1zS0pjXZLHPQVI34VxT/P/H7AYhpsapevX7TTf76vVfvrbXb7bYAAAAM9Z1FVwAAAGAShBkAAGA0wgwAADAaYQYAABiNMAMAAIxGmAEAAEYjzAAAAKMRZgAAgNEIMwBuvSAIFl0FADNEmAFw6+VyOYVhuOhqAJgRwgyAmdjf39fm5qbW1ta0tramdDodv5LJZPz+rPm+L8uylEgklrJ+ACb31qIrAOB22t3d1dnZmarVqnZ3d1UqlTqOB0GgdDo983pUKhUVCoWlrR+AydEzA2BmTk9PJalvKLAsS6lUauZ18Dxv4H2WoX4AJrfGrtkAZiUaphn0MROGYc/wzzTVajXV63VVKpW+xxddPwDTQc8MgJnwPE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RXMIwlGVZ8WPYUQ9OpVJREASq1Wrz+00s0Eo9zQQAWEJ/uLfoGsyF7/txT4rv+9rf31c+n1cikYjnwjx9+lTpdDoOJ8fHxx1P4W5vbyudTiubzUq67JG5umFlPp9XpVL
2024-01-15 16:46:25 +01:00
"text/plain": [
"<Figure size 640x480 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
2024-01-17 15:59:39 +01:00
"xlim=0\n",
"\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-17 15:59:39 +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-17 15:59:39 +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-19 11:22:15 +01:00
"execution_count": 12,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
2024-01-18 16:06:16 +01:00
"found: 32898 , lost: 11265\n",
"0.34242203173445196\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",
" -133,\n",
" 65.2,\n",
" -5.73,\n",
" -26.6,\n",
" -4.26,\n",
" 6.83,\n",
" 10.7,\n",
2024-01-17 15:59:39 +01:00
" 26.2,\n",
2024-01-18 16:06:16 +01:00
" ...,\n",
" -11.6,\n",
" -13.1,\n",
" -25.6,\n",
" -4.27,\n",
" -4.27,\n",
" -103,\n",
" 8.82,\n",
" 12.8,\n",
" -17.8]\n",
"---------------------\n",
"type: 32898 * float64</pre>"
2024-01-17 15:59:39 +01:00
],
"text/plain": [
2024-01-18 16:06:16 +01:00
"<Array [-3.61, -33.8, -133, ..., 8.82, 12.8, -17.8] type='32898 * float64'>"
2024-01-17 15:59:39 +01:00
]
},
2024-01-19 11:22:15 +01:00
"execution_count": 12,
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-19 11:22:15 +01:00
"execution_count": 21,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-19 11:22:15 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkgAAAL5CAYAAAD7Uaj9AAAAOXRFWHRTb2Z0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wP+U0vnEfBEHbehYKBT3wwAN95dV6ZU6vV440dPMBcKOOXq+g6ZftapAohrWecW+/1quETp061fag9W4lEonmVVStA3eNB8c3tntrzDWg17iaab+HxNucOXOm+Xfrh/SNK1KSyWRfg4m98H1fGxsb2tzc1NbWlhYWFroenGkdaG29mmSv1kGFuB6E3s82zuVyHQOwjYGye++9d0gZAwAAjDcGSAAAANC3bm8J1KrxweOkfLPb9/3mB9qND5xrtZrq9XrkQY1WjQ+6S6VSzx+Ut25D1we6jf3kmmcYrr/++oGUM6z1HNX2q1arzf1eq9WUyWS0tLTU07f5G4MZjauxpN3bZC0uLjY/CG/9UD2fz1sH9Bq314p6PLfeTs30IX1cgyN77Xdl2V6t5zPXvmgcB3ENjkj9beNisSjf9zvyTafTbccPAADALGGABAAAAH1rfODWywerUW93NUp7n/ngepZDL2q1WvPDy9Z6utX6ge7eZ120auynKANag9C40iiqYa3nKLdf41ZHjTJLpZL1lnQm6XS6mVdjIGRtba35PJhkMql6va5SqdS88sX0Om3cYizqs3QkNQf2bB/SR7l1XFS1Wk1LS0taWFjQ1taWNjc3m1fI7CeRSDT3x1e/+lXrfI0BhTgHfqJu4yAIVK/Xja/BxvHWOpAGAAAwKxggAQAAQN8agxy25zeYtH7I7HqYduN2QeOg9XkrxWJRxWKxrw+UG5aWlpTP55sPlq/Vam0
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-17 15:59:39 +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-19 11:22:15 +01:00
"execution_count": 14,
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",
" \n",
" 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",
" elif (ntuple[jelec, \"brem_vtx_z\", jphoton] > 770) and (\n",
" ntuple[jelec, \"brem_vtx_z\", jphoton] <= 2700\n",
" ):\n",
" 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",
" \n",
" energy_emissions.field(\"neither_length\").integer(tmp_neither_length)\n",
" energy_emissions.field(\"downstream\").real(tmp_neither)\n",
" \n",
" energy_emissions.field(\"photon_length\").integer(tmp_neither_length+tmp_richut_length+tmp_velo_length)\n",
" \n",
" if (tmp_velo==0) and (tmp_richut==0):\n",
" 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-17 15:59:39 +01:00
"print(ak.num(energy_emissions,axis=0))\n"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 15,
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-19 11:22:15 +01:00
"execution_count": 15,
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-19 11:22:15 +01:00
"execution_count": 16,
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-18 16:06:16 +01:00
"found: 40402\n",
"lost: 10099\n",
"50501\n",
"VELO energy emission, eff: 0.2624700500980179\n",
"RICH1+UT energy emission, eff: 0.17696679273677748\n",
"Neither, eff: 0.3605869190709095\n",
"total efficiency: 0.8000237619057049\n",
"efficiency: 0.8000237619057048\n",
2024-01-17 15:59:39 +01:00
"\n",
"found in velo/(found + lost in velo)\n",
2024-01-18 16:06:16 +01:00
"VELO energy emission, eff: 0.807739183424741\n",
"RICH1+UT energy emission, eff: 0.7549417131272175\n",
"eff von e die nicht strahlen: 0.8183166314654204\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-17 15:59:39 +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",
"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",
" if (electrons_found[itr, \"quality\"]==1):\n",
" if (electrons_found[itr, \"velo\"] >= electrons_found[itr, \"rich\"]):\n",
" 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",
" if (electrons_lost[itr, \"quality\"]==1):\n",
" if (electrons_lost[itr, \"velo\"] >= electrons_lost[itr, \"rich\"]):\n",
" 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",
"\n",
2024-01-15 16:46:25 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"denom = ak.num(electrons,axis=0)\n",
"print(denom)\n",
2024-01-15 16:46:25 +01:00
"\n",
"\n",
2024-01-17 15:59:39 +01:00
"eff_velo = num_velo_found/denom\n",
2024-01-16 21:48:53 +01:00
"\n",
2024-01-17 15:59:39 +01:00
"eff_rich = num_rich_found/denom\n",
"\n",
"eff_other = ak.num(electrons_found[electrons_found.quality==0],axis=0)/denom\n",
"\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-17 15:59:39 +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-17 15:59:39 +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",
"\n",
"eff_no_rad = num_no_up_rad_found/(num_no_up_rad_found+num_no_up_rad_lost)\n",
"\n",
"print(\"VELO energy emission, eff: \", eff_velo)\n",
"\n",
"print(\"RICH1+UT energy emission, eff: \", eff_rich)\n",
"\n",
"print(\"eff von e die nicht strahlen: \", eff_no_rad )"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 17,
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-18 16:06:16 +01:00
"40402\n",
"10099\n",
"50501\n"
2024-01-16 22:04:43 +01:00
]
2024-01-16 21:48:53 +01:00
}
],
"source": [
2024-01-17 15:59:39 +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))\n",
"\n"
2024-01-16 21:48:53 +01:00
]
},
2024-01-16 22:04:43 +01:00
{
"cell_type": "code",
2024-01-19 11:22:15 +01:00
"execution_count": 23,
2024-01-16 22:04:43 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
2024-01-19 11:22:15 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHJCAYAAADjF8/HAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA/q0lEQVR4nO3dXYgjaX7v+V/a465Ju+hWZQ2YuTBLh8AsZmGKUM4BN6y7oRTri7lYTEpVN7bH0JTEUGCWxk6RBtPZe2ERia8MgpGSgV77qlNKzF4Mu1hqk+UDA3s6FW7fHMzhZBSHXJhzMaOKKWqdU+2eib3IiZhUKqSM1EsoFPp+IKnKiOeJeJ6IytS/ntcN3/d9AQAAYKX9yrILAAAAgNkR1AEAAGQAQR0AAEAGENQBAABkAEEdAABABhDUAQAAZABBHQAAQAYQ1AEAAGQAQR2AleI4jlqt1rKLsTJ4XsD6IKgDEJvrurp3795SggTXdVUul1UoFNRsNhO//6oZ97xueoeO46hWq6lcLiufz+vg4CDWOQDL95VlFwDA6vA8T57n6ezsbOSc67ra2tpSLpeLdf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WnWqGmakVtt3ZRv3mmazeaN24NdFbT4AQAALMLUQV2c5Tra7bb+6q/+atpbIKanT5+mKv20eRZ9D+q9mPTT5ln0Paj3YtJPm2fR96Dei0k/bZ5F3yMr9Z63DT9qp/oYHj16JNu2IxfrPTs7U6vV0ne/+92ZC7hO/umf/ilc3+e206hX2cuXL/XWW2/pJz/5ya2mwK866k2
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",
"diff_found = ak.to_numpy(energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality==1)][\"velo\"]) - ak.to_numpy(energy_emissions[(~energy_emissions.lost) & (energy_emissions.quality==1)][\"rich\"])\n",
"diff_lost = ak.to_numpy(energy_emissions[(energy_emissions.lost) & (energy_emissions.quality==1)][\"velo\"]) - ak.to_numpy(energy_emissions[(energy_emissions.lost) & (energy_emissions.quality==1)][\"rich\"])\n",
"\n",
"xlim = 20000\n",
"\n",
"plt.hist(diff_lost,bins=100,density=True,alpha=0.5,histtype=\"bar\",color=\"darkorange\",label=\"lost\",range=[-xlim,xlim])\n",
"plt.hist(diff_found,bins=100,density=True,alpha=0.5,histtype=\"bar\",color=\"blue\",label=\"found\", range=[-xlim,xlim])\n",
"plt.xlim(-20000,20000)\n",
2024-01-19 11:22:15 +01:00
"plt.title(\"emitted energy difference\")\n",
"plt.xlabel(r\"$E_{velo} - E_{rich}$ [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-19 11:22:15 +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-18 16:06:16 +01:00
"image/png": "iVBORw0KGg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d9vfvuu4vaxVz82Z/9mX77t3975LK9vT3t7e0tuSIAAMx2cHCgg4ODkct+/vOfz3VfMwehb3/722OXRVGkTqejp0+fZj4I/d3f/Z3+6I/+aNVlAACAz01qiPjRj36ku3fvzm1fMwehaSZGbDab+qu/+qtZd7EWFt2itIwWq3VpFVuHY8W5MG8fi7Yux4lzYdY+5mnmucZ2d3fl+762t7fPLOv1emo0Gvre97536QIXJUmUH3/8MS1CK/bZZ5/prbfe0k9/+tOFdhPG+TgX2cG5yBbOR3bM+/o9c/f5SqWi27dv66233jrz5TiO8vm8/vIv//LSBQIAACzKzEHo3r17E5fbtq16vT7r5gEAABZu5meEnj17NnZZGIbyPG/WTQMAACzFzEHIcRxtbGyMXR7Hsfb392fd/FyEYcigjgAAYKyZg5BlWdrd3ZVlWWeW3bp1S47jnHv7bJQgCFSr1WTbtqIokuu6KhaLU617Opg5jqNut3vhGgAAgBlmDkKHh4e6f//+PGtRGIbK5/PqdrvphG25XE79fl/lcnniuo1GQ+VyWblcLn2tUCjMtT4AALBeZg5C8w5B0uueaIVCYWjWWs/zVKlUzg1CzWZT7XZ77jUBAID1tbApNr773e9qZ2dH3/nOd6Z6fzIate/7Q6/v7OxI+qLFZ5RWq6WjoyOVSiW5rntuaJKkGzduDP33yvq3R6uu4NI2X/1KH374oTY3N1ddivE2Nzc5FxnBucgWzkd2zPv6PXP3+UmeP3+uer2uarU69TpHR0eSdObh5qR1aFJrT7vdVhR
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",
"number_velo = ak.to_numpy(energy_emissions[energy_emissions.quality==1][\"velo_length\"])\n",
"number_rich = ak.to_numpy(energy_emissions[energy_emissions.quality==1][\"rich_length\"])\n",
"\n",
"\n",
"plt.hist(number_velo,bins=10,density=True,alpha=0.5,histtype=\"bar\",color=\"darkorange\",label=\"velo\",range=[0,10])\n",
"plt.hist(number_rich,bins=10,density=True,alpha=0.5,histtype=\"bar\",color=\"blue\",label=\"rich\",range=[0,10])\n",
"plt.xlim(0,10)\n",
"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-19 11:22:15 +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-19 11:22:15 +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
}