## 3 Materials and Methods
### Data Set
#### 3.1.3 Image Formation  
As shown in [28], energy deposited in calorimeter cells can be treated as pixels of an image, which allows the usage of powerful image-processing techniques. Also, this approach has a significant advantage since additional preprocessing needed for traditional methods for this kind of classification problem, like random forest (RF) or boosted decision trees (BDT), is avoided. Each HGCAL layer is represented as a separate image, resulting in 36 two-dimensional (2D) images. Considering that the first 14 layers belong to the CE-E part of the endcap and the last 22 to CE-H, the classifier can deal with a complete 36-layer image or take only the CE-E or CE-H part.  
Passing through the calorimeter layers, the particles/decay products deposit energy in sensor cells grouped into trigger cells (TC). The trigger cells with the highest energies are grouped into 2D clusters within a single layer. Then, individual 2D clusters are connected into 3D ones, which gives complete 3D information about the shower (Figure 2(a)). If the targeted image size is smaller than an individual 2D cluster range, not all trigger cells participate in such image creation. It is shown in Figure 2(b), where all TCs are bordered depending on whether they participate in image generation (black border) or not (red border).  
Subsequently, from the 3D cluster data obtained from CMSSW, virtual images are created by applying the following steps: the line between the center of mass of the 3D cluster and the center of the detector represents the deposition axis. The intersection point of the axis with each individual layer is the center of the region of interest (ROI) on that layer (Figure 3(a)). Afterward, the range along the coordinate axes is calculated according to the center depending on the target size of the ROI. Finally, a 2D histogram of 5 \(\times\) 5 bins, with a bin size 2 \(\times\) 2 cm\({}^{2}\) (adjusted to the size of the trigger cell), is applied to summarize all the energies (Figure 3(b)). The study [44] has shown that with a similar data set, window size enlargement does not significantly impact model accuracy.  
As a result of the described image generation procedure, 3D images with a shape 5 \(\times\) 5 \(\times\) 36 are generated. The 5 \(\times\) 5 parameter represents the window size, while the third value indicates the number of displayed layers (i.e., depth).  
Figure 3: (a) 3D presentation of EM cluster where dot size and color are proportional to deposited pt. (b) The same cluster; cluster points participating in 5 \(\times\) 5 \(\times\) 36 image generation are bordered black, and the others have red borders.  
Since every second layer is used for triggering in the electromagnetic part of the calorimeter, it is described with 14 images, while the hadronic part consists of the remaining 22 layers, one for each layer. Figure 5 represents the longitudinal profile for EM (Figure 5), PU (Figure 5), and QCD showers (Figure 5). It is clear that compared with EM showers (on average), PU and QCD start showering earlier, with a peak reached before layer 10 and a higher energy deposit in the hadronic part.  
Observing the distribution of the total energy of EM clusters with PU and QCD clusters, shown in Figure 6, it is evident that EM clusters, on average, have significantly higher energy than background clusters.  
The models are tested on full HGCAL image (Figure 7), but for some of the tested approaches, like a reduction in the longitudinal profile, the HGCAL image is split into CE-E and CE-H image parts. CE-E image has a shape \(5\times 5\times 14\) (Figure 7) and shows only the electromagnetic part of the calorimeter, while CE-H image with a shape \(5\times 5\times 22\) represents the hadronic part.  
Figure 4: Example of layer 13 image generation: (a) the projection of deposited particle energies (b) the resulting layer image.  
Figure 5: Histogram representing average longitudinal profile for (a) EM shower, (b) PU, (c) QCD.  
Figure 6: Comparison of average EM and (a) PU, (b) QCD cluster energies.