Focal Spot and Wavefront Sensing of an X-Ray Free Electron laser using Ronchi shearing interferometry

The Linac Coherent Light Source (LCLS) is an X-ray source of unmatched brilliance, that is advancing many scientific fields at a rapid pace. The highest peak intensities that are routinely produced at LCLS take place at the Coherent X-ray Imaging (CXI) instrument, which can produce spotsize at the order of 100 nm, and such spotsizes and intensities are crucial for experiments ranging from coherent diffractive imaging, non-linear x-ray optics and high field physics, and single molecule imaging. Nevertheless, a full characterisation of this beam has up to now not been performed. In this paper we for the first time characterise this nanofocused beam in both phase and intensity using a Ronchi Shearing Interferometric technique. The method is fast, in-situ, uses a straightforward optimization algoritm, and is insensitive to spatial jitter.

and its aperture is large enough to capture the full beam. Therefore, it routinely creates the highest peak X-ray intensities of the facility, estimated to be in the order of 1 × 10 20 W/cm 2 . It has been used in many fluence dependent experiments such as the formation of hollow atoms 22 , anomalous nonlinear X-ray Compton scattering 23 , and radiation damage studies on protein microcrystals 24 . In the experiment presented here, the LCLS beam, with a photon energy of 7.2 keV was focused with the KB-mirror pair, which has focal lengths of 900 mm in the horizontal direction, and 500 mm in the vertical direction. A one dimensional diffraction grating, (i.e. the Ronchi target) is placed 9.3 mm downstream of the X-ray focal plane. An X-ray detector is placed 982 mm downstream of the Ronchi target. A conceptual sketch of the setup can be seen in Fig. 1.
Ronchi gratings were fabricated on 4 μm thick polished diamond membranes (Diamond Materials GmbH). An 8 nm layer of Ti was evaporated on the diamond, and 150 nm hydrogen silsesquioxane (HSQ) resist was spun on top of the Ti. Electron beam lithography was performed using a 100 keV beam with doses ranging from 2200-2600 μC/cm 2 . The gratings were then developed in 25% wt tetramethyl ammonium hydroxide (TMAH) for 100 seconds and rinsed with isopropyl alcohol and deionized water. Transfer of the HQ grating pattern into diamond was performed using reactive ion etching. A 15 second titanium etch using chlorine was used to remove the Ti layer. The diamond was then etched for 50 minutes using an O 2 /Ar plasma (33/17 sccm, 10 mTorr, RIE power = 100 W) until the etch depth reached 1.1 μm. Using atomic layer deposition (ALD), 78 nm platinum was deposited conformally to fill the diamond gratings.
The Ronchi target functions as a diffraction grating for the incoming, focused X-rays. The spatial frequency of the grating is chosen such that the first orders overlap with the fundamental, but do not overlap with each other. The best configuration is attained when the diffraction angle is half of the full-angle divergence of the focused X-ray beam. Indeed, for a larger diffraction angle the overlap is less, and there is a central part of the beam for which there is no interference data available, and therefore the phase will not be determined by the measurement in this area. On the other hand, if the diffraction angle is too small, the +1 and −1 orders will overlap, interfere with each other and not only with the zeroth order, and the phase recovery method will not work. When the spatial period of the grating equals 2f # λ, with f # the f-number of the optic and λ the wavelength of the X-rays, the ideal overlap between the first orders and the zeroth order is attained. The zeroth and first order interfere and cause a fringe pattern on the detector. Figure 1 shows that this pattern arises from the interference of two sources that emit spherical wavefronts: the focus of the zeroth order, and the (virtual) focus of the first order. The fringes are therefore analogous to those of Young's double slit experiment, and it can easily be shown that the phase difference between the zeroth order and first order changes linearly with x according to (1) x 1 2 with z 2 the distance between the X-ray camera and the focus, z 1 the distance between the Ronchi grating and the focus, D the period of the grating, and C x a constant in x (see methods section for more details). The phase difference results in a linear fringe pattern on the detector, called Ronchigrams. Three Ronchigrams of the beam are seen in Fig. 2(a-c), where the analysis mask of the zeroth order is shown by the red rectangle, and the positions of the +1 and −1 orders by the blue and green rectangles respectively. The fringe density can be tuned to the resolution of the camera by translating the grating with respect to the focus, which effectively changes z 1 in Eq. (1).
As can be seen in Fig. 2 the X-ray beam on the camera looks very asymmetrical, and has two big vertical lobes. The two lobes are caused by the fact the beam overfills a steering mirror located approximately 330 m upstream of the CXI endstation, causing this feature in the far field image. The total beam size in the vertical direction is roughly 70% bigger than in the horizontal direction. This is caused by the fact that the vertical KB mirror has a Top (a-c): the three ronchigrams used to calculate the phase of the X-ray beam, with a magnified close-up of the fringes below. The images are taken with gratings with the different spatial periods (225 nm for (a,c), and 275 nm for (b)), at the same position with respect to the focus, but with an angle of the grating with respect to the vertical of −37.9° for (a), −15.4° for (b) and 29.6° for (c). The red rectangle is the analysis mask of the zeroth order, the green and blue rectangles are the position of the −1 and +1 orders respectively. There is no interference and hence no phase information in the white shade area in (a). Bottom (d-f): False-color image of the difference (i.e. errors) between the phase derived from the Ronchigrams, and the phase derived after reshearing the recovered wavefront of the beam. RMS error of the images is λ/55 for (a) and λ/40 for (b,c). smaller focal length and therefore sits closer to the focus (500 mm vs 900 mm), leading to a higher divergence and hence a larger vertical size on the detector.
Aberrations in the wavefront of the focused beam will result in a distortion of the fringe pattern. Standard Fourier transform and phase unwrapping methods 25 are used to calculate the phase of the Ronchigrams. However, the retrieved phase is not the phase of the X-ray beam itself, but the phase difference between the beam and a shifted copy of itself. The Ronchi test is a shearing interferometer and quantitative analysis requires one to invert the shearing operator. Shearing interferometry is well described in the literature and many methods exist to analyse the interferograms [26][27][28][29][30] . The main difficulty stems from the fact that the shearing operator has a kernel, and therefore cannot be inverted mathematically. Indeed, if we define the shearing operator in the x-direction as: x x we see that any periodic function in x with a period s x gets mapped onto the null vector. Therefore, trying to determine the beam that gives rise to the Ronchigrams is a mathematically ill-posed problem 31 . The most common way to resolve this issue is by using standard regularization theory 32 . In this paper we will follow that road, and adapt an algorithm described in Servin et al. 33 , in which two orthogonal interferograms are used in combination with an a priori assumption of smoothness of the wavefront. However, an additional difficulty with the Ronchigrams is that the shear is half the beam-size which is large in comparison to typical shearograms. This can result in a large area of the beam where no shearing information is available. For example, in Fig. 2(a) we have no shearing information and therefore no information on the phase in the white shaded area, which is approximately a quarter of the total beam aperture. Furthermore, the area where we do see fringes only yields information on the phase differences in one direction: we do not have any information on phase changes in the beam parallel to the fringes. This problem can be overcome by using enough Ronchigrams to ensure that every area where there is appreciable beam intensity is sheared along at least two angles. In the results presented here, we use the three Ronchigrams shown in Fig. 2(a-c). We only use the interference between the fundamental and the +1 order (i.e. right side of the image) since the interference with the −1 yields exactly the same phase information. Together, the three Ronchigrams contain enough information to retrieve the phase of the whole beam since they ensure we have shearograms in at least two direction in almost the entire aperture. An added bonus is that the three shearograms effectively shear both the horizontal and vertical directions with two incommensurate shear values and since Jacobi has shown that a double periodic function with incommensurate periods is necessarily constant 34 , this removes nearly the whole kernel. Common to interferometric methods, the implicit assumption is made that the beam is spatially coherent, and hence only the coherent part of the beam will be measured. A full description of the inversion algorithm can be found in the methods section of this paper.

