Browse Source

up and downstream

master
cetin 1 year ago
parent
commit
d78cc9cdb3
  1. 142
      B_rework.ipynb
  2. 717
      B_updown.ipynb

142
B_rework.ipynb

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22,
"execution_count": 58,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -22,7 +22,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23,
"execution_count": 59,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -31,7 +31,7 @@
"10522" "10522"
] ]
}, },
"execution_count": 23,
"execution_count": 59,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -50,7 +50,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24,
"execution_count": 60,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -78,7 +78,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25,
"execution_count": 61,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -100,7 +100,7 @@
"<Record {energy: 4.62e+04, ...} type='{energy: float64, photon_length: int6...'>" "<Record {energy: 4.62e+04, ...} type='{energy: float64, photon_length: int6...'>"
] ]
}, },
"execution_count": 25,
"execution_count": 61,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -163,7 +163,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26,
"execution_count": 62,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -234,7 +234,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27,
"execution_count": 63,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -243,7 +243,7 @@
"9056" "9056"
] ]
}, },
"execution_count": 27,
"execution_count": 63,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -254,21 +254,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 64,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -277,7 +263,7 @@
"'\\nph_e = found[\"brem_photons_pe\"]\\nevent_cut = ak.all(ph_e<cutoff_energy,axis=1)\\nph_e = ph_e[event_cut]\\n'" "'\\nph_e = found[\"brem_photons_pe\"]\\nevent_cut = ak.all(ph_e<cutoff_energy,axis=1)\\nph_e = ph_e[event_cut]\\n'"
] ]
}, },
"execution_count": 28,
"execution_count": 64,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -294,14 +280,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 65,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -444,14 +423,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 66,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -495,7 +467,7 @@
"<Array [{energy: 2.58e+04, ...}, ..., {...}] type='1418 * {energy: float64,...'>" "<Array [{energy: 2.58e+04, ...}, ..., {...}] type='1418 * {energy: float64,...'>"
] ]
}, },
"execution_count": 30,
"execution_count": 66,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -523,7 +495,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31,
"execution_count": 67,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -544,7 +516,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32,
"execution_count": 68,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -579,7 +551,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33,
"execution_count": 69,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -622,7 +594,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34,
"execution_count": 70,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -662,75 +634,6 @@
"plt.show()" "plt.show()"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#try to find a split between energy lost before and after the magnet (z~5000mm)\n",
"\n",
"upstream_found = ak.ArrayBuilder()\n",
"downstream_found = ak.ArrayBuilder()\n",
"\n",
"for itr in range(ak.num(brem_f, axis=0)):\n",
" upstream_found.begin_record()\n",
" upstream_found.field(\"energy\").real(brem_f[itr,\"energy\"])\n",
" \n",
" downstream_found.begin_record()\n",
" downstream_found.field(\"energy\").real(brem_f[itr,\"energy\"])\n",
" \n",
" upstream_found.field(\"brem_photons_pe\")\n",
" downstream_found.field(\"brem_photons_pe\")\n",
" upstream_found.begin_list()\n",
" downstream_found.begin_list()\n",
" for jentry in range(brem_f[itr, \"photon_length\"]):\n",
" if (brem_f[itr, \"brem_vtx_z\", jentry]>5000):\n",
" if brem_f[itr, \"brem_vtx_z\", jentry]<9500:\n",
" downstream_found.real(brem_f[itr,\"brem_photons_pe\",jentry])\n",
" else:\n",
" continue\n",
" else:\n",
" upstream_found.real(brem_f[itr,\"brem_photons_pe\", jentry]) \n",
" upstream_found.end_list()\n",
" downstream_found.end_list()\n",
" \n",
" upstream_found.field(\"brem_vtx_z\")\n",
" downstream_found.field(\"brem_vtx_z\")\n",
" upstream_found.begin_list()\n",
" downstream_found.begin_list()\n",
" for jentry in range(brem_f[itr, \"photon_length\"]):\n",
" if brem_f[itr, \"brem_vtx_z\", jentry]>5000:\n",
" if brem_f[itr,\"brem_vtx_z\",jentry]<9500:\n",
" downstream_found.real(brem_f[itr,\"brem_vtx_z\",jentry])\n",
" else:\n",
" continue\n",
" else:\n",
" upstream_found.real(brem_f[itr, \"brem_vtx_z\",jentry])\n",
" upstream_found.end_list()\n",
" downstream_found.end_list()\n",
" upstream_found.end_record()\n",
" downstream_found.end_record()\n",
" \n",
"\n",
"upstream_found = ak.Array(upstream_found)\n",
"downstream_found = ak.Array(downstream_found)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
@ -767,15 +670,6 @@
" return (xv-tx*zv-a+b*z_ref)/(b-tx)" " return (xv-tx*zv-a+b*z_ref)/(b-tx)"
] ]
}, },
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"###"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 15,

717
B_updown.ipynb
File diff suppressed because one or more lines are too long
View File

Loading…
Cancel
Save