Linear optics correction for linacs and free electron lasers

Linear optics errors in the linac, the transport line, and the undulator section of a free electron laser (FEL) can significantly impact the FEL performance. In this paper we propose two methods to measure and correct the linear optics of one-pass systems using trajectory scan data. The methods have been successfully applied to data taken on the Linac Coherent Light Source (LCLS) to find the quadrupole errors and beam position monitor (BPM) gains.


I. INTRODUCTION
Linear optics in an accelerator are a representation of the focusing scheme of its lattice. First-order deviations of the focusing scheme from design settings are called linear optics errors and can have significant impact on the propagation of the beam through steering errors and degradation of the beam transverse profile. In storage rings, linear optics errors have significant impact on the nonlinear beam dynamics performance in terms of dynamic aperture and momentum aperture. Therefore, global optics correction for storage rings has been a topic of intensive study and has achieved reasonable success [1][2][3][4][5][6][7][8] with a brief review of linear optics correction presented recently in [9].
Global optics correction for one-pass systems, including linacs and transport lines, have not received as much attention as for storage rings. For example, at the LCLS [10] optics are typically measured at a few selected locations with the transverse beam profile analyzed on wire scanners or fluorescent screens [11,12]. Optics control is focused primarily at these locations. Transverse properties at other locations of the linac and transport lines are then inferred by numerically propagating these measurements throughout based on knowledge of magnet current settings and offline magnetic measurement data. However, several applications leveraging global trajectory, or "orbit" data have also been studied. This includes global steering and beam-based alignment [13,14], dispersion-free steering solutions [15], and global optics measurement and matching of a multipass transport system [16]. A demonstration at the LCLS to fit the orbit response for BPM gain and offset correction has been shown [17], though there is so far no reported determination of quantitative quadrupole errors.
A more detailed global optics measurement and correction scheme that can identify errors including specific magnet strength errors would have many benefits for a long linac. First, any large errors due to short circuits, improper wiring, or mechanical roll in quadrupole magnets can be detected and corrected which can be particularly helpful during commissioning stages or after significant maintenance. Second, isolation and correction of even smaller (∼1%) focusing errors can help mitigate uncontrolled emittance dilution associated with betatron oscillations [18]. Third, the correction of optics throughout the linac also puts the beam profile closer to the design at the selected profile-measurement locations which may make systematic local optics matching easier. Finally, for free electron lasers such as the LCLS and the European XFEL, the correction of optics up to and throughout the undulator section may improve FEL output as lower emittance and improved undulator matching are achieved.
More advanced optics correction methods developed for storage rings could be modified for one-pass systems. The idea of using trajectory response matrices for optics modeling has a long history [19]. A trajectory response matrix based method has been successfully applied to the SPEAR3 booster to storage ring (BTS) transport line [20]. This approach fits the trajectory response matrix data to the lattice model in a way similar to LOCO, the orbit response matrix based method [1].
In storage rings turn-by-turn beam position monitor (BPM) data taken with the beam undergoing coherent betatron oscillations has been used for optics correction in many studies [3][4][5][6][7][8]. Most methods rely on extracting betatron phase advance and beta functions at the BPMs using temporally coherent oscillations. Because there is no temporally coherent oscillation in a linac, these methods do not apply.
There is, however, one method that uses the turn-by-turn BPM data directly and does not rely on temporal oscillation signals [4]. This method derives the angle coordinates using two BPMs separated by a drift, uses the full phase space coordinates in tracking with a lattice model, and fits the lattice model to the measured BPM data. The method was tested with a section of the SPEAR3 storage ring, which was essentially a one-pass system. This method can be applied to a long linac or transport line directly. The difference between such an application and the test in Ref. [4] would only be how the phase space is sampled. In the SPEAR3 test the beam samples the phase space through temporal betatron oscillation, which traces out an ellipse in the phase space, while in a linac application we can drive the beam to paint the phase space arbitrarily [21].
Long linacs and the undulator sections of FELs often consist of periodic structures with one BPM and one quadrupole located next to each other in each period. In such a case the kick angle a quadrupole applies to the beam in one pass can be calculated with the beam positions observed by the nearby BPMs, from which the quadrupole gradient can be derived. This leads to a local analysis method for optics error detection and correction.
We have applied both the local analysis method and the BPM data fitting method to trajectory scan data taken on the LCLS. The data were taken by a grid scan of trajectories as prescribed in Ref. [21]. The two methods found quadrupole gradient errors consistent with the experimental setting, and without the manual intervention to fitting previously required [19]. Simulation has also been done to investigate the performance and application requirements of the global fitting method, using particle tracking with the LCLS lattice to generate data.
In this paper we will first describe the two data analysis methods in Sec. II. The application of the methods to LCLS is discussed in Sec. III, which includes both experimental and simulation results. Section IV gives the conclusions.

