Local correction of quadrupole errors at LHC interaction regions using action and phase jump analysis on turn-by-turn beam position data

This article shows that the effect of all quadrupole errors present in an interaction region with low β can be modeled by an equivalent magnetic kick, which can be estimated from action and phase jumps found on beam position data. This equivalent kick is used to find the strengths that certain normal and skew quadrupoles located on the IR must have to make an effective correction in that region. Additionally, averaging techniques to reduce noise on beam position data, which allows precise estimates of equivalent kicks, are presented and mathematically justified. The complete procedure is tested with simulated data obtained from MADX and 2015-LHC experimental data. The analyses performed in the experimental data indicate that the strengths of the IR skew quadrupole correctors and normal quadrupole correctors can be estimated within a 10% uncertainty. Finally, the effect of IR corrections in the β is studied, and a correction scheme that returns this parameter to its designed value is proposed.


I. INTRODUCTION
Local corrections of magnetic errors in the interaction regions (IRs) are essential to achieve the maximum possible luminosity for the experiments located in these regions and to improve the overall performance of the accelerator.The major contribution of these magnetic errors often corresponds to quadrupole components, whether skew or normal components.For the skew components, high-energy accelerators like RHIC and LHC have two skew quadrupole correctors in each IR with strengths that need to be estimated by any reliable technique.For the normal components, corrections can be made directly with the IR quadrupoles, and as in the previous case, it is necessary to have a technique to estimate how much the strengths of these quadrupoles must be changed to compensate for the magnetic errors.In this paper, it is shown that the action and phase jump (APJ) analysis [1][2][3][4][5] can achieve these goals using turn-by-turn (TBT) beam position data.
Section II reviews how the APJ analysis has been used to estimate a magnetic field error intentionally placed in the IR of a high-energy accelerator.Section III shows that if an equivalent magnetic kick is defined, the equations used for the case of a magnetic field error can also be used for the more general case of having multiple magnetic errors.Section IV describes how turns or trajectories are selected from TBT data to make the best possible estimate of the quadrupole components of the equivalent kick under ideal conditions, i.e., without noise in the beam position measurements.Section V describes a technique to significantly reduce this noise.In Sec.VI, it is shown that the quadrupole components of the equivalent kick can be used to find the strengths that certain normal and skew quadrupoles located on the IR must have to make an effective correction in that region.All equations and procedures are initially deduced assuming that beam 1 data are being used; Sec.VIII shows the changes that must be made in order to estimate the corrector strengths from beam 2 data.All equations and procedures presented are tested with simulations in Sec.VII and with experimental data in Sec.IX.Finally, the effect of IR corrections in the β Ã is studied, and a correction scheme that returns this parameter to its designed value is proposed and tested through simulations in Sec.X A. The experimental limitations of this correction scheme and the plans to overcome them are discussed in Sec.X B.

II. ONE MAGNETIC ERROR AND ACTION AND PHASE JUMP ANALYSIS
Reference [6] shows that the betatron oscillations after the particle has passed through a magnetic error can be described by where z represents either the x or the y axis, β z are the nominal beta functions, J z 0 and J z 1 are the actions upstream and downstream of the error, and s θ is the longitudinal position of the error.The nominal betatron phase is represented by ψ z ðsÞ, while δ z represents an arbitrary phase, which remains constant except at longitudinal positions where there are magnetic errors.In this paper, δ z is simply called "the phase."Using this convention, δ z 0 and δ z 1 can be defined as the phases upstream and downstream of the error respectively.The kick θ z of the magnetic error can be of any order: a dipole, a quadrupole, etc., and it can be estimated from [3] and also In practice, Eq. ( 3) is used to estimate the magnitude of θ z , and Eq. ( 4) is used to determine its sign.Additionally, the different multipole components A n and B n of the magnetic error (as defined in [6]) can be related to the magnetic kick through where x and y are evaluated at s ¼ s θ .Also in Ref. [6], it was shown that if Eq. ( 2) is extended to the case in which the particle has passed k magnetic errors, the trajectory between the kth and kthþ1 error is given by Phase (rads) Action and phase analysis of 2015-LHC beam trajectories.Each point of the action and phase plots is calculated with measurements of two adjacent Beam Position Monitors (BPMs) (see [6]) that have been preprocessed with averaging techniques, as explained in Sec.V.The figure also contains a simplified representation of the LHC lattice with short bars corresponding to dipole magnets and long bars corresponding to quadrupole magnets.The effect that local corrections have on the action and phase plots is also illustrated.
where s i is the longitudinal position of the ith magnetic error, θ z i is the kick of the corresponding magnetic error, and J z k and δ z k are the action and phases after the kth magnetic error.Equation ( 8) allows the exact description of a particle trajectory in an error-free segment of the accelerator using the lattice functions calculated directly from the ideal model of the accelerator.This remains true even if the lattice has magnetic errors outside the error-free segment regardless of their strengths, number, or nature of these errors (either quadrupole, sextupole, or higher orders errors).In particular, estimates of the β beating generated by sources outside the error-free segment are not necessary; the ideal or nominal lattice functions exactly describe the trajectories within that segment.This is not in contradiction with the usual approach in which J and δ are constants of motion and the magnetic errors modify the lattice functions all around the accelerator.Equation ( 8) is an alternative approach that allows J and δ to change due to the presence of magnetic errors, while the lattice functions remain unchanged.
If the segment contains small randomly distributed magnetic errors, it is still convenient to model the trajectory of the particle with Eq. (8).The differences between the data and the model are only due to magnetic errors within the chosen segment, not to errors outside that segment according to the previous discussion.
In high-energy accelerators, such as RHIC and LHC, action and phase plots in the arcs show small variations when compared to variations of the same quantities in the IRs (see Fig. 1).Therefore, Eq. ( 8) can be used to model the particle trajectory in the arcs with the nominal lattice functions and constant values of J z k and δ z k in each of these arcs.
The action and phase of the arc on the left side of a particular IR (J 0 and δ 0 in Fig. 1) and the action and phase of the arc on the right side of the same IR (J 1 and δ 1 in Fig. 1) can be used to estimate the kick produced by a magnetic error in the IR by means of Eq. (3).Also, its multipole components can be estimated applying Eqs. ( 5) and (6).It has been shown in [6] that this method works with good accuracy for experiments in which a magnetic error is intentionally introduced at a particular place on a high-energy accelerator.

