## 3 Methods
### Clustering and Overlap Formulation  
For the case of the last step of the reconstruction, the overlap algorithm needs to resolve the cases where a cell belongs to more than one cluster. To do so, the energy of that cell needs to be distributed among the involved clusters, depending on the total energy of each cluster. To be specific, since the energy measured in an overlapping cell may come from the addition of two different particles, one fraction of the overlapping cell energy belongs to one particle and the rest of the fraction to the other particle. Therefore, the desired output for this step is, given an input cell with overlap, the part of the energy designated to each of its contributing clusters. In case the cell does not have overlap, the output needs to be the same energy value of the input. To correctly perform the distribution of the energy in case of overlap, the algorithm needed to know which cluster is the fraction of energy going to belong. Since there is a maximum of four possible clusters contributing to a cell by construction (see Figure 3), each fraction operation needs to be related to one of the clusters involved in the overlap. Two conclusions can be extracted at this point for the overlap cases:  
* The neighborhood window for this step needs to be big enough to identify all the cells belonging to the possible clusters causing overlap. This number corresponds with 24 neighbors inside a \(5\times 5\) square window around the given cell, as can be seen in Figure 3.
* Extra information needs to be added to the \(5\times 5\) window, indicating the cluster to which the energy fraction is going to be part of. Since each fraction of energy needs to be assigned to a certain cluster, in the overlap cases, the same \(5\times 5\) window must be evaluated as many times as the number of clusters involved, but each time selecting a cluster that the fraction is going to contribute. This dominant cluster, within a \(5\times 5\) window, will be called central cluster. In order to provide the central cluster information, before transforming the input image into blocks of \(5\times 5\) windows, there is a first transformation into windows of \(7\times 7\). Within this \(7\times 7\) window, we can identify if the cell located at the centre is a local maximum and generates another stream of data to indicate that, for this particular window, the central cluster is the one in the middle of the window. An example representation can be seen in Figure 3 where the blue cross represents a local maxima and in this case would be marked as a central cluster as well. Regarding the identification of the central cluster, these data are generated with a masking of the local maxima stream of each \(7\times 7\) window. Where the mask is a \(7\times 7\) matrix of zeros and a single one on the central position where we expect to find the central cluster. Once we include this third stream of information in a window of \(7\times 7\), we can subsample all nine possible \(5\times 5\) windows that can fit inside the \(7\times 7\). At this time, we have, on a single \(5\times 5\) sample, the data regarding the readout cells of the calorimeter, the local maxima information and the central cluster information. It is prepared to generate a prediction of the designated energy partition of the cell located at the centre of the window concerning the central cluster. Gathering the previous concepts, the cellular automaton formulation of this step has the following characteristics:  
* States: 10,240. Since the algorithm needs to give, as output, a value concerning the energy of a cell, the CA must have enough states to model the full calorimeter sensitivity, which is of 12 bits on the ADC lecture with a gain of 2.5 MeVs per ADC value (\(2^{12}\times 2.5\)). * Neighborhood: 24 cells. As explained above, the window around a cell to predict its value needs to be of \(5\times 5\) cells. * Original data sample. Obtained from the calorimeter simulation with values from 0 to 10,240. - Local maxima information.