A. Local analysis in periodic structures
If a one-pass lattice system consists of periodic cells and each cell has a BPM and a quadrupole magnet which are located closely, a local analysis of trajectory data could be conducted to derive the gradient of the quadrupole. A special case of such a situation is found in the LCLS linac, in which a BPM is located at the center of a quadrupole in each cell between two adjacent acceleration structures, as illustrated in Fig. 1.
In the LCLS linac case the length of the quadrupole is 0.1 m, very small compared to the cell length of 12.3 m. The quadrupole may be treated as a thin-lens device. The angle coordinate of the beam in the space between adjacent quadrupoles can be calculated with the beam positions recorded by the BPMs. Considering the angle coordinate changes in the acceleration sections due to small energy changes, the angle coordinates at the entrance and exit of quadrupole Q2 as shown in Fig. 1 are where x and E are the beam position and energy at the three BPMs, respectively, with subscripts indicating the corresponding BPMs. The integrated gradient of the Q2 magnet, ½KL q 2 can be derived from with a linear fit of Δx 0 2 vs x 2 . The more general case is for the BPM to be separated by a small distance from the quadrupole center, for example, as illustrated in Fig. 2. In this case the beam angle and position coordinates at the BPMs are related by where Δx 0 1;2 are kick angles by quadrupole Q1 and Q2, respectively, and x 0 2;3 are angle coordinates at BPM 2 and 3, respectively, and we have assumed no energy change for simplicity. The angular kick by quadrupole Q2 can be solved to be In the case L 0 ≪ L as we have assumed, the angular kick Δx 0 1 in Eq. (6) can be calculated with the nominal gradient of Q1 Any error between the actual and nominal gradients for Q1 will be scaled down by the factor L 0 =ðL − L 0 Þ in the calculated value of Δx 0 2 and may be neglected. If necessary, a second iteration can be conducted to recompute Δx 0 2 using the quadrupole gradient results from the first iteration instead of the nominal values. Knowing the angular kick Δx 0 2 , the gradient of Q2 can be computed using Eq. (3). The effect of the finite quadrupole lengths would be small if L q ≪ L and can be included as a correction if necessary. The above approach could be applied to configurations different from the above two cases, as long as there is one nearby BPM for each quadrupole with a separation distance that is much shorter than the distance between the adjacent quadrupoles.
Advantages of the local analysis approach include that it does not require a thorough lattice model and that it is not affected by optics errors elsewhere. A disadvantage is that if the three adjacent BPMs have different calibration gain errors, the measured quadrupole gradient will have a systematic error. It is noted that if all BPMs have the same calibration error, the calculated quadrupole gradient value is not affected.

