## 2 Materials and Methods  
Our analyses rely on the electron beam foreseen by the accelerator of the MariX project [48]. MariX is based on the innovative and compact design of a two-pass, two-way superconducting linear electron accelerator equipped with an arc compressor [49; 50; 51], to be operated in CW mode at 1 MHz. The characteristics of the electron beam, as evaluated after start-to-end simulations [52], are listed in Table 1. A short period, planar undulator can allow the production of radiation pulses in the desired wavelength range (5-2 A, or in energy 2-5 keV), starting from the moderate electron energy provided by the MariX accelerator (at a maximum of 3.8 GeV). From the resonance relation,  
\[\lambda=\frac{\lambda_{w}}{2\gamma^{2}}(1+a_{w}^{2})\,, \tag{1}\]  
where \(a_{w}=0.657\lambda_{w}(\text{cm})B(\text{T})\) is the undulator parameter and \(\gamma\) the electron Lorentz factor for an electron beam energy of 2.4 GeV, we can deduce that an undulator period \(\lambda_{w}=1.2\) cm, corresponding to a peak on-axis magnetic field of \(B=0.93\) T, is suitable for emitting at 3 keV. Both the structure and length of the undulator depend on the seeding scheme: the XFELO requires a single short undulator module, equipped with a sequence of X-ray crystal mirrors. \[\Gamma_{n,m}(\tau)=\left|\frac{\int dtE_{n}(t)E_{m}(t-\tau)}{\sqrt{\int dt|E_{n}|^{2 }}\sqrt{\int dt|E_{m}|^{2}}}\right|, \tag{2}\]  
between two different generic pulses or for one single pulse (\(\Gamma=\Gamma_{1,1}\)), is shown in the windows on the right part of Figure 1. In expression (2), \(E_{n}\) and \(E_{m}\) are the complex electric fields of the pulses as a function of time. In the SASE mode (case (a)), phase coherence on one single pulse and shot-to-shot stability are poor, with a coherence length less than 1 \(\upmu\)m over a 10 \(\upmu\)m long pulse and an equal time coherence degree (\(\Gamma_{1,2}(0)\)) of about \(4\times 10^{2}\). In the single spike mode (case (b)), the coherence length coincides with the pulse's, but the shot-to-shot stability is low, with \(\Gamma_{1,2}(0)=2\times 10^{1}\). The characteristics of the SASE radiation are summarized in Table 2, in the third (high charge working point) and fourth (single spike mode) columns. The patterns of the SASE power (a) and spectral distribution (b) are shown in Figure 2 as a function of the number of shots. From this graph, the modest size of the coherence areas and the poor stability of the SASE process are evident. The XFELO operation has been numerically studied by extracting the radiation simulated by GENESIS 1.3 from the oscillator undulator, driving it through the optical line and superimposing it on the successive electron bunches. In order to simulate the electron bunch train fluctuations, the microscopic distribution of the electron beam is changed shot-to-shot in the simulations. The transport inside the cavity is done by using the Huygens integral [54]  
\[E(\underline{x}^{\prime},t^{\prime}) = \frac{i}{B\lambda_{0}}\int\underline{dx}\underline{x}( \underline{x},t)e^{-\frac{i\pi t}{B}(\Lambda t^{2}-2(xx^{\prime}+yy)+D\
u^{ 2})}, \tag{3}\]  
where \(\underline{x}=(x;y)\), \(r^{2}=x^{2}+y^{2}\) and \(r^{\prime 2}=x^{\prime 2}+y^{2}\). Here, the electric field is the output of the FEL simulation (performed with about 2048 particles and 7000 slices), which is extracted at the end of the undulator over a three-dimensional grid (grid dimensions: transverse \(\sim 2\upmu\)m, longitudinal \(\sim 1.6\) nm). In the first step, the Huygens integral is extended from the end of the undulator up to the first mirror. A, B, C and D are the elements of a \(2\times 2\) matrix describing the optical path and depending on the drift length and on the focal length of the mirror. The effect of the mirror is modelled with a transfer function, taking into account its  
Figure 2: SASE (**a**) power vs. \(s=c\tau\) and (**b**) spectrum vs. \(\lambda\) as a function of the number of shots. Logarithmic scale. reflectivity and spectral selectivity.