Results of the first implementation of RF phase signature matching at LANSCE

The LINAC at the Los Alamos Neutron Science Center (LANSCE) has been utilizing the Delta-t method to match the RF cavities to the design acceleration parameters since its commissioning in 1972. The differences in time-of-flight between two subsequent Beam Position and Phase Monitors (BPPMs) are measured with both accelerated and drifting beams, depending on the whether the module is set to on or off. The algorithm optimizes the module amplitude and phase via iterative measurements if the initial phase is in the vicinity of the design value. With an upgrade to a faster readout system, a scan over the whole RF cavity phase range requires relatively less time than the classical optimization procedure. The Phase Scan Signature Matching (PSSM) method provides a time-efficient method that ensures the phase selection lands on the bunching side and empowers future analyses to build module-specific models. The PSSM also utilizes a direct model to determine the correct amplitude to sub-percent level instead of using linearized matrices. Furthermore, lacking a reliable energy measurement method in the LINAC, we measure the beam phases at two downstream locations to increase the precision of energy measurements. In this letter, we also discuss the sensitivities of PSSM, error propagation, and the implementation results for the 2019 and 2020 beam cycles.


Introduction
High energy proton beam LINAC is widely used worldwide for innovative sciences [1,2] and applications [3]. However, optimizing the LINAC RF cavities is critical, especially to maintain a repetitive energy gain from each cavity. A variation of the energy gain from a cavity is problematic for target and beam transport in any user facilities, like the LANSCE accelerators system [1]. An accurate cavity optimization with better resolution of phase and amplitude is desired to maintain energy gain to minimize halos and beam tails.
Most of the worldwide accelerators were constructed several decades ago, especially in the U.S.A., with an evolution of optimization procedures. The Delta-t (Δ ) [4] procedure developed at LANSCE was one of the pioneer methods to optimize RF cavities, and it adopts an iterative process that compares measured beam phases at two downstream locations with the design values. Later on, some laboratories [5][6][7][8] implemented a phase scan method that is more robust and accurate for their ideal beam pulsed length. However, the LANSCE accelerator is different principally than others. It is an almost five-decade-old facility that simultaneously provides − beam to 4 national user facilities [1] as a modernized laboratory. At the LANSCE accelerator, the frequency of the beam pulse is not the same as some other laboratories, which have the advantage of single beam use (e.g. SNS accelerator system). At the LANSCE, for the Weapon Neutron Program (WNR), a 100-Hz 625-μs pulsed length beam is used with a bunch current of 25 mA for an average power of 3 to 4 kW -1 -

JINST 17 T02007
for an 800 MeV beam. For the Ultra Cold Neutron (UCN) [9] facility, a 20 Hz, 625 μs with 10mA per bunch beam current is used for an 8 kW power beam. For the proton Radiography (pRad) facility, 1 Hz, 625 μs pulsed beam is used for < 1 kW power, and for the Lujan Center, a 20 Hz, 625 μs beam with ten mA per bunch beam is used 80 kW power beam. Figure 1 shows a schematic layout of the LANSCE user facility and the exit energy at each of the accelerating modules. As we have seen, the requirement of the beam power is different, but the beam is delivered simultaneously, dividing the beam pulse length into gates specific to the experimental areas. For this unique feature and better accuracy, high-quality optimization is required. A Phase Scan Signature Matching (PSSM) method with modification of one-pass procedure, two baselines for precise time-of-flight measurements, and a careful error analysis have been used in this study for prompt optimization of an RF cavity. The process might be helpful for other accelerator communities.

