Publisher Correction: Control of laser plasma accelerated electrons for light sources

The original version of this Article contained an error in the last sentence of the first paragraph of the Introduction and incorrectly read 'A proper electron beam control is one of the main challenges towards the Graal of developing a compact alternative of X-ray free-electron lasers by coupling LWFA gigaelectron-volts per centimetre acceleration gradient with undulators in the amplification regime in equation 11, nx(n-β) x β: n the two times and beta the two times should be bold since they are vectorsin Eq. 12, β should be bold as well.' The correct version is 'A proper electron beam control is one of the main challenges towards the Graal of developing a compact alternative of X-ray free-electron lasers by coupling LWFA gigaelectron-volts per centimetre acceleration gradient with undulators in the amplification regime.'This has been corrected in both the PDF and HTML versions of the Article.

T he capacity of plasma waves to produce and sustain extremely strong electric fields gave rise to a high interest for plasma-based electron acceleration 1 . In the past decade, the concept of laser wakefield acceleration (LWFA) has become a reality [2][3][4] . Worldwide efforts presently aim at improving LWFA performance, targeting applications, such as undulator synchrotron radiation 5,6 , free electron lasers [7][8][9] , intrinsic betatron radiation 10 , ultrafast electron diffraction sources 11 and even highenergy colliders 12 . In modern LWFA schemes, a high-power femtosecond laser is focused into a gas target and resonantly drives a nonlinear plasma wave. The charge-separation fields in such waves are much larger than in the radio-frequency cavities of conventional accelerators. Being able to trap the ambient plasma electrons, plasma fields accelerate them to hundreds of megaelectron-volts over few millimetre distances [13][14][15] . The characteristics of the produced electron beams strongly depend on how they are injected into the accelerating plasma structures. Depending on the desired application, the LWFA can be based on self injection [2][3][4]16,17 , on triggering local injection using an auxiliary laser pulse 18,19 or by creating sharp plasma density transitions [20][21][22] . The localised injection requires more complicated setups but can significantly improve beam quality in terms of energy spread and divergence. In both configurations, the ionisation injection [22][23][24][25][26] , which uses a gas with a mixture of low and high atomic number ions, enables an improvement in the source stability 22,27 , but may also lead to a higher energy spread. By guiding the laser pulse at high intensity over a longer distance, high-energy electrons are obtained 28 . Experimentally, robust operation of LWFA, with all state-of-the-art beam characteristics (multi-gigaelectron-volt energies, hundreds pico-Coulomb charge, sub-percent energy spread and sub-milliradian divergence) remains extremely challenging. Moreover, the transport of such beams holds nontrivial complications, since beams with large energy spread and divergence develop a chromatic behaviour, that leads to a dramatic growth in emittance [29][30][31][32] and consequently beam quality degradation in the transfer lines. While conventional accelerators deliver microradian divergence and per mille of energy spread beams, the quality issues of LWFA require specific electron beam manipulation in order to fit the FEL application requirements, in particular to handle the large initial divergence with conventional permanent magnet quadrupole type 5,6,[33][34][35] or plasma-based [36][37][38][39] focusing devices, and to mitigate the energy spread with magnetic chicanes for beam decompression [40][41][42] or transverse gradient undulators 43 . A proper electron beam control is one of the main challenges towards the Graal of developing a compact alternative of X-ray free-electron lasers by coupling LWFA gigaelectron-volts per centimetre acceleration gradient with undulators in the amplification regime.
Here we show that the LWFA beam properties can be controlled thanks to a dedicated transfer line comprising multiple magnetic devices 44 . The variable strength quadrupoles handle beam divergence and control its chromatic focusing along the beamline. A special alignment strategy was developed for separate correction of beam dispersion and position, and mitigation of pointing fluctuations. A slit equipped magnetic chicane decompresses the beam and selects the desired energy range. We finally matched this shaped electron beam to successfully produce undulator radiation.