B. Global trajectory data fitting
If the beam path is away from the centers of the quadrupole magnets along the beam line, the beam trajectories sample the strengths of the quadrupoles and hence contain linear optics information. One way to recover the optics information from the trajectory data is to fit the lattice model to minimize the differences between the measured trajectories and the trajectories predicted by the model. This approach has been tested for a one-pass system using a section of a storage ring [4].
The key to realizing the approach is to derive the angle coordinates to be used for tracking. This could be done with two BPMs separated by a lattice section for which the transfer matrix is precisely known. A simple case is when the two BPMs are separated by a drift space. For example, in Fig. 3 BPMs 0 and 1 are separated by a drift with length L and hence the angle coordinates at BPM 1 are Knowing the transverse phase space coordinates (x, x 0 , y, y 0 ) at BPM 1, the beam positions at all downstream BPMs can be predicted with particle tracking using the lattice model.
BPM gain errors and rolls can be included in the prediction. For each BPM, the predicted position readings ðx;ỹÞ are related to tracking coordinates ðx;ȳÞ by where θ is the BPM roll and g x;y are horizontal and vertical gains, respectively. The predicted BPM readings are necessarily different from the measured trajectories, given the errors in the actual machine optics and in the BPM calibration. These errors could be recovered through a fitting scheme that adjust the lattice parameters and the BPM parameters to minimize the differences between the measured and predicted trajectories. This fitting scheme is a least-square problem with the objective function where N is the number of trajectories, M is the number of BPMs, p is a vector of fitting parameters, and σ x;y are BPM noise sigmas. The fitting parameters include quadrupole gradients in the lattice model and BPM parameters. The least-square problem can be solved with the Levenberg-Marquardt method [22,23]. Quadrupole rolls can also be fitted. However, small rolls are typically not very important if only the linear optics is concerned as the change of the normal quadrupole component due to a small roll is a second order effect and the resulting skew quadrupole component should not interfere the fitting of normal quadrupole gradients because the skew and normal quadrupole components affect the objective function differently.
It is worth pointing out that the ability to determine the fitting parameters from the data may be limited, depending on how the fitting parameters affect the χ 2 function and the noise level in the data. One challenge is to distinguish the contributions of quadrupoles that are very close in terms of betatron phase advances. Another challenge is to determine the gradient errors of quadrupoles located near the end of the line with few downstream BPMs to detect their effects. In these cases there is a near degeneracy in the fitting problem and the fitting parameter vector p could have large excursions in certain directions in the parameter space that are not constrained well by the data. The degeneracy problem is common to linear optics correction methods and has been previously studied in Ref. [2].
A practical solution to the degeneracy problem is to use constrained fitting, which tries to limit the deviations of fitting parameters from their initial values in each iteration by adding penalty terms to the χ 2 function [2]. For example, the objective function may be modified to in order to limit the deviations of fitted quadrupole gradients, ΔK i , i ¼ 1; 2; …; P, where P is the number of quadrupole parameters, w i are weight factors, ∂r ∂K i is the column of the Jacobian matrix corresponding to quadrupole i, and r is the residual vector. The residual vector consists of all the terms in χ 2 , but not squared, such that χ 2 ¼ r T r, where r T is the transpose of the column vector r. The appropriate values of the weight factors differ for different fitting setup and can be empirically found, using the χ 2 contribution of the parameters as a guidance. More discussion on the constrained fitting scheme can be found in Ref. [2]. With constrained fitting, we can find equivalent solutions that represent the optics information in the trajectory data with minimal deviations from the nominal setting. Solutions by constrained fitting also have smaller error bars. Such solutions are more ideal for iterative optics correction on the machine.

III. APPLICATION TO THE LCLS
The portion of the LCLS [10] under study consists of the L3 sublinac downstream of final bunch compression, the beam switch yard (BSY) and linac to undulator (LTU) transport line, the undulator section, and the dump line consisting of 126 working BPMs and 131 quadrupole magnets. The design linear optics for the beam line are shown in Fig. 4. The design L3 linac accelerates the beam from 4.5 GeV to the full energy of 13.6 GeV.
In evaluating the significance of the fitting both in the initial measurement and in simulation, we consider the design and measured tolerances. In the L2 and L3 sublinacs, the magnetic stability of all quadrupoles is required to be 0.5% or less. For the BSY, LTU and undulator regions, this requirement is reduced to 0.1%-0.2% or less. Offline magnet measurements confirms the quadrupole field reproducibility to be 0.03%-0.06%, well within requirements. However, quadrupole strengths in the actual machine may differ from the offline bench measurements due to changes of operation conditions, interference from other components, or human errors. Though these methods will allow determination of BPM noise, this has previously been determined for the stripline-type BPMs used in all regions outside of the undulator as typically 25 μm RMS [24]. In the undulator where beam trajectory tolerance is much tighter (< 1 μm), RF BPMs have a noise level of 300 nm.