III. SEVERAL MAGNETIC ERRORS AND THE EQUIVALENT KICK
In a more general case, IRs have not only one but multiple magnetic errors distributed in all their magnets.In this section, it is shown that the same equations used for the case of a single magnetic error can also be applied to the case of multiple quadrupole errors if an equivalent magnetic kick is defined.
IRs designed for high-luminosity experiments are usually composed of two triplets of quadrupoles: one triplet on each side of the interaction point (IP).The triplets focus and reduce the beam to a very small size, which is achieved by adjusting these magnets so that the beta functions are very small in the IP.As a consequence, the betatron phase advance between the triplets becomes very close to π, and the betatron phase advances between the quadrupoles of each triplet become almost zero.This particular condition helps to simplify the equations that are presented below and, in this paper, is called "the approximation of phases".
Each of the six normal quadrupoles of the IR may have magnetic field errors that give a kick θ z i to the beam in addition to the regular kick due to the nominal strength of the quadrupole.This additional kick can be expanded in its multipole magnetic components according to Eq. ( 5) as follows: where A 1i and B 1i correspond to the integrated skew and normal quadrupole components, which are assumed to have a much greater effect than the nonlinear components.Also, dipole components can be assumed equal to zero since their effect can be suppressed by subtracting the closed orbit from the beam position measurements.The first step to relate Eq. ( 9) to experimental measurements is to express zðs i Þ as a function of the BPM measurements available in the IR.Using Eq. ( 7) and the approximation of phases, beam positions in the IR can be written as where ψ zL is the nominal betatron phase in the left triplet, which remains almost constant inside this triplet.The sign is positive if s i is inside the left triplet and negative if s i is inside the right triplet.With the aid of Eq. ( 10), the beam position at the ith magnet can be rewritten as a function of the beam position at some arbitrary location s e inside the IR as where s e is chosen so that it corresponds to the longitudinal position of any of the six BPMs of the IR.The sign is positive if s i and s e are in the same triplet otherwise it is negative.After replacing Eq. (11) in Eq. ( 9), the kick due to the magnetic error in the ith magnet is where x e and y e are the transverse components of the beam at s e .The signs of the first term and the second term are negative and positive respectively if s i and s e are in the same triplet; otherwise, the first sign is positive and the second one is negative.
Replacing Eq. ( 12) in Eq. ( 7), it is found that the horizontal component of the beam after passing through the IR is where and In the vertical plane the corresponding equations can be deduced by the same procedure, which leads to Equations ( 13) and ( 16) have the same functional form as Eq. ( 1), which was deduced for a single magnetic error.Therefore, θ z;e can be viewed as an equivalent kick that behaves like the kick produced by a single magnetic error located at s e .Thanks to this equivalence, the value of θ z;e can be calculated from the actions and phases on each side of the IR using Eq. ( 3).The quadrupole components of the equivalent magnetic kick [Eqs.(15) and Eqs.(18)] were deduced under the assumption that the ith magnetic error was concentrated at a longitudinal position s i within the ith magnet, as done in [1].In reality, magnetic errors extend across the entire magnet.To take this into account, skew and normal quadrupole components K 1s and K 1 (same notation used in MADX [7]) are related to their corresponding integrated quadrupole components through where ΔK 1i and K 1s;i are assumed to be constant throughout the ith-magnet length L i .The additional symbol Δ is used to distinguish the error component from the total strength of the magnet.Using the definitions of Eq. ( 19), Eqs. ( 15) and ( 18) are rewritten as where and s li and s ri are the longitudinal positions of the left and right faces of the ith magnet.