LANSCE and the traditional Δ method
The LINAC consists of three major components: the 750-keV Cockcroft-Walton injectors for both the + and the − sources, the 100-MeV Drift Tube LINAC (DTL) at 201.25 MHz, and the 800-MeV Side Coupled-Cavity LINAC (CCL) at 805 MHz. The DTL consists of the first four accelerating modules, while the CCL contains modules 5 to 48. The DTL accelerates both the + and the − . The CCL currently only accelerates the − , while it is still capable of carrying the + . We use only the − beam for this study. However, all the discussions should apply to an + beam with minimum modifications. Except for IPF receiving the 100-MeV + beam coming out of the DTL, all the other target stations use the 800-MeV proton beam. The beam delivered to the Lujan Center is further stacked via the Proton Storage Ring (PSR). Improper tuning of the CCL could result in high loss along the LINAC, the 800-MeV beam transport region, and the PSR [10]. As a result, it is critical in the startup process to correctly determine the RF amplitude setpoint (ASP) and phase setpoint (PSP) for each module in the CCL.
Since the commissioning of the LINAC, the Delta-t (Δ ) method [4], first implemented in the VAX computer system and later translated into a Java program, has been the standard tuning procedure for the CCL to determine the desired ASP and PSP for each RF module. A direct time-of-flight method, though with a higher error budget, was also introduced in 2019 [10] to measure the beam energy independently. Though the equation uses time-of-flight, the actual measurable is the phase difference between the beam's arrival at the BPPM and the broadcast 201.25-MHz signal sent throughout the LINAC for synchronization. As a result, degeneracies in solutions separated by ∼ 5 ns exist. However, if the initial PSP is in the proximity of the design value, such a large discrepancy should be avoidable.

Reference RF Line
Readout Sys 1(2) Readout Sys 2(1) Figure 2. Illustration of the Δ measurement system. A phase comparison between the measurements from the BPPMs and the 201.25 MHz reference RF signal is conducted in the readout systems. The phase difference is then sent to the EPICS system.
The Δ method compares the time-of-flight difference between the module being on and off at the two subsequent detectors at positions B and C (the first and the second detector) for a test particle, as shown in figure 2. The time-of-flight difference at position B(C) can be written as where point A corresponds to the beginning of the module and status AB,AC is the time of flight for the − particle to travel from point A to B(C) when module being adjusted is the status, either on or off. The difference between the measured and design value for B and C can be written as The Δ B and Δ C can be converted into the incoming and outgoing phase and energy offsets via a linearized matrix [4] calculated around the optimal phase.

JINST 17 T02007
The tradition Δ method iteratively changes PSP, measures the TOF, and determines the next PSP until in the incoming phase offset is within 1 • . If the amplitude requires changes, a partial phase scan is conducted. For modules 5 to 12 (proton energy < 211 MeV), the amplitude is determined via the change of Δ B with 5 • difference in PSP. For modules 13 and above, the difference between optimal and maximum Δ B is used. Figure 3 gives an example of the optimization process for PSP. Figure 3. An example of the traditional Δ method to determine the optimal phase setpoint (PSP). The algorithm measures Δ B vs. Δ C , the time differences compared with the predictions at the first and the second BPPMs after the module. Then the algorithm changes the PSP accordingly and measures again until termination criteria are achieved. Data points are enlarged for visibility. The method to determine the optimal RF amplitude is not shown.
Several potential drawbacks could arise in the optimization process with minimal information to diagnose the problem. First, the classical Δ method, using linearized matrices, assumes the initial PSP and ASP are in the proximity of the design position. However, figure 6 shows that both the Δ C − Δ B and Δ − Δ plots have a misleading local minimum, the PSP on the debunching side with the correct energy. If the initial setpoints are not near the design value, then the traditional Δ would conduct a phase scan, significantly raising the time needed to optimize the module. Lastly, for the modernization of LANSCE, the traditional method lacks the data needed for future analyses.

RF signature matching
With the help of a newly installed fast readout system for the BPPMs [11], a Phase Scan Signature Matching (PSSM) method is modified and implemented at LANL as an improvement to the classical Δ method. The PSSM, which can be conducted with less time, would provide a more precise and robust solution and much data for future analyses.
The phase scan method was suggested at LANL as early as 1990s [12]. The phase scan method has been widely used by several facilities, including Fermilab [13], the Spallation Neutron Source [14], the European Spallation Source [15], the China Spallation Neutron Source [16,17], J-PARC [18,19]. Each facility has developed its procedure, some with a one-pass tuneup or others with a two-stage process. For LANL, we adopt a single-pass strategy with a medium step size of 100 points over 360 • while interpolating for the optimal points. In the 2020 startup period, we have proven that the interpolation precision is on par with the classical method. Furthermore, since the new readout system returns the whole waveform of the 150-us-long pulse with 1-us resolution, we take only one measurement for each PSP and use the measured waveform to determine the data quality. After each scan, the program estimates the cavity amplitudes calculated in three different ways, including a fitting to the whole phase scan, the measurement of the local energy gain gradient, and the energy offset to the maximum acceleration. The users adjust the ASPs accordingly. The new readout system greatly boosts the readout speed from < 1 to 4 Hz and measures the whole waveform to monitor in-pulse variations instead of a single value. This provides a new opportunity for the 40+ year old procedure to be upgraded. There are only two readout systems, and a specific BPPM needs to be selected for each of the readout systems. As a result, the readout system 1 is not always connected to the first detector after the module.

