{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/hep/davide/miniconda3/envs/root_env/lib/python2.7/site-packages/root_numpy/_tree.py:5: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility\n", " from . import _librootnumpy\n" ] } ], "source": [ "import root_numpy as rn\n", "import ROOT as r\n", "import numpy as np\n", "import pandas as pd\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "\n", "file_name='B2Dmunu_full'\n", "file_path='/disk/lhcb_data/davide/HCAL_project_full_event/'+file_name+'.root'\n", "tree_name='Bd2Dmu/DecayTree'\n", "\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "f = r.TFile(file_path)\n", "t = f.Get(tree_name)\n", "j=t.GetEntries()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "#b=r.TBrowser()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "batch_size=20000\n", "#n_batches=2\n", "N = j\n", "n_batches= N//batch_size" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "particle = 'pi1'\n", "variable = 'ET'\n", "\n", "cal_zone = 'inner'\n", "\n", "cellsET_inner_dict={}\n", "\n", "for j in range(n_batches):\n", " cellsET_inner_dict[j]=rn.root2array(\n", " filenames=file_path, \n", " treename=tree_name,\n", " branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,#\"B0_L0HadronDecision_TOS\",\"B0_L0HadronDecision_TIS\"],\n", " start=j*batch_size,\n", " stop=(j+1)*batch_size,\n", " )\n", " \n", " cellsET_inner_dict[j]=np.array([cellsET_inner_dict[j][i] for i in range(batch_size)])\n", " np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsET_inner_dict[j])\n", "\n", "if N % batch_size != 0:\n", " \n", " cellsET_inner_dict[j+1]=rn.root2array(\n", " filenames=file_path,\n", " treename=tree_name,\n", " branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,# \"B0_L0HadronDecision_TOS\",\"B0_L0HadronDecision_TIS\"],\n", " start=n_batches*batch_size,\n", " stop=N,\n", " ) \n", " cellsET_inner_dict[j+1]=np.array([cellsET_inner_dict[j+1][i] for i in range((N % batch_size))])\n", " np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsET_inner_dict[j+1])\n", " \n", "particle = 'pi1'\n", "variable = 'ET'\n", "\n", "cal_zone='outer'\n", "\n", "cellsET_outer_dict ={}\n", "\n", "for j in range(n_batches):\n", " cellsET_outer_dict[j]=rn.root2array(\n", " filenames=file_path, \n", " treename=tree_name,\n", " branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,# \"B0_L0HadronDecision_TOS\",\"B0_L0HadronDecision_TIS\"],\n", " start=j*batch_size,\n", " stop=(j+1)*batch_size,\n", " )\n", " cellsET_outer_dict[j]=np.array([cellsET_outer_dict[j][i] for i in range(batch_size)])\n", " np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsET_outer_dict[j])\n", "\n", "if N % batch_size != 0:\n", " \n", " cellsET_outer_dict[j+1]=rn.root2array(\n", " filenames=file_path,\n", " treename=tree_name,\n", " branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,# \"B0_L0HadronDecision_TOS\",\"B0_L0HadronDecision_TIS\"],\n", " start=n_batches*batch_size,\n", " stop=N,\n", " ) \n", " cellsET_outer_dict[j+1]=np.array([cellsET_outer_dict[j+1][i] for i in range((N % batch_size))])\n", " np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsET_outer_dict[j+1]) " ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "ename": "SyntaxError", "evalue": "invalid syntax (<ipython-input-7-7befa847dcbe>, line 6)", "output_type": "error", "traceback": [ "\u001b[0;36m File \u001b[0;32m\"<ipython-input-7-7befa847dcbe>\"\u001b[0;36m, line \u001b[0;32m6\u001b[0m\n\u001b[0;31m if cellsET_inner_dict[j][i][1]: and not cellsET_inner_dict[j][i][2]:\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], "source": [ "cellsET_inner_dict_TOS={}\n", "\n", "for j in range(n_batches):\n", " cellsET_inner_dict_TOS[j]=[]\n", " for i in range(100):\n", " if cellsET_inner_dict[j][i][1]: and not cellsET_inner_dict[j][i][2]:\n", " cellsET_inner_dict_TOS[j].append(cellsET_inner_dict[j][i][0])\n", " cellsET_inner_dict_TOS[j]=np.array(cellsET_inner_dict_TOS[j])\n", " \n", "cellsET_inner_dict_TIS={}\n", "\n", "for j in range(n_batches):\n", " cellsET_inner_dict_TIS[j]=[]\n", " for i in range(100):\n", " if cellsET_inner_dict[j][i][2]:\n", " cellsET_inner_dict_TIS[j].append(cellsET_inner_dict[j][i][0])\n", " cellsET_inner_dict_TIS[j]=np.array(cellsET_inner_dict_TIS[j])" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(17, 32, 32)" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "cellsET_inner_dict_TOS[0].shape" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [], "source": [ "cellsET_outer_dict_TOS={}\n", "\n", "for j in range(n_batches):\n", " cellsET_outer_dict_TOS[j]=[]\n", " for i in range(100):\n", " if cellsET_outer_dict[j][i][1] and not cellsET_inner_dict[j][i][2]:\n", " cellsET_outer_dict_TOS[j].append(cellsET_outer_dict[j][i][0])\n", " cellsET_outer_dict_TOS[j]=np.array(cellsET_outer_dict_TOS[j])\n", " \n", "cellsET_outer_dict_TIS={}\n", "\n", "for j in range(n_batches):\n", " cellsET_outer_dict_TIS[j]=[]\n", " for i in range(100):\n", " if cellsET_outer_dict[j][i][2]:\n", " cellsET_outer_dict_TIS[j].append(cellsET_outer_dict[j][i][0])\n", " cellsET_outer_dict_TIS[j]=np.array(cellsET_outer_dict_TIS[j])" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "<matplotlib.image.AxesImage at 0x7fcc1894d710>" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAEYJJREFUeJzt3W+IXNd5x/HvI2mllXaNLVn/qCWqtqYWRlnUVMINOCVuCQg7b4rBokVviuuF4qTYpdDWhUaBvmggboqLIQhk0lpCGJyQQivVdl8Yx9AmLLGzkiWlwa0bqehfLOvf2qt/fvpi7sJK2fPM7Nk7d2Z0fh8QO3PP3HufvTuPZuY8c84xd0dEyrOo1wGISG8o+UUKpeQXKZSSX6RQSn6RQin5RQql5BcplJJfpFBKfpFCLVnIzma2A/gGsBj4R3f/2zaP19cJRbrM3a2Tx1nu13vNbBnwE+DzwGngP4Bxd/9RsI+SX6TLOk3+hbztfwh4z91PuPt14BXgsQUcT0QatJDk3wCcmHX/ZLVNRAbAgj7zd8LMxoHxbp9HROZnIcl/Etg46/6Gatst3H0PsAf0mV+knyzkbf8PgS1mtsHMhoCdwKF6whKRbst+5Xf3aTP7Y+A1Wv+J7HP3idoiE5Guyi71ZZ1Mb/tFuq6JUp+IDDAlv0ihlPwihVLyixRKyS9S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U5ErkJggg==\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "batch=10\n", "n=4\n", "plt.imshow(cellsET_inner_dict[batch][n],cmap='gray')" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "<matplotlib.image.AxesImage at 0x7fcc18901d90>" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP8AAAD8CAYAAAC4nHJkAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAD8BJREFUeJzt3X/oXfV9x/Hne5rGmUiymF/MyNyUIZKKqxEt2lm31UrtP6NQ2fCf0fULw3a0Y7AtgzWFMSa063AUSkDppqJCWzqY2qb7o9jIbAkljUbjqlvWGJpvftgEI0RNfO+PewJf03vOvTnfc8+933yeDwjfez/nnnPenu99ee79fL7ncyIzkVSeX5l2AZKmw/BLhTL8UqEMv1Qowy8VyvBLhTL8UqEMv1Qowy8V6uLFrBwRdwFfAi4C/jUz/3HE6/1zQmnCMjPGeV20/fPeiFgOvAx8CDgE/Bcwl5k/bljH8EsTNm74F/Ox/2Zgb2YeyMx3gCeAuxexPUk9Wkz4NwEHFjx/rWqTtAQs6jv/OCJiDpib9H4knZ/FhP814MoFzzdVbe+RmduB7eB3fmmWLOZj/4+AzRGxKSKWAfcAT3dTlqRJa33mz8xTEfFnwHcZ/E/kkczc1Vllkiaq9VBfq535sV+auD6G+iQtYYZfKpThlwpl+KVCGX6pUIZfKpThlwpl+KVCGX6pUIZfKpThlwo18ev5x3XRRRd1ur0zZ850ur0mTbX3WccsqTsmTcdjEsexTR2T0Oa/bdLvK8/8UqEMv1Qowy8VyvBLhTL8Uq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XAN4DPZeaJvvY7Rh29H5PMPJOZNzA4MX7ofCbNHdc0wv8ag+/7Z22q2nqXmYeqn4cZ/LJvmkYdlbMToVL9PDyNIjLzSPXGexf4Gj0dk+qGMN9kME3ct6rm3o/JsDqmdUyqfR8HngRuoePjMY3w/wjYHBGbqgN9D1OY/DMiVkTEpWcfA3cBL/ZdxwIzMSFqRCz8KPkJejgm1V2hHgReyswvL1jU6zGpq6PvY9LbpLl99WCe05v5MWAv8BLwt1Oq4bcYdOj8hEGv7t9T/dFTD/t+DPg5gynQXwM+BVwO/CfwfPVzzZTqeKQ6LvuAHcCVPdRxG4P+lz3A7urfx/o+Jg119HpMgOurff8EeBnYVrV3ejz8Cz+pUKV3+EnFMvxSoQy/VCjDLxXK8EuFMvxSoQy/VCjDLxXq/wEGRKQ0eZGaIgAAAABJRU5ErkJggg==\n", "text/plain": [ "<Figure size 432x288 with 1 Axes>" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "batch=10\n", "n=4\n", "plt.imshow(cellsET_outer_dict[batch][n],cmap='gray')" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [], "source": [ "for j in range(n_batches):\n", "\n", " np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsET_inner_dict[j])\n", " #np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsET_inner_dict[j+1])\n", "\n", " np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsET_outer_dict[j])\n", " #np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsET_outer_dict[j+1]) \n", "\n" ] }, { "cell_type": "code", "execution_count": 125, "metadata": {}, "outputs": [], "source": [ "#particle = 'piplus'\n", "#cal_zone = 'inner'\n", "#variable = 'X'\n", "#\n", "#cellsX_inner_dict={}\n", "#\n", "#for j in range(n_batches):\n", "# cellsX_inner_dict[j]=rn.root2array(\n", "# filenames=file_path, \n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=j*batch_size,\n", "# stop=(j+1)*batch_size,\n", "# )\n", "# \n", "# cellsX_inner_dict[j]=np.array([cellsX_inner_dict[j][i] for i in range(batch_size)])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsX_inner_dict[j])\n", "#\n", "#if N % batch_size != 0:\n", "# \n", "# cellsX_inner_dict[j+1]=rn.root2array(\n", "# filenames=file_path,\n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=n_batches*batch_size,\n", "# stop=N,\n", "# ) \n", "# cellsX_inner_dict[j+1]=np.array([cellsX_inner_dict[j+1][i] for i in range((N % batch_size))])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsX_inner_dict[j+1])\n", "# \n", "#variable = 'Y'\n", "#\n", "#cellsY_inner_dict ={}\n", "#\n", "#for j in range(n_batches):\n", "# cellsY_inner_dict[j]=rn.root2array(\n", "# filenames=file_path, \n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=j*batch_size,\n", "# stop=(j+1)*batch_size,\n", "# )\n", "# cellsY_inner_dict[j]=np.array([cellsY_inner_dict[j][i] for i in range(batch_size)])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsY_inner_dict[j])\n", "#\n", "#if N % batch_size != 0:\n", "# \n", "# cellsY_inner_dict[j+1]=rn.root2array(\n", "# filenames=file_path,\n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=n_batches*batch_size,\n", "# stop=N,\n", "# ) \n", "# cellsY_inner_dict[j+1]=np.array([cellsY_inner_dict[j+1][i] for i in range((N % batch_size))])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsY_inner_dict[j+1])\n", "\n", "#particle = 'piplus'\n", "#cal_zone = 'outer'\n", "#variable = 'X'\n", "#\n", "#cellsX_outer_dict={}\n", "#\n", "#for j in range(n_batches):\n", "# cellsX_outer_dict[j]=rn.root2array(\n", "# filenames=file_path, \n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=j*batch_size,\n", "# stop=(j+1)*batch_size,\n", "# )\n", "# \n", "# cellsX_outer_dict[j]=np.array([cellsX_outer_dict[j][i] for i in range(batch_size)])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsX_outer_dict[j])\n", "#\n", "#if N % batch_size != 0:\n", "# \n", "# cellsX_outer_dict[j+1]=rn.root2array(\n", "# filenames=file_path,\n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=n_batches*batch_size,\n", "# stop=N,\n", "# ) \n", "# cellsX_outer_dict[j+1]=np.array([cellsX_outer_dict[j+1][i] for i in range((N % batch_size))])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsX_outer_dict[j+1])\n", "# \n", "#variable = 'Y'\n", "#\n", "#cellsY_outer_dict ={}\n", "#\n", "#for j in range(n_batches):\n", "# cellsY_outer_dict[j]=rn.root2array(\n", "# filenames=file_path, \n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=j*batch_size,\n", "# stop=(j+1)*batch_size,\n", "# )\n", "# cellsY_outer_dict[j]=np.array([cellsY_outer_dict[j][i] for i in range(batch_size)])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j), cellsY_outer_dict[j])\n", "#\n", "#if N % batch_size != 0:\n", "# \n", "# cellsY_outer_dict[j+1]=rn.root2array(\n", "# filenames=file_path,\n", "# treename=tree_name,\n", "# branches=particle+'_L0Calo_HCAL_Cells'+variable+'_'+cal_zone,\n", "# start=n_batches*batch_size,\n", "# stop=N,\n", "# ) \n", "# cellsY_outer_dict[j+1]=np.array([cellsY_outer_dict[j+1][i] for i in range((N % batch_size))])\n", "# np.save('/disk/lhcb_data/davide/HCAL_project_full_event/npy/'+file_name+'/'+variable+'_'+cal_zone+'/batch_'+str(j+1), cellsY_outer_dict[j+1]) " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.15" } }, "nbformat": 4, "nbformat_minor": 2 }