IV. QUADRUPOLE COMPONENTS OF THE EQUIVALENT KICK FROM TBT DATA
A beam trajectory with multiple turns can be obtained after the closed orbit is removed from a TBT data set.From this multiturn trajectory, one-turn trajectories can be obtained either by choosing a particular turn or by selecting an arbitrary number of one-turn trajectories and averaging them.Throughout this paper, trajectories of the first case are called "simple trajectories" (or just "trajectories" if there is no room for ambiguity), while the trajectories of the second case are called "average trajectories".
These trajectories can be combined with Eqs. ( 14) and ( 17) to find the quadrupole components of the equivalent kick.Since there are three unknown variables, at least two trajectories are needed, which leads to a system of four equations.One of the possible solutions to this system of equations is or where the numerical subscripts in the right-hand side of the equations help to distinguish variables from one trajectory or the other, and in practice, A 1;e is computed as the average of the last two equations.One of the desirable conditions of the two selected trajectories is that they have the largest possible excursion (positive or negative) at s e in both planes.These types of trajectories will be named max trajectories.To find max trajectories from a TBT data set, each turn or trajectory is modeled with the approximate equation, zðs; nÞ ≈ ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi 2 Jz ðnÞβ z ðsÞ q sin ½ψ z ðsÞ − δz ðnÞ; ð23Þ where δz ðnÞ ¼ with j extending over all available v measurements of δ z ðn; s j Þ in turn n.Similarly, According to Eq. ( 23), zðs e ; nÞ is maximum for those trajectories whose turn number n ¼ n m satisfies the condition where p is an odd, positive, or negative number.Therefore, the procedure to find max trajectories from a TBT data set is done by calculating δz ðnÞ for all available trajectories and those trajectories consistent with Eq. ( 26) are the desired max trajectories.Max trajectories can be of four different kinds according to their phases in the horizontal and vertical plane (see Fig. 2).The two trajectories required by Eq. ( 22) must have different phases in at least one plane.Therefore, at least two of these four kinds of trajectories are used to estimate the quadrupole components of the equivalent kick.

V. NOISE REDUCTION THROUGH AVERAGING TECHNIQUES
Two simple trajectories obtained from a TBT data set should be sufficient to estimate the equivalent magnetic kick in a particular IR, as shown in Sec.IV.However, noise present in these trajectories may be large enough to significantly affect these estimates.APJ analysis has been used simultaneously with averaging techniques to reduce noise in SPS-TBT data [8,9] and LHC-TBT data [5,10].However, there has been no formal demonstration of how these averaging procedures affect the determination of magnetic errors.In the first part of this section, it is proved that the equivalent kick calculated from an average trajectory has the same quadrupole components as the equivalent kick calculated from a simple trajectory but with much less noise.
Another factor to consider is the type of trajectories that allow the most reliable estimate of the quadrupole components of the equivalent kick.As mentioned in Sec.IV, trajectories with maximum excursions at s e (max trajectories) are the most convenient.Therefore, it is necessary to build the average trajectory so that it is also a max trajectory, which is shown in the second part of this section.A. The quadrupole components of the equivalent kick from average trajectories According to Eqs. ( 13) and ( 16), the particle trajectory in the nth turn after having passed through the IR can be written as where a function ηðs; nÞ has been added to represent the noise in the BPMs, which is assumed to obey a Gaussian distribution with standard deviation σðsÞ.
A new trajectory can be built by averaging N selected turns or trajectories as where and the resulting action and phase J r and δ r are given by From the central limit theorem, the second term of Eq. ( 29) approaches zero with a standard deviation equal to σðsÞ= ffiffiffiffi N p , and if N is in the order of thousands, this term is significantly smaller than the noise present in each simple trajectory.Therefore, Eq. ( 29) has the same functional form as Eqs.( 13) and (16), and it is possible to use Eq. ( 3) to calculate the equivalent kick with the actions and phases of the average trajectory.Also, this equivalent kick has the same quadrupole components as the kick of a simple trajectory, as can be seen by comparing Eq. (30) with Eqs. ( 14) and (17).

