Reconstruction of evolving nanostructures in ultrathin films with X-ray waveguide fluorescence holography

Controlled synthesis of nanostructure ultrathin films is critical for applications in nanoelectronics, photonics, and energy generation and storage. The paucity of structural probes that are sensitive to nanometer-thick films and also capable of in-operando conditions with high spatiotemporal resolutions limits the understanding of morphology and dynamics in ultrathin films. Similar to X-ray fluorescence holography for crystals, where holograms are formed through the interference between the reference and the object waves, we demonstrated that an ultrathin film, being an X-ray waveguide, can also generate fluorescence holograms as a result of the establishment of X-ray standing waves. Coupled with model-independent reconstruction algorithms based on rigorous dynamical scattering theories, the thin-film-based X-ray waveguide fluorescence holography becomes a unique in situ and time-resolved imaging probe capable of elucidating the real-time nanostructure kinetics with unprecedented resolutions. Combined with chemical sensitive spectroscopic analysis, the reconstruction can yield element-specific morphology of embedding nanostructures in ultrathin films.

F luorescence is the emission of light or radiation by certain substances as a result of absorbing incident radiation of a shorter wavelength or higher photon energy. Applications of fluorescence such as in spectroscopy and microscopy do not utilize its steradian sensitivity because the directly emitted fluorescence is an isotropic outgoing spherical wave. However, an anisotropic intensity distribution of the fluorescence can be induced when the fluorescence is modulated by local environmental inhomogeneities near its emitting source due to interference of the fluorescence waves. This concept has been explored in the X-ray regime as the X-ray fluorescence holography (XFH) 1-3 for crystalline samples, where local atomic structures can be reconstructed from fluorescence holograms with subatomic spatial resolution. Figure 1a schematically shows the normal mode XFH where fluorescence from an emitter atom and that scattered off from an object atom interfere to form a spatially varying interference pattern in the far-field, a.k.a. fluorescence hologram. In contrast, XFH in the inverse mode is done by scanning the incident angle while recording the fluorescence signal that varies due to the interference between the incoming reference wave and the object wave at the position of the emitter atom (Fig. 1b). While XFH in ordered crystals is three dimensional, we speculate that XFH can be generated to display a lowerdimensional intensity distribution in thin films consisting of layered nanostructures that are confined in the direction normal to the film surface. This is because the film acts as an electromagnetic waveguide so that the reflection at the interfaces confines the waves to the interior of the waveguide and these waves interfere constructively to redistribute the electric field intensity (EFI) normal to the waveguide [5][6][7][8][9][10] . Hence, the originally isotropic fluorescence wave is modulated within the waveguide, creating a concentric cone-shaped hologram when it leaves the waveguide (Fig. 1c). A similar effect has been observed in the crystallography of single crystals containing fluorescence atoms 11,12 or their Kossel diffractions with a divergent beam 13 .
In this work, we illustrate the principle of XFH for a thin-film waveguide and demonstrate that when applied to a film consisting of fluorescence substances, it becomes an in situ and timeresolved imaging technique with sub-nanometer spatial resolution-X-ray waveguide fluorescence holography (XWFH)-for embedded nanostructures and their kinetics in the film. In conventional XFH (normal and inverse modes), holographic reconstruction is achieved via a back-propagation of the far-field hologram in the framework of kinematic approximation [14][15][16][17][18] , and the non-kinematic effects such as mode mixing, self-interference, multiple scattering and extinction often unavoidable in actual experimental conditions cause problems such as ghost patterns or false atomic images. In contrast, XWFH takes advantage of the inherent dynamical effects in a waveguide and requires the reconstruction to be performed in the framework of the dynamical theory. For that purpose, a rigorous dynamical theory for thin films has been developed. A model-independent reconstruction algorithm has also been designed based on Bayesian interference. This algorithm reconstructs the coefficients of the cubic b-spline basis for a depth profile with an efficient Markov Chain Monte Carlo sampler based on the concept analogous to the Hamiltonian dynamics in classical mechanics. Applying this algorithm to a mixed-mode XWFH carried out at both grazingincidence and exit angles, we can take many advantages of the dynamical scattering effects and treat these effects as additional  Fig. 1 Schematics of X-ray fluorescence holography (XFH) operation modes. a In the normal XFH mode 1 , an emitting atom (i.e. emitter) gives out a spherically outgoing X-ray fluorescence wave. An object wave is formed when this outgoing wave is scattered by a nearby atom (i.e. scatterer) and then interferes with the unperturbed outgoing reference wave, producing a spatially distributed hologram. Lines in blue and gold colors represent waves of elastic and fluorescence energies, respectively. b In the inverse XFH mode 4 , the exciting wave at the emitter is a result of interference of the unperturbed incident wave and the scattered incident wave from the scatterer. The hologram is constructed by scanning the incident wave and recording the integrated fluorescence intensity at a fixed detector position. c In the mixed-mode X-ray waveguide fluorescence holography (XWFH) at grazing-incidence and exit angles, X-ray standing waves are created within the waveguide for both the elastic and fluorescence energies. The intensity of fluorescence leaving the waveguide concentrates at discrete exit angles, producing a concentric cone-like hologram whose axis of rotation is perpendicular to the film surface. The forward elastic scattering is also modulated by the waveguide and its angular dependence is measured via grazing-incidence small-angle X-ray scattering (GISAXS).
constraints for better and fast convergence and reconstruction qualities. To illustrate these concepts, we selected gold nanoparticle monolayers embedded within supported and capping polymer films, i.e., sandwiching layers, as model systems. Combinations of two molecular weights (low and high) for the sandwiching polymer layers were chosen in order for the in situ study of the diffusion kinetics of the nanoparticles upon thermal annealing. Buried nanostructures in thin films have often been measured with forward scattering-based techniques such as grazing-incidence small-angle X-ray scattering (GISAXS) and reflectivity. With XWFH, we were able to monitor the diffusion kinetics of the nanoparticles because the broadened nanoparticle distribution upon thermal annealing alters the waveguide conditions which were detected as the variation of the angular dependence of the gold fluorescence hologram. The advantages of performing XWFH on nanostructured thin films emerged when the dynamically reconstructed gold atomic number density distribution was compared to the result from the reflectivity and the structures from the model fitting of the simultaneously collected GISAXS.

