Novel approach to push the limit of temporal resolution in ultrafast electron diffraction accelerators

Ultrafast electron diffraction techniques that employ relativistic electrons as a probe have been in the spotlight as a key technology for visualizing structural dynamics which take place on a time scale of a few femtoseconds to hundreds femtoseconds. These applications highly demand not only extreme beam quality in 6-D phase space such as a few nanometer transverse emittances and femtosecond duration but also equivalent beam stability. Although these utmost requirements have been demonstrated by a compact setup with a high-gradient electron gun with state-of-the-art laser technologies, this approach is fundamentally restricted by its nature for compressing the electrons in a short distance by a ballistic bunching method. Here, we propose a new methodology that pushes the limit of timing jitter beyond the state-of-the-art by utilizing consecutive RF cavities. This layout already exists in reality for energy recovery linear accelerator demonstrators. Furthermore, the demonstrators are able to provide MHz repetition rates, which are out of reach for most conventional high-gradient electron guns.

Over the last decade, kilometre-long hard X-ray Free-Electron Lasers (FELs) [1][2][3][4] and its follow-up in-depth researches [5][6][7][8] have opened an era for examining ultrafast structural dynamics associated with the diffraction of phase transformations, the making and breaking of bonds in solids, chemical reactions, and rapid biological processes. Recent researches on a semiconductor-based photocathodes [9][10][11] have pushed the thermal emittance of electron beams down to few nanometer-radian at femtocoulomb bunch charges, resulting in MeV-class electrons produced by a gun having the transverse coherency close to the hard X-rays. Particularly, the strong scattering power of electrons 12 enables observation of atomic and molecular structures at a low intensity that can be covered by a cost-effective and compact ultrafast electron diffraction (UED) facility. The MeV-class beam energy not only suppresses background noise from inelastic scattering and velocity mismatch efficiently but also increases penetration depth in a matter and accomplishes sufficient bunch charges at a short bunch length 13 . For instance, a few hundreds of electrons can be packed at a keV energy with a bunch length of 100 fs 14 which is not enough to produce a diffraction pattern by a single-shot. However, MeV-class electrons effectively overcome this constraint, so up to 10 6 electrons can be filled in a bunch at the same length. This feature grants the utilization of a pump-probe technique that aims to image the structural changes happening in a sample after an interaction with photons (pump pulse) with a fine scanning of the structure at different time steps attained by adjusting the time-delay between pump and probe pulses. The MeV-UED accelerators have served numerous experiments in condensed media such as phase transitions 15,16 , electron-phonon coupling 17 and thin film lattice dynamics 18 for example with pico-and even femtosecond time scales. In the last years, progress has been made regarding the development of various UED techniques for the study of gas phase molecules 19 and liquid phase samples 20,21 as well.
One of the confronting challenges that MeV-class UED accelerators still face is the generation of extremely short bunches with consummately reliable stability in terms of transverse emittances and beam arrival time for achieving a high temporal resolution as well as sufficient lateral coherency. For obtaining a bunch length of sub-100 fs at a bunch charge of at least 100 fC, various schemes have been devised 22,23 and experimentally demonstrated 24 . The fluctuation of elapsed time between pump and probe pulses so-called timing jitter τ jitter , however, overwhelms the temporal distribution of electrons in a bunch, so it determines the temporal resolution of the whole system 25,26 (see "Methods" for more details). Therefore, in modern UED facilities, the challenge tackled is to achieve an optimum temporal resolution by compromising both contributions as defined by Renkai Li et al. 27 . The existing facilities employ the method in which the phase of radio-frequency (RF) fields in a gun www.nature.com/scientificreports/ is adjusted to a slight off-crest value for obtaining the minimum bunch length, pushing the performance limit of the timing distribution system 28,29 . However, this approach is still fundamentally limited due to the enhancement of the jitter by setting the off-crest phase and an ultrashort laser pulse is required at the cathode. In the last years, several approaches have been developed to improve the time resolution in MeV UED facilities by compensating the Time-of-Flight (ToF) error using a sophisticated magnetic lattice. Two very recent studies 30,31 proposed to use a RF gun in combination with a double bend achromatic optic to vanish the ToF jitter and they have demonstrated experimentally a time resolution of sub-50 fs (full-width-at-half-maximum, corresponding to 21.2 fs root-mean-square). In addition, a further study on multiple RF cavities in a beamline was presented by Franssen et al. 32 for minimizing the arrival time and bunch compression at an initial beam energy of 100 keV. However, this model does not consider the electron beam dynamics in the electron gun, i.e. the emission of lowenergy electrons from the cathode, the effects of RF to laser mismatch and the field fluctuations. Furthermore, the space-charge forces, which play a major role in low-energy beams, are neither included, making it difficult to apply in photoinjectors. Here we propose a new methodology to ameliorate the temporal resolution further by implementing additional cavities downstream while also including the complete acceleration process starting from the gun emission together with space charge effects. This scheme allows to free the gun cavity from the burden of a bunch compression and choose the best emission phase for suppressing the mismatch between the laser and RF fields. This shows that the gun itself can reduce the ToF jitter of electrons by a factor of more than 2 respect to initial timing mismatch in the cathode. The subsequent cavities downstream of the gun can increase the efficiency of the compensation by a factor of up to 6. In addition, multiple cavities permit the manipulation of electron distribution in longitudinal phase-space using linearization method based on the stretcher mode 33 . It can reduce bunch length further by compensating for a nonlinear distortion caused by space charge forces. We have obtained a bunch compression factor larger than 40, which corresponds to a bunch length of 22 fs for an initial drive laser pulse length of 1 ps, being this the minimum achievable laser pulse duration in the Sealab facility (see "Methods"). Since the injectors of energy recovery linear accelerators (ERLs) demonstrators (see "Methods") produce intense electron beams of superior quality in 6-D phase space at an equivalent layout to our idea, this approach offers special scientific opportunities for these facilities (see "Methods" for more details). Our method applies to accelerator facilities with any type of cavities. However, given the capacity of superconducting injectors to operate with one bunch per RF cycle, the utilization of this method in accelerator facilities that involve superconducting cavities not only enables MHz repetition rate UED experiments for highly reversible processes in solids, such as electron plasma dynamics 34 , or even irreversible processes in gas and liquid phase targets, greatly increasing the signal-to-noise ratio, but also enhances the temporal resolution due to the stability provided by the SRF nature. Furthermore, the application of the method can be an important step towards enabling novel technologies that demand ultra-short and stable bunches with a high repetition rate e.g. external injector for plasma-wakefield accelerators 35 .

