## 3 Results and Discussion
### Terawatt-Attosecond Hard X-ray Pulse Generation
At each of the following amplification stages, the target pulse is aligned with a fresh current spike (i.e., the 2 nd, 3 rd, 4 th, and so on) using  
Figure 3: (**a**) The current modulation of a 10 GeV electron beam for hard X-ray amplification; the black-dashed line shows the spoiled section of the current profile and the red-dashed line shows the unspoiled section. (**b**) The longitudinal phase space plot showing energy modulation of the electrons along the electron bunch after the interaction with the optical laser (Figure 1a). the electron-beam delay unit. Figure 4b shows the snapshot of the radiation pulse after 8 UMs. After 8 UMs, we get one dominant radiation spike with a few weak neighboring radiation spikes. The snapshot of the radiation after 13 UMs in a uniform undulator is shown in Figure 4c. After the 13 th UM, we obtain a 0.55 TW and 130 attosecond radiation pulse at a photon energy of 12.4 keV in a 75 m long uniform undulator. This power corresponds to 0.1 mJ energy (or \(5\times 10^{10}\) photons) per pulse. As the amplification progresses, the resonant condition is gradually broken. The undulator strength parameter K may need to be tapered to maintain the resonance condition as the electron beam loses its energy [35]. Initially, up to 47.4 m long, the energy loss was not severe. Thus, we considered tapering in the last part of the undulator. For each undulator module, K value was optimized to maximize the power. Figure 4d shows the result of tapering optimization: the radiation profile after 13 UMs in a tapered undulator. The radiation power was doubled, up to 1.2 TW, by applying the tapering from UM9 to UM13, within a 75 m long undulator without any other modification. High peak currents suffer from the energy spread and the major energy loss occurs at the current spikes to which the target radiation spike is seeded. By choosing a tapering to compensate the degradation of the seeded current spike, we preserve the resonance condition in that region and partially suppress the amplification at the neighboring current spikes due to the off-resonance condition. The ideal tapering profile is a smoothly varying function of undulator length. However, a stepwise undulator tapering is considered here along UM9-UM13 modules, maximizing the output power. The stepwise tapering is shown in Figure 5a. First, UM1-UM8 undulator modules have the same K parameter K\({}_{0}\). The modules UM9-UM13 belongs to the exponential regime of radiation amplification. Therefore, K is adjusted to decrease sharply along the undulator. The undulator parameter K\({}_{n}\) of the nth undulator module can be described as  
\[\mathrm{K}_{n}=\left\{ \begin{array}{c}\mathrm{K}_{0},\;n\leq k\\ \mathrm{K}_{0}-a(n-k)-b(n-k)^{2},\;n>k\end{array} \right. \tag{1}\]  
Figure 4: The radiation amplification along the undulator for hard X-ray case. Snapshot of the radiation pulse (**a**) after 3 UMs; (**b**) after 8 UMs; (**c**) after 13 UMs in a uniform undulator; and (**d**) after 13 UMs when a tapering is considered in UM9-UM13. A single isolated 130 attosecond FWHM, 1.2 TW radiation pulse is obtained in a tapered undulator. where K\({}_{0}\) is the initial undulator parameter, k is the segment number at which the tapering starts, and a and b are the coefficients obtained by multidimensional scans that maximize the radiation power. The optimal values for hard X-ray case are plotted in Figure 5a with K\({}_{0}\) = 1.9728 and k = 8. Figure 5b shows the growth of the electron-beam energy spread. The green curve shows the initial energy spread due to the current modulation by the ESASE section prior to the undulator entrance. The red curve shows the growth of the energy spread after 13 UMs in the uniform undulator case and the blue-dotted curve in the tapered undulator case. One can see that some of the current spikes are still reusable due to the small energy spread. Therefore, the radiation power can be further increased if more units are added.