Results
Principle of XWFH. We first need to understand the intensity distribution of the electric field in the waveguide as it directly relates to the yield and the spatial distribution of fluorescence signals. With incident energy of 12.11 keV (denoted as elastic energy or excitation energy below), the gold's L 3 2p 3/2 (11.919 keV) energy level is excited, with corresponding dominant X-ray emission energies Lα 1 (9.713 keV), Lα 2 (9.628 keV), Lβ 2 (11.585 keV), and Lβ 15 (11.566 keV). However, the subtle split between the two Lα lines, as well as the two Lβ lines, is indistinguishable given the energy and angular resolution of the detector and the instrumentation setup. Therefore, they are treated as two rather than four emission lines: Lα (1,2) and Lβ (2,15) , whose relative fluorescence yields (fluorescence intensity from an atom) are fixed at tabulated values 19 during the reconstruction. Figure 2a shows the calculated EFI as a function of depth and incident angle (or exit angle by optical reciprocity theorem) for the elastic energy. The calculation is done using reconstructed parameters (see text in the next three sub-sections and Fig. 3c) for an as-cast LH sample (nanoparticle monolayer sandwiched between a supporting layer of low molecular weight and a capping layer of high molecular weight; see Methods for Materials and samples). Near-surface evanescent wave 20 is created if the incident angle is less than the critical angle for total-external reflection of the polymer film (α c,flim | e = 0.102°). If the incident angle is above α c,flim | e , the electric field penetrates into the film and gets amplified at certain depths when the incident angle coincides with special angles between α c,flim | e and α c,Pd | e (the critical angle of the supporting Pd mirror which is 0.317°for the incident energy). This EFI enhancement is known as the waveguide effect or X-ray standing wave (XSW) in grazingangle conditions [5][6][7][8][9] , and these special angles are denoted as antinode angles. However, the EFI enhancement quickly diminishes beyond α c,Pd | e , as a consequence of loss due to X-ray penetration into the substrate. Therefore, if one is to utilize this enhancement for a better signal-to-noise ratio, the incident angle should be kept below the critical angle of the substrate. For example, an incident angle of 0.125°is used in this study for both XWFH and GISAXS.
By the optical reciprocity theorem, the same EFI enhancement effect can be also observed at the exit angle side for internally excited fluorescence. The critical angles of the polymer film are α c,flim | Lα = 0.127°and α c,flim | Lβ = 0.107°for Lα (1,2) and Lβ (2,15) , respectively. If the exit angle is below 0.125°, for example, only the evanescent wave exists for Lα (1,2) fluorescence. Both the elastically scattered intensity and the fluorescence intensity are proportional to the number of gold atoms as well as the magnitudes of the incident electric fields these atoms are exposed to. In other words, although the independently established EFI at each relevant energy (one elastic and two fluorescence energies) has its own angle (Fig. 2b) and depth ( Fig. 2c) dependence, and contributes incoherently to the total XWFH (Fig. 3c), they are interrelated through the same electron density profile ρ(z) of the waveguide. Therefore, the key to reconstructing the angle-resolved XWFH holograms is to determine the common dependence of these EFIs on ρ(z). This needs to be done iteratively with are construction based on dynamical scattering theory described as follows.
Dynamical theory for reconstructing the mixed-mode XWFH holograms. The total intensity measured on the fluorescence pixel-array detector consists of fluorescence intensity I f (α i , α f ) and elastic scattering background I e (α i , α f ), where α i and α f are respectively the incident and exit angles with respect to the film surface, and w is a weight factor for the fluorescence contribution. The emission power of the immediate fluorescence of a gold atom is proportional to the square of the exciting incident electric field E z; α i ; λ e ; ρ z ð Þ ð Þ . This incident field varies at different depths of a waveguide and depends on the angle α i and wavelength λ e of the incident wave, as well as the overall electron density profile ρ(z) of the waveguide. On the emission side, the waveguide modulates the fluorescence and establishes a fluorescence electric field Eðz; α f ; λ f ; ρðzÞÞ, where α f and λ f are the exit angle and wavelength of the fluorescence wave, respectively. In the presence of strong multiple reflections at the waveguide interfaces at grazing angles, these electric fields need to be computed with the dynamical theory. For one-dimensional scenarios such as in the normal direction of the waveguide, Parratt's recursive method is often adopted for the electric field computation (see Methods for Electric field computation).
Summing over the emission spectrum, a.k.a. relative fluorescence yield Y Au (λ f ), we can write the fluorescence intensity as where ϕ Au (z) the gold atomic number density is the ultimate goal of the reconstruction. It is related to ρ(z) and can be recursively reconstructed (see Sub-section XWFH reconstruction algorithm). Similarly, the elastic background is written as where ϕ j (z) is the atomic number density for the jth element, and σ j is its elastic scattering cross-section 19 . The summation goes over every element in the entire sample: Si, Cr, Pd, Au, as well as C, H, and O in the polymers. The relation of the mixed-mode XWFH at both grazingincidence and exit angles to the conventional XFH can be understood as follows. In the perspective of the normal XFH, Þis the incident wave, while Eðz; α f ; λ f ; ρðzÞÞ is the hologram as a result of the self-interference of fluorescence within the waveguide. On the other hand, the excitation field Þcan be also seen, from the inverse XFH's point of view, as the consequence of the interference of the gold atoms and the entire waveguide. Unlike in the conventional XFH, it is impossible to distinguish the reference from object waves here, because (1) the strong multiple reflections occur at the interfaces for angles in the vicinity of the total-external reflection; and (2) gold is not only the emitter but also the scatterer in the waveguide and has a significant effect on the incident electric field that subsequently determines the total fluorescence intensity. These intertwining effects cannot be handled with conventional reconstruction methods based on the kinematical approximation. Instead, they can only be approached with the dynamical formula as described above.
XWFH reconstruction algorithm. Given prior information about the gold atomic number density profile ϕ Au (z), one may model the profile approximately with appropriate empirical analytical functions. For example, Gaussian gives a reasonably stratifying description of the sandwiched gold monolayer in the present study, where the number density profile is determined by three parameters: mean height, root-mean-squared width, and the total amount of gold atoms. These parameters can be determined by χ 2 -minimization or other optimization methods. However, in order to develop a generalized reconstruction method for any arbitrary profiles, we introduce a Bayesianinference based model-independent algorithm, where no prior knowledge and profile modeling is required. In this approach, an arbitrary smooth profile can be numerically represented by cubic b-splines. Specifically, ϕ Au (z) can be written as a linear combination of a set of N cubic b-spline basis {B i (z)} whose first and last basis end with zero at the film/substrate and film/helium interfaces (i.e. neither do gold atoms leave the film nor penetrate into the substrate) [21][22][23] (also see Supplementary Note 1), where N Au is the total number of gold atoms and its value corresponds to the nominal thickness during the thermal deposition. C i are b-spline coefficients to be reconstructed. In order for parameter parsimony and overall curve smoothness, regularizations on C i and their variations ΔC i are applied. Here we used a modified version of the fused lasso regularization 24 for the cost function such that where the 1st term is sum-square-residual (SSR) of the M experiment data points, the 2nd term encourages the sparsity of the N basis splines, and the 3rd term encourages the overall smoothness. β 1,2 are corresponding penalty parameters. In addition, mean-square-residual method (MSR) was used to determine the minimal total number of basis splines (insets of Fig. 3c, h). Although many nonlinear optimization solvers can be used to minimize this regularized cost function, the reconstruction is not necessarily guaranteed to converge or the convergence may consume extraordinarily long time due to the high-dimensional parameter space (e.g., 30 spline coefficients in Fig. 3c). Hence we adopted an efficient Bayesian-inference method, the recently developed Hamiltonian Markov Chain Monte Carlo (HMCMC) Au Lα (1,2) Au Lβ (2,15) Fig. 2 Electric field intensity (EFI) distribution. a EFI for the elastic energy (12.11 keV) as a function of grazing angle and height above the Pd mirror for the LH sample whose the gold monolayer is~250 Å above the mirror (white dashed line). Parameters for the calculation are from the reconstructed XWFH before the thermal annealing (details described in the text). Two red arrows indicate the critical angles for total-external reflection of the polymer film (α c,flim | e = 0.102°) and the Pd mirror (α c,Pd | e = 0.317°), respectively, at the elastic energy. Inset illustrates the layers of the sandwiched film. b Line profiles of the EFI at the gold monolayer height for three energies: elastic, gold Lα (1,2), and Lβ (2,15) . c Line profiles of the normalized EFI at a grazing angle of 0.125°( indicated by the blue arrow in a) for the three energies.
sampling method 25,26 , to estimate these parameters as well as the reconstruction confidence (see Supplementary Note 2). This method, bearing some analogy to the concept of Hamiltonian dynamics in classical mechanics, explores the parameter space more efficiently for high-dimensional problems than conventional optimization algorithms. Assuming that the probability of the measured intensity at the jth data point is a normal distribution such that I mea F;j $ N À I cal F;j ; σ 2 Á , the cost function J can be transformed to the potential energy in the language of HMCMC, Starting with a randomized or a guessed position in the parameter space, HMCMC stochastically explores the parameter space to generate a sequence of parameter samples. After the chain becomes stationary (named burn-in or warm-up), the sequence can be used for the inferences on the parameters as well as the gold atomic number density profile and its confidence intervals. HMCMC often converges quickly to the target probability distribution because the ergodic property of HMCMC algorithms avoids local traps in some subsets of the parameter space. For example, even starting with the weakest guess (i.e. gold atoms are evenly distributed throughout the entire polymer film), the convergence to the unique solution appears in only a few iterations and becomes stable thereafter (see Supplementary Note 2).
Comparison of XWFH to GISAXS and reflectivity. Typical XWFH hologram is displayed in Fig. 3a for the sandwiched LH sample before thermal annealing (see Methods for Materials and samples). It was taken with a pixel-array detector mounted at a 90°in-plane angle (see Methods for Experimental details). The propagation of the fluorescence from point-like emitting atoms is 125°. GISAXS pattern is mirror-symmetrical with respect to the forward scattering direction (i.e. 0°inplane angle), so only the right half is shown in (b). c In-plane integrated experimental and reconstructed XWFH data. Individual contributions from the Lα (1,2) , Lβ (2,15)  modulated in the normal direction of the waveguide, leading to a concentric cone-like spatial power distribution when the fluorescence leaves waveguide. Since this distribution is isotropic in the plane of the waveguide and depends only on the exit angle, we can integrate it over a wide range of in-plane angles to give a better signal-to-noise ratio in the one-dimensional XWFH (Fig. 3c). XWFH is then reconstructed using Eqs. (1)-(3) with respect to the number distribution profile of the gold atoms ϕ Au (z) which is model-independently represented by cubic bsplines.
In contrast, GISAXS is a conventional surface scattering technique to measure nanostructures in thin films 27 . It is performed in the forward direction at low in-plane and exit angles, so its elastic scattering cross-section in the forward direction is many orders of magnitude stronger than the fluorescence 19 . Figure 3b shows the GISAXS pattern recorded on another pixel-array detector mounted in the forward direction. It was taken simultaneously with the XWFH. Unlike XWFH whose reconstruction does not require any morphological and structural assumptions about the nanoparticles, the intensity distribution of GISAXS depends on the size and shape distribution of the nanoparticles as well as their positional correlations. Therefore, GISAXS needs to be fitted rather than reconstructed with the assistance of modeling in the framework of the distorted wave Born approximation (see Methods for Theory of GISAXS analysis). The best fit result (Fig. 3d) is obtained with the following modeling assumptions: the nanoparticles are spheres; they form a two-dimensional monolayer superlattice whose nanoparticle number density in the film normal direction is modeled as a Gaussian, and the inter-particle correlation in the plane follows a one-dimensional paracrystal model 28 .
As a third independent surface technique, reflectivity was recorded in the forward scattering direction but with both incident and exit angle scanned (thus losing time-resolution) at identical values (see Methods for Reflectivity analysis). These three independent techniques yield very similar electron density profile (Fig. 4a), or equivalently the atomic number density (Fig. 4c). It is noticed that the ϕ Au (z) obtained from GISAXS is slightly broader than those of the XWFH and reflectivity, which is attributed to the insufficient exit angle sampling (due to limited sample-detector distance) in the GISAXS setup and GISAXS's tendency of slightly overestimating the distribution variance (see Supplementary Note 3).
The diffusion of the gold nanoparticle monolayer upon thermal annealing alters the nanoparticle number density ϕ np (z) in the film normal, hence the atomic number density ϕ Au (z) and the overall electron density profile. As the width of the initially welldefined gold monolayer gets broader, the overall density evolves from a sandwiched film with well-defined film/gold interfaces towards a more mixed film with obscure interfaces. This smears out high-order modes of both the incident standing wave (for the elastic energy) that excites the gold atoms and the fluorescence hologram cones. Meanwhile, the amplitude contrast of the EFI oscillations reduces, as displayed in Fig. 3f and its integrated line curve in Fig. 3h. Identical phenomena are also observed in Fig. 3g, i for GISAXS. For GISAXS, there is an additional dependence on the inter-particle correlation exhibited as a tendency of in-plane aggregation upon thermal annealing (Fig. 3g) 29,30 . Both XWFH reconstruction and GISAXS fitting give similar results as for the electron density profile showing much smaller density variations across the film as the nanoparticle monolayer diffuses out in the normal direction upon thermal annealing. However, the reflectivity completely loses its sensitivity to these small density variations, because a more parsimonious single-layer model with an averaged uniform electron density fits the reflectivity sufficiently well (Fig. 4b). This can be ascribed to the dependence of the reflectivity sensitivity not only on the highest measured angle (or wave vector transfer) but more importantly on the largest density contrast throughout the layer stacking in this case. To be specific, the density variation of the gold-polymer composite mixture is overwhelmed by the much higher contrast of helium/Pd that dominates the reflectivity sensitivity. In contrast, the sensitivity of XWFH and GISAXS arises from the modulation of the electric field in the waveguide, rather than solely the density contrast between layers. In other words, the perturbation of the gold to the depth-dependent incident electric field, as well as its angularly modulated fluorescence (in XWFH) and elastic scattering (in GISAXS) due to subsequent exposure to this incident electric field, provides much higher sensitivity than reflectivity.
Diffusion kinetics of gold nanoparticle monolayer. By monitoring their kinetics or dynamics in a polymer melt, nanoparticles can be used as markers to determine rheological properties such as viscosity of a polymer matrix. In this work, the time dependence of the gold nanoparticle distribution is used to determine the out-of-plane (normal to the film surface) diffusion coefficient in the polymer film. Figure 4e displays the results of the variance of the ϕ Au (z) profile with respect to the beginning of the annealing. The diffusion coefficient D is obtained via σ 2 t ð Þ À σ 2 0 ð Þ ¼ Dt. As pointed previously, GISAXS inclines to return a broader distribution than XWFH as seen for the LH sample, thus GISAXS yields a slightly larger diffusion coefficient. The variance plot clearly indicates the trend of the diffusion coefficient on the molecular weights of the two sandwiching layers. Sample with both supporting and capping layers made of low (high) molecular weight polymer exhibits the fastest (slowest) diffusion kinetics, while the sample with layers made of polymers of mixed molecular weight falls in between. It is also noticed that the mean height of the distribution of three samples slightly moves towards the Pd substrate (Fig. 4f), indicating the van der Walls attraction between the heavy metals (Au and Pd). As expected, this overall translational movement towards the substrate is the least for the HH sample with both layers made of high molecular weight polymers.

