Browse Source

started reworking some tasks

master
cetin 1 year ago
parent
commit
208b8fa995
  1. 179
      B_tasks.ipynb

179
B_tasks.ipynb

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
@ -21,9 +21,20 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 23,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"9056"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"file = uproot.open(\"tracking_losses_ntuple_Bd2KstEE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n",
"#file = uproot.open(\"tracking_losses_ntuple_Dst0ToD0EE.root:PrDebugTrackingLosses.PrDebugTrackingTool/Tuple;1\")\n",
@ -34,13 +45,13 @@
"found = allcolumns[(allcolumns.isElectron) & (~allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p > 5e3)] #B: 9056\n",
"lost = allcolumns[(allcolumns.isElectron) & (allcolumns.lost) & (allcolumns.fromSignal) & (allcolumns.p > 5e3)] #B: 1466\n",
"\n",
"#ak.num(found, axis=0)\n",
"ak.num(found, axis=0)\n",
"#ak.count(found, axis=None)\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 38,
"metadata": {},
"outputs": [
{
@ -49,20 +60,125 @@
"0.8606728758791105"
]
},
"execution_count": 3,
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def t_eff(found, lost):\n",
" sel = found[\"energy\"]\n",
" des = lost[\"energy\"]\n",
" return ak.count(sel,axis=None)/(ak.count(sel,axis=None)+ak.count(des,axis=None))\n",
"def t_eff(found, lost, axis = 0):\n",
" sel = ak.num(found, axis=axis)\n",
" des = ak.num(lost, axis=axis)\n",
" return sel/(sel + des)\n",
"\n",
"t_eff(found, lost)"
]
},
{
"cell_type": "code",
"execution_count": 104,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"sample size: 32\n",
"eff (cutoff = 0 ) = 0.96875\n",
"sample size: 32\n",
"eff (cutoff = 50 ) = 0.96875\n",
"sample size: 32\n",
"eff (cutoff = 100 ) = 0.96875\n",
"sample size: 43\n",
"eff (cutoff = 150 ) = 0.9767441860465116\n",
"sample size: 65\n",
"eff (cutoff = 200 ) = 0.9692307692307692\n",
"sample size: 97\n",
"eff (cutoff = 250 ) = 0.9587628865979382\n",
"sample size: 129\n",
"eff (cutoff = 300 ) = 0.9457364341085271\n",
"sample size: 150\n",
"eff (cutoff = 350 ) = 0.9533333333333334\n",
"sample size: 169\n",
"eff (cutoff = 400 ) = 0.9408284023668639\n",
"sample size: 197\n",
"eff (cutoff = 450 ) = 0.9390862944162437\n",
"sample size: 227\n",
"eff (cutoff = 500 ) = 0.920704845814978\n",
"sample size: 257\n",
"eff (cutoff = 550 ) = 0.9260700389105059\n",
"sample size: 297\n",
"eff (cutoff = 600 ) = 0.9326599326599326\n",
"sample size: 334\n",
"eff (cutoff = 650 ) = 0.9281437125748503\n",
"sample size: 366\n",
"eff (cutoff = 700 ) = 0.9289617486338798\n",
"sample size: 400\n",
"eff (cutoff = 750 ) = 0.925\n",
"sample size: 436\n",
"eff (cutoff = 800 ) = 0.9151376146788991\n",
"sample size: 468\n",
"eff (cutoff = 850 ) = 0.9102564102564102\n",
"sample size: 500\n",
"eff (cutoff = 900 ) = 0.912\n",
"sample size: 533\n",
"eff (cutoff = 950 ) = 0.9136960600375235\n",
"sample size: 562\n",
"eff (cutoff = 1000 ) = 0.9163701067615658\n",
"\n",
"sample size: 150\n"
]
},
{
"data": {
"text/plain": [
"0.9533333333333334"
]
},
"execution_count": 104,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#finden wir die elektronen die keine bremsstrahlung gemacht haben mit hoher effizienz?\n",
"#von energie der photonen abmachen\n",
"#scan ab welcher energie der photonen die effizienz abfällt\n",
"\n",
"#abhängigkeit vom ort der emission untersuchen <- noch nicht gemacht\n",
"\n",
"\n",
"\n",
"#idea: we make an event cut st all events that contain a photon of energy > cutoff_energy are not included\n",
"\"\"\"\n",
"ph_e = found[\"brem_photons_pe\"]\n",
"event_cut = ak.all(ph_e<cutoff_energy,axis=1)\n",
"ph_e = ph_e[event_cut]\n",
"\"\"\"\n",
"\n",
"\n",
"\n",
"for cutoff_energy in range(0,1050,50):\n",
"\tnobrem_f = found[ak.all(found[\"brem_photons_pe\"]<cutoff_energy,axis=1)]\n",
"\tnobrem_l = lost[ak.all(lost[\"brem_photons_pe\"]<cutoff_energy,axis=1)]\n",
"\tprint(\"sample size: \",ak.num(nobrem_f,axis=0)+ak.num(nobrem_l,axis=0))\n",
"\tprint(\"eff (cutoff = \",str(cutoff_energy),\") = \",str(t_eff(nobrem_f,nobrem_l)))\n",
"\n",
"\"\"\"\n",
"we see that a cutoff energy of 350MeV is ideal because the efficiency drops significantly for higher values\n",
"\"\"\"\n",
"cutoff_energy = 350.0 #MeV\n",
"\n",
"\"\"\"\n",
"better statistics: cutoff=350MeV - sample size: 150 events and efficiency=0.9533\n",
"\"\"\"\n",
"nobrem_found = found[ak.all(found[\"brem_photons_pe\"]<cutoff_energy,axis=1)]\n",
"nobrem_lost = lost[ak.all(lost[\"brem_photons_pe\"]<cutoff_energy,axis=1)]\n",
"\n",
"print(\"\\nsample size: \",ak.num(nobrem_found,axis=0)+ak.num(nobrem_lost,axis=0))\n",
"t_eff(nobrem_found, nobrem_lost)"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -72,25 +188,29 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 75,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"31\n"
]
},
{
"data": {
"text/plain": [
"0.96875"
]
},
"execution_count": 4,
"execution_count": 75,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"#finden wir die elektronen die keine bremsstrahlung gemacht haben mit hoher effizienz?\n",
"#von energie der photonen ab,machen\n",
"#scan ab welcher energie der photonen die effizienz abfällt\n",
"#abhängigkeit vom ort der emission untersuchen\n",
"#hier wird ohne rücksicht auf energie der photonen getrennt\n",
"\n",
"nobrem_found = found[found[\"brem_photons_pe_length\"]==0]\n",
"nobrem_lost = lost[lost[\"brem_photons_pe_length\"]==0]\n",
@ -99,10 +219,33 @@
"die effizienz mit der wir elektronen finden, die keine bremsstrahlung gemacht haben, ist gut mit 0.9688.\n",
"allerdings haben wir hier nur sehr wenige teilchen (<100)\n",
"\"\"\"\n",
"\n",
"print(ak.num(nobrem_found,axis=0))\n",
"t_eff(nobrem_found, nobrem_lost)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#wie viel energie relativ zur anfangsenergie verlieren die elektronen durch bremstrahlung und hat das einen einfluss darauf ob wir sie finden oder nicht?\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 5,
@ -120,7 +263,7 @@
}
],
"source": [
"#wie viel energie relativ zur anfangsenergie verlieren die elektronen durch bremstrahlung und hat das einen einfluss darauf ob wir sie finden oder nicht?\n",
"#keine rücksicht auf energie der photonen\n",
"brem_found = found[found[\"brem_photons_pe_length\"]!=0]\n",
"energy_found = ak.to_numpy(brem_found[\"energy\"])\n",
"eph_found = ak.to_numpy(ak.sum(brem_found[\"brem_photons_pe\"], axis=-1, keepdims=False))\n",

Loading…
Cancel
Save