Universal representation of undulator phase errors

The phase error is an important parameter to represent the quality of an undulator, which makes it possible to quickly evaluate the reduction in photon intensity due to magnetic field errors without rigorous numerical calculations. Although the phase error has been used as a standard to evaluate the undulator field errors because of its simplicity, a couple of papers have reported that the phase error actually overestimates the intensity reduction under practical conditions, and thus its tolerance tends to be too tight. In other words, the applicability of the phase error defined in the conventional form is rather limited. To overcome this difficulty, we derive a set of formulas to quickly evaluate the undulator quality based on an analytical approach, which can be used in a more universal manner. Comparisons with rigorous numerical results under various conditions show the validity and universality of the derived formulas. Analytical methods to investigate the effects due to systematic errors in undulators are also presented as one of the important applications of these formulas.


I. INTRODUCTION
It is well known that the magnetic field of a real undulator is not completely periodic because of various error sources.Since such field errors result in a reduction in photon intensity of undulator radiation (UR), they should be corrected as much as possible to maximize the number of photons available for users.It should be noted, however, that a lot of efforts have to be made to improve the field quality of undulators, and thus it is practically important to specify the acceptable tolerance in terms of the normalized intensity I r =I 0 , where I 0 is the photon intensity available with an ideal undulator without any errors, while I r is that available with the real one.
The most straightforward way to evaluate I r =I 0 is to numerically calculate the intensity of UR by means of dedicated numerical codes [1][2][3].Although the numerical method enables an exact evaluation of the undulator quality, it is more convenient to roughly and quickly evaluate I r =I 0 for many applications.This is the reason why another solution using the well-known formula derived by Walker [4] has been generally used, which is given by where k is the harmonic number of UR and σ ϕ is the root mean square (RMS) phase error that can be easily calculated once the magnetic field distribution is given.Because of its simplicity, this formula has been widely used to quickly evaluate the effects due to field errors of undulators, and the tolerance on σ ϕ is usually mentioned in the specification documents for undulator manufacturers.
It is easy to understand that the above tolerance becomes tighter for higher harmonics.For example, we have a tolerance kσ ϕ ≤ 27°to keep the intensity reduction within 20%, i.e., I r =I 0 ≥ 0.8.To be specific, we need to satisfy σ ϕ ≤ 27°for the 1st harmonic, and σ ϕ ≤ 1.8°for the 15th harmonic.The latter tolerance is so tight that we need to eliminate a huge number of error sources to satisfy this condition.
Recently, several authors have pointed out that the tolerance on σ ϕ as discussed above is greatly relaxed under practical conditions [5,6].This is attributable to the fact that Eq. ( 1) applies to the on-axis angular flux density of UR emitted by a single electron, and is not necessarily valid for other conditions.To be specific, I r =I 0 is recovered once all the effects having impacts on the intensity of UR are taken into account, such as the finite emittance and energy spread of the electron beam, and the finite collection angles defined by the components installed in the beamline, which are hereinafter referred to as the "recovery factors."Under the practical conditions in which the recovery factors play an important role, Eq. ( 1) overestimates the effects due to field errors, and does not correctly represent the undulator quality.
To overcome the above difficulty, Walker has introduced a new parameter "local phase error" σ ψ [6] to specify the undulator quality under the practical conditions, and has shown that σ ψ correlates well with I r =I 0 in a particular case when the collection angle is sufficiently large.Although evaluating I r =I 0 using σ ψ is much more practical than that using σ ϕ , it still cannot universally represent the undulator quality; the correlation between σ ψ and I r =I 0 gets worse for smaller collection angles.
The above discussion suggests that it is more useful to have an expression to evaluate I r =I 0 under arbitrary conditions.The purpose of this paper is to derive a new parameter Σ ϕ based on an analytical approach, which can be used to represent the undulator quality in a more universal manner.We also explain how Σ ϕ relates with σ ϕ and σ ψ , together with its physical background.In addition, the analytical method is applied to investigating the effects due to systematic errors that usually result in large phase errors (σ ϕ ), to reveal that their impacts on the actual undulator performance under practical conditions are much lower than what is generally supposed.

II. ANALYTICAL FORMULATION
In what follows, we assume that the undulator is of a planar type to mainly generate a magnetic field in the vertical direction, and focus on the horizontally polarized radiation.Let z be the main axis of the electron motion and thus the optical axis of UR, x and y be the horizontal and vertical axes perpendicular to z, and the coordinate origin be the center of the undulator.
Although there are many parameters related to the recovery factors, they can be actually represented by five variables: the energy spread (σ ε ) and angular divergences (σ x 0 , σ y 0 ) of the electron beam, and the collection angles (Δθ x , Δθ y ) in the beamline.Note that the angular divergence should be defined so that all the relevant beam parameters are taken into account.To be specific, and a similar expression for σ y 0 , where D is the distance from the undulator center (z ¼ 0) to the components in the beamline defining the collection angle, Z w is the beam waist position, and σ x0 and σ x 0 0 are the beam size and angular divergence at z ¼ Z w to be determined by the Twiss parameters, dispersion functions, energy spread and emittance of the electron beam.For reference, these definitions are illustrated in Fig. 1.Then I r =I 0 is given as a function of these variables, i.e., I r =I 0 ¼ ρðσ ε ; σ; ΔθÞ, with σ ¼ ðσ x 0 ; σ y 0 Þ and Δθ ¼ ðΔθ x ; Δθ y Þ being introduced for simplicity.In the following sections, we derive an explicit form of the function ρ based on an analytical approach.