Procedure and data quality
Instead of the classical iterative method, the PSSM method collects all the necessary data within one fast phase scan. First, the PSP is moved to either end of the phase range with the module up for tuning being off. The program first measures the unaccelerated beam phases and then switches on the module. Beam phases at two downstream locations are measured while the PSP is swept across the whole phase range. Currently, for module 6 to 24, the phase shifter has been upgraded to a fast digital system, while other modules are using a physical trombone system. The phase sweep is completed for the digital system by directly setting the new values in the EPICS system. However, for the physical trombone system, fixed numbers of pulses are sent to the trombone for smooth movement. Figure 4, the first of the three major figures generated from the PSSM, shows a clear picture of the data quality during the phase scan. It includes all the relevant setpoints, including the PSP, ASP, and whether the module is on or off. It also includes the Δ B /Δ C measurements, the RMS of the measurements derived from the waveforms, and the signal strength across all PSP values. With this information, any interruptions during the measurement can be easily spotted by low signal strength, large standard deviations within individual waveforms, or irregular shape of the Δ B and Δ C trends. The measurements against time can be converted into measurements against PSP via the relations of PSP and time during the phase scan. After the scan, the peak, which appears as a minimum in time of flight, is determined. Therefore, the design PSP, typically around −30 • from the minimum, is highlighted with the vertical dashed lines.  In the startup process of the 2019 run cycle, a preliminary version of the PSSM method was consistently utilized to set the initial PSP to the design value before the classical Δ optimization. Therefore, the final optimal PSP is unambiguously on the bunching side. A complete data set is obtained to be compared with the data collected at the end of the run cycle for stability studies.

Model prediction and amplitude setpoint
The single-particle model that generated the linearized matrices in the classical Δ method was modified to predict the whole phase scan. For the CCL, four accelerating tanks reside in each module from 5 to 12, while module 13 to 48 comprises two tanks each. Each tank contains a various number of accelerating cells, ranging from 32 to 61, depending on the specific tank. In this single-particle model, the electric field 0 for each cell within the module is calculated as where e is the electron charge, out ( in ) is the design output and input energy of the module, is the transit time factor at the design , design is the design PSP, and tanks is the total length of all the tanks within the module. The test particle drifts along the whole length of the module while an energy kick Δ is applied at the center of each cell with where CF is the fraction of the set amplitude compared with the design value, is the phase of the test particle, mod is the module PSP, cell is the phase offset for the cell (0 • or 180 • ) and cell is the length of the tank divided by the number of cells inside.
Three parameters are required to fit the single-particle model: incoming beam energy offset (Δ ), incoming beam phase offset (Δ A ), and the amplitude of the module. The sampled data is fit for either of the two downstream BPPMs or both, depending on the goodness of the fit. Figure 5 shows the best-fit curve fitted at point B, the first downstream BPPM, and the residues between the data and the prediction at point B for module 13. This single-particle model, albeit with great opportunities for improvements, tracks the measurements of every module in the CCL well for its simplicity. With the best-fit parameters obtained at point B, The predicted curves also help rewrap the data at point C, the second BPPM, when the measurements are off by ±360 • , which is indistinguishable for phase measurement. The predicted curves at point C are consistent with the unwrapped measurements for all modules.
The best-fit amplitude for the module is a significant improvement from the classical Δ method. For modules 5 to 12, the classical Δ method determines the amplitude by the local energy gain gradient. However, the measured slope is easily subject to measurement uncertainties, and the design setpoint is not always identical to the optimal setpoint. For modules 13 to 48 of the Δ method, the output beam energy offset from the maximum acceleration determines the module amplitude. This requires a localized phase scan and the step size of the PSP largely determines the precision. In contrast, the PSSM determines the amplitude via fitting data collected over the whole phase scan. The fitted amplitudes closely follow the change of the klystron power to the sub-percent level. Currently, the estimated amplitudes with the three different methods are generally consistent within 2-3%. Combined with klystron power limits, known RF field driftings, and 2019 end-of-year documentation results, the ASP is adjusted to be within 5% of the design value to balance a quick turn-on and an optimal ASP.