B. Building average max trajectories
In this section it is proved that if the selection of trajectories is done such that their phases δz ðnÞ are uniformly distributed around δz ðn m Þ, then the average trajectory will also be a max trajectory.
With the help of Eq. ( 23), the average trajectory zðsÞ can be approximated as where Jz ðnÞ is considered independent of n, an approximation that is generally valid since the initial J z is usually several times larger than the average changes that the magnetic errors produce in this variable all around the accelerator.
The condition of uniform distribution around δz ðn m Þ means that for any trajectory with turn number equal to k and with phase δz ðkÞ ¼ δz ðn m Þ − σ k , where σ k is an arbitrary number, there is a symmetric trajectory within the selected trajectories with a phase that is equal to δz ðn m Þ þ σ k .Using this condition, the previous equation can be written as where the phase of the resulting trajectory is δz ðn m Þ, and therefore zðsÞ is a max trajectory, as defined in Sec.IV.In a typical TBT data set, the phases δz ðnÞ are distributed almost evenly between 0 and 2π, and then it is sufficient to select the trajectories according to where Ω sets the range of allowed phases around the phase of the max trajectory.If Ω is equal to zero, only trajectories with phase equal to δz ðn m Þ are selected and therefore only a few trajectories contribute to build the average trajectory, which in turn leads to a modest reduction of noise.As Ω increases, the number of turns or trajectories that are selected also increases.In principle, Ω can have any value.In the extreme case for which Ω ¼ π, all the turns of the TBT data set are selected, and the noise reduction achieved is the largest possible.However, the amplitude of the resulting average trajectory is reduced almost to zero.An intermediate value, such as Ω ¼ π=2, is a good choice for obtaining average trajectories with amplitudes large enough to be measured and with very good noise reduction.
Equation (34) defines two conditions: one for the x plane and one for the y plane.Each of these conditions is applied individually to select trajectories in each plane.Only the trajectories with turn numbers that are common to both planes are used to build the corresponding average trajectory.
Figure 3 shows examples of average max trajectories built from an experimental TBT data set of 6600 turns.With Ω equal to 0.02 rads, only one simple trajectory is selected to build the average trajectory: the trajectory with phase equal to or very close to δz ðn m Þ.If Ω is increased, the number of trajectories selected to build the average trajectory also increases, but its phase does not change, as seen in Fig. 3. Therefore, since the first average trajectory (Ω ¼ 0.02 rads) is a max trajectory, the other two are also max trajectories.Also, a clear reduction of the noise fluctuations as Ω increases (and thus N) can be seen in the action plots of Fig. 4.
Alternative techniques to reduce noise based on digital filters have also been developed, and they can be found in [11,12].

VI. RELATIONSHIPS BETWEEN THE EQUIVALENT KICK AND THE CORRECTIONS
As discussed in Sec.III, the second term on the righthand side of Eqs. ( 13) and ( 16) corresponds to the contribution of the IR magnetic errors to the particle trajectory.To suppress this contribution, the strengths of the skew quadrupole correctors and normal quadrupole of the IR can be adjusted so that where θ ðcÞ z is the equivalent kick at s e due to the corrections alone.Since Eq. (35) must be valid for any s after the IR, and since Eq.(36) must be valid for any n, The relationships between the corrector strengths and the quadrupole components of the equivalent kick produced by these strengths, obtained from Eq. ( 20), are The larger the allowed phase range (determined by Ω), the larger is N the number of trajectories involved in the construction of the average trajectory.All three average trajectories are in phase, and since the first one is a max trajectory, the other two are also max trajectories.
Since the quadrupole components of the equivalent kick are estimated from TBT data, the corrector strengths can be calculated directly from Eq. (39).
In the derivation of Eq. (39), it is assumed that only one skew quadrupole corrector is used.It is also possible to use two IR skew quadrupole correctors, and in that case, Eq. (38c) becomes where the subscripts L and R are used for the skew quadrupole correctors located in the left and right triplets, respectively, and the integral I xy , which in principle must be calculated independently for each corrector, was found to be the same in both cases for all LHC lattices used in this article.Equation (40) allows to rewrite Eq. (39c) as Therefore, the right-hand side of Eq. (39c) gives the total strength at which the two skew quadrupoles correctors must be powered to locally eliminate the coupling in the IR.Any strength can be used in each corrector with the only condition that their sum equals the value estimated by Eq. (39c).The corrector strengths estimated by Eqs.(39) not only suppress the equivalent magnetic kick in the IR as expressed through Eq. (36) but also suppress the β beating and the coupling that originates in that IR, as shown theoretically in Appendix D and through simulations in the next section.

VII. ESTIMATING CORRECTIONS FROM SIMULATED TBT DATA
The first part of this section shows a simulation with MADX that validates the entire correction procedure in IR1, while the second part shows the advantages of the use of average trajectories to estimate corrector strengths.
For all simulations presented in this section, a LHC lattice with β Ã equal to 65 cm at IP1 is used.Also, normal and skew errors of the same strength (10 −5 m −2 ) have been added in all quadrupoles of IR1, and the magnets that are used as correctors are the Q2L (left Q2 quadrupole or magnet a), the Q2R (right Q2 quadrupole or magnet b), and the left skew quadrupole corrector of IR1.