A. LCLS trajectory scan data
We have applied the methods described in the previous section to LCLS experimental data. In the experiment, trajectories from the end of bunch compressor 2 (BC2) to the final dump were scanned on a 6 × 6 grid by two orbit correctors upstream of L3 in each of two transverse planes,   Fig. 6 shows the singular values for the horizontal and vertical trajectories. Two leading modes dominate for both planes and their spatial patterns bear features of the optics functions, which indicates they correspond to true trajectory variations due to steering errors upstream of the L3 linac. If treated properly, such trajectory variations are not noise, but a source of information. Removing the two leading modes, we can obtain an estimate of the BPM noise level. The standard deviations of trajectories before and after the two leading SV modes are removed are shown in Fig. 7. The noise of L3 linac BPMs are 5-10 μm RMS, lower than previously determined.

B. Local analysis for the L3 linac
In the L3 linac, there is one BPM for each quadrupole and the BPM is located at the center of the quadrupole.
This allows the application of the local analysis described in the previous section, using Eqs. (1)-(3). Figure 8 shows the data fitting of Δx 0 ∼ x and Δy 0 ∼ y for one of the L3 quadrupoles as an example. Here and in the following the x and y position values are trajectory offsets after the nominal trajectory is subtracted. The energy gain between two adjacent quadrupoles in the L3 linac is 200 MeV. The effect of beam energy change on the angular coordinates is included in the calculation of Δx 0 and Δy 0 . The linear fitting gives the integrated gradient and an estimate of its error bar based on the BPM noise level. The integrated gradients fitted from the horizontal and vertical data are ½KL q ¼ −0.0415 AE 0.00015 m −1 and ½KL q ¼ −0.0413 AE 0.00012 m −1 , respectively.
In the above example we show data fitting for the horizontal and vertical planes separately as an illustration. In the actual data processing we fit the horizontal and vertical data together for each quadrupole. The fitted gradients for the L3 quadrupoles are compared to the design model values in Fig. 9. Good agreement is seen almost everywhere except for quadrupoles 9 (model name Q26201) through 13 (Q26601). These quadrupoles were tuned for optics matching in operation and therefore are expected to deviate from the design model (see next subsection for comparison to the expected values). Their effects on the trajectory data will be discussed in the next subsection.

