## 6 Soft X-Rays: Virtual Spectrometer  
The limiting factors concerning the spectral resolution of the PES are the natural linewidth of the target gas and the instrumental broadening of the flight tubes that increases with higher electron kinetic energy. This constraint can be circumvented by using the correlation between the gas-based online diagnostics and the GS measurements as was shown in the proof-of-principle study in ref. [8]. The concept is to collect data simultaneously from the GS and the PES previous to the experiment and perform a fit using a regression model to infer the GS only from the pulse-resolved data. After the fit, a model may be used to obtain a higher-quality spectrum from the PES non-invasively at MHz repetition rates. However, such an idea involves a significant amount of data analysis, and it is hard to automate for operations. Developments have been made using further mathematical techniques to automate and streamline the procedure, including full-resolution characterization using European XFEL data under several beam conditions. The final system has been named the Virtual Spectrometer (VS) and has been deployed in a European XFEL control environment [39]. Ref. [40] describes the VS, which includes the online estimate of the resolution, uncertainties, as well as continuous data quality checks. Additionally, the VS avoids the need for a separate calibration of the PES. Figure 6a presents one single-pulse TOF spectrum for the Ne 1s photoelectron at about \(1000\,\mathrm{eV}\) for six detectors with a digitizer configured to \(2\,\mathrm{GSs^{-1}}\). The photoelectron kinetic energy is about \(130\,\mathrm{eV}\). The calibration function converts the scale from TOF to photon energy. Indeed, the plots in Figure 6b are each meant to represent the spectral distribution of the same pulse. The discrepancies between the detectors can be attributed to non-identical components for signal electronics that contribute to electronic noise and imperfections in flight tube geometry that can lead to non-uniform detection efficiency. The VS model takes advantage of the wealth of information from all available detectors and reconstructs the spectrum with high fidelity to the actual spectral distribution as is seen in Figure 6c (red line), including  
Figure 5: xxPES two-color operation with Ne 1s. (**a**) Flight tubes at \(157.5^{\circ}\), \(180^{\circ}\) and \(202.5^{\circ}\) are set to \(-60\,\mathrm{V}\) for higher photon energy. Flight tubes at \(22.5^{\circ}\), \(0^{\circ}\) and \(337.5^{\circ}\) are set to \(-20\,\mathrm{V}\) for lower photon energy. \(\vec{z}\) indicates the polarization vector. (**b**) Sum of single pulse spectral distribution registered at the two detector groups with undulator sections tuned to \(945\,\mathrm{eV}\) and \(905\,\mathrm{eV}\), respectively. This data set was collected in single-bunch mode, which enables us to compare the spectra with the GS for both colors. the energy calibration. In addition to TOF data from the digitizers, the model also uses the single-shot pulse-energy data provided by the XGM, which is helpful extra information for the model to take into account non-linear dependence on pulse energy. The reconstructed spectrum is based on a total of 12 detectors, whereof 6 are presented. Comparison with the GS (green dashed line) convolved with a Gaussian distribution of width given by the estimated resolution of the VS for that pulse (full width half maximum 0.91 eV), which was not included in the training data set, demonstrates the validity and reliability of the method. Four spikes with <2 eV separation are clearly resolved that cannot be discerned from only the PES data. The uncertainty band, that is based only on noise and is not related to the resolution, corresponds to a 68 % confidence level. Systematic resolution studies have been performed in ref. [40], demonstrating significantly improved resolution obtained with the VS compared with traditional calibration.