A. Undulator radiation with field errors
Let us first derive a formula to represent the angular flux density of UR emitted by a single electron moving in a real undulator with field errors.
The complex amplitude of UR denoted as E is given in a dimensionless form by [7] where γ is the Lorentz factor of the electron, β ⊥ ¼ ðβ x ; β y Þ is its transverse relative velocity given as a function of z, λ u is the periodic length of the undulator, N is the number of periods, θ ¼ ðθ x ; θ y Þ is the observation angle, λ and ω are the wavelength and angular frequency of radiation, and c is the speed of light.The angular flux density is then given by jEj 2 , excluding the unit conversion factor for simplicity.
In an ideal undulator, we have β x ¼ γ −1 K cosð2πz=λ u Þ and β y ¼ 0, where K is known as the deflection parameter of an undulator defined as with e and m e being the electron charge and mass, and B 0 being the peak magnetic field of the undulator.Then we can define the so-called fundamental frequency which satisfies the phase matching condition ω 0 τðz þ λ u Þ ¼ ω 0 τðzÞ þ 2π, and thus radiation is emitted in phase at ω ¼ ω 0 .The phase error of a real undulator, in which with j ¼ 1; 2; …; 2N, where τ 0 denotes τ for an ideal undulator, and z j is the longitudinal position of the j-th magnet pole, which, in an ideal undulator, is given by z j ¼ ðj − N − 1=2Þλ u =2.Thus, the phase error is usually evaluated at the discrete positions z ¼ z j , i.e., at the points of emission of radiation.The RMS phase error σ ϕ is then defined as the RMS of the discrete data set ϕ j , and can be used to evaluate I r =I 0 using Eq. ( 1).
Although evaluating I r =I 0 with σ ϕ defined above is simple and useful, it usually underestimates the undulator quality when the recovery factors are not negligible.We thus need to investigate in more detail the impacts of ϕ j on I r =I 0 with the recovery factors taken into account.To facilitate the following discussion, we introduce a coordinate variable n ≡ z=λ u .
In general, the transverse velocity β ⊥ , which is given by integrating the magnetic distribution along the z axis, is roughly expressed by where X0 and Ȳ0 denote the horizontal and vertical slope errors, while U describes the amplitude of the wiggling motion.If the undulator is an ideal one, we have X0 ðnÞ ¼ Ȳ0 ðnÞ ¼ 0 and UðnÞ ¼ const ¼ K.For real undulators, it is reasonable to define K as being the average of UðnÞ.Substituting Eqs.(3) and (5) into Eq.( 2), we have with where χ is the phase advance in an ideal undulator given by χðn; and ϕðnÞ ¼ φðnÞ þ ΔðnÞ denotes the phase error coming from the field errors, where we have introduced two functions and Note that two assumptions have been made to derive Eqs. ( 6), ( 9) and (10); (i) the deviation of UðnÞ from K is small, and (ii) the trajectory wander given by integrating γ −1 X0 and γ −1 Ȳ0 are not much larger than the wiggling amplitude; in practice, the discrepancy between UðnÞ and K in practical undulators is at least less than a few percent, and the trajectory wander is of the order of a few times the wiggling amplitude or less.
Because of the oscillating factor sinð2πnÞ, ΔðnÞ rapidly oscillates as n, and is referred to as the phase oscillation.In contrast, φðnÞ does not explicitly contain the oscillating factor, and is thus a slowly varying function of n.Namely, φðnÞ does not vary significantly over the range h ≤ n ≤ h þ 1, where h is an arbitrary number satisfying jhj < N=2.
The phase error function ϕðnÞ defined above is well represented by the discrete data set ϕ j evaluated with Eq. ( 4), i.e., ϕ j ¼ ϕðn j Þ, with n j ¼ z j =λ u .For later discussions, we introduce other data sets φ j and Δ j defined by which represent the functions φðnÞ and ΔðnÞ, i.e., φ j ¼ φðn j Þ and Δ j ¼ Δðn j Þ.We also define σ φ and σ Δ as being the RMS of φ j and Δ j , respectively.The reason why we do not adopt a more straightforward definition of φ j ¼ ðϕ j þ ϕ j−1 Þ=2 is that the resultant data set φ j denotes the phase error at the midpoint of two adjacent magnet poles where no radiation is emitted, which is not suitable to describe the intensity of UR.If φ j and Δ j are statistically uncorrelated, which is usually the case for general undulators, we have a relation Let us introduce two variables defined by λ 0 2Nλ u s being known as the angular divergence of UR at the fundamental wavelength of λ 0 ¼ 2πc=ω 0 ð0Þ.In the following discussions, we focus on the calculation of the kth harmonic intensity near the optical axis; namely, we assume ω ≪ 1 and Θ 2 ≪ 1.
From the mathematical point of view, it is convenient to modify Eq. ( 7) as follows φðnÞ: Namely, the argument γθ x in χ is replaced with γθ x − X0 ðnÞ, and the function ϕ is replaced with φ.Then, recalling that φ is a slowly varying function of n, while χ rapidly oscillates as n, Eq. ( 6) reduces to B. Simplifying into a convenient form Although Eqs. ( 14) and (15) can be used to exactly calculate the angular flux density jEj 2 available with a real undulator, they are not convenient to quickly evaluate its quality under practical conditions, because we need to perform a numerical calculation using the functions φðnÞ and X0 ðnÞ represented by the given data sets φ j and Δ j , with the effects due to the recovery factors taken into account.In the following sections, we further modify these equations to derive a simple form to represent jEj 2 as a function of σ φ and σ Δ , which is convenient for analytical formulation to deal with the recovery factors.

