# Deep Learning Study of an Electromagnetic Calorimeter
## 3 Positron Multiplicity and Energy Distribution
### Discrete Positron Energy Spectrum  
Apart from the characteristic parameters of the distribution, another straightforward method is often used by breaking apart the continuous distribution function into a discrete histogram like Equation (1). We train and test the energy spectrum in terms of a histogram with 20 bins. The energy ranges of these bins are predetermined as \([E_{j},E_{j+1})\) and  
\[E_{j+1}=E_{j}+0.7\ \text{GeV},\ \ \ E_{0}=0 \tag{4}\]  
where \(j\) is the bin number. The analysis is carried out by associating each event with an array of 20 entries, corresponding to the histograms of \(n|\frac{E^{j+1}}{E_{j}}\) with \(j=0,1,\ldots,19\). Employing the \(\rho=3\) um data, we generated 10 random runs (65% train and 35% test out of 1000 events in each run) and evaluated their histograms. The average true (MC) results were compared to the CNN outputs of the average test set results, shown in Figure 3.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Moments** & **True Value** & **Output** & **Bias** \\ \hline \(M_{1}\)\([\text{GeV}]\) & 4.65 & 4.71 & 1.2\% \\ \(M_{2}\)\([\text{GeV}^{2}]\) & 24.1 & 24.6 & 2.3\% \\ \(M_{3}\)\([\text{GeV}^{3}]\) & 137.4 & 142.8 & 3.9\% \\ \hline \hline \end{tabular}
\end{table}
Table 2: Moments of the energy distribution of the test set of the \(\rho=3\) μm source, summing over all events. The true values are determined from the MC data, and the reconstructed values arise from the CNN evaluation of the ECAL analysis of individual events, as described above.  
Figure 2: CNN outputs of the multiplicity and the first and second central moments for each event. The events are ordered according to the true (MC) number of positrons \(n_{\text{true}}\). The left and right frames refer to the smaller (<200) and larger (\(\geq\)200) multiplicities. The predictions of the CNN agree with the values of the MC data. These results are used to evaluate the average moments of the energy distributions displayed in Table 2.  
The CNN predictions have a small average bias over all bins \(\left\langle\Delta N\right\rangle/N_{\text{true}}=-(0.88\pm 0.42)\%\) and its root-mean-square is \(\sqrt{\left\langle\Delta N^{2}\right\rangle}/N_{\text{true}}=(0.92\pm 0.25)\%\), where \(\Delta N=N_{\text{out}}-N_{\text{true}}\). The average number of positrons per event in these 10 runs was \(1024\pm 31\) for the training and \(1000\pm 46\) for the test data.  
Another estimate of the accuracy of a histogram prediction is the conventional KL distance [25]  
\[\text{KL}(P,Q)=\sum_{j}p_{j}\log(p_{j}/q_{j}) \tag{5}\]  
as the metric for the closeness of two probability distributions \(P\) and \(Q\). Here \(p_{j},q_{j}\) are, respectively, the probabilities defined as \(p_{j}=N_{\text{true},j}/N_{\text{true}}\) and \(q_{j}=N_{\text{out},j}/N_{\text{out}}\) for the 20 bins. The KL distance for the Figure 3 distributions is \(1.2\times 10^{-4}\) indicating that the true distribution is in agreement with the CNN output.  
It should be noted that the reconstruction of the test-set distributions by the CNN has been performed through accumulating the data event by event. This means that all events construct harmoniously a coherent distribution, even though the histograms differ from event to event. In this dataset, as the multiplicity of an event increases, so does its average energy (near the peak position of the histogram). This can be seen in Figure 2, and is also demonstrated in Figure 4, where we plot histograms of the lowest range and of the highest range of \(n\) for \(\rho=3\) um events.  
Trying to generalize from the \(\rho=3\) um CNN, and applying it to \(\rho=5\) um test data, we have to carefully adjust the energy ranges accordingly. With this aspect being taken into account, the generalization works very well. This point is important when we consider future applications to real-world experimental data, where we have to select reliable MC datasets for training procedures.  
Figure 3: Average CNN output and the true energy spectrum of the 10 runs. Each run contained 350 test samples.