Results
Time-of-Flight Jitter. In UED facilities, the time delay between laser pump and electron probe pulses at a sample is defined by not only the relative arrival timing between two pulses but also fluctuations of the laser arrival time and the Time-of-Flight (ToF) of an electron bunch that are given by ToF = t g + t 1 , where t g denotes the time that electrons need to exit the gun as a function of emission phase and field gradient and t 1 is the flight time in a subsequent space. The beam energy which is determined by an amplitude of electric field E g and phase φ g of the gun governs t 1 . By sharing a laser on the cathode with the pump pulse on a sample, two events of electron ejection from the cathode and laser pulse on the sample become entangled naturally, resulting in the timing jitter τ jitter being determined solely by the uncertainty of ToF, i.e. τ jitter = σ ToF 36 . Fluctuations of the amplitude and phase of RF fields cause beam energy changes that leads to a ToF variation which is inversely proportional to γ 3 , where gamma denotes the Lorentz factor. Taking account of fluctuations of laser arrival time on a cathode σ L and amplitude σ A g and phase σ φ g of the RF field, the total mismatch σ RL can be described by In the subsequent drift, the electron bunch ToF is governed by the energy E g , which is affected by the fluctuation of gun parameters, and the bunch accumulates a further ToF deviation with respect to the design value. The total jitter from the cathode to the end of the drift L 1 is given by where m 0 is the rest mass of the electron and c is the speed of light. Using Eq. (1), the optimum phase and amplitude of a gun can be investigated. To calculate the partial derivatives ∂�t ∂A g , ∂�t g ∂φ g , ∂E g ∂A g and ∂E g ∂φ g , numerical simulations are carried out using Astra 37 . The ToF jitter normalized by the initial error σ RL at the target position as functions of the phase and field gradient of a gun within achievable parameters for superconducting technology is shown in Fig. 1.
The result highlights three important aspects: firstly, the jitter can be minimized obviously by adjusting emission angles close to the on-crest phase, as it minimizes the bunch energy variation caused by the laser to RF mismatch. Secondly, it is more sensitive to the variation of the phase than the field gradient. Lastly, the higher the gradient, the better for decreasing jitter. For instance, an initial jitter σ RL of 318.5 fs can be suppressed down (1)  27 and experimental results at UED facilities 28,30 . This has proven explicitly that extra cavities yield further suppression of the jitter below the minimum value by setting the RF phase to its optimum which is not feasible for a typical UED set-up with an electron gun only. This motivates the investigation of the effect of the cavities for the jitter compensation. The ToF jitter of a beamline composed of a gun and n-subsequent cavities with the corresponding drift spaces can be expressed as (see "Methods" for the derivation) where the σ φ i and σ A i are the phase and amplitude uncertainties of the i-th cavity, respectively. The partial derivatives of the ToF can be calculated respect to the amplitudes and phases of the cavities in a beamline. The minimum jitters are investigated for the different numbers of cavities numerically and analytically with feasible layout based on Sealab parameters (see "Methods" for more details). The results are listed in Table 1 and shown in Fig. 2. For cases of a gradient of a superconducting electron gun of 20 MV/m and 25 MV/m, the optimum phases and amplitudes of the three successive cavities, as well as the gun, are calculated by using a basin-hopping algorithm 38 .
The results evidence that the three extra cavities, (n = 3) , can push the limit of the jitter defined by the synchronization between the laser and RF field reduced by a factor of 5.7. This scheme is widely used in a photoinjector of ERL demonstrators which has a booster module downstream of the gun. The analytical formula It is the same convention that is used for the electron emission phase from a cathode in Astra code. The parameter space is determined by achievable parameters for superconducting technology. It is calculated by using Eq. (1) with the partial derivatives ∂�t ∂A g , ∂φ g that have been emanated by numerical simulations using Astra code. Table 1. Machine parameters for the minimization of ToF jitter in Fig. 2 with an initial jitter of σ RL = 318.5fs , cavity phase stability of σ φ = 0.05 • and amplitude stability of σ A = 1 × 10 −4 A. Significant values are in bold. Calculated ToF jitter refers to the calculation using Eq. (2) and the simulated one is obtained using Astra.