A. Simulation of the correction procedure at IR1
The simulation of the correction procedure is done in two steps: before and after correction.In the first step, corrector strengths are estimated from a simulated TBT data set generated from the LHC lattice with errors that was previously described.The corresponding values obtained for the corrector strengths can be seen in the first row (Before correction) of Table I.
In the second step, the previously calculated corrector strengths are added to the lattice and the efficacy of the correction is evaluated with different methods.A first method is to verify that the corrector strengths calculated after correction are reduced to zero, as expected from theory.To do this verification, a TBT data set is generated with the new settings and the corrector strengths are recalculated.The results shown in the last row of Table I (After correction) indicate that the new corrector strengths are significantly reduced.In addition, the correction can be verified through TABLE I.This Table illustrates the two-step correction procedure in IR1.The first row shows the corrector strengths estimated from a TBT data set, which was generated with a LHC lattice with errors in IR1 (Before correction).The second row shows the corrector strengths estimated after correction.the β beating obtained directly from the Twiss files generated by MADX (Fig. 5) and through betatron oscillations induced from one plane to another, which can be seen directly on firstturn trajectories (Fig. 6).

B. Corrector strengths from average max trajectories
The effect of BPM noise in the calculation of corrector strengths is studied in this section using simulated TBT data with Gaussian noise.In particular, Gaussian noise with σ ¼ 0.8 mm (about 20% of the maximum amplitude of the trajectory in the arcs) is added to the TBT data set originally generated without corrections in order to generate other ten TBT data sets.Corrector strengths are estimated for each of these TBT data sets using simple max trajectories.The averages of these strengths and 3 times their standard deviation are reported in the first row of Table II, which shows that corrector strengths are hidden behind the noise.
The procedure is repeated for the same TBT data sets, but this time average max trajectories are used instead of simple max trajectories.The results, in the second row of Table II, show that the uncertainties of the corrector strengths are significantly lower than those obtained with simple trajectories.Also, the new corrector strengths coincide with the "ideal" corrector strengths reported in Table I within the new and smaller uncertainties.

VIII. ESTIMATING CORRECTIONS FROM BEAM 2 DATA
The procedure explained to estimate corrector strengths assumes that the beam circulates from left to right in the APJ plots.This is the case for beam 1, but for beam 2 the circulation of the beam in the APJ plots occurs from right to left since the lattice files for beam 2, obtained from LHC databases, are arranged in a sequence opposite to the beam direction.This issue is relevant to those equations that use variables at the left and right sides of the IR, which are Eq.(1) to Eq. ( 4), and it can be solved by exchanging the subscripts 0 and 1, which are used to label these two sides.The only equation used in the estimation of corrector strengths affected by this exchange of subscripts is Eq. ( 4), which undergoes a change of sign.Therefore, if the sign of Eq. ( 4) is changed, the same procedure used to estimate corrector strengths from beam 1 data can be used to estimate corrector strengths from beam 2 data.
Once the above modification has been made for beam 2, it can be verified that corrector strengths obtained with TBT data from each beam separately are practically the same.The reason for this equivalence lies in the symmetry relations between the beta functions of both beams in the IRs, which can be expressed as and according to Eqs. ( 20) and ( 21) lead to   Trajectory where the circumflex is used to distinguish the variables of beam 2 from those corresponding to beam 1.If these relations are used in, for example Eq. (39a), the equivalence between ΔK 1a and ΔK 1a can be verified as follows: Simulations of beam 2 with the same parameters used to obtain the first row of Table I show that corrector strengths calculated from beam 2 are equal to those obtained from beam 1 with differences that start to appear from the third or fourth significant figure.These differences are much smaller than the experimental uncertainties (see Sec. IX), and thus the measurements obtained from both beams can be considered equal.

IX. ESTIMATING CORRECTIONS FROM 2015-LHC DATA
The same two-steps procedure explained in Sec.VII is used to test the technique with 41 TBT data sets acquired during different optics corrections in which the strengths of IR1 magnets were changed.
In the first step, corrector strengths are estimated using each TBT data set available before changing the strengths of IR1 magnets.Averages values and three-standard deviations are estimated for each beam individually, and a weighted average of these last two are calculated and reported on the first row of Table III (Before correction).
For the second step, the ideal situation is to change the corrector strengths in IR1 exactly by the values found in the previous step and to generate TBT data with the new settings.This was not possible since no dedicated experiments have been done for this technique.TBT data generated with very similar corrections installed in IR1 (3.5 × 10 −6 m −2 in Q2L, −7.0 × 10 −6 m −2 in Q2R, and −1.4 × 10 −4 m −2 distributed between the two skew quadrupole correctors) is used instead.Corrector strengths estimated from this TBT data (second row of Table III) show a significant decrease in all values, as expected.Also, a clear decrease in the action and phase jump at IR1 is observed in the corresponding action and phase plots (Fig. 1).
The small remaining values in the second row of Table III can be explained in part by the above-mentioned differences between the corrector strengths actually applied in the machine and the corrector strengths estimated prior to correction.Discounting these differences from the second row, a new estimation of the corrector strengths is obtained in the last row of Table III.In theory, all values in this row should be equal to zero; any difference from zero that cannot be explained by the statistical uncertainties corresponds to a systematic uncertainty.Therefore, the uncertainties of the normal corrector strengths are mainly systematic (about 6 × 10 −7 m −2 ), while the uncertainty of the skew corrector strength is mainly statistical (1.6 × 10 −5 m −2 ).In both cases, the total strength uncertainties are about 10% of the values originally obtained before correction.