Selection of optimal phase setpoint
The design PSP, −36 • , for module 5 and −30 • after module 17 from the measured minimum phase, can be easily determined with one phase scan, as shown in figure 4. Figure 6 shows that the PSSM and the classical VAX Δ method have consistent results on the Δ C − Δ B plot. Several comparisons have been conducted in a beam development time showing that the classical method and the PSSM method are consistent for both the Δ C − Δ B and Δ − Δ plots. While the classical Δ method only shows one of the two plots depending on the module, both plots are shown and updated with a scroll bar to change the PSP in the graphic user interface in the PSSM software. The right column in figure 6 shows the error to the optimal point as a function of the PSP. This provides an unambiguous way to determine the optimal PSP. The figure also demonstrates the potential pitfall of selecting a PSP at the debunching local minimum. If the classical method fails to determine the bunching side, there exists no clear way to recognize the mistake as the Δ C − Δ B or Δ − Δ plots may show an excellent but faulty optimization result.
Furthermore, in the PSSM method, data points at various PSPs can be drawn in the Δ C − Δ B and Δ − Δ plots simultaneously. The trend of the data points on the plots provides important information as well as an indication of the amplitude setpoint and the quality of the measurements.  panel in figure 6) should stay constant since the incoming energy would not vary by any change in the module. For the Δ C − Δ B plot, the trend of the data points could be also informative in view of the two dashed lines. The dashed line in vertical direction marks the asymptotic trend for Δ = 0, and the one in the horizontal direction marks the intersection for minimum error from the design value.
Lastly, a phase scan is recommended after an amplitude change. An amplitude change would cause a shift in the position of the peak, especially in the earlier modules. Figure 7 shows that a PSP originally around the design value could shift to the debunching side after an amplitude change.

Implementation results in the 2019 and 2020 run cycles
The PSSM method dramatically increases the amount of data collected compared with the classical method. The increase of data empowers our ability for future operational and diagnostic analyses. This section will demonstrate the results from the data collected in the 2019 and 2020 run cycles.
For the 2019 startup period, a preliminary version of the PSSM method is used as a coarse tuning to locate the vicinity of the optimal PSP. As a result, there exist no beam phase measurements when the module is off. Therefore, the fitting at position B includes one more parameter, off AB , and off AC is further calculated with the comparison between the model prediction and the measurements. Another set of data was taken at the end of the 2019 beam cycle for documentation. For the 2020 startup period, the new PSSM software was implemented alongside the classical Δ software. For all the modules in the CCL, the PSSM obtained consistent optimal PSPs compared with the classical Δ program. The RF amplitudes are consistent within 2-3% between PSSM and the Δ method for most modules. However, in later modules, a maximum of ∼ 5% discrepancy is observed. Measurement uncertainties and step size of the classical Δ method potentially caused the differences. Figure 8 shows the measured RF amplitude for the start and the end of the 2019 run cycle, and the start of the 2020 beam cycles. For the 2019 beam cycle before PSSM, the RF amplitudes were set within 15% of the design values since PSSM was not the default method. For the 2020 beam cycle tuned with the PSSM program, the RF amplitudes were set within 5% of the design values.
The fitted amplitudes can also be used to understand the linearity of the RF response. Figure 9 shows that the best-fit RF cavity amplitude scales linearly with ASP across 10% range when the RF amplitude is close to 100% of the design value. Potential PSP Amp= 85% Amp=100% Amp=115% Figure 7. A potential risk of an amplitude change without a phase scan. The three curves are the predicted Δ B for three different amplitude settings while the incoming energy and phase stay unchanged. For a potential PSP (vertical dashed line) around the design value when the amplitude is at 115%, the same PSP would be at the debunching side if the amplitude is shifted to 85%. This shows the importance of a phase scan after an amplitude change.