C. Global lattice fitting
There are three pairs of BPMs that are separated by drift spaces in the LCLS line downstream of BC2. The locations of these BPMs are shown in Fig. 4 with vertical bars. Using these BPMs to derive the angle coordinates, we can apply the global lattice fitting method to various sections of the line.
The first pair of BPMs are located in the BSY, after the L3 linac. The distance between the two BPMs is 21.4 m. Quadrupoles in the L3 linac can be fitted with trajectory data using backward tracking. The particle tracking code Accelerator Toolbox (AT) [25] is used. Since AT considers the reference beam energy a fixed value, we made simple modifications to the code to account for the changes to the angle coordinates due to beam energy increases in the linac.
The design model is used as the initial lattice in the leastsquare fitting. The χ 2 value normalized by the degrees of freedom (the number of data points minus the number of fitting parameters) was reduced from 1350 to 3.6. The final χ 2 value does not converge to 1.0 because of effects that are not accounted for by the fitting model, such as, orbit corrector fluctuations, energy jitters, and quadrupole and BPM rolls. The differences between the fitted values and the design model values, ΔK, for the L3 quadrupoles are shown in Fig. 10. Results using the global fitting approach and the local analysis approach are compared to the "Extant" model, which calculates quadrupole gradient values with the magnet setpoints and off-line magnetic field measurements. The differences between the fitting results and the Extant model are also shown. Error bars for the fitting results are obtained from the Jacobian matrix of the fitting parameters. Good agreement is found between the two beam-based methods and the Extant model. Deviations are on the level of the error sigma for most of the quadrupole parameters. The expected accuracy of fitted quadrupole gradients is discussed in Sec. III D. The fitted BPM gains are plotted in Fig. 11. Gains for the pair of drift separated BPMs are also included in the fitting.
The BPM gains are scaled so that the horizontal and vertical gains for one of the BSY BPM pair, BPM #50, are 1.0. Figure 12 shows the differences between the measured and the tracked trajectories before and after the fitted parameters are applied to the model. The measured trajectories significantly differ from tracking results obtained with the original lattice model at BPMs at or after quadrupoles 9 through 13 (note tracking direction is backward). After fitting, the differences are substantially reduced.   The global fitting method is applied to the BSY and LTU sections that follows the same pair of BSY BPMs using forward tracking. Fitting for this section can also be done with a pair of drift separated BPMs located at the end of the LTU (just before the undulators), using backward tracking. The distance between this second pair of BPMs is 6.6 m. In this section some quadrupoles are powered with serial power supplies. One quadrupole fitting parameter is used for all the quadrupoles with a common power supply. There are 20 quadrupole parameters and 33 BPMs in the fitting setup.
The forward tracking fitting reduces the normalized χ 2 value from 877 to 6.7. The backward tracking reduces the normalized χ 2 value from 1905 to 3.9. The differences of the fitted quadrupole gradient values for both fitting setups and the Extant model from the fitting starting values are plotted in Fig. 13 top plot. There are two BSY design optics for LCLS. The one we used as the fitting starting point was not used in operation during the time of data taking. This is the explanation for the large differences for quadrupole parameters 3-5. Note that the four QEM quadrupoles are also different from the design model. These quadrupoles were tuned for optics matching to the undulator and thus deviated from the design values. The differences between the Extant model and the fitted gradient values are shown in Fig. 13 bottom plot. The fitting results from the forward and backward setups agree very well. While the fitting results successfully recovered the Extant model with beam based data, there are differences considerably higher than the error sigma level.
The fitted BPM gains are plotted in Fig. 14 for results obtained with both forward tracking and backward tracking. Here we also set the gains for BPM #50 to 1.0. The BPMs obtained with the two tracking setups are very similar. It is worth noting that the gains for BPM#51 obtained here with the BSY-LTU data and the L3 linac data shown in Fig. 11 are also similar.   The trajectory differences between measurements and tracking before and after fitting are shown in Fig. 15 for the forward tracking case. It can be seen that before the model is calibrated with fitting, there are significant differences between the measured and tracked trajectories. This is in part because we used a wrong BSY lattice model as the starting point, in part because the four optics matching quadrupoles in LTU were adjusted away from the model. After fitting, the difference is also substantially reduced.
Using the second pair of drift-separated BPMs, we can also fit the trajectory data for the undulator section. However, it is more difficult to resolve the quadrupole errors in this section. The fitted quadrupole gradients show a spurious zig-zag pattern with ΔK reaching the AE0.02 m −2 level, which indicates that the cross coupling between the adjacent quadrupole parameters is causing the fitting result to drift toward the underconstrained directions [2]. The challenges of optics correction for the undulator section and potential solutions are discussed in the subsection III D 3.