Gun Cavity 1 Cavity 2 Cavity 3
σ ToF @ 7.64m  (2) quantitatively agrees well with the numerical results. As shown in Table 1, the emission phase in the gun has the optimum point close to the on-crest phase to minimize the laser to RF jitter influence in the ToF of the electrons. At the working points that lead to the minimum values, the final arrival time fluctuation is almost immune to σ RL and is governed by the amplitude and phase fluctuations in the additional cavities. The compensation by increasing the field gradient in the gun is still effective for the case of none or one cavity available, but the difference diminishes when more cavities are involved.
Bunch compression with space charge effects. The time resolution in UED machines is not only determined by the ToF jitter but also depends on the temporal distribution of electron beams at a sample (see "Methods" for more details). This does call for the manipulation of electron distribution in longitudinal phase space to achieve a short bunch length at a sample by sacrificing the optimum phase calculated in the above section. Particularly, for the bunch length down to its limit, it is necessary to rectify a nonlinear distortion of the particle distribution in longitudinal phase space which is caused by space charge (SC) forces. The distortion is formed in the first meter after the gun since the transverse phase space of the beam is necessary to be tailored by a collimator with an opening of in the order of a few tens micrometres to acquire its desired transverse emittance, as the minimum achievable emittance without collimation is limited by the minimum laser pulse spot-size of 0.5 mm rms at the cathode 39 . The transverse emittances can be down to suitable value for obtaining a high-quality diffraction pattern, ǫ x,y ∼ 30 nm rad, by selecting a fraction of the electron beams generated by a gun with a bunch charge of a few pC. The SC effect is investigated for the different initial bunch charges and the result is shown in Fig. 3. After the collimator, the bunch charge in the range of 50 fC with the MeV beam energy allows us to ignore the space charge effects downstream. Therefore, the nonlinear distortion only occurs in the section between the cathode and the collimator. The extra cavities downstream can be used to mitigate the effect of the distortion in the bunch compression. The normalized transverse emittance remains almost constant regardless of longitudinal bunch compression. Then, the cavities can contribute not only to reducing the jitter as explained in above section but also to giving adjustable parameters for the longitudinal phase space manipulation. A linearization method is adopted 33 for rectifying the nonlinear distortion. The main advantage of the method is that the phase-space curvature caused by SC fields can be taken into account in the compensation of the distortion up to the third order. In addition, the linearization allows to use the on-crest emission from the gun to minimize the effect of σ RL in the jitter and compress the bunch at the same time. With a linearization method, for the maximum bunch compression with on-crest gun emission, a minimum length of 22 fs at the interaction point can be achieved with an initial laser pulse length of 1 ps, providing a compression factor over 40. This clearly improves the compression that can be achieved with a single buncher cavity under the same emission conditions in the gun. The evolution of the bunch length for the three different schemes can be seen in Fig. 4. The bunch lengths at the target position together with the working points of the RF cavities for each case are shown in Table 2. Moving the target closer to the last cavity would improve the minimum achievable bunch length, but higher gradients are necessary for obtaining the high bunch compression factor. This would also increase the contribution to the ToF jitter given by the amplitude fluctuations. In any case, even if the target is located closer downstream from the last cavity, the shortest bunch length achieved with the buncher mode under the same initial conditions is still a factor 3 longer than the one achieved using the linearization method shown in Fig. 4.
The cavity parameters for the longitudinal phase-space curvature compensation, however, are not the same as the optimal working point of the ToF jitter minimization. The linearized bunch configuration results in a ToF  The initial bunch charge is 3 pC and it is reduced to 50 fC after the collimator. The bunch length for different configurations is shown, always for a gun gradient of 20 MV/m. The red line shows the evolution of the bunch length for only gun, the minimum value at the target is achieved with φ g = −12.3 • for the given initial charge. The green line corresponds to the beamline with one additional cavity in which the emission from the gun happens in on-crest phase. Finally, the blue line shows the bunch length evolution for one of the linearization solutions with three extra cavities, using the same cavity amplitudes and gun phase that minimize the ToF jitter in Table 1. The zoomed image shows the difference between the bunch length at the target for the last two. The final energy is 2.22 MeV for the first two cases and 2.15 MeV for the linearization case. The increase in the rms bunch length at the aperture is given by the radial dependence of the longitudinal particle distribution caused by space charge fields. The outermost particles are collimated, leaving only the closer to on-axis particles which have a larger rms spread. (RHS) On the top side, the phase space of the electron bunch at the aperture position is shown colored according to the particle density for the two cases with shortest bunch length. On the bottom side the longitudinal particle distribution for the two cases is shown. For the linearized solution the maximum compression is limited by the higher order nonlinear distortions. For instance, the optimum working point that minimizes the time-resolution while keeping an acceptable lateral coherence length with a final bunch charge of at least 50 fC leads to with a lateral coherence length of 3 nm (for a bunch spot size of 300 mm at the target) and a time resolution of 103 fs (being the last cavity field fluctuations the main contribution with 72 fs) with an initial laser to RF mismatch of 318.5 fs and laser duration of 1.0 ps. The resulting solution is a nearly linearized bunch at the target, with an on-crest emission from the gun. Hence, the scheme with the three cavities reduces the jitter by a factor of about 4 and compresses the bunch in time by a factor slightly above 10 at the same time, while the gun on its own is only able to reduce the bunch length by half without any gain for the jitter compensation. The effect of adding the extra cavities in the beamline improves the time resolution clearly.

