## 5 Attosecond Pulse Shaping with an Arbitrary Number \(N\) of Phase-Locked Harmonics
For instance, if harmonics H\({}_{k+1}\), H\({}_{k+2}\), and H\({}_{k+3}\) (H\({}_{k-1}\), H\({}_{k}\), and H\({}_{k+1}\)) are to be optimized to obtain a phase difference \(\Delta\varphi_{k+1,k+2,k+3}\) (\(\Delta\varphi_{k-1,k+1}\)) after the optimization of H\({}_{k}\), H\({}_{k+1}\), and H\({}_{k+2}\), the phase shifter PS\({}_{k+2}\) (PS\({}_{k-1}\)) must be used and not PS\({}_{k+1}\) (PS\({}_{k}\)). A particular sequence does not need to be followed in optimizing each set of the three harmonics. The phase difference \(\Delta\varphi_{i,i+1,i+2}\,(i=1\) to \((N-2)\)) terms and the amplitudes of the harmonics measured in the absence of the NIR field can be implemented to reconstruct the attosecond waveforms using the following equation:  
\[I(t)\propto\sum_{i=1}^{N}(F_{i}f(t))^{2}+\sum_{i\
eq j,l<j}^{N}2F_{i}F_{j}f^{ 2}(t)\cos[(j-i)\omega_{\text{UV}}t+\varphi_{i,j}] \tag{8}\]  
where:  
\[ \begin{split}\varphi_{i,j}&=(\varphi_{j}-\varphi _{i})=(j-i)\bigg{(}\varphi_{1,2}+\sum_{l=1,i\geq 2}^{i-1}\varphi^{l}\bigg{)}+ \bigg{(}\sum_{m=1}^{(j-i)}(j-i-m)\varphi^{i+m-1}\bigg{)}\\ \varphi_{1,2}&=\chi-\sum_{k=1}^{N-2}\bigg{(}\frac{ N-k-1}{N-1}\bigg{)}\varphi^{k}\\ \chi&=\frac{\varphi_{N}-\varphi_{1}}{N-1}\end{split}  \tag{9}\]  
here \(\varphi^{l}=\Delta\varphi_{l,l+1,l+2}\). Equation (9) can be implemented in the reconstruction of waveforms in the experiments where only phases proportional to the GDD are accessible. The experiment showed that one can successfully operate with four consecutive harmonics. Increasing this number to six is possible at FERMI in terms of hardware, and it will be investigated in future beam times. In experiments with a harmonic comb with six harmonics, the maximum energy acceptance of the time-of-flight spectrometer and its energy resolution should be considered. In order to overcome this limitation, time-of-flight spectra with good energy resolution in different energy ranges could be acquired sequentially, and the relative phases between groups of three consecutive harmonics could then be retrieved; for instance, if harmonics H\({}_{i}\,(i=7-12)\) are generated, initially, the spectrometer can be optimized to collect the photoelectrons generated by harmonics H\({}_{7}\), H\({}_{8}\), H\({}_{9}\), and H\({}_{10}\). Implementing the CoBRA technique, phase differences \(\varphi^{i}\,(i=7,8)\) can be obtained. Subsequently, the spectrometer can be optimized to collect photoelectrons ionized by harmonics H\({}_{9}\), H\({}_{10}\), H\({}_{11}\), and H\({}_{12}\) and follow the same procedure to calibrate the phase differences. From the two sets of acquisitions, attosecond waveforms can be reconstructed. A shortest attosecond pulse of \(\approx 130\) as FWHM was estimated from our simulations based on SFA with a seed laser of wavelength \(264\) nm. Another important aspect is the temporal separation between the individual pulses in the pulse train. The time separation between individual attosecond pulses in the train is related to the energy separation between two consecutive harmonics. Changing the seed laser wavelength in the presently available range for the seed (230 nm-360 nm) at FERMI would allow changing the time separation in the range between 0.7 fs and 1.2 fs. A shorter separation can be achieved by setting the undulators of the FEL to alternate harmonics (e.g., \(q=6,8,10\)). While not yet possible at FERMI, spike separations up to tens of femtoseconds are technically attainable by seeding at a much longer wavelength. The seed laser used in the experiment (264 nm) reflected a pulse separation of \(\approx\)880 as.