L3 Linac
We performed simulation for the L3 linac section to study the accuracy and the applicability requirements of the global fitting method. In the simulation we modified the quadrupole strengths in the lattice model to the values obtained with the global fitting method as in Fig. 10. Particle tracking is used to generate simulated BPM data with initial phase space coordinates distributed on 6 × 6 grid points similar to that of the experimental data. BPM gain errors are inserted to the data using values fitted with the actual data. Gaussian white noise is added to the BPM data with the noise sigma at each BPM given by the standard deviation of the raw BPM data as shown in Fig. 7.
The global fitting method with backward tracking is applied to the simulation data 10 times, each time with a different random seed for BPM noise generation. The initial solution in the fitting is the design model. The fitted BPM gains reproduce the target values, with a median error sigma of 0.8% for the horizontal gains and 1.2% for the vertical gains, where the error sigmas are estimated with the standard deviations of the 10 fitting solutions.
The errors in the fitted quadrupole gradients are shown in Fig. 16. The median of the error sigmas, σ K , is 0.0052 m −2 , and the median of σ K K is 1.4%. The error sigmas can be reduced by increasing the trajectory scan amplitude. If the scan amplitude is increased by a factor of 5, to 1.5 mm, the error sigmas will be reduced by a factor of 5.
A major cause of the large error sigmas for the quadrupole gradients is the correlation between the adjacent quadrupoles, which can be mitigated with the constrained fitting scheme [see Eq. (11)]. The correlation problem is more severe with the undulator section. More discussion on the use of constrained fitting is provided in subsection III D 3.

BSY-LTU section
Simulation is also performed for the BSY-LTU section using the same approach as done for the L3 Linac. Quadrupole errors fitted with forward tracking are inserted to the model to generate simulation data (see Fig. 13). BPM gain errors and random noise are added to the data.
The fitting procedure is applied to the simulated data with different random noise seeds for 10 times. The average FIG. 15. Trajectory differences between measurements and tracking before and after fitting for the BSY-LTU section using forward tracking. Top: horizontal trajectories; Bottom: vertical trajectories. values and the standard deviations for the fitted quadrupole gradients are shown in Fig. 17. The error bars for the last two quadrupoles are much larger than the other quadrupole parameters because the distance between the last two BPMs is small. In the forward tracking case, the last two quadrupoles are constrained only by data from these BPMs; in the backward tracking case, these two quadrupoles are varied in fitting to compensate the large angle coordinate noise due to the small distance, resulting in big error bars. The error sigma, σ K , for the other quadrupole parameters has a median value of 1.0 × 10 −3 m −2 (with σ K =K ≈ 0.20%) and 1.3 × 10 −3 m −2 (σ K =K ≈ 0.26%) for the forward and backward tracking cases, respectively. The error sigmas for quadrupole gradient in the BSY-LTU section are smaller than the L3 Linac case because there are more BPMs than quadrupole parameters.

Undulator section
Simulation was also done for the undulator section. This section consists of 33 quadrupoles, located between undulators, with a separation of about 4 m between two adjacent quadrupoles. Each quadrupole is accompanied by a BPM in the lattice. The betatron phase advances, ½μ x ; μ y , for the entire undulator section are ½0.696; 0.780 × 2π, less than one betatron period for both planes. The small phase advances between the adjacent quadrupoles means the impact of gradient errors of these quadrupoles to the linear optics are very similar, as indicated by the correlation coefficients of the corresponding columns of the Jacobian matrix of the quadrupole pairs shown in Fig. 18. The high correlation cause difficulties for the optics fitting method to resolve the contribution of individual quadrupoles.
In the simulation we insert large gradient errors, at 5% of the nominal values, to three quadrupoles and random small errors, with rms of 0.5% to the other quadrupoles. Trajectory scan data are generated using particle tracking with the amplitude of 300 μm. Random BPM noise with rms value of 1 μm is added to the data on all BPMs. The pair of BPMs with a separation of 6.6 m before the undulator section are used to calculate the angle coordinates for forward tracking.
Global fitting was performed 10 times with different random seeds. The average fitted quadrupole gradients are compared to the target values in Fig. 19, where the error bars are standard deviations of the 10 data sets. Because of the near degeneracy of the quadrupole parameters, the fitted gradients have large error bars, with an average value for σ K at 0.016 m −2 . Figure 20 shows the beta beat in the undulator section before and after the quadrupole errors in the lattice model are corrected. With the quadrupole errors, the beta beat reaches 25% for the horizontal plane and 20% for the vertical plane, respectively. When the lattice errors are corrected, the beta beat is reduced to below 2%, even for fitting solutions that are substantially different from the target values. This clearly indicates that the large variations are mainly due to excursions of the solution toward the under-constrained patterns which involve a lot of cancellation between the quadrupole parameters [2].
By applying constraints to the quadrupole parameters, we could derive an equivalent optics model that may differ from the target model in quadrupole gradient values, yet with nearly the same optics functions [2]. Figure 21 shows the fitting results for the same data sets as used in Fig. 19   using constrained fitting. The average error sigma for the gradient parameters are 1.9 × 10 −3 m −2 , with the weight factors w ¼ 0.02 for all quadrupoles [see Eq. (11)]. Even though the fitted gradient values are significantly different from the target solution, the beta beats of the corrected lattices are below 2%. Simulation with the undulator section also shows that increasing the trajectory scan amplitude and increasing the distance between the two drift-separated BPMs increase the capability of the fitting method to resolve quadrupole errors. We also found that the trajectory scan does not need to span a grid in the phase space as the data we used in the analysis for LCLS. Populating the trajectories uniformly on the design ellipse in the phase space at the entrance point with the largest amplitude has better performance in the resolution of quadrupole errors.