Formulation based on Fourier analysis
We first consider the case when the horizontal slope error X0 is so small that f k ½γθ x − X0 ð2πnÞ in Eq. ( 14) hardly depends on n.In other words, the phase oscillation term ΔðnÞ is negligibly small.Then we have Note that summation with respect to n in Eq. ( 14) has been replaced with integration over n; this is possible because the exponent in the above equation is a slowly varying function of n in the sense explained in the preceding section.
We now apply Fourier analysis to Eq. ( 16).Namely, φ in the exponent is expanded into a Fourier series as follows with where φm is the Fourier coefficient defined as φðnÞ exp 2πimn N dn: Substituting Eq. (17) into Eq.( 16), and using the wellknown formula expðix sin yÞ ¼ we have where J l is the lth order Bessel function of the 1st kind.Except for the exponential phase factor, the integrand in Eq. ( 19) is composed of products of Bessel functions with l m being an integer.Among them, we neglect the terms containing (1) the 2nd or higher-order Bessel functions, and (2) the quadratic or higher-order terms of J 1 , assuming that kφ m ≤ 1 is satisfied.
Based on the above simplification, Eq. (19) reduces to with sincðxÞ ≡ sin x=x, and Making use of approximate expressions of Bessel functions which are valid when jxj ≤ 1, we have where we have omitted the cross terms because of the deltafunction-like behavior of sincðxÞ.
Recalling that σ φ is the standard deviation of φðnÞ given by Eq. ( 17), it is easy to show with which we finally have Note that this formula has been derived under the condition when the horizontal slope error X0 is small and thus the phase oscillation term ΔðnÞ is negligible.

Effects due to the phase oscillation
Now let us consider the effects due to the phase oscillation, which can be done by investigating the impact of X0 on E through the function f k ðXÞ defined in Eq. ( 15).Instead of the rigorous formulation using Eq. ( 14), we extend the discussions made in the preceding section, and assume that the angular flux density is roughly given as In what follows, we derive an explicit expression for F k ðγθ x ; σ Δ Þ that is consistent with Eqs. ( 14) and (15).
Although the integration in Eq. ( 15) can be done analytically, the result is given as a complicated formula composed of quadratic forms of Bessel functions [8], and is not convenient to continue mathematical operations.Instead of the exact expression, we thus derive a simple form of f k ðXÞ by making a few assumptions and approximations as follows.
We first assume that the observation angle γθ and the horizontal slope error X0 are much less than K. Then we make approximations in Eq. ( 8) and in Eq. ( 15).Then we have The integrand in the above formula can be represented by the Bessel functions using Eq. ( 18) and the integration can be done analytically as has been done before; however, the result is given as a sum of quadratic forms of Bessel functions because the exponent in the above formula contains two different sinusoidal functions.To avoid the difficulty in dealing with them, we apply a rough approximation to the last term of the exponent.Then Eq. ( 21) reduces to UNIVERSAL REPRESENTATION OF UNDULATOR … PHYS.REV.ACCEL.BEAMS 21, 110704 (2018) 110704-5 which can be analytically calculated to give an approximate and simple form of f k ðXÞ as follows where k is assumed to be an odd integer because even harmonics are of no interest in the present work.
The validity of the above approximation should be examined by comparing the approximate and exact formulas given by Eqs. ( 15) and ( 22), respectively.For this purpose, we computed jf k ðXÞj 2 using the two formulas with the parameters of K ¼ 2.2 and k ¼ 11.The results are shown in Fig. 2, where we find that the approximate formula (22) well reproduces the exact one (15) at least within the range of jXj ≤ 0.5, which is wide enough to evaluate I r =I 0 near the optical axis.
Having verified the validity of Eq. ( 22), let us consider the effects due to X0 and derive the expression for F k ðγθ x ; σ Δ Þ. Recalling that the argument of f k in Eq. ( 14) is ðγθ x − X0 Þ, it is reasonable to calculate F k with the following formula for a given data set of X0 j ≡ X0 ðn j Þ.In a more general manner, this is rewritten as where σ X 0 is the RMS of X0 .Substituting Eq. ( 22), the above formula reduces to Using the relation between ΔðnÞ and X0 ðnÞ defined in Eq. ( 10), we finally have