Results
To validate the inversion, we have sheared the recovered wavefront at angles −37.9°, −15.4° and 29.6° and compared them to the measured phase of the Ronchigrams. The result is shown in Fig. 2(d-f). We find an RMS error of less than 1 40 of a wavelength for each Ronchigram, ensuring that the inversion algorithm works accurately. We note that the use of three Ronchigrams over-constrains the optimization problem. Indeed, any two Ronchigrams with different shearing directions can always be used to invert the shearing operator with a vanishing error. However, this is not the case when three or more shearograms are used: only those derived from a physical field will result in an illumination phase that yields a small RMS error between the measured shearograms and the calculated ones. This is important since we use three shearograms from three different FEL pulses, and we make the implicit assumption that the phase of these pulses are the same. The fact that such a small RMS error is found validates this assumption and the method in general.
The recovered phase can be seen in Fig. 3(a), while Fig. 3(b) shows the measured intensity of the beam. Using this phase and measured intensity profile, we can calculate the X-ray profile at focus, which is shown in Fig. 3(c-e). The full width at half maximum of focal size of the central peak is 167 nm in the vertical and 123 nm in the horizontal. The uncertainty in the wavefront measurement of λ/40 mentioned above results in an uncertainty of approximately 2% in the peak intensity of the beam, applying the Strehl Ratio/Ruze formula 35,36 .

Discussion
In order to demonstrate the value of the information gained from the Ronchigram wavefront retrieval, a simulation of the aberrations due to misalignment of the KB mirror pair was performed. In the simulation, the vertical focusing mirror (VFM) was misaligned by 9 μrad and the horizontal focusing mirror (HFM) was misaligned by 7.5 μrad, resulting in a best focus 2 mm upstream of the nominal focus position. Horizontal and vertical lineouts are shown in Fig. 4, along with lineouts corresponding to operation of the system with the mirrors aligned to the design angle. From comparison with Fig. 3(d,e), it is clear that the majority of the observed vertical aberrations are captured in the simulated misalignment of the VFM. However, the horizontal direction is strongly affected by aberrations caused by two horizontal steering mirrors 330 m upstream of the KB pair. While an attempt was made to account for these aberrations in the simulation, the Ronchigram result suggests that there are additional aberrations that were not fully captured in the simulation. The analysis presented here underscores the importance of techniques which retrieve both the amplitude and phase of the focus. Other techniques, such as the use of imprints, rely on the assumption that the interaction plane has been chosen correctly. As can be seen in Fig. 4, a small error of 2 mm along the beam axis can result in a peak intensity that is a factor of two below what can be achieved with ideal alignment.
In conclusion, we have presented a method to determine the focus of Free electron laser using Ronchi shearing interferometry. The method is fast, in situ and does not require high beam pointing stability. The method has been applied to the nanofocus of the CXI beamline at LCLS, and is readily applicable to other X-ray beamlines and focal sizes.