Error analysis
The best-fit curve appears typically right on top of the data points if the whole scan is displayed, as shown in the top panel of figure 5 and all the phase scan publications cited in this letter [13][14][15][16][17][18][19]. However, when the difference is plotted, as shown in the bottom panel of figure 5, the differences are more significant than the required 1 • measurement uncertainties. The differences could be caused by the naive single particle model and its insufficient description of the RF cavities, the measurement errors of the BPPM locations, and the linearity of the PSP of the RF cavities. The matching of the measured phase scan with the single-particle model yields an average 2 per degree of freedom at 3.77. This translates into a total empirical error at 1.94 • , encompassing both the statistical error (1 • maximum) and a measured systematic error at 1.66 • . In this section, we will discuss the statistical errors from the BPPM measurements. With the total empirical error, we will demonstrate the sensitivities and the correlation between fitting parameters and the error propagation under various assumptions.

BPPM waveforms
The beam loading effect changes the RF response during the 150-μs long pulse, the longest length LANSCE uses for tuning to avoid activation and damages. LANSCE mitigates the effect via the RF feed-forward system [20] and a pulse-width modulation [21] that gradually increases the amount -11 -

JINST 17 T02007
of beam over the first 30 μs. However, the beam loading effect is still apparent in the observed BPPM waveforms, as shown figure 10. The beginning of the stabilized region varies with PSPs and modules. We tested how fast the observed waveforms can achieve stabilization, defined as the 10-μs rolling standard deviation < 1 • and the difference between the 10-μs rolling mean and the mean of the last 10 μs is also less than 1 • , as shown in figure 11. Among the waveforms having < 1 • std at the last 10 μs, 95%(99%) of them stabilize at 74 μs(105 μs). Note that the waveforms with rolling standard deviation always > 1 • are at the fast-changing part of the phase scan, and therefore, often discarded in the fitting process. We have chosen the window between 135 to 145 μs for our phase measurements. However, the knowledge of the stabilized region is essential if we would like to accelerate the process via raising the repetition rate and therefore lowering the pulse width to keep the average current the same. Note that a pulse length modulation that gradually increases the beam loading is applied in the first 30 μs. The vertical purple line shows the earliest time where the 10-μs rolling standard deviation is less than 1 • and the 10-μs rolling mean is less than 1 • different from the mean of the last 10 μs.

Sensitivity
Without other precise energy measurement methods in the CCL, the derived input and output energies from the PSSM method help determine whether the beam has achieved its design energy. Therefore, a thorough understanding of the measurement precision is needed. To understand the sensitivities of did not stabilize selection region < 1 & diff<1 Figure 11. The timing distribution when the waveforms first stabilize under the selection criteria. The criteria require that the 10-μs rolling standard deviation is less than 1 • and the difference between the mean of the last 10 μs and the 10-μs rolling mean is also less than 1 • . Around 10% of the waveforms do not have their rolling standard deviation < 1 • within the 150-μs beam pulse (blue line). Most of these waveforms happen when the BPPM measurements have rapid changes during the phase scan. Our current BPPM phase measurements are selected from the window of 135 to 145 μs (vertical dashed lines).
the best-fit parameters, figure 12 and figure 13 show the 1-D scan of module 12 and 48 for the three parameters: Δ A , Δ A , and RF Amp. We assume the same number of measurement points with the total empirical error. Figure 14 and figure 15 show the 2-D scan of each parameter pair. For each module, the 1-D and 2-D scans have the same parameter range. The 1-D confidence level has been reported in [19]. However, the apparent correlation between parameters would greatly enlarge the confidence region observed in the 1-D scan. As shown in the 1-D scan of module 48 in figure 13, the three-sigma boundary for Δ A is at about ±0.1%. In the 2-D scan, the three-sigma range for Δ A is at +0.6% to −0.5%, a larger than 5-fold increase.
With the 2-D scans, the correlation between each pair of parameters can be estimated [22]. Figure 16 shows the change of correlations with respect to each module. In the beginning of the LINAC, there is a strong correlation between Δ A and the RF amplitude, while at module 17, the correlation between RF amplitude and Δ A peaks. After module 20, the anti-correlation between Δ and Δ A dominates.