C. Considering the recovery factors
Using S k;N and F k derived in the previous sections, the angular flux density of UR, which is emitted by a single electron moving in a real undulator with field errors, can be calculated, at an arbitrary angle Θ and frequency ω.The next step is to modify Eqs. ( 20) and ( 23) to take into account the recovery factors, i.e., the effects due to the finite energy spread, emittance, and collection angles, which are denoted as S e k;N and F e k to be distinguished from the original ones.

Effects due to the energy spread
To take into account the effects due to the energy spread, we first consider how the derived formulas change for an electron having a different energy γ 0 ¼ γð1 þ εÞ, where we assume jεj ≪ 1.It is obvious that F k does not change significantly, while S k;N should be modified.This comes from the fact that the fundamental frequency changes as ω 0 0 ¼ ω 0 ð1 þ 2εÞ, and thus the normalized frequency changes as ω0 ¼ ω − 2kε.In other words, the argument ω in S k;N should be replaced with ω − 2kε for an electron with the energy deviation of ε.Summing up all the photons emitted by the electrons contained in the electron beam with the RMS energy spread of σ ε , we have with σ kε ¼ 2kσ ε , the operator ⊗ denoting the convolution operation, and being a Gaussian function with the standard deviation of σ.Substituting Eq. (20) into Eq.( 24), we have The above equation describes the growth of the spectral bandwidth because of the convolution with the Gaussian function Gð ω; σ kε Þ.Using Eq. (A2) in the Appendix A, we can simplify the above formula to give with We now focus on the peak angular flux density by substituting ω ¼ Θ ¼ 0 into Eq.( 26), which results in Introducing a function φðn; N 0 Þ, whose Fourier coefficient is given by φN 0 ;m and using the Parseval's theorem, we have being the RMS of the function φðn; N 0 Þ.
To clarify the meaning of the function φðn; N 0 Þ, we consider a rectangular function defined by rectðn; whose Fourier coefficient is given as Then Eq. ( 28) reduces to which means that the Fourier coefficient of φðn; N 0 Þ is given as a product of the Fourier coefficients of φðnÞ and rectðn; N 0 Þ=N 0 .Thus φðn; N 0 Þ is given as the convolution of two functions φðnÞ and rectðn; N 0 Þ=N 0 , namely, In other words, φðn; N 0 Þ is a moving average of φðnÞ with a window size of N 0 .As Nσ kε grows, N 0 becomes smaller, and φðn; N 0 Þ approaches φðnÞ.
It is relevant to mention that S e k;N defined in Eq. ( 29) is given as a product of two factors, ð1 φ;N 0 Þ.The former describes the intensity reduction due to field errors, while the latter describes its recovery because of the finite energy spread, which strongly depends on the smoothness of φðnÞ; if it is a smooth function of n in the sense that it does not change significantly over the range of N 0 , we have σφ;N 0 ∼ σ φ , and thus S e k;N → 1.It is often the case that σ φ is mostly attributable to a large but slow variation of φðnÞ in a real undulator, and thus its impact on I r =I 0 is in practice weakened under the practical condition when the energy spread of the electron beam is finite.

Effects due to the emittance and collection angles
Unlike the effects due to the energy spread, the angular divergences (σ x 0 , σ y 0 ) and collection angles (Δθ x , Δθ y ) have impacts on both S e k;N and F e k , which are investigated separately in the following discussions.
We first consider the impacts on S e k;N .Convoluting S k;N with the angular profile of the electron beam, which is given as a product of two Gaussian functions with the UNIVERSAL REPRESENTATION OF UNDULATOR … PHYS.REV.ACCEL.BEAMS 21, 110704 (2018) 110704-7 standard deviations of σ x 0 and σ y 0 , and integrating over the collection angles Δθ x and Δθ y , we have where we have omitted the argument Θ in S e k;N .The above formula can be rewritten as Using Eq. (B2) in the Appendix B, we have and a similar expression for Σ y 0. Now we substitute Eq. (20) into Eq.(32), and decompose as follows with Although the integration in the above formula cannot be done analytically, we can roughly evaluate its spectral profile.First, we rewrite the above formula as follows where δðxÞ is the Dirac's delta function.Exchanging the order of integration, we have with Using I G ð ωÞ, Eq. (34) can be written as which has the same form as Eq. ( 25), if we substitute Θ ¼ 0 and replace Gð ω; σ kε Þ with I G ð ωÞ.In other words, Eq. ( 35) describes the growth of the bandwidth due to the finite emittance and collection angles.Thus, we can follow the same analytical process taken in the preceding section by approximating I G ð ωÞ by Gð ω; σ ω;I Þ, in which σ ω;I should be determined to be consistent with the spectral profile of I G ð ωÞ.As an example, we evaluate the bandwidth of I G ð ωÞ in the same manner as the Gaussian function, i.e., Calculations of the numerator and denominator of the above formula can be done analytically, i.e., with which we have Combining with the results derived in the preceding section, the parameter N 0 defined in (27) should be modified according to with which we have Although the above formula is identical to Eq. ( 29) except for the collection angle factor, it should be emphasized that the parameter N 0 is calculated according to Eq. (37) instead of Eq. ( 27).
Next we discuss the impacts on F e k .In the same manner as Eq.(32) for S e k;N , we have Using Eq. ( 23), the integration can be done analytically to give It should be mentioned that the above procedure to separately calculate S e k and F e k , under the effects due to the finite angular divergence and collection angles, is not mathematically valid.Strictly speaking, we may need to calculate to evaluate the product F e k S e k , instead of the independent mathematical operations of (32) and (38).It is easy to understand, however, that the integration in the above equation cannot be analytically performed, and thus we cannot derive any useful information in a convenient manner if we stick to the rigorous treatment.This is the reason why we calculate S e k and F e k separately, and assume that their product gives a good approximation to the rigorous form.The validity of this assumptions should be examined by comparing with the rigorous numerical calculations, as discussed later in Sec.III.