Ronchigrams.
A Ronchi grating with a duty cycle of 1 and with the orientation of the grating in the x direction can be described as: (3) where ☆ denotes the convolution operator, T 1 and T 2 are the complex transmission functions the two parts of the grating, the Dirac comb is defined as (4) and the rectangle function defined as Taking the two dimensional Fourier transform of the Ronchi grating we get: with sinc(x) = sin (x)/x and using the the two-dimensional Fourier transform defined as: The Ronchi grating and its Fourier transform can be seen in Fig. 5. We now consider the X-ray beam with a focus located at z = 0, with electric field E 0 (x, y, 0). Using the paraxial approximation, we can propagate the electric field to the camera position, z c , using the Fresnel intergral: with k the wavenumber of the electromagnetic field and the spherical phase factor P z c defined as: Basically, E c F 0 is the electric field at the camera position without the spherical wavefront curvature due to the propagation distance z c . We now place the Ronchi grating at position z = z 1 , and propagate the beam from focus to the grating using the Fresnel integral. We multiply the field with the transmission function of the Ronchi grating and then propagate the field back to the (now virtual) focus of the beam. We get the resulting (virtual) field E R0 : We use the Fresnel integral to propagate this field to z = z c . Substituting equation (11) we get: When different orders (i.e. different values of l) overlap, they will interfere, and form predominant linear fringes due to the linear phase in x. For our ronchi test, we choose D to have the half-beam overlap as shown in Fig. 2. From equation (15) we can calculate the phase difference between the zeroth and first order: , and Ŝ X D the shearing operator defined as: X D D and ≡ X X D D 1 . The first three terms give the constant phase difference between the orders (corresponding to the undetermined C x in equation (1). This constant phase is a priory unknown, since we cannot know the exact position of the beam with respect to the grating, and a shift of δx in this position will lead to a constant phase of π The value of this constant phase is actually important during the shear-inversion, and will need to be optimized together with the rest of the wavefront. It could also be used to measure beam jitter, if it is not larger than the grating period. The last two terms show how the phase varies in x and y. The linear phase in x of the last term will result in linear fringes in the intensity of E RC , provided the spatial frequency πz z D 2 c 1 is large enough. Using standard Fourier methods 25 and phase unwrapping algorithms we can retrieve φ S x y [ ( , )] X c0 D as long as the spatial fre- quency πz z D 2 c 1 is at least twice the highest spatial frequency that is present in the intensity of E RC ; otherwise aliasing will occur. To retrieve the phase of the electric field at the camera location φ co (x, y), we will have to invert the shearing operator Ŝ X D . Measuring the intensity of E c0 is trivially done without Ronchi grating. Therefore, we will have full information of both phase and amplitude of the electric field at the camera location, which allows us to propagate the beam to any z location, and therefore fully determine its focal characteristics.
Inverting the shearing operator. As shown above, the phase retrieved from the Ronchigrams is not the actual phase of the X-ray beam, but the sheared phase. In general we have: with the shear vector = s s s ( , ) x y orthogonal to the lines of the Ronchi grating. The measured data will be sampled in x and y, and defining φ i,j as the phase at the sample points (i.e., pixels), we have the corresponding discrete operator , , x y with s x and s y expressed in number of pixels. We call φ i j s , the measured sheared phase retrieved from the Ronchigram. We now search for a solution of φ i,j that minimizes the cost function of the mean-square error between the sheared phase and the measured one: with φ c s the constant phase that is jitter dependent mentioned above and P i j s , the masking function that is equal to 1 where good sheared data is available and 0 where there isn't. As mentioned above, we need multiple Ronchigrams to recover the phase, due to the limited overlap between the beams after shearing. Therefore the total cost function will be the sum for different values of the sheared direction s: In the reconstruction that is shown in the main body of this paper we use three values of s, corresponding to shears at −37.9°, −15.4° and 29.6°, but in principle we could use more shearograms and reduce the error. As in Servin et al. 33 we will add a cost function that corresponds to our a priori assumption of smoothness in x and y: where P i,j is masking function equal to 1 inside the aperture of the beam, and 0 outside it. Note that in principle we could use i j s i j i s j s , , , x y although in practise we may need to take the mask slightly smaller. Alternatively, we could allow values in the masking function between 0 and 1 to allow for a weighted average in in the cost function. With the regularization, the total cost function becomes: with η the regularization parameter. Efficient minimization of the cost function requires the partial derivatives toward φ i,j and φ c s :