X. EFFECT OF CORRECTIONS ON
THE β Ã OF THE IRS IR corrections using two normal quadrupole correctors reduce the β beating that originates in the IR and propagates around the ring, as shown throughout this paper.However, in some cases, these IR corrections may not correct β Ã to its designed value, as reported in [13,14].In this section, it is demonstrated through simulations that corrections involving two normal quadrupole correctors per triplet (four correctors per IR) can achieve both objectives, i.e., reduce the β beating that originates in the IR and at the same time correct the β Ã to its designed value.The current experimental limitations for achieving these triplet-by-triplet corrections are also discussed.

A. Simulations
The change of the β Ã when using IR corrections is illustrated in Fig. 7.This figure shows the β beating resulting from a simulation using the LHC lattice with magnetic errors and different corrections.To perform this simulation, magnetic errors are introduced into the six normal quadrupoles of IR1 according to Table IV and the corresponding β beating is calculated (black curve of TABLE III.Estimates of corrector strengths before and after having modified the strengths of Q2L (magnet a), Q2R (magnet b), and the skew quadrupole correctors of IR1.The last row (After correction new) is obtained after subtracting from the second row (After correction) the difference between the corrector strengths estimated prior to correction and the corrector strengths actually used in the machine.Fig. 7).Also, TBT data is generated to obtain the corrections as explained throughout the paper, and these numbers (third column of Table IV) are inserted into the lattice to recalculate the corresponding β beating (red curves of Fig. 7).It is evident that the corrections have significantly reduced the β beating around the ring, but the β beating at the IP (peak around 23520 m) has increased, which could lead to undesirable effects, such as reduction of luminosity at that point of the accelerator.Triplet-by-triplet corrections can offer a solution to this problem.The modifications in the APJ technique to calculate this type of corrections imply the use not only of the actions and phases in the arcs but also among triplets.

Case
To obtain those values, at least two BPMs are needed between the triplets.In the LHC these two BPMs are present in the IRs of interest (BPMs with prefix BPMSW), and in theory, the action and phase between the triplets can be calculated.
The same TBT data from the first simulation of this section (magnetic errors in the six quadrupoles of IR1 without corrections and without noise) are used to obtain the actions and phases in the arcs and also between the triplets to estimate two corrector strengths per triplet instead of two corrector strengths per IR.
The four corrector strengths obtained are shown in the fourth column of Table IV.The β beating that includes these new corrections (blue line in Fig. 7) shows that not only the β beating around the ring is eliminated but also the β beating in IP1 is reduced almost to zero.Also, as done in Sec.VII, if the corrector strengths are estimated again, they are now 2 to 3 orders of magnitude smaller than before the correction were applied.
The effect of the two types of corrections can also be seen in the phase plots of Fig. 8.If there are no corrections, a large jump between the phase before and after the IR can be seen (black curve).IR corrections eliminate the jump in phase between the arcs (red curve), but a large step can still be seen between the arcs and the IR.After introducing

Magnet
Magnetic errors triplet-by-triplet corrections, the phase plot becomes completely flat (blue curve).
The main reason for the original large β beating at the IP is the waist shift of the β Ã , as reported in [13].This shift can be seen in Fig. 9, where the beta functions of the previous simulations around the IP are drawn.This figure compares the beta functions of the LHC lattice with six magnetic errors, with errors plus IR corrections, and with errors plus triplet-by-triplet corrections.Figure 9 shows that the nominal beta functions and the beta functions of the LHC lattice with errors plus triplet-by-triplet corrections around the IP are identical.Therefore, this last type of correction completely eliminates the waist shift of the β Ã .