Redefining the phase error
Now let us evaluate I r =I 0 with all the recovery factors taken into account.Summarizing the results gained so far, we have For reference, let us recall the definitions of the parameters; σ φ and σ Δ are the RMS of the functions φ and Δ defined in Eqs. ( 9) and (10), while σφ;N 0 and Σx 0 are defined in Eqs. ( 30) and (39), respectively.
As easily understood, the applicability of the above expression is limited.For example, ρ becomes negative when kσ φ > 1, which is physically incorrect.This is attributable to the assumption kφ m ≤ 1 made in Sec.II B. Although this assumption is in most cases valid, it may be useful to modify Eq. ( 40) to be applicable even without it, i.e., for large values of kσ φ and k σφ;N 0 .Recalling the well-known approximation expðxÞ∼1þx for jxj ≪ 1, it is reasonable to replace the 1st and 2nd factors by expð−k 2 σ 2 φ Þ and expðk 2 σ2 φ;N 0 Þ.Then, we also modify the 3rd factor to be compatible with the 1st and 2nd factors, namely, As a result, we finally have being the redefined phase error given in a universal form, which takes into account the effects due to the recovery factors.It is worth repeating that σ φ , σφ;N 0 , Σx 0 and σ Δ are evaluated from the measured magnetic field distribution, using Eqs.( 4), (11), ( 12), (30), (31), (33) and (39).

III. EXAMPLES
Because Eqs.(41) and (42) have been derived based on an analytical approach with a number of assumptions and approximations, we need to examine their validities by comparing with rigorous numerical calculations.For this purpose, we need to prepare as many undulator models as possible and perform calculations under various conditions with different recovery factors, for better statistics and more reliable results.
As an example, we consider the case when an electron beam with the energy of 6 GeV and coupling constant of 10% is injected to an undulator with K ¼ 2.2 and λ u ¼ 20 mm, which is installed in the straight section with the horizontal and veritcal betatron functions of 6 m and 3 m, respectively.The fundamental photon energy of UR with the above parameters is 5 keV and we focus on harmonics up to 15th, corresponding to the maximum photon energy of 75 keV.
We then calculate the normalized intensity under 6 conditions (a)-(f) having different recovery factors defined by the energy spread σ ε , natural emittance ε n , and normalized collection angle Δθ=σ p as summarized in Table I, where σ p is the angular divergence of the photon beam at the fundamental energy.We also assume that the normalized collection angles in the horizontal and vertical directions are identical, i.e., Δθ x =σ px ¼ Δθ y =σ py and omitted the subscripts for simplicity.Note that the effects due to the recovery factors are more significant (smaller N 0 and larger Σx 0 ) in the conditions that are alphabetically greater; e.g., the normalized intensity in (c) is recovered more than that in (b), etc.This is obvious from the two columns indicating the parameters N 0 and Σx 0 , which are evaluated with N ¼ 200 and k ¼ 15 for each condition.
To facilitate the following discussions, we define I r =I 0 as the normalized intensity evaluated with the numerical method, while ρ as that evaluated with Eqs. ( 41) and (42).The validity of the analytical formulation made in Sec.II can be examined by comparing I r =I 0 and ρ.

