## 2 Near-Cathode Particle Dynamics  
Figure 1 sketches a layout of the European XFEL and its injector section. A cesium-telluride photocathode based high-gradient L-band RF gun is in use as the electron source [34], providing about 6.5 MeV/m beam momentum at the gun exit. The photoemission process in the gun is driven by a Nd:YVO4 laser at 266 nm [35]. A temporal Gaussian ultraviolet (UV) pulse with an rms length of 3 ps is currently employed. Transversely, the size of the laser beam shaping aperture (BSA), which is imaged onto the photocathode, can be varied. The existing infrastructure of the laser beam line allows an adjustment of the laser beam size at the BSA position with moderate additional technical efforts. By attenuation of the pulse energy, the laser system can extract different bunch charges from the cathode [36]. Along with the aforementioned variability in the imaging  
system of the laser, the emittance growth at a fixed charge can be minimized by optimization of transverse laser pulse shape via modeling of the photoemission process [37; 38]. In addition, a typical surface roughness of the cesium-telluride photocathode produced using the present recipe is about 10 nm. Potential impacts of the cathode surface roughness on the emittance growth are not considered in this study. Interested readers can be referred to [39; 40] for model-dependent evaluation of the emittance growth. Here, we follow the strategy of transverse laser pulse shaping described in [41; 42] to linearize the space-charge fields during emission from the cathode in particle tracking simulations. This is done using a programmed adapter that is incorporated with the Particle-in-Cell (PIC) object of CST Particle Studio [43]. Three-dimensional (3D) particle tracking simulations are performed iteratively, by adapting the transverse profile of the bunched particles at the cathode, such that, for a certain transverse shape of the drive laser, the space-charge fields are linearized at the observation positions in the close-to cathode regime. This approach allows self-consistent calculation of the evolution of 3D electromagnetic fields and the associated particle dynamics at discrete time samples, also taking into account image-charge effects. Figure 2 presents detailed results obtained from the transverse profile optimization of the cathode drive laser. Two longitudinal observation positions A and B are chosen for field computations, as marked in (a) and (d) in the evolution of the total extracted charge during emission and the mean bunch position, respectively. At these two positions, the transverse space-charge fields are computed as shown in (c) at position A during the emission, and in (f) at position B after the emission. The adaption of the transverse cathode laser distribution is quantified by adjusting the edge-to-center intensity ratio, that is, the truncation ratio of the distribution. The calculations are performed for a series of truncation ratios as illustrated in Figure 2b, where an exemplary intensity distribution and a horizontal cut through it are shown. The corresponding, normalized projections of the intensity in this cut are depicted in Figure 2d for different truncation ratios. Figure 2c shows that the transverse space-charge field during the emission is most linear for a truncation ratio of about 0.65 (red curve) in comparison to a uniform distribution with a truncation ratio of 1 (black curve). The shadows represent some traces of the simulated results as corresponding to different truncation ratios. After emission, there is no pronounced difference in the field linearity as shown in Figure 2f. Furthermore, Figure 3 provides a transient view of the optimization with more insights into the characteristics of the produced particle distribution at the end of the emission process. Figure 3a shows the transverse particle distribution when an optimal truncated-Gaussian shape of the drive laser is used.