B. Experimental analysis
As mentioned in the previous section, BPMSWs are needed to estimate actions and phases between the triplets.Actions and phases calculated with these BPMs may have significant uncertainties since the phase advance between them is very close to π. High precision BPMs are needed to reduce these uncertainties to acceptable levels.The BPMSWs have been updated with new electronics called DOROS [15] that reduces the noise level 1 order of magnitude [16].Tests with these new electronics must be postponed until it is properly calibrated and fully integrated into the LHC BPM system.Meanwhile, analyses with regular IR BPMs can be done to understand their limitations, and to see if DOROS electronics could overcome those limitations.
For this purpose, triplet-by-triplet corrections are determined for the left triplet of IR1 from five TBT data sets (without corrections) acquired during 2016 LHC run.The required actions and phases between the triplets are determined with BPMSW.1L1 and BPMSW.1R1 and regular electronics.Analyses of the results (Table V) indicate that these estimates are very sensitive to gain errors in the BPMSWs.If, for example, all beam position measurements of BPMSW.1R1 are multiplied by 1.01 (1% change in the BPM gain), corrector strength estimates can change as much as 50% (second row of Table V).At the time of these experiments, there was evidence that the BPMSWs had gain errors as large as 3%.Therefore, corrector strengths calculated with these BPMs may have large deviations from the actual values.The accuracy of the BPMSWs calibration should be approximately 0.1% to keep the deviations of the corrector strengths within acceptable limits, as can be inferred by comparing the first and the third row of Table V.
The most accurate BPM calibrations achieved in the LHC with regular electronics are around 1% [17].Since DOROS electronics reduces the noise level 1 order of magnitude, the accuracy of the calibrations is expected to improve in the same way, which would allow to reach the required accuracy of 0.1%.
It should also be noted that, in some cases, the statistical uncertainties in Table V are comparable to their corresponding corrector strengths, which could cause these measurements to be unreliable.DOROS electronics will significantly reduce these uncertainties since large reductions in noise also lead to large reductions in statistical uncertainties, as can be inferred from Table X.

XI. CONCLUSIONS
It has been shown that the effect of all quadrupole errors of a low-β Ã IR in the trajectory of a particle can be modeled by an equivalent magnetic kick located at some arbitrary position within the IR.The quadrupole components of this equivalent kick can be used to estimate the strengths that normal and skew correctors should have to eliminate the effect of all quadrupole errors in the IR.
Through simulations and theoretical calculations, it was shown that these corrections lead to a significant reduction of the β beating generated by normal quadrupole errors in the IR, and the same remains true for linear coupling and skew quadrupole errors.However, these corrections can result in a waist shift of the β Ã , which has been shown to be corrected by the so-called triplet-by-triplet corrections in which a total of four correctors per IR are powered instead of only 2.
Estimates of corrector strengths have been made from experimental data for both types of corrections.For IR corrections, the normal corrector strengths can be determined within a 10% uncertainty, which it is mainly of a systematic nature, and the skew corrector strengths can be determined within the same uncertainty, but in this case, the uncertainty is mainly of a statistical nature.For triplet-by-triplet corrections, it was found that the two BPMs that are closest to IP1 (BPMSWs) should be calibrated to an accuracy of approximately 0.1% to have acceptable estimates of the corrector strengths.DOROS electronics is expected to help achieve this level of accuracy.
It has also been shown that the noise reduction technique based on selection of trajectories from TBT data and the subsequent construction of average trajectories does not introduce any bias in the determination of the quadrupole components of the equivalent kick, which makes possible accurate estimates of the corrector strengths.APJ can be used as a complement or instead of another technique called segment by segment (SBS), which has been extensively applied in the LHC to correct quadrupole errors [18][19][20][21][22][23][24].Just as APJ, SBS uses TBT data, but unlike APJ, the analyses that are performed on these data are based on Fourier analysis.Also, the BPMs used in each case are different.SBS uses the BPMs that are located in or near the IR, while APJ uses the BPMs that are located in the arcs (except for the BPM required at s e ), which allows an independent verification of the measurements.
Also, considering the increasing importance of having fast and accurate measurements while the accelerator works, perhaps with malfunctioning BPMs, one technique can replace the other as these malfunctioning BPMs are activated again.
Simulations of Sec.VII can also be used to test how the correction estimates change as the nominal value of β Ã is changed.To perform these simulations, all quadrupole errors are decreased by 1 order of magnitude such that  their strengths are now equal to 10 −6 1 m 2 .This change is necessary since the accelerator lattice becomes more sensitive to magnetic errors as the β Ã becomes smaller.The estimated corrector strengths are summarized in Table VIII, where it can be seen that the differences between the corrector strengths corresponding to different values of β Ã begin to appear after the third significant figure.Since, in these simulations, all the magnetic errors are known in advance, the corrector strengths can be estimated directly from theory using Eqs.( 20) and (39).Table VIII shows that differences in these theoretical estimates begin to appear after the fourth significant figure.

APPENDIX C: CORRECTOR STRENGTH ESTIMATIONS USING CONVENTIONAL FITTING PROCEDURES
Each trajectory or turn in a TBT data set gives a value of θ z;e and z e .Therefore, for a typical TBT data set containing a thousand turns, there will be a thousand different values for each of these quantities in each plane.This data can be directly fitted to Eqs. ( 14) and ( 17) using the quadrupole components of the equivalent kick as fitting parameters, and then Eq. ( 39) is used to estimate the corrector strengths.This procedure was applied to the simulated data of Sec.VII but with different Gaussian noise levels added to all BPM readings.The results can be seen in Table IX, while Table X shows the corrector strengths calculated with the procedure discussed throughout this paper.After comparing the uncertainties of both tables, it can be seen that the technique for noise reduction presented in this paper has better immunity to noise than conventional fitting procedures.