A. Generating undulator models with field errors
To generate realistic undulator models with field errors, we first assume that the transverse magnetic field is given in a form , where B 0 is the average peak field and b x;j (b y;j ) is the normal random number with the standard deviation of σ b specifying the field error of the jth magnet pole.Typically, σ b is of the order of 0.01 (1%) or less, assuming that commercially available permanent magnets are used.Note that the horizontal and vertical components of b j are defined differently, meaning that the vertical field is the principal component of B ⊥ .The random field errors introduced above deteriorate the undulator quality and give rise to the phase and trajectory errors, as usually found in the initial magnetic condition of a real undulator just after assembly.In the following discussions, the trajectory error in the x (y) direction denoted as σ ex (σ ey ) is defined as the RMS of the deviation from the nominal trajectory.In the normal process of undulator manufacturing, the phase and trajectory errors are corrected by the so-called shimming technique.To numerically emulate the shimming process, we apply two types of corrections, local and global.The former is to locally adjust the field deviations, namely, to modify b x;j and b y;j of specific magnet poles dominating the trajectory error, while the latter is to globally tune the peak field B 0 to eliminate the smooth variation of the phase error.
In generating the undulator model, we apply the above corrections so that the trajectory and phase errors are reduced down to certain tolerances.It should be noted, however, that we do not minimize these errors by fully applying the corrections; what we need is to generate realistic undulator models with typical trajectory and phase errors.
As an example, Fig. 3(a) shows the phase errors calculated for two different undulator models denoted as A and B. Although both of them have the identical number of periods (N) of 200 and phase error (σ ϕ ) of 6°, the parameters σ b , σ ex and σ ey are different; ðσ b ; σ ex ; σ ey Þ ¼ ð0.45%; 0.20 μm; 0.77 μmÞ in A, while ðσ b ; σ ex ; σ ey Þ ¼ ð0.94%; 0.58 μm; 0.85 μmÞ in B. Note that the trajectory amplitude of a 6-GeV electron moving in this undulator is 0.6 μm, which is to be compared with σ ex and σ ey .Although the maximum values are similar (∼15°), the profiles of ϕ j in the models A and B are quite different from each other.To be specific, ϕ j varies more rapidly as j in the model B than in A; this becomes more clear if we turn to the frequency domain as shown in Fig. 3(b), where the Fourier coefficient φ m is plotted as a function of m.Low-frequency components are more dominant in the model A than in B, and φ m decays more rapidly as m.
To investigate how the difference in the phase error profile as discussed above has impacts on I r =I 0 , we numerically calculated the intensity of UR using the magnetic distributions corresponding to the undulator models A and B, under the conditions (a)-(f).The calculations have been done with the numerical code SPECTRA [3], the results of which are shown in Figs.4(a)-(f) as the spectra around the 15th harmonic (75 keV), with the alphabets indicating the conditions specifying the recovery factors.Note that the spectrum in an ideal case without any field errors is also shown for each condition, and the intensity is normalized by the maximum value of the ideal spectrum.For reference, the redefined phase errors for the models A and B (denoted as Σ ϕ;A and Σ ϕ;B ) are given in each condition.
Without the recovery factors as found in (a) and inset, the peak intensities available with the undulator models A and B are similar, and are about an order of magnitude lower than the ideal value, meaning that I r =I 0 in this condition is lower than 10%.Once the energy spread (σ ε ) is taken into account, I r =I 0 in the model A is significantly recovered and exceeds 50% as found in (b).This recovery becomes more significant when other effects (ε n , Δθ) are taken into account, and I r =I 0 exceeds 70% with the conditions (d)-(f).
On the other hand, the recovery is much slower in the model B; I r =I 0 is slightly larger than 10% even with the energy spread and still less than 30% in the condition (e).
Recalling that both undulator models have the same phase error (σ ϕ ) of 6°, it is obvious that I r =I 0 does not necessarily correlate well with σ ϕ under practical conditions, where recovery factors are not negligible; specifying the tolerance of the undulator quality with σ ϕ is thus not practical.

