From 42c9f9dd5e4d5b2fb674f0c51bbf424546298bcc Mon Sep 17 00:00:00 2001 From: cetin Date: Wed, 27 Sep 2023 14:05:40 +0200 Subject: [PATCH] calc percentage of shared tracks and improve statistics --- D_tasks.ipynb | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/D_tasks.ipynb b/D_tasks.ipynb index 3159162..fde883c 100644 --- a/D_tasks.ipynb +++ b/D_tasks.ipynb @@ -518,7 +518,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -527,7 +527,8 @@ "text": [ "2591\n", "1908\n", - "4499\n" + "4499\n", + "5767\n" ] } ], @@ -535,43 +536,47 @@ "both = ak.concatenate([found,lost],axis=0)\n", "print(ak.num(found,axis=0))\n", "print(ak.num(lost,axis=0))\n", - "print(ak.num(both,axis=0))" + "print(ak.num(both,axis=0))\n", + "\n", + "tracks = allcolumns[(allcolumns.fromSignal) & (allcolumns.isElectron) & (~allcolumns.lost)]\n", + "alltracks = allcolumns[(allcolumns.fromSignal) & (allcolumns.isElectron)]\n", + "print(ak.num(tracks,axis=0))" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "#events w/ shared track electrons from found and lost: 1\n", - "event_count: [2822, 2822]\n", - "velo idx: [146, 146]\n", - "mcp_index: [5806, 5829]\n", + "#events w/ shared track electrons from found and lost: 35\n", + "event_count: [359, 359]\n", + "velo idx: [25, 25]\n", + "mcp_index: [2926, 2936]\n", "\n", - "velo x: [-75.1, -75.1]\n", - "velo y: [5.88, 5.88]\n", + "velo x: [5.89, 5.89]\n", + "velo y: [9.81, 9.81]\n", "\n", - "velo tx: [-0.0908, -0.0908]\n", - "velo ty: [0.00703, 0.00703]\n", - "percentage of e with shared tracks: 0.0445\n" + "velo tx: [0.00824, 0.00824]\n", + "velo ty: [0.0135, 0.0135]\n", + "percentage of e with shared tracks: 0.7488\n" ] } ], "source": [ "#versuche teilchen von denselben events mit shared tracks zu finden. \n", "#idee: alle teilchen eines events sind durch event_count auffindbar. \n", - "a_f_itr = found[\"event_count\"].to_numpy()\n", + "a_f_itr = tracks[\"event_count\"].to_numpy()\n", "f_itr = np.unique(a_f_itr)\n", "\n", "shared = ak.ArrayBuilder()\n", "count = 0\n", "\n", "for itr in f_itr:\n", - " temp = both[both[\"event_count\"]==itr]\n", + " temp = alltracks[alltracks[\"event_count\"]==itr]\n", " if ak.num(temp,axis=0)>1:\n", " #iterate over cols in temp and append all with duplicate velo_track_idx, such that possibles is array with possible shared tracks particles\n", " #idea: look at one event at a time and at one velo track at a time. if there are at least two e with the same velo_track_idx in the same event,\n", @@ -603,7 +608,7 @@ "\n", "\n", "\n", - "print(\"percentage of e with shared tracks: \", np.round((ak.num(shared,axis=0)*2)/(ak.num(both,axis=0))*100,4))" + "print(\"percentage of e with shared tracks: \", np.round((ak.num(shared,axis=0)*2)/(ak.num(alltracks,axis=0))*100,4))" ] }, {