APPENDIX D: APJ CORRECTIONS, β BEATING AND COUPLING
It can be shown that the corrections predicted by Eq. (39) also eliminate the contributions of IR magnetic errors to typical observables, such as β beating and coupling driving terms.
For the first case, the integral defining the β beating [25] can be divided into the contribution from a particular IR and the contribution of the rest of the ring R, A similar analysis can be done for the skew quadrupole component, which can be related to the minimization of the coupling driving terms [26]-a technique frequently used in accelerators to reduce coupling-which can also be divided in two contributions,   Z IR ds 0 K 1;s ðs 0 Þ ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi β x ðs 0 Þβ y ðs 0 Þ q × exp i½ϕ x ðs 0 ÞAEϕ y ðs 0 Þ−ðQ x AEQ y −q AE Þ 2πs 0 L ; ðD6Þ and a similar equation for the second term of Eq. (D5).Q x and Q y are the horizontal and vertical tunes of the accelerator, q AE is an integer number, L is the circumference of the accelerator.The sum and the difference of phases in the exponential factor of κ ðIRÞ AE remain constant by virtue of the approximation of phases.Likewise, the variation of the fraction s 0 L is very small along the IR.Hence, the exponential factor can be taken out of the integral leading to which is equal to zero by virtue of Eq. (37c).

FIG. 2 .
FIG. 2. Max trajectory whose horizontal and vertical componentsat s e are positive and negative respectively.The other three possible combinations produce a total of four kinds of max trajectories.

1y , and A ðcÞ 1
are the quadrupole components of θ ðcÞ z .Equations (37) imply that at least the strengths of two normal quadrupoles (a and b) and the strength of one skew quadrupole corrector need to be adjusted to carry out the correction.

FIG. 3 .
FIG. 3. Three average trajectories with different values of Ω.The larger the allowed phase range (determined by Ω), the larger is N the number of trajectories involved in the construction of the average trajectory.All three average trajectories are in phase, and since the first one is a max trajectory, the other two are also max trajectories.

FIG. 4 . 1 ¼ 1
FIG.4.Action plots of the average trajectories shown in Fig.3.A significant reduction in fluctuations (noise) can be seen as more turns are used to build the average trajectory.

FIG. 5 .
FIG.5.β beating due to quadrupole errors introduced in the LHC lattice in IR1 (black), and the effect of adding the corrections of TableIto the same lattice (red).

FIG. 6 .
FIG.6.This first turn trajectory shows how betatron oscillations are fed into the y plane due to the skew quadrupole errors placed in IR1 (black).Corrections of TableIreduce significantly the induced trajectory in the y plane (red), which indicates a good local compensation of linear coupling at IR1.

FIG. 7 .
FIG. 7. Comparison between the β beating generated by magnetic errors in IR1, and the corresponding β beating after IR and triplet-by-triplet corrections are applied.

TABLE II .
Corrector strengths estimated from simple and average trajectories showing the significantly smaller uncertainties reached with average trajectories.The TBT data from which the trajectories are extracted has Gaussian noise with σ ¼ 0.8 mm and has no corrections.
Simulation of the waist shift of the β Ã due to magnetic errors and corrections.IR corrections increase the waist shift of the β Ã , while triplet-by-triplet corrections eliminate this shift by returning the beta functions to their nominal values.Similar plots are found in the y plane.

TABLE V .
Triplet-by-triplet corrector strengths for the left triplet of IR1 obtained from experimental LHC data.The quadrupoles used as correctors are Q2L (a) and Q3L (b).The effect of gain errors in BPMSW.1R1 is also shown.

TABLE VI .
Quadrupole components of the equivalent kick estimated from the simulated data of Sec.VII.The quadrupole components are calculated in eight different locations of IR1.s e is measured from IP1.

TABLE VII .
Corrector strengths calculated from Table VI and Eq.(39).

TABLE VIII .
Corrector strengths for LHC lattices with different nominal values of β Ã .The values with label "simu" are obtained as in Sec.VII, while the values with label "theory" are directly obtained from Eqs. (20) and (39).

TABLE IX .
Corrector strengths estimated from the fitting procedure explained in Appendix C. The strengths reported in each row correspond to the average of strengths estimated from ten different TBT data sets with Gaussian noise.The uncertainties are estimated as 3 times the standard deviation.

TABLE X .
Corrector strengths estimated with the same TBT data sets used in Table IX but applying the analyses used to obtain Table II with average max trajectories.