Error propagations
Several Monte Carlo simulations were conducted to test the performance of this method. Three sets of simulations were performed under different conditions: 1) only the empirical total error for each measurement (marked as "meas. only") is included. 2) In addition to the first one, RF amplitude  fluctuations with an RMS at 2.5% are included to reflect the 2020 run cycle. 3) In addition to the previous two, a fluctuation in Δ A at an RMS of 0.5 MeV (0.5%) into the LINAC is included. Figure 17 shows that the output energy offsets at the end of the LINAC are consistent for the three assumptions. However, when the fluctuations of Δ A at the beginning of the CCL (module 5) are introduced, as shown in figure 18, the current fitting process would have a hard time converging, especially in the earlier modules. This introduced a larger error in the outgoing energy offset at the end of the LINAC, caused by one or several failed fitting(s) in the earlier modules. Nevertheless, the problem is easy to identify with a high 2 per degree of freedom. Figure 19 shows, in all three simulations, we can determine the RF amplitudes to within ±1% level.
Lastly, figure 20 shows the truth Δ A across the modules under the last simulation assumption. This reflects the ability of the previous module to set the correct output energy. While modules around 15 are best at setting the correct proton output energy, the outgoing energy errors remain -14 -2022 JINST 17 T02007  Figure 14. The 2-D sensitivities of the three fitting parameters for module 12 (design proton energy at 211 MeV). The range of each confidence level is larger than the ones obtained in the 1-D scan when the correlation is considered.
well within the design ±1% tolerance, even if an incoming energy fluctuation at 0.5 MeV RMS is applied at the beginning of the LINAC.

Future analyses
Contrary to the few measured points with the classical Δ method, the completeness of the data collected by the PSSM enables many possible analyses once the PSSM is utilized next. For the 2020 startup period, a preliminary monitoring software was built upon the data collected by the PSSM to mark the safe region for PSPs while the operators are minimizing the spill. Future operational analyses include comparing the best-fit amplitudes and the Klystron powers, monitoring the stability of the -15 -  Figure 15. The 2-D sensitivities of the three fitting parameters for module 48 (design proton energy at 800 MeV). The range of each confidence level is significantly larger than the 1-D scan ones in the latter modules, especially for the fitted in and , which is almost fully anti-correlated.
RF modules when data are taken at the same ASP at a different time, and checking the module status between different run cycles. Furthermore, there are opportunities for model development, including a comparison between this simple model and a multi-particle code [23], a study in the residues between the fitted curve and the data, and the analysis of the effects of tank-to-tank phase or amplitude change.

Conclusion
We demonstrated the Phase Scan Δ method at LANL to improve the classical Δ method using iterative optimization steps. We compared the differences in the implementation of the PSSM -16 -     . The box plot of the truth Δ A for each module, that is, the deviations of the outgoing proton energy from the previous module's design value. The simulation data with the last assumption includes a 0.5 MeV incoming energy fluctuation at module 5. A 2 cut has been applied to ensure the goodness of fit; the cut removes most of the data with incoming energy lower than −0.5 MeV. Few outliers that pass the 2 cut are also shown. Despite the sizeable incoming energy fluctuation, the Δ A maintains within ±0.5% across the LINAC, well within the ±1% requirement.
method at LANL and other facilities. Compared with the classical Δ method, this new PSSM method provides the following benefits. The PSSM, no longer relying on the linearized matrices, can explicitly determine the bunching side and provide an explicit check for data quality. The amplitude obtained by fitting hundreds of data points in the PSSM method is far more precise than the previous 2-point measurements of the slope or the peak. Lastly, the PSP offset between the optimal PSP and the design value becomes available in the PSSM method.
The PSSM method requires equal or less time than a smooth optimization process in the classical Δ method. If the classical Δ method fails to converge, the PSSM could still easily find the optimal point or identify the problem. The PSSM does not require lengthy iterative measurements to ensure the current PSP is the optimal choice. Therefore, the PSSM, when used in the startup process, can significantly shorten the tuning process.
Lastly, the PSSM offers substantially more information than the classical Δ method for future references, operational analyses, and model developments.