Projektpraktikum/trackinglosses_energy.ipynb

1103 lines
149 KiB
Plaintext
Raw Normal View History

2024-01-15 16:46:25 +01:00
{
"cells": [
{
"cell_type": "code",
2024-01-18 16:06:16 +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-18 16:06:16 +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-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",
" \"tracking_losses_ntuple_B_default.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\"\n",
")\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-18 16:06:16 +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",
" 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...'>"
]
},
"execution_count": 67,
"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-18 16:06:16 +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...'>"
]
},
"execution_count": 68,
"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-18 16:06:16 +01:00
"execution_count": 69,
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-18 16:06:16 +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-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, ...'>"
]
},
"execution_count": 70,
"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",
"execution_count": 71,
"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",
"execution_count": 72,
"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",
"execution_count": 73,
"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-18 16:06:16 +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",
"print(length_found+length_lost)\n",
"ntuple[1]"
2024-01-15 16:46:25 +01:00
]
},
{
"cell_type": "code",
2024-01-18 16:06:16 +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-18 16:06:16 +01:00
"execution_count": 75,
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+Seno3arVa/OtZB4XDw8O+Q0zSctQPwHQQZgDMxPHxsaTOIZwwDHV4eDiX+4dhqCAIZNv2UtYPwPQQZgDMRNTzcXh4KMdxlEwmtbm5qXfffXcu9z86OtKTJ0+Wtn4ApoenmQBMXdQrkkgk1Gg04vcePXo09qTaMAx1dHSkRqOhUql07RBQpVLR8+fPp1a/QqGgZDKpL7/8Uu+++66y2exYvw8A00eYATB1R0dHkjrnoyQSCaVSqYHDPtdJJBLa2trS0dHRwAm9kSAItLW1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MJqPt7W3V63UlEgnVarW+m1ACAABM09hh5k/+5E/0xRdf6G//9m+1tbUlSTo6OlI6ndarV68kSaVSaTq1BADcXn+9t+gaXO8P9xZdAwwx0aPZ3WHFsiydnZ3p1atX2traWrpF8wAAwO0zs+0MAADAt3zf1+HhoTzPkyQ1Go0F1+j2mMlGkwAAoJNt23ry5Il835/pfYIg6FnM9rYjzAAAMCfz2FInl8up2WzO/D7LhDADAMAtkcvlZt7zs4xmttEkAAAYXRiGcl1XiUQiDiSu6yqVSvU9JwxDeZ4n13WVz+dVq9Xi6wqFghKJhJ49e7YSGywTZgAAWDDf9/Xo0SM9f/48Dh/ValXpdFqlUkm7u7uSpKdPn8qyrPhp4mq1Gs+PyWazevHihfb391WpVGRZ1kJ+L4uwUsNMmUxG77zzTt9XuVxedPUAACvq6dOn2t7e7uhFyefzsm1brusqCAJJip+EunqO6crl8sDv5kwmM1IZK9Uzc3JyshLdbQAAcwRBIN/3496XqwqFggqFgiqVikqlkizL0v7+vu7fvx+f3+86k+zs7GhnZ6fvMd/35TjOtWWsVM8MAADLZtiE3e3tbUmKe2aOj4+VSCTkuq6SyeRKTvbthzADAMAS6Lc2TLTHYbRtkGVZevXqlVKplIIgkOM4qlarc6zlciLMAACwQNH0h+75MNK3ASeZTEq67KFJJBKq1+s6Pj6WdDkUteoIMwAALJBlWbJtW0EQxMNJkdPTUyUSiXii79U9EbPZrCqViiT1XMcKwAAAYK6iuTBXe1nCMFSpVNLBwUE83HR0dNQRXMIwlGVZ8WPYUQ9OpVJREASq1Wrz+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-18 16:06:16 +01:00
"execution_count": 76,
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-18 16:06:16 +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-18 16:06:16 +01:00
"execution_count": 77,
2024-01-15 16:46:25 +01:00
"metadata": {},
"outputs": [
{
"data": {
2024-01-18 16:06:16 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAABkgAAALACAYAAADYJP6YAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAACw50lEQVR4nOz9f3wc133f+7+HlMQglqgl5FKNnR/SQnaqfK98pVnUSaq2SmNsUrcP95sKAN0krZMmFrYskuZajblWdHsh5JaFwfjK328bVFlQvnXjpL0SQPW2/iZOsisn6o3S2MaOZKvXjiNjRfvGbMXK4IpkDVMiON8/wF0B3HMOdmZ3Z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4MTFR35fHjh0Lp6amdtUBAACAaLrVf7i2rdhM36GZtuC1bVQb2v3NryPtfgBonReGYdjpQRgAAAAAAAAAAIBewi22AAAAAAAAAADA0Lmu2wm0S7Va1cLCgqTdD4yqCYJACwsLSqfTqlarymazDQ/2atc8AAAAANBr6DMBAAAAuw3EAEmpVFKhUNDq6qpmZmYa4pVKRZlMRuVyuf7Q4bGxMW1sbNTnb9c8AAAAANBr6DMBAAAAjQbqGSSe52lmZkaFQmHX9Gw2K0kqFov1acvLy8rlcqqtfrvmAQAAAIBeRZ8JAAAAeMPAP4OkWq2qVCrVG+o14+PjkrYb6+2aBwAAAAD6DX0mAAAADKuBHyBZW1uTJKXT6V3Ta5d7F4vFts0DAAAAAP2GPhMAAACG1UA8g8SlUqlIklKplDXernlcXnnlFf3Wb/2WvuM7vkPf9m3ftnfiFjfccINuuOGG2MsDAAA
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",
"plt.colorbar(a0[3], ax=ax1)\n",
"\n",
"plt.show()"
]
},
{
"cell_type": "code",
2024-01-18 16:06:16 +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",
" \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-18 16:06:16 +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-18 16:06:16 +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-18 16:06:16 +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-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-18 16:06:16 +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-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-18 16:06:16 +01:00
"execution_count": 82,
2024-01-16 22:04:43 +01:00
"metadata": {},
2024-01-17 15:59:39 +01:00
"outputs": [
{
"data": {
2024-01-18 16:06:16 +01:00
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAnUAAAHJCAYAAADjF8/HAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAA/JUlEQVR4nO3dX2greX73+Y+TSXucHLp1fAZCX4SlSxCWsDCHkueBNGy64ag2F3OxBEunb5JMoDkSw4GwNInFCYR270WETK4CgpHMQG9y1ZZM2Ithl0gdfPLAwD5tVU5uHsLD4zo8eKGfixm55nA27tPpGe2Fu2osqySXS6VSufR+gel21e9X9ftV2db3/P6ujUajkQAAAHCr/cqyCwAAAID5EdQBAABkAEEdAABABhDUAQAAZABBHQAAQAYQ1AEAAGQAQR0AAEAGENQBAABkAEEdsMJs21a73V52MW4NnheWwXVdtdttOY6z7KIg5QjqgCVxHEd3795dSpDgOI7K5bIKhYJarVbi979tpj2v696hbduq1Woql8vK5/Pa29sLdQ7hec+xUCioUCgsuzhTRf19b7fbeuutt1StVuW67mIKh8z4xrILAKwq13Xluq5OTk4mzjmOo83NTeVyuVDHb8owDHU6Ha2trc11nVUx7XnNeoe2bevBgwc6OzuTJNVqNT/drHO4GdM0JUl7e3v+/6fRrJ+VWSqVik5OTgj6EQpBHbAkpmlq2tbL5XJZnU5nInibdhzLMesd1ut1bW5u+t83Go1Q53BzaQ7mPLN+Vq5z7969mEuDrKL7FUiZcrks27ZDH0c6zXpXvEcAi0BQB0xh27bK5bIsy1I+n1etVvPPeQOXLcvyBzBblqW7d+/Ksix/7Mve3p7y+bzu3r07ll+Sut2uyuWyyuXy2DHvA79arfqB3LTjYcp6ucz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DJydnflL1FQqlVGlUplYIiUOs97Pdb/vs55zp9Pxl3Dxlne5+t6mLaGC1bM2GkXcjA4AlsC2bX3yySd68uSJhsPhWGtFp9NRPp+fWA6i3++r0+mo1Woto8gAkAiWNAFwaziOo0KhoLOzM78L8DLDMAIHxrdaLX9APgBkVeqCOm+hScMw5LquLMvyF6WcN19caaSLsQzegphhFq/0xgDFPXsKWCXegPdHjx7pyZMn/gQJx3HU7/d1cnLi/z56M3+9gfKzJlMAQCYsu//3Mm8Px8vjHcKM0QiTL640o9Fo1Ov1/PERYfY49K5zeS8/ANE0Gg1/jJH3dXUckrcHr/cV93ZQAJBGqRpTZ1mWJKnX6/nH2u22qtWqZhUzTL640ly2tramSqVy7Tgdbzr+8fExLXVATLyxdNN2fqjVanIcZ6xFDwCyLDVLmriuq36/7wdWnsvr+ETNF1eaKPr9vu7du8eHChCzXC43cyuvRqOhTqfD7x6AlZGaoO74+FjS5H6L3h/ky61nN80XV5ooWq1W4MbMAAAAcUrNRAlvAPS0xRanbZcSJl9caW6qVquFmkTh+clPfqIf/ehHevPNN/XNb37zxvfzvPbaa3rttdci5wcAYJV8+eWX+vLLLyPn/+KLL/T555/ru9/9rr71rW/FWLKbSU1Qd3JyImn6BsvTVpcPky+uNDdh27bu3bs3s3voqh/96Ef6kz/5kxvdBwAApMPHH3+s733ve0u7f2qCOm8LpGlbnkwLjsLkiyvNTdTr9ambNE/z5ptvSpL+5m/+Rt/+9rdD5/ujP/oj/d3f/Z3//XUtddvb2zo8PAx9/Zumv2mely9f6p133tHTp091586dhZWLei8m/U3zUG/qvYhyUe/FpL9pntta76CWuqufrbP8y7/8i/70T//U/xxfloUFdd///ve1tbWl999/P1R6L2ia1iI2LagKky+uNGHVajV
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",
"plt.title(\"emitted energy difference velo - rich\")\n",
"plt.xlabel(r\"$E_{velo} - E_{rich}$\")\n",
"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-18 16:06:16 +01:00
"execution_count": 83,
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": "iVBORw0KGgoAAAANSUhEUgAAAkIAAAHJCAYAAABpOFaGAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy81sbWrAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAxnElEQVR4nO3dTWwj6X3v+5/SPS1P0siU1LPwrG66GBiBN2dQVHsR4KSNNOsagReB0aS8ywxgNAlDm2CAsNDZTPcmRAlZZCPApBCgT3bTpBHcRRAkpI2MA2RxR6x0NhcXB4fVAc7CAa6HKg/abqv9UnfRUzWkRFIUxZcSn+8HEKbFYlX9VcVR/fRUPc+zEcdxLAAAAAP91qoLAAAAWBWCEAAAMBZBC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cRxtbGyMXR7Hsfb392fd/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-18 16:06:16 +01:00
"execution_count": 84,
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-18 16:06:16 +01:00
"execution_count": 84,
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
}