## 3 Methods
### Local Maxima Formulation  
Starting with the local maxima finder, we want to identify cells that are a local maxima among the others. Hence, its cellular automata characteristics can be defined as follows:  
* States: two. One (1) if the cell is a maximum and zero (0) otherwise.  
* Neighborhood: eight cells. In order to check if it is a local maxima, the surrounding cells at distance one need to be checked. In a two-dimensional grid of cells, the number of distance one neighbors is eight.
* Ruleset function: in order to define the condition of a cell to be a maximum: (1) its value needs to be higher or equal to its neighbors. Although the equal condition is not obvious, it is needed to represent a specific pair of particles from a \(\pi^{0}\) that strike the calorimeter at a very short distance. Therefore Equation (1) defines the ruleset, where \(c_{ij}^{t}\) stands for the value of each cell at time \(t\) and the case \(M=0,N=0\) is excluded. The initial states of the grid cells concerning \(t=0\) are the values of the calorimeter readout cells. \[c_{i,j}^{t+1}=\begin{cases}1,&\text{if }c_{i,j}^{t}>=c_{i+M,j+N}^{t}\text{ for }M\in\{-1,0,1\},\ N\in\{-1,0,1\}\\ 0,&\text{otherwise.}\end{cases}\] (1)  
By looking at the function, it can be seen that the only operation is a comparison between the value of the central cell and one of its neighbors. Yet this comparison will perform the same way with independence of the values we have to compare. Hence, there is no dependence on the numerical scale value of the cells to the application of this ruleset function.  
Therefore, the dataset used for the training of the first network needs to reflect significantly the two possible cases of the ruleset function in any numerical value scale. Hence, each input test sample is generated as a two-dimensional grid of the same size as the calorimeter, with uniformly distributed random values from \(0\) to \(99\). This range of values was chosen, taking into account the statistical number of ones that appear on a sample. Regarding the maximum number of local maxima that can fit in a sample, which is one fourth of the total cells, we consider one sixth of the total cells as a good estimation on the number of local maxima that can be on a sample to make sure that some maxima occurrences happen to be adjacent in some cases. The random generation with values from \(0\) to \(99\) happen to match these conditions. For reference, the range of values of the calorimeter goes from \(0\) to \(10,240\) MeVs. Each expected output test sample is then generated with the application of the ruleset function of the CA on all the cells of the input sample. As a visual example, Figure 2 shows a sample of the input and expected output the network is trained with. Given that we want the network to learn to reproduce the CA ruleset on the calorimeter data, the testing samples are raw data samples of the calorimeter with the corresponding readout cell values. The expected output of the testing samples is obtained again with the application of the CA on the training input samples. The last image (d) on Figure 2 shows the image generated by the trained neural network when it is given image c at the input.  
Given that the three regions of the calorimeter have different cell sizes, samples from each region have different shapes. Hence, we will train one network for each region. All of them have the same structure that consists of a two-dimensional convolutional layer followed by two/three dense layers, depending on the region, and finally, an output dense layer of two neurons, since the network is trained as a classifier understanding the output class as the state of a cell in the CA formulation. Table 1 shows a summary of the network parameters and characteristics obtained in the training. To evaluate the network performance, we will use the accuracy metric, since we want to maximize the number of correct classifications. The accuracy is measured as the number of correct classifications over the total number of cells.