Discussion
The mixed-mode X-ray waveguide fluorescence can be simplified and performed at either grazing-incidence or grazing-exit geometries. In the former configuration, a detector of a very large solid angle is desired in order to collect as much fluorescence as possible for a better signal-noise ratio. The hologram is constructed by scanning the incidence angle of a well collimated monochromatic X-ray beam as is done in the conventional inverse XFH and the similar scenario of GIXRF (grazing-incidence X-ray fluorescence) [31][32][33][34] . When the incident angle is below the critical angle for the total-external reflection of the topmost surface or any buried interface, the evanescence wave is created, and a standing wave is also generated above the interface. This is known as the total-external-reflection X-ray standing wave (TER-XSW). In this work, we take advantage of this effect by setting the incident angles less than the critical angle of the Pd substrate so that the standing wave effect dominates and thus the enhanced and spatially modulated E-field above the substrate can be used as a highly sensitive probe for the nanostructures. In contrast, in the grazing-exit configuration, GEXRF (grazing-exit X-ray fluorescence) that is often used for low-level chemical impurity detection [35][36][37][38] , the external beam often impinges normal to the sample, eliminating the need for beam collimation and sample surface alignment. With efficient area pixel-array detectors, the fluorescence holographical cones can be quickly measured without the need of scanning the detector position and still give sufficient angular resolution near the grazing-exit angles. Therefore, for in situ and time-resolved measurements, grazing-exit is more desired than grazing-incidence configuration. However, unlike the grazing-incidence configuration, the very large elastic scattering background arising from the normal or high incidence angle in the grazing-exit configuration 39 often complicates the data interpretation and harms the reconstruction quality. In contrast, these difficulties are readily overcome in the mixedmode XWFH with simultaneous grazing-incidence and grazingexit angles. In addition, while GIXRF and GEXRF have been occasionally used on the same sample [40][41][42] , the measurements were carried independently rather than simultaneously like in XWFH. The additional information and constraints provided by the X-ray standing waves generated at simultaneous grazingincidence and exit angles in the XWFH configuration can greatly facilitate the reconstruction speed and the resolution of the depth profiling.
In XWFH, the angular dependence of the fluorescence hologram is a result of interference of the fluorescence within the waveguide, giving clues of the electron density profile of the waveguide. Although a complete reconstruction of an XWFH hologram requires a dynamical theory that is more sophisticated than the kinematical theory, it takes into account multiple scattering, extinction, self-interference, etc. Such phenomena are not readily handled with conventional XFH reconstruction algorithms. In our dynamical holographical reconstruction for XWFH, the nanostructure of interest self-consistently enters the iterative computation of the electric field that subsequently illuminates the fluorescence substances to give out angular-resolved fluorescence holograms. In addition, the reconstructed density profile of the waveguide is required to converge to a solution conforming to X-ray standing wave conditions for all the engaged energies (elastic and all fluorescence energies). The use of multiple energies is equivalent to an expansion of the measurement dimension and serves as an additional constraint for the reconstruction. As a result, it removes the ambiguity of the solution uniqueness that is encountered in many inverse problems. In addition, the convergence speed of the algorithm and the reconstruction accuracy are improved. In practice, this is analogous to the multiple-energy X-ray holography in solving local atomic environments in crystals, where image distortions of a single-energy hologram such as twin images can be effectively suppressed 4 . An additional benefit of multiple emission energies in XWFH is that they provide an automatic self-calibration of the exit angle, which mitigates the challenge of angular calibration in conventional grazing-exit configuration 38 . For instance, the rising edge of the very first peak in the hologram corresponds to the critical angle of the polymer film (Fig. 3c, h) and its position is inversely related to the emission energy. We, therefore, can easily infer the absolute exit angle as well as the sample-detector distance from different rising edges arising from multiple energies. Besides, in many GIXRF and GEXRF experiments where the index of refraction or optical constant of the substrate has to be specified in advance and thus has great direct impacts on the accuracy of the analysis. However, it is less of a concern for XWFH, because many constraints imposed by the waveguide effect enable the simultaneous optimization of the index of refraction as well as the layer thickness and roughness of the substrate as long as the indices of refraction of at two layers are provided (here helium and silicon are fixed at tabulated values). Nevertheless, to reduce the model complexity, these substraterelated parameters can be pre-determined precisely with the high-resolution reflectivity, a standard tool for X-ray mirror characterization, on the reference substrate before the film deposition. In summary, conventional fluorescence techniques such as GIXRF and GEXRF are two special variations of XWFH. Therefore, the full dynamical theory, as well as the efficient reconstruction method developed for the general scenario in XWFH, can be easily simplified for the data analysis in GIXRF and GEXRF.
The qualification of X-ray characterization techniques for in situ and time-resolved studies of elemental depth profile at the nanoscale is crucial to correlate material properties with the underlying chemical and physical properties. Combining many advantages of existent grazing-angle X-ray techniques, XWFH can serve as a powerful and high-resolution tool for quantitative thin-film and surface analysis when facilitated by the dynamical theory for waveguides and the novel reconstruction algorithm that we developed for XWFH. Although XWFH has proved in this work to deliver superior performance as compared to GISAXS and reflectivity, it is a complement to those conventional elastic scattering techniques and should be applied depending on the availability of experiment conditions and specific scientific problems to address. On the other hand, XWFH can be implemented as a scan-free technique, hence it is suitable for emergent systems that require in situ and time-resolving capabilities, as have been demonstrated in the present study. XWFH is also a flexible and non-contact technique and its capability can be extended and combined with other techniques. For example, one can vary the incidence angle to establish different modes for the incident X-ray standing waves in order for an even higher depth sensitivity. The incident energy can also be swept near the absorption edges of relevant substances 43 , thus combining the Xray absorption spectroscopy (XAS) analysis with XWFH to simultaneously obtain the chemical sensitivity of elements and the depth sensitivity of structures.