Results
Concept and configuration. A schematic of the manipulation line is shown in Fig. 1 (see Methods section for details of the equipment). The LWFA is operated in the ionisation injection mode, preferred for the sake of its simplicity and robustness to long term (several hours) operation. A Ti:Sapphire laser system delivers 1.5 J, 30 fs full width at half-maximum (FWHM) pulses focused into the supersonic jet of He and N 2 gas mixture. Electron beams of up to a hundred pico-Coulomb are produced in a broad energy spectrum spanning from few tens up to~250 MeV with few milliradians divergence. This large divergence is rapidly handled via strong focusing using a first set of removable permanent magnet quadrupoles, located 5 cm downstream from the gas jet. A magnetic chicane then longitudinally stretches the beam, sorts electrons in energy and selects the energy range of interest via a removable and adjustable slit mounted in the middle of the chicane. The second set of quadrupoles matches the beam inside an in-vacuum undulator that creates a periodic magnetic field (period λ u = 18 mm, period number N u = 107). Several scintillator screens can be inserted along the line to image the electron beam in the transverse plane 45 . Transfer line components and LWFA laser are aligned within ±100 μm on the same reference axis using a laser tracker.
Passing through the undulator, the beam produces synchrotron radiation with a spectrum, which typically consists of a series of lines at the so-called resonance wavelength λ r and its harmonics (order n), given by λ r ¼ λ u ð1 þ K 2 u =2 þ γ 2 θ 2 Þ=ð2nγ 2 Þ, K u being the deflection parameter proportional to the peak magnetic field and period, γ the Lorentz factor and θ the observation angle 46 . The line is tuned for a reference energy of 176 MeV, corresponding to a λ r = 200 nm on-axis radiation for K u = 1.8 achieved for the 5 mm gap. The undulator radiation lines present a homogenous FWHM linewidth Δλ hom being given by Δλ hom =λ r ' 0:9=N u , i.e. 0.8% in this case. But a large energy spread σ γ induces an inhomogeneous broadening Δλ σ γ =λ r ' 2σ γ =γ which can completely dominate the homogeneous linewidth (by a factor 50 for 20% energy spread). The effective energy spread of electrons, and thus the radiation linewidth, can be reduced by inserting an adjustable width slit in the chicane.
LWFA electron beam. Figure 2a shows an electron beam spectrum, measured right after the gas jet, by inserting a spectrometer when the permanent magnet quadrupoles are extracted from the beamline. It exhibits a broad energy spectrum. The vertical divergence σ ′ z is analysed by slice because of the energy dependence, and the average value is found to be 4.5 mrad root mean square (RMS) with a standard deviation of 0.3 mrad over 20 shots. The slice divergence in the energy range of 176 ± 5 MeV is 3.5 mrad RMS with a standard deviation of 0.2 mrad over 20 shots. The electron beam transverse distribution measured on the first screen (Fig. 2b) provides an average horizontal divergence σ ′ x of 12.1 mrad RMS with a standard deviation of 0.5 mrad and σ ′ z of 7.1 mrad RMS with a standard deviation of 0.2 mrad. This larger vertical divergence results from the low energy electrons that are not captured by the spectrometer. As revealed in Fig. 2c, d, significant pointing fluctuations (2.2 mrad RMS) are observed and can be attributed to the intrinsic features of the LWFA source.
Divergence handling. A first triplet of strong permanent magnet quadrupoles, called QUAPEVA, ensures a strong focusing of the large electron beam divergence. Conventional quadrupolespermanent magnet based for high gradient delivery-were preferred to plasma lenses for the sake of simplicity, flexibility, reliability and large possible demagnification. QUAPEVAs, unlike usual permanent magnet based focusing systems 5,6,34,47 , can vary their gradient strengths by a factor 2 48-50 thanks to a special design combining a Halbach type quadrupole surrounded by rotating cylindrical magnets. They are also equipped with motorised translation plates for magnetic axis adjustment in both transverse directions. With the QUAPEVA triplet inserted, the projected transverse size is reduced from 6 to 2 mm RMS in the horizontal plane and from 3.5 to 1 mm RMS in the vertical plane ( Fig. 3a, d). Assuming an on-axis point source, the physical aperture of the QUAPEVAs let pass through more than 85% of the beam charge (Fig. 4c, d) and the transport line naturally filters the low energy electrons (Fig. 4). While the QUAPEVAs provide a strong focusing, they also permit to freeze the total-emittance growth at the exit of the triplet. The slice emittance around 176 MeV for ±5 MeV slice is typically increased from 1 to 92 (H) and 30 (V) (π.mm.mrad) due to the large initial divergence but remains then unaffected along the line. The focused beam, both measured and simulated, also exhibits a cross-like shape which results from chromatic effects (Fig. 3b, e). Indeed, the low energy electrons are focused horizontally while the high-energy ones are focused vertically (Fig. 3c, f). The transport relies on a source-toimage optics in which the focusing magnification depends on the energy range (Fig. 4a, b) (see Methods section).
Beam alignment along the line. To progress further down the line, while maintaining the beam quality, large orbit deviations and dispersion must be reduced to minimise the beam distortions in the undulator. Both can appear due to a misalignment of the magnetic elements with respect to the electron beam axis, resulting either from a defect of initial position of the equipment (in particular the QUAPEVA) or from systematic and random shifts of the electron beam pointing. While in some cases this electron steering issue can be addressed using magnetised plasma guiding 37,38,51 , a specific beam pointing alignment compensation (BPAC) strategy, taking advantage of the motorised translations of the QUAPEVA, is here implemented. The horizontal and vertical response matrices A x (s) and A z (s) of the system, at a position s along the line, that link the beam position and dispersion to the transverse offset of the magnetic centre of the three QUAPEVAs, are solved (see Methods section). The proper positions of the quadrupole magnetic centres are tuned to independently minimise the transverse offset and the dispersion according to the required correction on a given screen in both planes. This procedure is illustrated in Fig. 5 for two positions along the line. In the middle of the chicane, where a strong horizontal dispersion is produced, the vertical dispersion is corrected ( Fig. 5a) (tilted beam in position I rotates towards position II). A ±400 μm maximum correction of QUAPEVA transverse displacement mitigates the residual alignment errors of the quadrupoles and a change of the electrons pointing. Then, on a daily basis, adjustments remain within 10-150 μm. Further steps of BPAC include optimisation of the beam on the downstream screens before and after the undulator. The horizontal dispersion is then corrected on the screen located in front of the undulator  Fine tuning of the focused energies. As a final control step, the variable gradient of the QUAPEVA allows for the fine tuning of the electron beam focusing. Minor tuning of quadrupole strength (decrease of the second QUAPEVA strength by 1.5% from the model) enables the beam shape optimisation from a cross-shaped profile (Fig. 6a) to a small round spot on the screen placed after the undulator (Fig. 6c). Numerical analysis demonstrates that the cross-shape results from electrons being focused at different planes according to their energies, as illustrated in the phase-space representations. Measurements and simulations are similar; the tilt of the cross results from a remaining QUAPEVA skew quadrupole. Furthermore, for a well-focused beam, a strength scan of all quadrupoles (QUA-PEVA and electromagnetic quadrupoles) along the line by the same ±2% amount permits to select the focused energies while keeping the electron beams well centred on the screen with the same size ( Fig. 6b-d).
Following the above strategy, the electron beam is properly handled all along the line. The measured beam transverse distributions (Fig. 1, upper images) correspond indeed to the simulated ones (Fig. 1, lower images).
Photon observation. The shaped electron beam is suitable for the observation of the undulator synchrotron radiation with a camera installed under vacuum at the end of the line. Figure 7a, b display the transverse profiles of the radiation measured and simulated (see Methods section) without the slit: they are similar in terms of both signal level and profile shape. Simulations indicate that the physical acceptance of the beamline, defined by the vacuum MeV from the initial broad energy spectrum (Fig. 7c), leading to a reduction of the energy spread down to 30% RMS. When the 4 mm slit is inserted, the energy spread decreases to 8% RMS. A charge up to 17.4 pC, without the slit, is transported through the undulator closed at gap 5 mm. With the slit inserted, this charge drops to 5.2 pC. The resonant wavelengths corresponding to the electron beam energy range are displayed in Fig. 7d. For example, for a gap g = 5 mm, λ r spans from 98 to 358 nm without the slit, and is reduced to 161-230 nm range with the slit inserted. With larger gaps, the deflection parameter decreases as K u / exp Àag=λ u þ bg 2 =λ 2 u À Á with a and b constants, and λ r is reduced (see Methods section). Thus, opening the gap produces two effects: the decrease of the total radiation power, P / K 2 u , and a blue-shift of the produced spectrum, λ r / ð1 þ K 2 u =2 þ γ 2 r θ 2 Þ. Figure 7e shows measurements of the integrated camera signal vs. gap above 150 nm (due to the optics system transmission), applying several spectral bandpass filters. When opening the gap, the signals decrease, both for measurements and simulations. In the case when the electron beam is not spectrally filtered (black stars), the camera receives the on-axis and the red-shifted off-axis radiation, associated with the resonant wavelengths and its harmonics. The signal follows qualitatively the dependence of the undulator total power, decreasing as the intensity collected in the detection spectral range. The measurements with the bandpass filtered inserted (coloured markers) provide a further insight on spectral behaviour. With 253 and 300 nm filters mainly off-axis light is collected, exhibiting a similar gap dependance as the total power. Alternatively, with the 200 nm narrow-band filter on-axis (at low gaps) and off-axis radiation is seen, leading to slightly different evolutions vs. gap. At 5 mm gap the camera collects the purely on-axis 200 nm light. While at 6 mm gap, the resonant wavelength decreases, the 200 nm filter band gets the red-shifted off-axis radiation whose intensity is larger than the on-axis one 46 resulting in a maximum on the gap curve (Fig. 7e). All these features clearly demonstrate the synchrotron radiation nature of the light emitted and, according to simulations, the full number of photons per beam charge at the exit of the undulator can be estimated as N ph ≈ 3 × 10 7 pC −1 .