Conclusion
In this study, we have proposed and demonstrated the new approach for improving the time resolution in UED experiments by implementing three additional cavities downstream of a gun, which is widely adopted in an SRF photoinjector of ERL demonstrators. This offers a new strategy to push the limit of the time resolution that has been constrained by state-of-the-art technologies for the ultrashort electron bunch generation from the photocathode and the synchronization between laser and RF cavity. Hence, synchronization between laser and RF fields is no longer the limiting factor in the arrival time jitter and short laser pulses at the cathode in the tens of fs are not required. The compensation of nonlinear distortion caused by space charge effects as well as timeof-flight jitters can be achieved by mastering the phase and gradient of the additional cavities. These milestones are achieved while keeping a large lateral coherence length at a sample for obtaining clear diffraction patterns with a bunch charge of about 100 fC by tailoring the transverse phase-space distribution of a few pC bunches using a collimator with a diameter of a few tens of micrometres. The initial conditions taken into account in the estimations are conservatively assumed, for instance, the maximum gradients on the cavities have been limited to values which are considered easily reachable (see "Methods"), but the real values are expected to be at least 50% higher. The time resolution in the studied method is limited by the field stability of the cavities. The LLRF control is expected to at least match the phase and amplitude instability values used here (see "Methods"), any improvement in the value of the fluctuations would automatically lead to smaller ToF jitter for every studied . The constrains for the optimization are that the initial laser pulse length at the cathode has to be longer than 1 ps, the initial rms laser spot size larger than 0.5 mm and that the electron bunch at the target must have a charge of at least 50 fC. The pareto fronts show that there is indeed a correlation between bunch compression and ToF jitter, both cannot be minimized simultaneously. For each magnitude the individually achievable minimum values are shown by the asymptotic behaviours of the ends of the pareto fronts, while the curve in between both ends represents the trade-off between them when both are minimized at the same time (better seen in the zoomed-in plot).  Fig. 4 to values below 60 fs. In this scheme, the last cavity contributes mainly to the time resolution with a jitter of 42 fs that can be improved by utilizing an isochronous optics. Further improvements in the phase stability would bring the time resolution to lower values, where the amplitude fluctuations in the cavity fields and the minimum bunch length given by the linearization would become the limiting factors. This highlights the advantage of the approach in this work, the capacity that the additional cavities provide to improve time resolution without the need of improving laser to RF synchronization or reducing the longitudinal electron bunch profile at the cathode. Furthermore, this opens a new opportunity for existing ERL photoinjectors as a new scientific case without significant modifications.