Methods
Materials and samples. Samples are gold nanoparticle monolayers synthesized by thermal evaporation and sandwiched between two layers of poly (tert-butyl acrylate) (PtBA) of equal thickness of~250 Å. PtBA of two molecular weights (19.6 kg/ mol and 46.5 kg/mol) are used in this study, and both have a polydispersity index <1.2. The glass transition temperature T g of PtBA is~49°C. To prepare these thin films, silicon substrates are first coated with a chromium adhesive layer (~50 Å) and followed by a palladium mirror layer (~500 Å) in a thermal evaporation chamber. A PtBA layer is then coated onto the Pd mirror by spin-casting from a butanol solution. An ultrathin gold layer of a nominal thickness of~6 Å is then deposited by thermal evaporation onto the PtBA layer. Gold nanoparticles form and grow spontaneously as a result of much weaker polymer-metal interaction than that between the metal atoms, and their sizes are typically around 2 nm 29,31,44 . A second PtBA layer is spun-cast onto a spare silicon substrate. It is then floated onto a water surface and picked up onto the top of the gold nanoparticle monolayer to create a sandwiched sample. Three types of samples are made by using different molecular weight for the supporting and capping PtBA layers. For notational convenience, they are denoted by two letters starting with the supporting followed by the capping layers: LL, HH, and LH, where L and H stand for low and high molecular weights, respectively. All samples are finally capped with a polystyrene (PS) layer (molecular weight of 131 kg/mol, polydispersity index of 1.08, thickness of~250 Å, and T g of~100°C) to prevent dewetting upon thermal annealing.
Experimental setup. The experiments were performed at Sector 7-ID-C at the Advanced Photon Source, Argonne National Laboratory. The incident X-rays of energy 12.11 keV and bandwidth ΔE/E = 10 −4 were collimated with two slit pairs so that the beam size was 400 μm × 60 μm (H × V) with a flux of 6 × 10 10 photons per second on the sample. Samples were loaded onto a thermal stage inside a sealed helium chamber in order to minimize the radiation damage and air scattering background. The chamber was mounted on a six-circle diffractometer with xyz translational stages. To further control the radiation damage, the sample was horizontally translated to a fresh region after one-minute exposure (far less than the sustainable lifetime estimated on similar test samples by monitoring the change of reflectivity and GISAXS). GISAXS and XWFH patterns were simultaneously collected with two Pilatus (Dectris, Inc.) single-photon counting pixel array detectors (pixel dimension of 0.172 × 0.172 mm 2 ). The GISAXS detector was 996 mm away from the sample in the forward scattering direction, and the XWFH detector was 3180 mm at the right in-plane angle in order to minimize the elastic scattering background. In order to enhance the XWFH and GISAXS signals and meanwhile to further suppress the background contributions from the substrate, the incident angle was chosen to be 0.125°so that it is less than any critical angles of the sample support layers (Si, Cr, and Pd) but still resides above the critical angle of the polymer film. The reflectivity was measured by simultaneously scanning the incident and exit angles and recording the intensity within an ROI (region of interest) on the GISAXS detector. To minimize the air absorption and background scattering, vacuum flight paths were installed between the sample chamber and the two Pilatus detectors. XWFH, GISAXS, and reflectivity were first measured at the ambient temperature on each sample. The temperature was then ramped to 60°C in about 7 min for thermal annealing experiments. To achieve a required timeresolution, only the scan-free XWFH and GISAXS were recorded during the thermal annealing. Reflectivity data were collected again at the end of the annealing cycle. The solid angles of pixels on each detector were determined and taken into account during the data analysis as an angular resolution convolution to a window function. The quantum efficiency for each energy (the efficiency curve is provided by the manufacturer) cannot be corrected beforehand, because Pilatus is not an energy-resolving detector and does not have a sufficient energy resolution to efficiently separate photons of different energies. However, according to the dynamical scattering theory or XWFH, the energy resolution is transformed to the angular resolution; thus the quantum efficiency correction can be iteratively applied (as a multiplicative combination with the air path absorption correction because they both effectively behave as the attenuation effect from the detection efficiency point of view) to the calculated XWFH for each energy during the reconstruction.
Electric field calculation. Given X-ray energy, the transmitted and reflected wave amplitudes T(α, z) and R(α, z) within a film or waveguide can be calculated for every height z and angle α (incident or exit) using Parratt's recursive method which gives the exact one-dimensional solution of the Helmholtz equation for the stationary wave-propagation form of the Maxwell equations 45,46 . The complex electric field is given by where k z (α, z) is the z-component of the wave vector for angle α. |E| 2 is often called the electric field intensity (EFI). In general, the perturbation of a dense layer to the overall electron density, hence the electric field, cannot be ignored. A selfconsistent multi-layer method is needed to obtain the correct electric field E z; α; λ; ρ z ð Þ ð Þ 30 . In this method, both ρ(z) and wave vector k z (α, z) are complex values so that the extinction and absorption effects automatically take place.
Theory of GISAXS analysis. The elastic forward scattering is quantitatively modeled in the framework of distorted wave Born approximation (DWBA) 47 , where the nanostructure of interest (e.g., gold nanoparticles) is viewed as a perturbation to the reference scattering potential produced by the supporting substrate and the embedding film. Due to the perturbation of the gold layer to the overall electron density, a multi-layer form of the DWBA must be employed 30 . For a twodimensional superlattice, the structure factor of the monolayer S(q || ) only depends on the in-plane scattering angle 2θ or equivalently the in-plane wave vector transfer q || . Using the local monodisperse approximation, the GISAXS intensity is given by 30 where Δρ is the constant electron density contrast between gold and the embedding polymer. The form factor F q m z ð Þ; r ½ describes the morphology of the nanoparticles, and it is approximated by a sphere model, where h np and σ np are mean height and standard deviation above the Pd mirror, and N np is the total number of nanoparticles. In order to compute the electron density profile, and hence the transmitted and reflected wave amplitudes T and R, the nanoparticle number density ϕ np (z) needs to be converted to the atomic number density ϕ Au (z) with the nanoparticle model parameters such as radius and polydispersity. These morphological parameters are either previously known or kept floating for fitting in GISAXS analysis.
Reflectivity analysis. The reflectivity calculation is accomplished as a byproduct of the Parratt's recursive method for the electric field computation. Briefly, it is the squared modulus of the amplitude of the topmost reflected wave at the film surface 45 , i.e., I R α ð Þ ¼ R α ð Þ j j 2 .

Data availability
The source data (XWFH, GISAXS, and reflectivity) supporting the findings of this study are available within the paper and its supplementary information files.