Discussion
In conclusion, we have shown that the LWFA electron beam properties can be manipulated through an adequate transport line, mitigating the performance that do not meet the one of state-of-the-art conventional accelerators for some-specific applications. This electron beam control is not restricted to LWFA, but could be of interest for various advanced accelerating techniques. These results pave the way for further merging of novel and conventional accelerator techniques towards future applications, such as the new generation of colliders, requiring stages of LWFA accelerating modules or free electron laser applications, relying on more optimised LWFA performance that are progressing very fast.

Methods
Electron generation. A 60 TW, 800 nm, 30 fs FWHM Ti:Sapphire laser, managed by the Laboratoire d'Optique Appliquée team in "Salle Jaune," is focused on a 12 × 15 μm 2 FWHM spot into a supersonic jet filled with a gas mixture (99% Helium, 1% Nitrogen). The precision of the laser alignment is within 10 μm in position and 10 μrad in angle. The electron beam generation is optimised thanks to a first electron spectrometer, located 355 mm from the gas jet, consisting of a removable permanent magnet dipole (1.1 T field, 10 cm length) in conjunction with a phosphor screen imaged on a CCD camera, providing a spectral resolution varying between 2.7 and 3.8% between 50 and 280 MeV. During experiments, electrons are generated, aiming at a 176 MeV reference energy, over a broad energy range. Over 422 recorded shots during 1 month of experiments, σ ′ x (respectively σ ′ z ) = 12.6 (5.6) mrad RMS with a standard deviation of 1.8 (1.5) mrad are measured on the first screen. These large values mainly reflect the contribution of the low energy electrons. The energy distribution obtained with the electron spectrometer ranges from 50 to 280 MeV, and the slice vertical divergence, deduced from the spectrometer, has typical values of 3.9 mrad at 100 ± 5 MeV, 3.2 mrad at 150 ± 5 MeV and 2.9 mrad at 200 ± 5 MeV. The slice horizontal divergence is deduced from the average horizontal divergence (σ ′ x ¼ 12:1 mrad), measured on the first screen without QUAPEVAs, normalised by the ratio of the slice vertical divergence measured with the spectrometer, over the average divergence measured on the first screen (σ ′ z ¼ 7:1 mrad). Typical horizontal divergence values are: 6.6 mrad at 100 ± 5 MeV, 5.4 mrad at 150 ± 5 MeV and 4.9 mrad at 200 ± 5 MeV.
Equipment of the transfer line. The equipment used in the transfer line have been designed and prepared at Synchrotron SOLEIL.
Magnetic elements: all the magnetic elements have been designed using RADIA 52 and TOSCA 53 codes. After construction, they have been measured. Their fiducial references taken on the magnetic measurement bench have been reported on the installed transfer line thanks to a FARO Vantage laser tracker.
The QUAPEVA 50 , developed in the frame of a SOLEIL/Sigmaphi collaboration, consists of two parts: an inner hybrid Halbach type quadrupolar ring 54 surrounded by four cylindrical magnets screened by poles, the gradient being varied by rotation of these magnets around their axis. A gradient up to 210 T m −1 with a 50% tunability for a bore diameter of 10.5 mm can be reached, while containing reasonably the harmonic content. The installed triplet enables an operation between 176 and 400 MeV. The gradient and multipolar systematic terms measured with three different methods (stretched wire 55 of relative precision of 6 × 10 −4 , rotating coil of relative precision of 8 × 10 −356 , pulse wire 57 ) correspond to the expectations from the models. The residual excursion of the magnetic centre for the gradient adjustment method (by rotating the four cylinders of the outer quadrupole in the same direction) remained in the 100 μm range, and was compensated by embedded correction tables applied on translation stages. The gradient is controlled within 0.5% mechanical precision of magnetic cylinder repositioning, the stretched wire measurement precision being much lower.
The magnetic chicane consists of four water-cooled dipoles manufactured by SEF providing 0.55 T when powered at 150 A (Sigmaphi Electronics bipolar power supplies, 8 V, 30 ppm, calibrated at SOLEIL) for 25 mm yoke gap. The electron beam dump dipole powered at 300 A provides 0.84 T. All dipoles have been measured on a SOLEIL magnetic measurement bench including a Hall probe system (consisting of three single-axis Hall probes (FW Bell GH-701) with a 1 V T −1 sensibility) and a rotating coil (a 20 turn 3.5 m long coil made of a 0.1 mm diameter copper wire, reproducibility of 1.5%). The field measurements of one of the dipoles at 150 A with two other systems (a Group3 Teslameter and a Metrolab PT2025 NMR system) show an agreement of 10 mT, corresponding to a relative error of 1.8%, which can be explained by the relative position and orientation of the different probes, and by the hysteresis influence.
A removable aluminium slit of variable width (up to 4 mm) is inserted, in the middle of the chicane, at 32 ± 0.5 mm horizontal position corresponding to the 176 MeV energy, the positioning error resulting from the mechanical tolerances of the different parts.
The electromagnetic quadrupoles, manufactured by SEF, have been measured at SOLEIL with a 0.33% relative accuracy.
The 2 m long 18 mm period cryo-ready undulator, equipped with Pr 2 Fe 14 B magnets and Vanadium Permendur pole, has been developed at SOLEIL. For simplicity of infrastructure, it is operated for the experiment at room temperature, without Nitrogen cooling. In such a case, the peak magnetic field reaches 1.11 (respectively 1.005) T at 5 (respectively 5.5) mm gap, corresponding to a resonant wavelength at 200 nm for an electron beam energy of 176 (respectively 164) MeV. At 5 mm gap, 160 MeV are resonant at 243 nm, and 170 MeV at 215 nm. The magnetic field is known at 0.2%, resulting from the Hall uncertainties of calibration. The undulator deflection parameter dependence vs. gap is fitted using first harmonic of the measured magnetic field leading to: K u / exp Àag=λ u þ bg 2 =λ 2 u À Á with a = 3.54 ± 0.05 and b = 0.22 ± 0.05. Electron and photon diagnostics: the four electron beam imagers installed along the line consist of a scintillating screen mounted on a motorised stage for insertion on the electron beam axis, of imaging optics and of a camera. The screens are backside imaged. On the first imager (LWFA exit), a LANEX type screen protected by a 75 μm black ionised aluminium foil is used together with a pair of simple focusing lenses and a 12 bit Basler scA640 CCD camera. The magnification ratio (0.12 and 0.17, respectively in the horizontal and vertical plane) together with the screen leads to a resolution of about 150 μm. For the downstream imagers, a LANEX or YAG:Ce screen protected by a 25 μm black ionised Aluminium foil can be inserted while the imaging optics is a commercial objective (f/2 100 mm focal length ZEISS MACRO or f/2.8 105 mm focal length SIGMA MACRO) and the camera is a 16 bit ORCA Flash 4.0 cMOS from Hamamatsu. The magnification ratio (0.35 and 0.5, respectively in the horizontal and vertical plane) together with the screen grain size allow to reach a resolution of 100 μm using a LANEX and of 30 μm using a YAG:Ce.
For beam charge measurements, the line is equipped with two Turbo Integrating Current Transformers (T-ICT) from Bergoz (specified for 10 fC noise), one after the electron generation chamber and a second one at the undulator exit 45  undulator has been calibrated with the measurement performed with the second ICT, which has been calibrated by the supplier BERGOZ, leading to a conversion of 1.5 × 10 7 counts pC −145 . The agreement with the absolute calibration 59-61 , is found within a factor 2. The undulator radiation was imaged with a Princeton Instruments PIXIS XO 2048 B camera, located directly under vacuum at the exit of the line, with a 75 mm fused silica biconvex lens (Newport SBX052) in front of it, limiting the detected wavelengths above 150 nm. Bandpass filters from Edmund Optics were employed for spectral selectivity (a filter centred at 200 nm (16% transmission) with a 10.2 nm FWHM width, a filter centred at 254 nm (30% transmission) with 40.8 nm FWHM width, and a filter centred at 300 nm (32% transmission) with a 46.2 nm FWHM width).
Modelling. Electron beam modelling: limited to the first order, the propagation of an electron through a magnetic system can be represented with a matrix formalism: X(s) = R ⋅ X(0), where X(s) = (x(s), x ′ (s), z(s), z ′ (s), ζ(s), δ = ΔP/P 0 ) is the sixdimensional phase-space vector that describes the electron positions and momenta at any position s along the trajectory and R is a 6 × 6 matrix that represents the magnetic line with R = R(n)⋯R(1)R(0) the product of the individual transport matrix of the elements of the line (i.e. drift, quadrupoles, bendings, etc.).
The transport relies on a source-to-image optics. In the case of a monoenergetic electron beam, a first estimate of the demagnification factor due to the QUAPEVA focusing is given by σ f = σ i × R 12 /D with σ f (σ i ) the focused (unfocused) beam size, For laser plasma acceleration beams presenting broad energy distribution and large divergence, the contribution of the chromatic emittance cannot be neglected, as usually done in the case of conventional accelerators. The phase-space emittance, limited to a drift space, is expressed as 30,66 with ε n0,x the initial normalised emittance of the beam, p x the horizontal momentum, σ δ the energy deviation and s the distance from the source. For large divergence and energy spread, the second term becomes dominant.
In the trace-space 67 , the emittance at undulator centre in the supermatching case can be expressed up to the second order in energy deviation as 41 : x the divergence, R 11 the transport matrix elements linking the positions, R 126 the one linking the position to the transverse momentum and the energy deviation 68 . In the case of ±1 mrad divergence for which the transport line has been initially design (see Fig. 4), the trace-space emittance remains the same for the ±1 MeV slice and is contained to a factor 3 in vertical for the ±5 MeV slice. The magnetic defects (QUAPEVA remaining skew and dodecapole components) start to affect the emittance (via the first term of the equation) for divergences greater than 2 mrad. With the experimental 5.3 (3.1) mrad horizontal (vertical) divergences, the emittance grows via the chromatic term. The increase of the total emittance at the exit of the QUAPEVAs leads to a degradation of the transverse beam brightness by a factor 92 horizontally and 30 vertically (see Table 1 and see Fig. 8), while the slice emittance (slice of ±1 MeV around 176 MeV) increases by a factor 58 (15) horizontally (vertically), indicating that the slice emittance associated to a given energy of interest is kept smaller. These chromatic effects could even be turned into an advantage for an FEL amplification application along the undulator when adopting a chromatic matching optics 41 where only a slice of a given energy is of interest. Electron BPAC modelling: a conventional beam-based alignment (BBA) of magnetic elements would consist in varying the gradient while changing the magnetic axis of a quadrupole which would align the electron path along the magnet centre but not necessarily the electron path along the axis of the transfer line 69 . An empirical BBA technique with electron beam energy variation has been employed for single-pass free-electron lasers 70 . The proposed BPAC method consists in compensating the initial pointing of the electron beam and QUAPEVAs with respect to the line, thanks to the QUAPEVA magnetic centre resettings. In order to apply the BPAC, one needs to numerically compute the response matrix of the line linking the position and dispersion of the beam to the transverse offset of the QUAPEVAs. The transport of the beam is done numerically by applying in a first step, a transverse offset ΔZ i = (Δx i , Δz i ) to the magnetic centre of the QUAPEVA i in consideration for the case of an ideal beam without energy dispersion (i.e. δ = 0), and in a second step, by considering an electron beam with a given energy dispersion δ ≠ 0: The induced orbit (x i (s), z i (s)) and dispersion (D x,i (s), D z,i (s)) due to the misalignment of the QUAPEVA i at any position s along the line are equal to: where <> is the average over the entire electron bunch. From Eqs. (3)(4)(5)(6), the response matrix A x,z (s) of the transport line can be expressed as: where Δx i , Δz i are the QUAPEVAs transverse offset. By solving Eqs. (9,10), one can deduce the transverse offset to apply to the QUAPEVAs to correct independently the orbit and dispersion deduced from beam positions and profiles on the given screens. The under-determined system is solved by means of a least square methods and exhibits very small residual orbit and dispersion slopes at the exit of the permanent quadrupoles making it almost valid for all screens.
Modelling of the undulator radiation: simulations of undulator radiation are performed using LWFA test particle beam with a broad energy spectrum (see dotted curve in the inset of Figs. 7c), 0.5 mm.mrad emittance, 3 mrad vertical and 5 mrad horizontal divergences. The 12,000 test particles are propagated in the undulator with Δs = λ u /50 steps, using the second order Boris method 71 . Orbits are recorded and integrated to compute the spectral-angular distribution of radiation energy using classical far-field approach (see ref. 72  with ε 0 the vacuum permittivity. It has been checked that similar results are found with the more accurate near-field model given by 73 : Simulations presented in Fig. 7 are modelled in far-field approximation, as it is less sensitive to the issues related to the finite integration limits. Beam transport until the undulator is simulated with the OCELOT tracking code, which was modified to enable the large spectra beam modelling, and the orbits inside the undulator and emission is calculated with help of the dedicated modules of the home-made code CHIMERA 74 .
To reproduce the measurements, the simulated spectra are treated with the optics characteristics, i.e. quantum-efficiency curve of camera, transmission of the band-pass filters and of the lens.
Data availability. The data that support the findings of this study are available from the corresponding authors upon reasonable request.