Methods
ERL demonstrators. Energy Recovery Linac (ERL) demonstrators are test facilities that aim to verify various physical and technical challenges in the generation, acceleration, transport and energy recovery of high brightness and high average current electron beams in a superconducting radio-frequency (SRF) linear accelerator. During the past decades, several ERL demonstrators have been built in the world [43][44][45] and one of them, bERLinPro, is being currently commissioned in Helmholtz-Zentrum Berlin 46 . The layout of the ERL demonstrators follows a common design similar to the bERLinPro shown in Fig. 6. It consists of an injector with a photocathode gun and booster, the main linac, and the recirculator. These demonstrators have completed the verification of core technologies and the scientific applications of such accelerators are being currently studied 47 . Besides working as test facilities, given the high brilliance and short bunch length that can be achieved, it could be used for Compton back-scattering experiments, THz radiation sources or, as in this case, time-resolved pump-probe experiments.

Sealab and the SRF photoinjector. Superconducting Electron Accelerator Laboratory (Sealab) in Helm-
holtz-Zentrum Berlin is a test bench for beam dynamics, control and instrumentation R &D of high average current, ultrashort and high brightness beams. The main beamline within the Sealab facility is an ERL demonstrator injector. A simplified sketch of the SRF Photoinjector beamline with the UED components can be seen in Fig. 7.
The laser system provides green light between 510 and 540 nm and a Gaussian shaped longitudinal profile with rms pulse length in the ps range at the photocathode. The repetition rate of the laser system goes up to 1.3 GHz. The laser spot size at the photocathode is limited in the lower side to 0.5 mm rms radius top-hat distribution. It has a minimum pulse length of 1.0 ps and a Gaussian longitudinal shape. The semiconductor K 2 CsSb photocathode, which operates nominally with an incident wavelength of 520 nm, is located at the back-wall of a supercon-  The working point of each RF cavity used in the beamline is subjected to fluctuations in amplitude and phase with respect to a reference signal given by a master oscillator. The fluctuations can be controlled by the feedback system of the LLRF control up to a certain point. The superconducting gun cavity has a phase stability σ φ g = 0.05 • and an amplitude stability σ A g = 1 × 10 −4 A. The added cavities along the beamline have been measured in the test stand to have an improved phase stability of σ φ = 0.02 • . However, for this work, the largest value σ φ = 0.05 • is adopted for all of them in principle. Furthermore, the laser timing jitter is of 300 fs, which together with the phase instability of the gun results in σ RL = 318.5 fs.
Time resolution. The time resolution R t in a UED experiment defines the capability of discerning minimum temporal extension of the structural dynamics. This quantity can be expressed by a square root of the sum of the quadrature of the different contributions, where σ pump and σ probe stand for the rms length of the laser and electron pulses at a sample, respectively, τ jitter refers to the fluctuation in elapsed time between the arrival of two pulses, and τ vm represents the velocity mismatch. Typically, the pump pulse originates from the same laser that illuminates the photocathode to produce electrons. Thus, even if the properties of the laser pulse at two distinct positions are very different, they are inherently synchronized in time. The pump pulse can be converted to a different wavelength via a high harmonic generator and is guided through a delay stage to control the delay between two pulses. Commercially available laser systems can provide a pump pulse length as short as 10 fs. The velocity mismatch τ vm is given by the time difference originated by the different velocities of photons and electrons in the target material that need to reach the same depths. The quantity causes the elapsed time between the interaction with the photons and with the electrons to differ depending on the depth in the sample. MeV electron beam energies make this contribution to the temporal resolution neglectable compared to lower energy electron beams, in which the velocity mismatch can be the limiting factor 48 .
ToF jitter in a beamline with multiple RF cavities. Departing from Eq. (1), the effects of further cavities along the beamline can be modeled using the single-particle approximation. This approximation assumes that the electrons in one bunch receive the same energy acceleration in the cavity, but that, at the same time, their relative position inside the bunch does not change. This approximation is more precise for the high energy bunch. The energy gain in a cavity under this approximation can be interpreted as where A and φ represent the amplitude and phase of the cavity respectively. The phase is defined with respect to the phase for the maximum energy gain at the moment in which the electron bunch crosses the cavity. This phase can be related to the ToF of the electron from the cathode to the cavity by the constant ω = 2πf and the phase φ 0 of the RF field at the time t = 0.0s . Figure 8 shows the sketch of the beamline between gun and target with an additional RF cavity in between.
Using the notation in Fig. 8, the total ToF of the electrons is the addition of time needed for the electrons to travel each drift section between the cavities. The beam energy at a given section is determined by all the cavity parameters upstream as www.nature.com/scientificreports/ Considering that E g = E g (φ g , A g ) and �t g = �t g (φ g , A g ) are extracted from simulations, one can then calculate the ToF jitter as a function of the fluctuation in the cavity parameters φ g , E g , φ 1,0 , E 1 by error propagation: The rms error of the cavity parameters are considered to be equal to the gun as they share the same LLRF control system. This same sketch can be directly extended to an arbitrary number of subsequent cavities. The energy after the n-th cavity is given by The time the electrons need to reach the end of the beamline is ToF = t g + i+1 n=1 t n . The advantage of this approach is that analytical derivatives of the time of flight respect to the resonant cavity parameters can be calculated by deriving Eq. (7). One only needs the initial phases φ i,0 and amplitudes of all the involved cavities together with the simulation results for the ToF and electron bunch energy at the exit of the gun. The final ToF jitter expression for n-cavities along the beamline is given in Eq. (2).
Lateral coherence length. The quality of a diffraction pattern is a combination of sample properties and instrumental factors. The study of favorable sample properties is beyond the scope of this work. The instrumental factors enclose the quality of the electron beam and that of the detection system. The quality of an electron beam for diffraction can be described by its coherence length. The lateral coherence length is a measure of the spatial coherence and is usually defined as: where = h/γβmc is the De Broglie wavelength of the electron, σ θ = ǫ n,⊥ /γβσ ⊥ is the uncorrelated angular spread, σ ⊥ represents the beam spot size in the transverse directions (x or y) and ǫ n,⊥ is the normalized transverse emittance in the same direction. The lateral coherence length indicate the maximum distance between atoms/ molecules in matter that can produce a diffraction pattern coherently. A criterion for generating a high-quality diffraction pattern in UED accelerators is L ⊥ > d 100 , i.e. the transverse coherence length should be larger than the largest lattice spacing d 100 of the sample. Numerical simulation. The simulations shown in this work are performed using the Astra 37 code that can compute macro-particle tracking numerically through user-defined electromagnetic fields with space-charge forces. The initial temporal and spatial distribution is a replica of an incident laser-pulse on a photocathode. The latest response-time measurement of semiconductor photocathodes 49 shows almost an order of magnitude smaller values than a laser pulse length in SRF Photoinjectors, so this effect is ignored in our calculation. The transverse momentum distribution is chosen so that the normalized transverse emittance of the initial bunch matches the intrinsic emittance of measured for K 2 CsSb photocathodes 39 . The electrons are propagated along the beamline with the simulated field patterns for RF cavities and solenoids. The initial number of macro-particles in the electron bunch is set in order to ensure that at least 1 × 10 4 macro-particles are still alive after the collimation to mitigate statistical errors. Simulations of Time-of-Flight jitter are performed tracking a reference particle from the cathode to the target with sufficient iterations ( 1 × 10 4 ). This procedure is repeated for each working point and the rms spread of the time of flight is calculated accordingly. The fluctuations of the field phases and amplitudes in the cavities follows pre-defined Gaussian statistics. For the linearization of the longitudinal phase space using additional cavities, the non-linearity of the collimated beam collimation by using an aperture is estimated by fitting a third order polynomial. The analytical solution for the linearization is found by solving the equations in 33 with the fitted polynomial. Once an analytical solution is found for the linearization, a particle tracking simulation is conducted to evaluate the space-charge effects. The analytical solution gives an initial working point for an optimizer. Then, numerical optimizations are used to search for the minimum achievable bunch length near the initial condition.

Data availibility
The data that support the findings of this study are available from the corresponding author upon reasonable request.