IV. CONCLUSION
In this paper we proposed and demonstrated two methods to determine the focusing errors in one-pass systems such as linacs and transport lines. The thin-lens local analysis method is applicable to special cases where one quadrupole is always accompanied by one BPM with a very small separation in between as compared to the distances between adjacent quadrupoles. This is the typical case for long linacs with many repetitive cells. The second method is a global fitting approach that fits trajectory scan data to the lattice model by minimizing the differences between the measured and tracked trajectories. A pair of BPMs that are separated by a drift space are needed to derive the phase space coordinates for tracking.
The first approach has the benefit of using local information only and not requiring a full lattice model. However, it is sensitive to differences in BPM calibration factors for the BPMs involved. Effects of energy changes, finite lengths of quadrupoles, and distances between the BPM-quadrupole pairs can be included in the formulas.
The second approach is more general. It requires a lattice model and a pair of drift-separated BPMs. But this should not be difficult to achieve. BPM calibration errors, and even BPM rolls and quadrupole rolls can be fitted, although small rolls are typically not important if only the linear optics is concerned.
After the quadrupole errors are derived from the data, they can be inserted into the model to evaluate the optics errors in the machine. Corrections can be applied to the machine to correct the linear optics errors.
Simulation shows that with a scan amplitude of 300 μm and BPM noise sigmas around 5-10 μm, the global fitting method can retrieve the quadrupole errors with a median accuracy of σ K ≈ 0.005 m −2 (σ K =K ≈ 1.4%) for the L3 Linac and σ K ≈ 0.001 m −2 (σ K =K ≈ 0.2%) for the BSY-LTU section. The error sigmas currently achieved are higher than the quadrupole accuracy requirements set for LCLS (0.5% for L2 and L3 linacs and 0.1%∼0.2% for BSY, LTU, and undulator sections). Increasing the signal to noise ratio in the data improves the quadrupole calibration accuracy, which can be achieved by either increasing the trajectory scan amplitude or reducing BPM noise. And, even though the errors of individual quadrupoles cannot be determined to the desired accuracy, the fitted solutions can still be used for global optics corrections because usually a significant fraction of the uncertainty is due to excursions along under-constrained directions which have little impact to the global optics. The constrained fitting scheme can be used to find solutions with smaller excursions in K, which are more suitable for optics correction.
For the global fitting approach, through simulation, we have also found that a large distance between the two drift-separated BPMs are important. The drift distance is preferred to be comparable to the average beta function value in the beam line of concern. A pair of drift-separated BPMs help determine the strengths of quadrupoles located toward the end of the line for the global fitting method. It is desirable to create multiple pairs of BPMs separated by long drift spaces in a long linac or transport line.