B. Comparison between numerical and analytical results
From the spectral calculations described in the preceding section, we can numerically evaluate I r =I 0 , as the ratio of the peak values available with the real undulator (for example, with the undulator models A or B) and the ideal one.To examine if the redefined phase error Σ ϕ can universally describe the effects due to the recovery factors, we repeated the process to numerically evaluate I r =I 0 for different harmonic numbers under the conditions (a)-(f), and compared with the analytical results given by Eqs. ( 41 Normalized Intensity Photon Energy (keV) FIG. 4. Spectra of UR calculated with the magnetic field distributions in the undulator models A and B, for six different conditions (a)-(f) defined in Table I. numerical and analytical results are shown by the symbols and solid lines, with the red and blue colors indicating the results for the models A and B, respectively.Note that the analytical results in the condition (a) are identical, and thus are shown in common in the black line.It is reasonable to say that the analytical results agree well with the rigorous numerical results in all the conditions and harmonics currently under discussion.
Having verified the validity and universality of Eqs. ( 41) and (42) using the undulator models A and B, we repeated the above process with other undulator models generated by the method described in Sec.III A, assuming N ¼ 100 or N ¼ 200.To scan a wide range of realistic conditions, we changed σ b and other tolerances for each undulator model, as well as the seed for the random number generator, with the maximum values of 1% (σ b ), 1 μm (σ ex and σ ey ) and 6°(σ ϕ ), respectively; they are large enough to cover the possibility of undulators whose field errors are not well corrected.We generated 300 undulator models for each value of N ¼ 200 and N ¼ 100, and numerically calculated I r =I 0 under the conditions (a)-(f), which are plotted in Fig. 6 as a function of kΣ ϕ evaluated by Eq. ( 42), together with the analytical formula ρ given by Eq. ( 41).We find a good correlation between I 0 =I r and ρ for each condition, suggesting the universal validity of the analytical formulas.
Figure 7 shows the statistics of the difference between I r =I 0 and ρ, where histograms of I r =I 0 − ρ are plotted for the conditions (a)-(f), together with the RMS values.We can conclude that the analytical formula can predict the normalized intensity with an accuracy at least better than 10% in any conditions from (a) to (f), which is obviously good enough to quickly examine the effects due to the field errors.
C. Relation between σ ϕ , σ ψ and Σ ϕ Now we show that the redefined phase error Σ ϕ , which can represent the undulator quality under general conditions, reduces to the conventional phase error σ ϕ or the local phase error σ ψ in a specific condition.
Next let us consider the case when the recovery factors are sufficiently large so that N 0 is small and Σx 0 is large.Then the 3rd term of the left-hand side of Eq. ( 42) can be omitted and we have Using Eq. (A1) in the Appendix A and assuming that πðN 0 =NÞm ≪ 1 is satisfied, we have to give  Recalling that the local phase error σ ψ is defined as the RMS of the derivative of φðnÞ with respect to n, we have The above equation suggests that Σ ϕ correlates well with σ ψ , if the approximation (44) is valid.This is examined in Fig. 8, where the correlation plots between Σ ϕ and σ ψ in the conditions (a)-(f) are shown.We find that the correlation, which is quite poor in the condition (a), becomes better in the alphabetically greater conditions, because of the larger recovery factors.In particular, we can say that Σ ϕ can be substituted for by σ ψ in the condition (f), and thus σ ψ can well represent the undulator quality.For other conditions, however, the correlation is not necessarily good, which suggests that we cannot apply the approximation (44), and evaluating the normalized intensity with σ ψ can overestimate the undulator quality.We thus need to use Σ ϕ in these conditions where the recovery factors are not sufficiently large.

IV. EFFECTS DUE TO LOW-FREQUENCY SYSTEMATIC ERRORS
The undulator models used in the previous section are based on an assumption that the peak field varies randomly at each magnetic pole, which comes from the variation in quality and dimension of permanent magnets.Besides such random errors, we need to consider the impacts of systematic errors, which come from the common mechanical structure of undulators, and have nothing to do with the quality of the permanent magnets.
The magnetic blocks of undulators are usually assembled onto a common rigid girder, which is supported by a few driving shafts to enable the gap motion.In such a conventional structure, the strong attractive force between the top and bottom girders potentially brings two systematic errors; one is the deformation of the girder, and the other is the motion error of the driving shaft, both of which cause a systematic gap variation along the undulator axis, which ranges from the entrance to the exit of the undulator and is given by a low-order polynomial function of the longitudinal coordinate n.It is obvious that the resultant phase error ϕðnÞ is dominated by low-frequency components; namely, the Fourier coefficient φ m decays rapidly as m.
In what follows, we investigate the effects due to this kind of systematic error, which is referred to as a low-frequency systematic error (LFSE).
Let us introduce a function ηðnÞ ηðnÞ ¼ B 0 ðnÞ − B 0 B 0 ; with B 0 ðnÞ being the peak field at n, and B0 being the average of B 0 ðnÞ over the whole undulator.Then, recalling that ηðnÞ is a slowly varying function of n, we have [9] ϕðnÞ which allows us to analytically calculate the phase error, if ηðnÞ is a polynomial function.Let us first consider the case when the gap variation is linear and thus ηðnÞ is given by a linear function, with η 0 being the peak field deviation at the end of the undulator (n ¼ AEN=2) with respect to its center (n ¼ 0).Then it is easy to show It is worth mentioning that the phase-oscillation term ΔðnÞ can be neglected for the LFSE, because the slow variation of the gap does not cause the trajectory error; we thus have φðnÞ ¼ ϕðnÞ.
The phase error σ ϕ , or the standard deviation of ϕðnÞ, can be analytically calculated to give As an example, let us consider the case when the top and bottom girders of the undulator with the parameters supposed in Sec.III, are tilted by AE1 μrad.Assuming that the undulator consists of a Halbach array, this leads to a field variation of η 0 ¼ 6.3 × 10 −4 , which results in the phase error of σ ϕ ¼ 5°for N ¼ 200.
The phase error of 5°found in the above condition is often unacceptable, because the normalized intensity I r =I 0 , evaluated without taking into account the recovery factors, will be extremely low for high-harmonic (k ≥ 11) radiation.This is the reason why a lot of efforts have to be made to reduce the LFSE as much as possible.As we have seen, however, I r =I 0 is actually much higher for practical conditions; it is thus interesting to evaluate the phase error Σ ϕ to investigate how the recovery factors work in this particular condition.
To derive an analytical form of Σ ϕ , we first calculate the Fourier coefficient φ m , which can be done analytically to give Substituting into Eq.( 43), we have Because of the relatively large exponent of 4 (m 4 ), the above summation converges rapidly with m.As a result, Σ ϕ =σ ϕ , which denotes the reduction of the phase error due to the recovery factors, hardly depends on N, as long as N 0 =N is kept constant.In other words, Σ ϕ =σ ϕ is given as a universal function of N 0 =N.As an example, Σ ϕ =σ ϕ is plotted as a function of N 0 =N in the solid line in Fig. 9, where the conditions assumed in Sec.III are indicated by arrows with alphabets.In the practical conditions (b-f), the phase error is reduced by nearly one order of magnitude (Σ ϕ =σ ϕ ∼ 0.1).As a result, σ ϕ of 5°generated by the tilt angle of 1 μrad reduces to a small error of Σ ϕ < 0.5°, which corresponds to I r =I 0 > 0.98 at the 15th harmonic.
Although the above discussion is limited to the linear systematic error, it can be easily extended to more general ones represented by higher-order polynomials.Following the mathematical operation given above, we have for a quadratic error, and for a cubic error, where η 0 is again the peak field deviation at the end of the undulator with respect to its center.In Fig. 9, Σ ϕ =σ ϕ for the quadratic and cubic errors are plotted in the dashed and dotted lines, respectively, in addition to that for the linear error.We now find that Σ ϕ =σ ϕ is rapidly reduced as decreasing N 0 =N, and is less than 0.3 for N 0 =N < 0.1 as long as the polynomial order is less than 3.This suggests that the tolerance for the LFSE, which potentially causes a large phase error (σ ϕ ), can be greatly relaxed under practical conditions.For example, let I r =I 0 > 0.9 be the tolerance criterion for the LFSE, which corresponds to Σ ϕ < 1.2°at the 15th harmonic.To satisfy this condition without the recovery factors, namely σ ϕ < 1.2°, the mechanical specification of the undulator should be extremely stringent in terms of the stiffness of the girder and robustness of the driving system, which is obvious from the example mentioned above; 1-μrad tilt of the girder results in σ ϕ of 5°.In practice, the specification can be significantly relaxed with the recovery factors taken into account.Assuming a reasonable condition of Σ ϕ =σ ϕ ¼ 0.2, we have a relatively moderate condition of σ ϕ < 6.0°, which significantly relaxes the mechanical tolerance of the undulator.

V. SUMMARY
We derived a new parameter Σ ϕ to quickly evaluate the undulator quality, as an alternative to the conventional phase error σ ϕ and the local phase error σ ψ .In contrast to these parameters whose applicability is rather limited to a specific condition when the recovery factors are negligibly small (σ ϕ ) or sufficiently large (σ ψ ), Σ ϕ can be used in a more universal manner, as verified by comparing with the rigorous numerical calculations using an extensive set of parameters.It is also worth repeating that σ ϕ and σ ψ are the asymptotic forms of Σ ϕ for small and large recovery factors, respectively.It goes without saying that evaluating the undulator quality using Σ ϕ is much simpler and faster than the numerical calculations.
As an important application of Σ ϕ , we also investigated the effects due to the LFSE, and analytically revealed that its impact on the normalized intensity I r =I 0 would be significantly diminished by the recovery factors.This suggests that the mechanical specification of the undulator, which tends to be too tight because of the high sensitivity of σ ϕ to the LFSE, should be carefully defined to be consistent with the actual performance degradation evaluated with Σ ϕ .
Before closing, we repeat that Σ ϕ has been analytically derived assuming that the peak-field deviation and trajectory wander are small in the sense mentioned in Sec.II A. If these conditions are not satisfied, rigorous numerical calculations should be made.

ACKNOWLEDGMENTS
This work was supported by JSPS KAKENHI Grant No. JP18H03691.

APPENDIX A: APPROXIMATE FORM OF THE CONVOLUTION OF GAUSSIAN AND sinc 2 FUNCTIONS
Let us consider the convolution of Gaussian and sinc 2 functions, Gðx; σÞ ⊗ sinc 2 ðπNxÞ.Although the integration cannot be done analytically, the resultant function can be well represented by Gðx; σ 0 Þ or sinc 2 ðπN 0 xÞ, where σ 0 and N 0 are new parameters to be determined.First, we make an approximation as follows The coefficient and standard deviation have been determined so that the peak value given at x ¼ 0 and the total area given by integrating over x have the same value (¼ 1) in both functions [7].Then the convolution can be done analytically to give which is represented as a Gaussian function.Recalling the relation between the Gaussian and sinc 2 functions (A1), it is easy to give an alternative form as follows Gðx; σÞ ⊗ sinc 2 ðπNxÞ The above equation is not convenient for further mathematical operations because the error function is not an elementary function.To derive an approximate form R 0 ðx; σ; ΔxÞ, we make an approximation as follows rectðx; ΔxÞ ∼ Gðx; cΔxÞΔx; where c is a parameter to be determined.Then by convoluting the two Gaussian functions, we have an alternative form R 0 ðx; σ; ΔxÞ ¼ Gðx; The parameter c should be determined so that R 0 defined above is consistent with R defined in Eq. (B1).In Sec.II C 2, we need to focus on the peak value given at x ¼ 0 as in Eq. (36), and thus we substitute x ¼ 0 in both equations to compare the results, namely, Rð0; σ; ΔxÞ ¼ erf Δx
TABLE I. Parameters to represent the recovery factors supposed in the conditions (a)-(f).Note that the parameters N 0 and Σx 0 for each condition are those for N ¼ 200 and k ¼ 15.

FIG. 3 .FIG. 5 .
FIG.3.Examples of undulator models having the same phase error σ ϕ of 6°in terms of (a) the phase error ϕ j plotted as a function of the pole number j and (b) the phase error amplitude φ m plotted as a function of the normalized frequency m.
FIG.6.I r =I 0 (symbol) numerically calculated as a function of kΣ ϕ defined by Eq. (42) for each undulator model, in comparison with the analytical formula ρ (line) defined by (41).

FIG. 7 .
FIG.7.Histograms of the difference in the normalized intensity evaluated with the analytical formula and numerical calculation.

FIG. 9 .
FIG. 9. Reduction of the phase error brought by the systematic errors due to the recovery factors represented by N=N 0 ; the solid, dashed, and dotted lines correspond to the linear, quadratic, and cubic variations of the magnetic field.