Perturbation-minimized triangular bunch for high-transformer ratio using a double dogleg emittance exchange beam line

The longitudinal shape, i.e., the current profile, of an electron bunch determines the transformer ratio in a collinear wakefield accelerator and thus methods are sought to control the longitudinal bunch shape. The emittance exchange (EEX) appears to be promising for creating a precisely controlled longitudinal bunch shapes. The longitudinal shape is perturbed by two sources: higher-order terms in the beam line optics and collective effects and these perturbations can lead to a significant drop of the transformer ratio. In this paper, we analytically and numerically investigate the perturbation to an ideal triangular longitudinal bunch shape and propose methods to minimize it.


I. INTRODUCTION
Methods for shaping the profile of an electron bunch in transverse phase space have long been available to the accelerator designer. However, methods for controlling the longitudinal phase space are scarce. Manipulation of the former is relatively straightforward since the transverse coordinates of the bunch (position and angle) can be directly manipulated with simple elements, such as magnetic quadrupoles and transverse masks. On the other hand, direct manipulation of the electron bunch longitudinal coordinates (position and momentum) is not as easily achieved. While the control of the momentum can be accomplished with an accelerating cavity, direct control over the longitudinal position is challenging for ultrashort electron bunches on the femtosecond to picosecond scale.
At the Argonne Wakefield Accelerator (AWA), we are developing a longitudinal bunch shaping (LBS) beam line we call the mask þ EEX method where a transverse mask is placed at the entrance to an emittance exchange (EEX) beam line. The mask is used to select the transverse bunch profile from the incident bunch at the entrance to the EEX beam line. The EEX beam line transforms the transverse bunch properties at its entrance into longitudinal bunch properties at its exit [1][2][3]. In principle, this method can generate a wide variety of extremely high-quality longitudinal bunch shapes. For example, this method can be used to improve the efficiency of DWFA and PWFA [4] by flattening the wakefield inside the bunch. Also, it has previously been used to generate a sub-ps bunch train [5].
The application we concentrate on in this paper is the collinear wakefield accelerator where a high-charge electron drive bunch excites wakefields in a high-impedance media (e.g. dielectric structures and plasma), which, in turn accelerates a low-charge electron witness bunch trailing behind on axis to higher energy [6]. While we focus on the collinear wakefield accelerator, since it directly bears on our research program, most of the results in this paper are relevant to applications requiring precise longitudinal bunch shapes.
In the collinear wakefield accelerator application, a primary figure of merit is the transformer ratio (R) defined as the ratio of the maximum accelerating field (E a ) experienced by the witness bunch to the maximum decelerating field (E d ) experienced by the drive bunch, R ¼ jE a =E d j. Therefore, the energy gained by the witness bunch is RΔW, where ΔW is the energy lost by the drive bunch. A high transformer ratio gives the accelerator designer a convenient way of generating a high-energy witness bunch from a low-energy drive bunch. Also, according to the fundamental wakefield theorem, the transformer ratio has an upper limit of 2 for symmetric longitudinal current profiles [7]. However, this upper limit can be overcome with either asymmetric bunch trains (e.g., the ramped bunch train [8]) or an asymmetric single bunch profile (e.g. a triangular current profile [7]).
In this paper, we use the particle tracking simulation code GPT [9] to numerically examine the efficacy of our LBS beam line (the mask þ EEX method) in generating triangular longitudinal bunch shapes for generating a high transformer ratio in the collinear wakefield accelerator application. We begin, in Sec. II, with an analysis of the ideal case in which perturbations from higher-order terms in the beam line optics and collective effects are ignored. Our goal in this section is to develop an intuitive understanding about the exchange process and to obtain the equation for generating an exact triangular current profile. Next, in Sec. III, we extend our analysis to the realistic case and derive analytic expressions for each perturbation source that had been ignored in Sec. II. In Sec. IV, we first describe the distortion of the ideal shape caused by each perturbation source. Second, to quantify each perturbation source, we define, as our figure of merit, the ratio of the change of the transformer ratio produced by the perturbed triangular profile to the exact one, ΔR=R ¼ ðR p − R e Þ=R e , where R p ¼ the transformer ratio produced by the perturbed bunch and R p ¼ the transformer ratio produced by the exact bunch. Finally, in Sec. V, we conclude the paper by benchmarking our analytic perturbation approach (Secs. III and IV) with numerical simulations (GPT) and evaluate two methods to suppress the perturbations.

II. LONGITUDINAL BUNCH SHAPING BEAM LINE (IDEAL CASE)
While various beam line configurations are capable of satisfying the emittance exchange condition [10], we chose to use a double dogleg EEX beam line throughout this paper [2,3]. In this section, we show that our LBS beam line (mask þ EEX based) can generate an exact triangular shape in the limit of the ideal case where higher-order optics in the EEX beam line are ignored and all collective effects are considered negligible [11].

A. LBS (mask þ EEX based) beam line
We begin by writing down the transfer matrices for the EEX beam line. In our analysis, the double dogleg EEX beam line (Fig. 1) is subdivided into three sub-beam lines, "DL1 þ TDC þ DL2," where DL1 is the first dogleg and DL2 is the second dogleg. [Notice that Fig. 1 includes a fundamental mode accelerating cavity (FMC) to eliminate the so-called "thick lens effect" of the transverse deflecting cavity (TDC) [12]. It is ignored in this section but is included in the figure since it will be used in later sections of the paper.] We define X m ¼ ðx m ; x 0 m ; z m ; δ m Þ T to be the 4D particle coordinates along the beam line ( Fig. 1).
In the LBS beam line, a transverse mask is followed by a double dogleg EEX beam line. B1-B4 are rectangular dipole magnets, TDC is a transverse deflecting cavity, and FMC is a fundamental mode cavity used to suppress the thick-lens effect. We reference particle coordinates at four locations.
Each dogleg consists of two rectangular dipole magnets of bending angle α i and length L B , separated by a drift of length L DL;i with transfer matrix, where 13]. The parameters η i and ξ i are, respectively, the dispersion and momentum compaction generated by each dogleg. The subscripts fi ¼ 1; 2g are used since, in general, the two doglegs can be different. The transverse deflecting cavity of kick strength κ in the thin-lens approximation [1] is described by where κ ¼ 2πeV ⊥ =λE, where E is the electron bunch kinetic energy, λ is the rf wavelength, and V ⊥ is the cavity's transverse voltage. Including the two drifts before and after the TDC (L D , Fig. 1), the total transfer matrix of the EEX beam line is given by The exact emittance exchange condition is given by where B and C are 2 × 2 submatrices. Equation (3) is equivalent to the following two equations: Therefore, we can say that the EEX beam line eliminates the dependence of the final horizontal (longitudinal) coordinates from the initial horizontal (longitudinal) coordinates.
At the end of the EEX beam line, the full exchange between the horizontal and the longitudinal phase space is complete as can be seen from the zero off-diagonal blocks in M EEX below, Details of how the EEX beam line works and why the EEX requires two identical doglegs are described in Appendix A. We remind the reader that when the two doglegs are the same, as is usually the case, the subscript i can be dropped from Eq. (6). In summary, the momentum exchange occurs in the first section of the beam line (DL1 þ TDC) and the position exchange occurs in the second (TDC þ DL2) and the entire beam line is needed to complete the total exchange.

B. The bunch shaping equation
For the longitudinal bunch shaping application that we are interested in, the key point is that all of the downstream longitudinal properties ðz f ; δ f Þ are completely governed by the upstream horizontal properties ðx 0 ; x 0 0 Þ. Thus, if one can control the horizontal properties upstream of the EEX beam line, then the downstream longitudinal properties are determined. Using the matrix of Eq. (6), we can write the bunch shaping equation for the idealized case, where the final longitudinal position of a particle is given by its initial horizontal position and angle as Using TRANSPORT notation, the two terms of the 6D EEX matrix that control the longitudinal bunch shape are The relationship given by Eq. (7) is not yet in a form that makes it easy to use for longitudinal bunch shaping since the final longitudinal position (z f ) depends on both initial transverse coordinates ðx 0 ; x 0 0 Þ. Ideally, we are seeking a relationship in which the final longitudinal position (z f ) depends only on the initial position (x 0 ) since that can be easily controlled with the transverse mask. Fortunately, the dependence of z f on x 0 0 can be eliminated from Eq. (7) because the relationship between x 0 0 and x 0 can be expressed in linear theory as S ¼ x 0 0 =x 0 , where S is a constant. We can now rewrite the above equation as where the coefficient is C 0 ¼½κξ 2 þSfη 2 þκξ 2 ðL 1 þL D Þg.
We finally have an easy to use longitudinal bunch shaping equation for our LBS beam line (the mask þ EEX based method) in Eq. (8): the final longitudinal position depends only on the product of a coefficient and the initial horizontal position. Equation (8) means that the final current profile is a simple linear transformation of the initial horizontal profile. Figure 2 shows several examples with the coefficient (C 0 ) set to 0.5. At the top of the figure, a Gaussian transverse profile is transformed into a Gaussian longitudinal profile with its length compressed by a factor of 2 since C 0 ¼ 0.5. In the second row, a three-particle model is used to visualize the linear transformation of particles with initial horizontal position fx 1 ; x 2 ; x 3 g linearly transformed into its final longitudinal positions, fz 1 ; z 2 ; z 3 g where the initial separation (Δ) between the particles is a factor of 2 less than the final separation (Δ=2). The other examples in the figure show that when a distribution is transformed its length is compressed by the same factor of 2, but the area of the distribution is the same since the charge of the distribution is conserved.
One concern that may be raised is that the sharp features at the ends of the horizontal distribution ( Fig. 2) may not properly propagate through the EEX beam line thus negatively affecting the final longitudinal shape. We note that the sharp features created by the mask have been simulated and found to be negligible in many publications [11,14,15]. Our GPT simulations also confirm that these are negligible and even our experiment showed that there is no issue with beam transport of the sharp feature, at least to the levels that we are capable of simulating and measuring [16]. Therefore, in the following formal analysis, the sharp features are neglected.
In summary, we have shown in this section that our LBS beam line (using the mask þ EEX layout) can generate perfectly shaped, arbitrary current profiles in the limit of the ideal case (negligible higher-order optics in the EEX beam line, negligible collective effects, low emittance, and linear phase space). For completeness, we note that the final horizontal properties ðx f ; x 0 f Þ are governed by the initial longitudinal properties ðz 0 ; δ 0 Þ but since the focus of this paper is longitudinal bunch shaping we do not cover this aspect.

C. Limitations of the ideal case
To motivate the analysis in the rest of this paper, we briefly compare the quality of the triangular current profile generated in the ideal case [Eq. (8)] with the realistic EEX beam line based on GPT simulations that includes finite emittance, thickness of TDC, higher-order optics, space charge (SC), and 1D coherent synchrotron radiation (CSR) [17]. Our comparison does not directly compare the quality of the two triangular current profiles since this cannot be quantified with a single number. Instead, we use the figure of merit the ratio of the change of the transformer ratio generated in the ideal case to the realistic one, or ΔR=R. Our comparison is based on the fact that the transformer ratio depends on the quality of the triangular current profile. The transformer ratio produced by an exact triangular current profile is R ¼ πN [7], where N is the ratio of the bunch length to the wavelength of the wakefield. However, if the current profile is not exactly triangular then the transformer ratio will usually be less than this value, R < πN, thus we have a method of comparison that can be quantified. Unfortunately, using an R-based figure of merit has one drawback: there are some nearly triangular shapes where R exceeds that of a triangle (e.g. a parabolically rising shape [18]). After considering the alternatives, we decided that using R was still the best choice and we will point out in the paper where difficulties occur.
Comparison of the two transformer ratios is based on a single mode wakefield with N ¼ 3 (final bunch length ¼ 3λ, where λ is the wavelength of the fundamental mode wakefield) thus R ¼ 3π ≈ 9.4 in the ideal case. In both the ideal case and the realistic case, GPT was used to generate the beam distribution at the entrance to the mask.
For the ideal case, the initial distribution from GPT, which was Gaussian in the transverse dimension before the mask, was propagated through mask and then through the EEX beam line using the linear matrix above, Eq. (6). The final longitudinal bunch shape is expected to be an exact triangle [based Eq. (8) and Fig. 2] with N ¼ 3, so R should not have any dependence on the initial beam condition. The plot on the left of Fig. 3 is in good agreement with the expectation, where R ≈ 9 for a wide range of the Courant-Snyder parameters, alpha and beta.
For the realistic case, the initial distribution from GPTwas again propagated through mask and then through the EEX beam line using GPT. The plot on the right of Fig. 3 shows a clear dependency on the initial Courant-Snyder parameters. Except for the region around alpha of 10 and beta of 150 m, the transformer ratio drops significantly from its peak value (R ≈ 9) by as much as 50% for alpha near −10.
The discrepancy in R between the ideal case and the realistic case (Fig. 3) shows that perturbations to the exact triangle arise from higher-order optics in the EEX beam line, SC and CSR effects, all which serve to degrade the quality of the triangular current profile. The remainder of this paper will analyze these perturbations and examine methods to suppress them in order to produce a highquality triangular current profile and, therefore, a high transformer ratio.
FIG. 2. The mask is used to produce the initial x-distribution after the mask (left) and the ideal EEX beam line linearly transforms this initial x-distribution to produce the final z-distribution (right). In the four examples shown, the coefficient (C 0 ) in Eq. (8) x is equal to 0.5 (i.e. z f ¼ 0.5x i ) so that the separation (Δ) between the particles (top) and beamlets (second from top) is reduced by a factor of 2 (Δ=2).

III. PERTURBATION SOURCES
In this section, we present an analysis of the EEX beam line that extends the beam dynamics to include perturbations. Studies of first-order perturbation source [3,11] and reduction of the first-order effects with sextupoles have been discussed before [15]. Here we include the secondorder perturbations and the collective effects from SC and CSR.
First-order perturbations arise from two sources in the EEX beam line: finite emittance coupled with nonzero R52 and the thick lens effect in the TDC. The effect due to the finite thickness of the TDC is included by replacing the TDC transfer matrix [1] of Eq. (2) with where L c is the length of the TDC. Note that when L c ¼ 0 we recover the thin-lens TDC matrix [Eq.
(2)] and the firstorder perturbation source is absent. The first-order perturbation from finite emittance is typically not very large since rf photoinjectors are capable of producing very low emittance beams. As long as R52 Ã Δx 0 < 10% of the ideal bunch length then transformer ratio error is negligible. This condition applies for the study we present in this paper. In Ref. [15], the perturbation due to R52 was eliminated by using quadrupoles placed between the mask and DL1 to make R52 ¼ 0. We do not take this approach, of eliminating R52, since we are focused on studying the limitations of longitudinal bunch shaping with an elementary EEX beam line.
In the remainder of this section we assume identical doglegs and drop the subscript i in Eq. (1).
A. Second-order beam dynamics Using TRANSPORT notation [19], the initial 6D particle coordinate is given by X ¼ ðx; x 0 ; y; y 0 ; z; δÞ T , and the propagation through the beam line from position "0" to "1" up to second order is given by where R is the linear transfer matrix, and T is the secondorder transfer matrix, m; n; l ¼ ð1…6Þ. In the EEX beam line, the first-order terms ðR mn Þ generate the idealized bunch shape (as described in Sec. II) while the secondorder terms ðT mnl Þ generate perturbations to the ideal triangular shape. Third and higher-order terms are not included in Eq. (10) since the simulations done in [15] indicate their effects are negligible for the case in this paper. In general, if the third-order terms are less than 5% of ideal bunch length then its effect is negligible which holds in this paper. The second-order terms arising from the TDC are negligible since λ ≫ σ z , where σ z is the rms bunch length. The transfer matrix expressions for the dogleg up to second order were derived from the transfer matrices from the drift and the rectangular dipole magnet. Among the total 126 possible second-order terms in the second-order matrix (T mnl ), a rectangular dipole magnet and drift have only a few nonzero second-order terms [20] resulting in 25 second-order terms. Equation (10) for the beam transport through DL1 which is found to be The identical expression holds for the transport through DL2 if we replace 0 → 2 and 1 → f (Fig. 1).
The expression for the complete EEX beam line ( Fig. 1) was derived using the expressions for the doglegs [Eqs. (11)- (16)], the drifts (L D ), and the TDC [Eq. (9)] and the terms are summarized in Table I. Using Eq. (7) for the linear terms and the results of this section, we can write out Eq. (10) explicitly as follows: The coefficients of the second-order terms (C 1 through C 13 ) in the equation correspond to the terms in each row of Table I. For example, we can see from Table I, row 3, that C 3 ¼ T 566 κ 2 ðL þ L D þ L c 2Þ 2 þ T 122 κξ. Note the numerical values of all second-order terms ðT mnl Þ have been calculated but are not shown in the paper since the calculation is tedious and not illuminating.
We propose a simple method to suppress the secondorder perturbation sources based on the results presented in Table I. In general, sextupoles are used to control secondorder terms, as in Ref. [15], where their simulation results showed that two sextupoles placed in DL2 almost perfectly suppressed the second-order effects. However, we suggest a new method that we call the slope-control method, which is a special case of the general Courant-Snyder parameter optimization, but limited to adjusting only the horizontal, vertical, and longitudinal slopes of the incoming electron beam. The transverse slopes can be adjusted using quadrupoles in front of the EEX beam line while the longitudinal slope (or "chirp") can be adjusted with the linac. In this way, second-order effects are suppressed in the EEX beam line without nonlinear elements. This method potentially reduces the tight alignment tolerances typically associated with sextupoles. The slope-control method is the main interest of the paper. It will be described in detail in Sec. V and verified using the particle tracking simulation code GPT [9].
Another method for suppressing the second-order perturbation sources is to modify the EEX beam line. One modification is to insert sextupoles into the EEX beam line TABLE I. Second-order terms affecting the longitudinal bunch shape and its related particle coordinates. R and T are the first-and second-order matrix elements of the dogleg. These coefficients correspond to the EEX beam line in Fig. 1.

Coordinates
Coefficient ¼ fDL2g þ fDL1g to control the second-order terms (e.g. T 566 of C 1 in Table I). A second way to modify the EEX beam line to reduce the second-order effects is to optimize the basic EEX beam line to reduce the linear parameters that appear in the second-order terms (e.g. κ of C 1 in Table I). Since most of the terms in Table I include the parameter κ 2 , which can be reduced by increasing the bending angle ðαÞ and the drift length ðL DL Þ, large α and L DL can reduce the secondorder terms (via reduction of the first-order parameter). On the other hand, this would increase the second-order coefficient (e.g. T 566 ) from the dogleg and CSR. In conclusion, this method involves a complicated trade-off between first-and second-order terms and the overall beam line parameters must be optimized. However, the focus of this paper is on the slope-control method and, therefore, this idea will be investigated in our future work.

B. Collective effects
Collective effects distort the final longitudinal bunch shape primarily through longitudinal collective forces creating first-order changes to the particle coordinates. Numerical simulations with GPT show that the longitudinal space-charge force dominates over the transverse one. In addition, numerical 3D CSR simulation [21] as well as 1D CSR simulations indicate that transverse CSR is negligible. Therefore, we ignore transverse collective forces in this subsection and the remainder of the paper.
The collective forces generate an integrated momentum kick, Δδ, as the bunch propagates along the beam line. Writing the unperturbed longitudinal momentum as, δ, then we define the perturbed one as δ new ¼ δ þ Δδ. In discussing the change to other coordinates (than δ) it is useful to divide the LBS beam line into two regions: one where the dispersion is constant and one where it is not; this is explained in detail below.
The regions of the LBS beam line (Fig. 1) where the dispersion is constant are (1) the drift region between the mask and DL1 (η ¼ 0) and (2) the region between the two doglegs (η ¼ constant). In these regions, the collective effects only alter the longitudinal momentum coordinate leaving the other five coordinates unchanged (to first order). Here we define the integrated momentum kick generated by collective effects at the end of first region as, Δδ η¼const 1 , and at the end of the second as, Δδ η¼const 2 . Referring to Fig. 1, these momentum kicks are added to the unperturbed values of δ 0 and δ 2 , Note that the magnitudes of these momentum changes depend on the length of the drift, the bunch length, the bunch charge, and the longitudinal bunch shape at each position. We now consider the impact of these two terms on z f . The top term in Eq. (18) (δ new 0 ) is easy to handle since its contribution to the final bunch length is canceled by the TDC condition, 1 þ κη ¼ 0. On the other hand, δ new 2 propagates through DL2 without being canceled [see the dogleg matrix of Eq. (1)] and contributes a perturbation to z f with the coefficient ξ 2 (i.e. Δz f ¼ ξ 2 Δδ η¼const 2 ). In the region where dispersion is not constant, the collective forces act directly on the longitudinal momentum coordinate to generate an integrated momentum kick at the end of the doglegs (Δδ η≠const DL1 ) and (Δδ η≠const DL2 ), similar to above, and indirectly on the position coordinates, The regions of the LBS beam line where the dispersion is not constant are the two doglegs. The indirect effect happens because the momentum kick (Δδ is coupled to the position coordinates through the matrix elements of the dogleg: R16 ¼ η and R56 ¼ ξ respectively, as can be seen from Eq. (1). In general, this means that the perturbation to z f in the doglegs is due to all three coordinates fx; z; δg.
The horizontal offset at the end of DL1, Δx 1 , is not simply ) since the momentum kick and the dispersion are changing inside the dogleg. The offset, Δx 1 , at the end of the dogleg is calculated as the accumulation of the infinitesimal offsets (dx) along the dogleg, where s is the distance along the dogleg. Therefore, we can write where η Ã is defined as the effective dispersion of the dogleg. Note that the horizontal offset due to this effective dispersion is always less than that due to the dogleg's final dispersion (i.e. Δx 1 < ηΔδ η≠const DL1 ). This is because the momentum kick due to the collective force (Δδ η≠const DL1 ) is zero at the beginning of the dogleg and does not reach its final value until the end of the dogleg and therefore the effective dispersion is between 0 and η or f0 < η Ã < ηg.
The perturbation in z f due to the collective effect in DL1 can now be calculated by tracking the new coordinates from the end of DL1, X new to the end of the first-order EEX beam line (Sec. II). In the absence of collective effects, x 1 does not contribute on z f because it is canceled by the exchange condition, but now the offset ðΔx 1 Þ experiences a different "effective dispersion" (η Ã ) which cannot be fully canceled by the exchange condition. Note that it is not necessary to write an expression for z new 1 since z does not change due to the exchange condition. Finally, the perturbation to z f caused by collective effects in DL1 is given by Δz f ¼ ξ 2 ð1 þ κηÞΔδ η≠const DL1 . Note that since f0 < η Ã < ηg then 0 < 1 þ κη Ã < 1.

PERTURBATION-MINIMIZED TRIANGULAR …
PHYS. REV. ACCEL. BEAMS 19, 121301 (2016) 121301-7 The perturbation to z f in DL2 is only due to the R56 ¼ ξ 2 in DL2 and the momentum kick generated inside DL2 (Δδ η≠const DL2 ). Therefore, the perturbation to z f caused by the collective effects in DL2 is given by ξ Ã 2 Δδ η≠const 2 where ξ Ã 2 is the effective momentum compaction factor that is always smaller than ξ 2 similar to the value of η Ã above.
Therefore, the total perturbation of the final longitudinal position due to all collective effects is the sum of the above three perturbations,

IV. DISTORTIONS DUE TO THE PERTURBATIONS SOURCES
We now consider the effect of the perturbation sources on the longitudinal bunch shape and the corresponding change to the transformer ratio. In the first part of this section, we group the various perturbation sources into five categories based on the characteristic distortion they cause to the ideal shape. In the second part of this section, we examine the change of the transformer ratio due to this perturbed shape.

A. Perturbation to the longitudinal bunch shape
be the position of the particle at the end of the EEX beam line in the absence of perturbation (i.e. the ideal final position) that started out at the mask with the initial position X 0 ¼ ðx 0 ; x 0 0 ; y 0 ; y 0 0 ; z 0 ; δ 0 Þ T . [Note that we are making a slight change to the notation in this section of the paper. The ideal final coordinates in this section are the same as the "final coordinates" given in Sec. II as X f ¼ ðx f ; x 0 f ; z f ; δ f Þ T .] When perturbation sources are present, the particle is shifted from its ideal-final-longitudinal-position ðz i f Þ to its perturbed-final-longitudinal-position (z p f ) which is given by the sum of the ideal position (z i f ) and the perturbation (ζ) or where z i f ¼ C 0 x 0 from Eq. (8) and ζ, which can be negative or positive. The total perturbation from the ideal position is given by the sum of the individual perturbation terms listed in Eqs. (17) and (21), The total perturbation terms are written out on five lines to match the five categories we will identify below. In general, the coefficients (C i ) can be positive or negative. This means that the final longitudinal position (z p f ) can either end up in front of or behind its ideal final longitudinal position (z i f ). The first thirteen terms in Eq. (23) are the second-order beam dynamics terms due to the nonlinear magnetic forces in the beam line while the last term is due to collective forces. Note that the last term, due to CSR and SC, is in the form of Eq. (21), but we will not consider the individual terms separately in the analysis to follow. This simplifying step was taken because the perturbation to the profile is of a similar characteristic shape for both SC and CSR.
1. The ideal longitudinal bunch shape, n 0 ðzÞ The ideal triangular bunch shape, n 0 ðzÞ, can be characterized by the particle density function, where N 0 is the total number of particles, l b is the bunch length, z min is the location of the tail of the triangle and z min þ l b is the location of its head. The origin of the final longitudinal coordinate system (z i f ¼ 0) corresponds to the origin of the initial transverse coordinate system at the mask ( In the remainder of the paper, our analysis assumes that the incident bunch (before the mask) has a Gaussian transverse distribution (Fig. 4). This means that the origin of the longitudinal coordinate system (z to the transverse center of the Gaussian bunch before the mask (Fig. 2, first row, x 0 ¼ 0), not the center of the mask (Fig. 2, fifth row, triangular profile).

The perturbed longitudinal bunch shape, nðzÞ
The perturbed longitudinal bunch shape, nðzÞ, is the convolution of the ideal profile n 0 ðz i f Þ and a perturbation function The perturbation function acts to redistribute the particles from their ideal position ðz i f Þ in the ideal triangular longitudinal bunch shape, n 0 ðz i f Þ, to their new position ðz p f Þ in the perturbed longitudinal bunch shape,nðz p f Þ. The integration of nðz p f Þ over the whole domain is equal to the original number of particles, N 0 . The continuous particle distribution functions [Eqs. (24) and (25)] were approximated as discrete distribution functions for the results presented in this paper.
To determine the shape of the perturbed longitudinal bunch, we first determine the perturbation of the individual slices of the ideal longitudinal bunch shape (Fig. 5, left) and then sum the perturbed slices together (Fig. 5, right). In the absence of perturbations, particles that originate from position x 0 at the mask will arrive at the ideal slice position, z i f ¼ C 0 x 0 after the EEX beam line. For each of the five categories there is a unique perturbation function, PðζÞ, that determines how the particles are redistributed from z i f to z p f . Let n 0 ½z i f ðjÞ represent the number of particles in the jth slice of the ideal longitudinal bunch. The perturbation function, PðζÞ, acts to shift particles in the ideal slice (blue rectangle in Fig. 5, left), to a new longitudinal positions (red distribution in Fig. 5, left) with a spread of distances. We define ζ max to be the maximum perturbation of particles from the ideal position (Fig. 5, left). In Appendix B, we provide an analytic form of PðζÞ for each source and  (3) if PðζÞ causes the slice to spread or not. In other words, we characterize each perturbation by its z i f -dependence, shift and spread.
The sum of the individual perturbed slices along the ideal bunch, n 0 ðz i f Þ, produces the perturbed longitudinal bunch shape, nðz p f Þ, (Fig. 5, right). The perturbation sources are grouped into five categories based on the characteristic shape they imparted onto nðzÞ (see Fig. 6). Each of the five categories has a unique PðζÞ, which leads to ζ unique characteristic shapes for each category. Note that the maximum perturbation from each ideal position as (ζ max ) is different for each category (Fig. 5).
The effects of the various perturbation functions on the longitudinal bunch shape are summarized in Fig. 7 and will be explained in detail in Appendix B. The strength of the individual perturbation terms [in Eq. (23)] are normalized by the ideal bunch length (ζ max =l b ) and are varied from 0 to 0.3.

B. Perturbation of the transformer ratio
The ideal longitudinal bunch shape, n 0 ðz i f Þ, produces the ideal transformer ratio, R 0 ¼ πN, and the perturbed longitudinal bunch shape, nðz i f Þ, produces a perturbed transformer ratio, R p . In this section, we study the relative change of the transformer ratio, ΔR=R 0 , where ΔR ¼ R p − R 0 , induced by the five types of perturbations introduced in Fig. 7. In Fig. 8, we plot ΔR=R 0 vs the perturbation strength as given by the ratio of the maximum deviation to the ideal bunch length for all perturbation sources. To calculate the transformer ratio, a single mode wakefield with N ¼ 3 is assumed again so that R 0 ¼ πN ∼ 9.4. As the strength of the perturbation increases, the transformer ratio for most of longitudinal bunch shapes drops by more than 60%. For equally strong perturbations: (1) the x 2 0 -series causes the largest drop to the transformer ratio; (2) the SC effect and the CSR effect cause the next largest change; (3) while the x 0 z 0 series and y 2 0 series (with a negative coefficient) actually show a transformer ratio rise (initially). This rise is an enhancement of the transformer ratio. This rise happens because a concave shaped head generates a higher transformer ratio than the linear head [18] and it therefore shows a small enhancement for the triangular profile. However, this change still means that the longitudinal bunch shaping mechanism is not well controlled.

V. SUPPRESSION OF THE PERTURBATIONS
In this section, we present methods for suppression of the perturbations based on the analysis given in Sec. IV. Results were benchmarked with realistic beam dynamics simulations of the complete LBS beam line (Fig. 1) using GPT simulations. The GPT simulation begins with a round beam before the mask that becomes a triangle horizontal profile with sharp edges after the mask. The simulation includes all physics (nonlinear dynamics, space-charge and CSR) and the beam is transported without any particle loss.
The perturbation terms due to the second-order effects and the collective effects in Eq. (23) are the product of two terms: a coefficient (C i or ξ) due to the beam line and a bunch coordinate (x 2 0 , x 0 z 0 , etc.). In general, the perturbation terms can be suppressed by two methods: (1) bunch control: adjusting the initial bunch coordinates (e.g. size and slope of the incident bunch) or (2) beam line control: modifying the beam line to reduce the coefficients.
The method we use for suppressing the second-order effects we term the slope-control method. In method (1) above, we can control either the incident bunch's size or slope. However, the adjustment of the bunch transverse FIG. 7. The perturbed longitudinal bunch shapes for: x 2 0 -series with C 1 < 0 (a), z 2 0 -series with C 4 > 0 (b) and C 4 < 0 (c), x 0 z 0 -series with C 7 ≠ 0 (d), y 2 0 -series with C 11 > 0 (e) and C 11 < 0 (f), SC effect (g), and CSR effect (h). The color corresponds to the ratio of the maximum deviation ζ max to the ideal bunch length (l b ): ζ max =l b .
FIG. 8. The relative change of the transformer ratio versus the ratio of the maximum deviation (ζ max ) to the ideal bunch length (l b ) for each of the perturbation cases. size (or bunch length) turns out not to be a good option since it interferes with other important requirements (e.g. a large beam size at the mask is preferred to improve tolerance). On the other hand, the slope is both available and simple to use for suppression of second-order effects. The slope is easily controlled by adjustment of the four quadrupoles upstream of the LBS beam line for transverse slope control or with the linac phase for longitudinal chirp control.
The method we use for suppressing the perturbations due to the collective effects we term the asymmetric-dogleg method. Our studies have shown that the slope-control method can conflict with minimizing conditions for other perturbation sources and the conditions needed to suppress the collective effects can hurt the transverse optics. Therefore, we used method (2) above, beam line control, and found that by reducing the bending angle and increasing the drift length of DL2 both CSR and SC were suppressed without increasing the complexity of the beam line.
Before presenting the results in this section, we make two comments about the simulations. First, a fundamental mode mavity (FMC) was added to the beam line to simplify our analysis since the FMC eliminates the thick-lens effect of the TDC and thus serves to avoid confusion between the thick-lens effect and the collective effects [3,12]. While we are aware that the thick-lens effect from the TDC can be minimized with an initial longitudinal chirp without the FMC [1], the magnitude of this chirp needed would create serious collective effects [3]. Second, we are also aware that the R52-emittance effect [3] in the EEX beam line can be eliminated with the addition of four quadrupoles between the mask and entrance to EEX (B1 in Fig. 1) [15]. However, we did not include these quadrupoles in our EEX beam line since their ζ max =l b factor is less than 3% and therefore causes a negligible perturbation to the longitudinal bunch shape.

A. Control of the second-order effects
The perturbations from the four sets of second-order series (x 2 0 , z 2 0 , x 0 z 0 , and y 2 0 ) identified in Table I and in subsection A of Sec. IV can be minimized by introducing appropriate correlations (i.e. slopes) between the terms in each series. We call this the slope-control method and begin this section by deriving the value of the horizontal slope that minimizes the perturbation due to the x 2 0 -series. We only present the results for the x 2 0 -series since the derivation for the other series are similar.
In order to suppress the perturbations to the ideal longitudinal bunch shape, n 0 ðz i f Þ, we minimize the perturbations to each slice of the ideal longitudinal bunch. Based on the results of Sec. IV, the perturbation of the ideal slice can be described by the errors: the mean shift ζ and the spread ζ 2 . We will suppress the perturbation to n 0 ðz i f Þ by minimizing ζ and ζ 2 for all the slices in the bunch.
In the absence of all other perturbations, one can calculate the mean and standard deviation of the perturbation due to the x 2 0 -series [Eq. (23)] as Defining the initial horizontal slope of the beam as S x 0 ¼ x 0 x 0 0 =x 2 0 then, in the limit of very low horizontal emittance, we have, x 0 0 ≅ S x 0 x 0 and we can write To minimize the perturbation due to the x 2 0 -series we take the partial derivative with respect to S x 0 and set it equal to zero. The optimal value of the horizontal slope that minimizes the perturbation [i.e. minimizes both Eq. (28) and Eq. (29)] due to the x 2 0 -series is S x 0 ¼ −C 2 =2C 3 . We call this value of S x 0 the minimizing horizontal slope and it represents the horizontal slope on the incident bunch (before the mask) that minimizes the perturbation due to the x 2 0 -series. The procedure outlined above for finding the minimizing horizontal slope (S x 0 ¼ −C 2 =2C 3 ) that minimizes the perturbations for the x 2 0 -series is essentially the same for the other three series. The initial vertical (S y 0 ¼ y 0 y 0 0 =y 2 0 ) slope is used to minimize the perturbation due to the y 2 0series. The last two series, z 2 0 -series and x 0 z 0 -series, can be simulaneously minimized by proper adjustment of the initial horizontal slope (S x 0 ¼ x 0 x 0 0 =x 2 0 ) and the longitudinal slope (S z 0 ¼ z 0 δ 0 =z 2 0 ), hereafter referred to as the chirp. In summary, for each of the three series, the minimizing horizontal slope, the minimizing chirp, and the minimizing vertical slope that suppress the perturbations due to the second-order series are where A and B are the summation of all coefficients related to y 2 0 and y 0 y 0 0 in Table I.

Benchmarking results
GPT simulations were used to verify the effectiveness of the slope-control method for minimizing the four sets of second-order series. The procedure we followed was to generate a Gaussian distributed beam with the parameters listed in Table II and with a given slope fS x 0 ; S y 0 ; S z 0 g, pass it through the EEX beam line (Table II), and examine the quality of both the final longitudinal bunch shape and the transformer ratio. For the transformer ratio, R 0 , a single mode wakefield with the wavelength satisfying N ¼ 3 for the ideal bunch length was used again. In case of the ideal triangle of length ¼ 3λ, R 0 ¼ 9.4. According to Eqs. (30)-(32) and using the parameters listed in Table II, we obtain the minimizing slopes to be The benchmarking results are shown in Fig. 9. The plots were made by scanning one slope fS x 0 ; S y 0 ; S z 0 g at a time, while the other two slopes were held constant at their minimizing values so that the results were focused on one parameter at a time. For similar reasons, the SC and CSR routines were turned off during these GPT simulations to keep the results focused on the suppression of second-order effects.
The horizontal slope.-During the GPT scan of S x 0 , the bunch length (l b ) changes and three different patterns appeared on the longitudinal bunch shape [ Fig. 9(a)]: (ramp) the ramp becomes slightly convex; (head) particles accumulate near the head to generate a bump; (tail) the tail preserves a sharp edge. This overall tendency is in good agreement with the analytic treatment given in Sec. IV as can be seen by inspection of Fig. 7(a).
Corresponding to the perturbations of the longitudinal bunch shape shown in Fig. 9(a), the transformer ratio also changes as shown in Fig. 9(b). The transformer ratio is close to its ideal value when the horizontal slope is near −0.3 m −1 , which is close to the predicted value (S x 0 ¼ −0.27 m −1 ). Note that both lower and higher values of S x 0 cause the transformer ratio to drop. For instance, if S x 0 > 0.5 then the transformer ratio drop exceeds 50% of its ideal value. Overall, the plots in both Figs. 9(a) and 9(b) show that the slope suppresses the perturbation very effectively when it is near the optimal value S x 0 ¼ −0.27 m −1 .
One down side to minimizing the x 2 0 -series perturbation using only the horizontal slope is that the bunch length after the EEX beam line also depends on the initial horizontal slope [note the dependence of z f on the angle, x 0 , in Eq. (7)] which is why the final bunch length, l b , varies from 2 to 5 mm in Fig. 9(a). However, if the sextupole method [15] is used in conjunction with our slope-control method then the x 2 0 -series perturbation can be minimized while simultaneously controlling the bunch length. Note that for bunch train generation, the horizontal slope ðS x 0 Þ changes both the overall length of the train and the microbunch separation.
The longitudinal slope (i.e. chirp).-The perturbation pattern imposed onto the ideal longitudinal bunch shape,n 0 ðzÞ, during the scan of the longitudinal slope ðS z 0 Þ is relatively complicated since the longitudinal slope effects the size of the perturbation terms in both the z 2 0series and x 0 z 0 -series. Therefore, the patterns produced during the scan of S z 0 are due to a combination of two perturbation patterns shown in Fig. 7(c): due to the z 2 0 -series with C 4 < 0 since the overall coefficient of z 2 0 -series is negative for the beam line parameters in Table II;  During the GPT scan of S z 0 , four different patterns appeared on the longitudinal bunch shape, nðzÞ: (head) a concave head; (peak) a rounded peak; (ramp) a slightly altered ramp angle; (tail) a concave tail. These patterns were compared with analytic predictions shown in Figs. 7(c) and 7(d) as discussed above. According to the analytic approach, the patterns (head) and (tail) are caused by both series. For pattern (ramp), the z 2 0 -series does not change the ramp, while the x 0 z 0 -series generates a slight change on the ramp angle. For pattern (peak), the peak is rounded by x 0 z 0 -series, but its position moves closer to the tail side than Fig. 7(d) because the z 2 0 -series preserves the position of the peak. Finally, GPT simulation results confirmed that this combined perturbation is minimized when the longitudinal slope is near −1.0 m −1 , which is close to the expected optimal slope of S z 0 δ 0 ¼ −1.05 m −1 [see Fig. 9(d)].
Similar to the case of the horizontal slope, the transformer ratio drops as the longitudinal slope (i.e. chirp) moves away from the optimal value (S z 0 δ 0 ¼ −1.05 m −1 ). For instance, when S z 0 > 6, then the transformer ratio drops by 50%. We note that during high-charge operation of a typical photoinjector, the bunch can exit the linac (i.e. enter the EEX beam line) with a high longitudinal slope (S z 0 ≈ 6) due to strong space-charge forces in the gun and linac. In this high-charge case, off-crest operation of the linac can help to suppress the transformer ratio drop by reducing the longitudinal chirp at the entrance to the EEX beam line.  The vertical slope.-The perturbation imposed on nðzÞ during the scan of the vertical slope ðS y 0 Þ is due to y 2 0 -series according to the analytic approach presented in Appendix B 4. Since the overall coefficient for the y 2 0 -series is negative (C 11 < 0) for the parameters given in Table II, the perturbation patterns in this case will behave as in Fig. 7(f).
During the GPT scan, two different patterns appeared on the ideal triangular profile: (peak) a convex shape near the peak and (tail) a concave tail as can be seen in Fig. 9(e). The patterns of the (head) and (ramp) were unchanged. The overall shape from the GPT simulations [ Fig. 9(e)] is in good agreement with that predicted from the perturbation analysis in Fig. 7(f).
The effect of the y 2 0 -series on transformer ratio is much weaker than the other two cases with the parameters of Table II. It follows the trend predicted by the perturbation analysis with its minimizing value near the predicted value S y 0 ¼ 0.13 m −1 . The transformer ratio drop is negligible for the range from −0.2 to 0.6 m −1 that includes the expected minimizing slope 0.13 m −1 .
In summary, GPT simulation results confirm that slopecontrol method can effectively suppress second-order effects in the EEX beam line. The slopes calculated with Eqs. (30)-(32) accurately predict the values of the slope that minimize the second-order perturbations according to GPT simulations. The good agreement between Figs. 7 and 9 proves that the second-order terms in Table I account for the perturbations. Most importantly, our results show that the second-order perturbations are easily controlled with the slope-control method that optimizes the initial horizontal, vertical and longitudinal slopes. The longitudinal slope can be adjusted by the linac phase while the horizontal and the vertical slopes are controlled with the four quadrupoles in front of the mask.

B. Control of the collective effects
The perturbations caused by CSR and SC have similar forms [Eq. (21)] and both can be minimized by minimizing ξ 2 (R56 in DL2) since ξ 2 is the coefficient of all collectiveeffect terms in Eq. (21). We call this method of minimizing the collective effects in the EEX beam line the asymmetricdogleg method since ξ 1 and ξ 2 are different. To verify the effectiveness of using ξ 2 to suppress the collective effects we scanned ξ 2 by scanning the bending angle and observed its effect on the longitudinal bunch shape and the transformer ratio. In order to change the value of ξ 2 while keeping η 2 constant (in order to maintain the exchange condition), both the bending angle and the drift length of DL2 had to be varied. This is possible since η 2 is more sensitive to the bending angle than ξ 2 so we were able to keep η 2 constant during the simulations by increasing the drift length.
GPT simulations were separated into two cases, depending on the beam energies, in order to study the two regimes of collective effects: CSR dominated (higher energy) and SC dominated (lower energy). In the first case, a 50 MeV beam was used to make CSR strong and SC weak while in the second case, a 15 MeV beam was used to makes CSR weak and SC strong. In the benchmarking simulations, the CSR and SC effects were only calculated up to the entrance of DL2 and turned off in DL2. In this way, we avoided confusion from the reduced angle (weaker CSR) and elongated drift (stronger SC) in order to verify that reducing ξ 2 helps to suppress the collective effects according to the analytic results in Secs. III and IV. However, at the end of this section, we verify the asymmetric-dogleg method in a realistic case by running a GPT simulation of a 3.5 nC bunch with all physics included in the beam line.
The EEX beam line parameters from Table II are used once again with the exception of α 2 and L D2 . The bending angle, α 2 , is varied from 20 degrees to 12 degrees in 2 degree steps. For the bending angle of 20 degrees, the drift length, L D2 , was set to 2 m for the 50 MeV case and 0.85 m for the 15 MeV case. It was then increased as the bending angle was decreased to keep η 2 constant. For the bending angle of 12 degrees, the drift length, L D2 , was set to 3.79 m for the 50 MeV case and 1.74 m for the 15 MeV case. For each combination of α 2 and L D2 , five different charge levels were applied. The lowest charge after the mask is 1.1 nC, and the highest charge is 11 nC. For the transformer ratio, a single mode wakefield with the wavelength satisfying N ¼ 3 for the ideal bunch length is used once again so that R 0 ¼ 9.4.

CSR-dominated regime
During the GPT scan in the CSR-dominated regime (50 MeV beam), three different patterns appeared on the ideal triangular profile (see Fig. 10): (ramp) a concave ramp shape, (tail) a convex tail shape, and (peak) a rounded peak. This overall feature shows good agreements with Fig. 7(h), which shows the predicted perturbation due to CSR. Although both CSR and SC generate similar perturbation patterns, the peak is rounded by CSR but flattened by space charge. Based on this observation, the perturbation in Fig. 10 is seen to be mostly caused by CSR, as expected.
Figures 10(a)-10(e) show a clear relationship between the CSR-perturbation strength, the charge, and ξ 2 . High charge generates strong CSR, which in turn generates strong perturbations. However, decreasing ξ 2 helps to weaken the CSR induced perturbations. For a given charge, the perturbation is clearly suppressed at lower ξ 2 . At 12 degrees, there is only a small amount of change on the tail side even for 11 nC. In terms of the transformer ratio, the 20 degree case generates 70% drop of transformer ratio at 5.5 nC or higher, but even 11 nC, the 12 degree case only generates a 20% drop of transformer ratio.
Notice that the behavior of the transformer ratio, R, in the CSR dominated regime does not follow a simple pattern. This is because R depends on both the bunch length and the shape. In the case of the ideal triangle, we have R 0 ¼ πN but the slightly concave shape on the head will generate a higher transformer ratio [18]. Since CSR generates a Note that the beam energy is 50 MeV to generate strong CSR but weak SC. slightly longer bunch length (due to the elongated tail) as well as a concave head shape, then the transformer ratio can actually be higher than the ideal triangle profile.

Space-charge dominated regime
During the GPT scan of the space-charge (SC) dominated regime (15 MeV beam), four different patterns appeared on the ideal triangular profile (Fig. 11): (head) a convex shaped head, (tail) a concave shape tail, (ramp) a concave ramp and (peak) a flattened peak in comparison to Fig. 10. The flattened peak is a distinguishing feature of the SC dominated regime while the rounded peak is a distinguishing feature of the CSR dominated regime. These overall patterns are similar to Fig. 7(g). Since the perturbation from the SC with energy and charge is too strong, even the 12 degree case still has a seriously perturbed longitudinal bunch shape. However, it is clearly better than the profiles in Fig. 11(a) which has an extremely elongated bunch length from the SC effect.
The asymmetric dogleg method is not as effective at suppressing the SC effects in this regime as it was for the CSR effect. A charge of 1.1 nC provides a reasonably high transformer ratio, and the 3.3 nC case shows clearly improved results for decreased ξ 2 . However, because of the severe space-charge perturbation, the transformer ratio quickly drops with charge and then changes slowly (and even oscillates) at higher charge.

C. Benchmarking results with all physics included
In the GPT simulation of the previous two subsections, we turned off the collective effects in DL2. This approximation allowed for easy comparison with the analytic results of Sec. IV. In this subsection, we verify the effectiveness of the asymmetric-dogleg method using a realistic case by running a GPT simulation of a 3.5 nC bunch with all physics included everywhere in the beam line. Figure 12 shows the GPT simulation result with both CSR (a) and SC (b) included along the entire beam line (including DL2). GPT simulations were done with a charge of 3.5 nC after the mask and wakefield is calculated in the same way. For N ¼ 3, transformer ratio for the CSR dominated regime is 8.0 which means 15% drop from the ideal value, and the SC dominated regime provides 6.0 which is 36% drop from the ideal value (9.4). These simulations verify that the approximations used in this section yield answers very close to the case when all physics is included.

VI. CONCLUSION
We presented an analysis of perturbation sources and their effect on the longitudinal bunch shape, the transformer ratio and studied methods to suppress perturbations in the mask þ emittance exchange beam line. The linear transfer matrix formalism is a useful tool to understand the basic beam dynamics in the EEX beam line, but it ignores other significant factors like higher-order terms in the beam line optics and collective effects. Our analysis extended the matrix formalism to include these terms to study their effect on the ideal longitudinal bunch shape and the transformer ratio. Our analytic estimates showed good agreement with particle tracking simulation using GPT that includes all physics.
We introduced two methods for the suppression of perturbations to the longitudinal bunch shape caused by second-order and collective effects. The slope-control method is used to minimize the perturbation from the second-order terms by controlling the horizontal and vertical slope of the bunch before the mask. The asymmetric-dogleg method minimizes the perturbation from the collective forces by reducing ξ 2 (while keeping η 2 constant). GPT simulation results, with all physics included, showed good agreement with the analytic predictions of suppression.

ACKNOWLEDGMENTS
This work was supported by the Department of Energy, Office of High Energy Physics, under Contract No. DE-AC02-06CH11357.

APPENDIX A: SECTIONS OF EEX BEAM LINE WHERE MOMENTUM EXCHANGE AND POSITION EXCHANGE TAKE PLACE
It is difficult to understand the emittance exchange process due to the complex motion of the beam inside the beam line. Therefore, in this section, we will develop an intuitive understanding of the emittance exchange process in the idealized case. Our explanation is intended to supplement explanations given previously in the literature, Refs.
[1] and [2]. We now examine the beam at two different sections inside the EEX beam line: after DL1 þ TDC and after TDC þ DL2.

The momentum exchange
We begin by examining the beam after it has passed through the first section (DL1 þ TDC) and show that this is where the transverse and longitudinal momentum is exchanged. Given the particle coordinates at the entrance to EEX beam line are X 0 ¼ ðx 0 ; x 0 0 ; z 0 ; δ 0 Þ T , then after the TDC we have Writing out the expressions for each momentum explicitly gives Let us consider the first line of Eq. (A2), which has four terms. The first term ðx 0 0 Þ is simply the initial transverse momentum while the second term ðκη 1 x 0 0 Þ arises in two steps. In the first step, Eq. (1) shows that an x 0 − z correlation is acquired at the end of the dogleg due to the longer path length taken by particles with nonzero x 0 in a region of dispersion ðη 1 Þ so that z 1 acquires an η 1 x 0 0 term. In other words, particles with a positive/negative initial divergence ðx 0 0 Þ arrive at the end of DL1 late/early, by the extra amount Δz 1 ¼ η 1 x 0 0 . In the second step, the TDC imparts a z-dependent transverse kick [Eq.
(2)] so that x 0 2 acquires the κz 1 term, (z 1 ¼ κη 1 x 0 0 ). The divergence after the TDC now depends on the initial divergence ðx 0 0 Þ and the acquired divergence ðκηx 0 0 Þ as x 0 At this point, if the beam line is tuned so that the exact EEX condition applies, by appropriate choice of the dogleg dispersion and TDC kick strength (1 þ κη 1 ¼ 0 [2]), then Eq. (A2) becomes Thus, the momenta have been exchanged: x 0 ⇌ δ. In other words, the transverse momentum after the TDC ðx 0 2 Þ depends only on the initial longitudinal coordinates ðz 0 ; δ 0 Þ and the longitudinal momentum after the TDC ðδ 2 Þ depends only on the initial transverse coordinates ðx 0 ; x 0 0 Þ. Note also that while DL2 [Eq.
(1)] completes the beam line, it does not change the momenta x 0 and δ. Thus, we see that the first section of the beam line (DL1 þ TDC) is the place where the momenta are exchanged.

The position exchange
We next examine the beam after it has passed through the second section of the beam line (TDC þ DL2) and show that this is where the transverse and longitudinal positions have been exchanged. Given the particle coordinates at the entrance to the TDC are X 1 ¼ ðx 1 ; x 0 1 ; z 1 ; δ 1 Þ T , then after DL2 we have the expression In the same way, the EEX condition (1 þ κη 2 ¼ 0) simplifies this relation and the final positions can be explicitly expressed as Before applying the EEX condition, we had a term x f ¼ x 1 þ κη 2 x 1 . The first term is simply the initial transverse position ðx 1 Þ and the second term ðκη 2 x 1 Þ arises in two steps. In the first step, the TDC applies an x-dependent longitudinal kick as shown in Eq. (2) so that δ 2 acquires a κx 1 term (i.e., δ 2 ¼ δ 1 þ κx 1 ) so the beam has an x − δ correlation. In the second step, the transverse dispersion of DL2 also creates an x − δ correlation [Eq. (1)] x f ¼ η 2 δ 2 ¼ κη 2 x 1 . Once again, if the correlation caused by the TDC is made to cancel the correlation from DL2, by tuning κ and η 2 , then the two terms can cancel out and the position exchange is complete.
Note that while the coordinate exchange is not complete due to the presence of momentum terms (ðL 2 þ L D Þx 0 1 and ξ 2 δ 1 ), Eq. (A5) still has the property that the final x-position is independent of the initial z-position and the final x-position is independent of the initial z-position. Inspection of Eq. (1) shows that this property is preserved if the matrix occurring in Eq. (A5) is multiplied by the matrix in Eq. (1) to the right. Therefore, we can say that the position exchange occurs in the second section (TDC þ DL2).

APPENDIX B PERTURBATION FUNCTIONS AND THEIR CHARACTERISTICS
1. x 2 0 -series perturbation: z i f -dependent, shift, no spread The first set of perturbation terms we consider is the x 2 0series on the first line of Eq. (23) (i.e., C 1 x 2 0 þ C 2 x 0 x 0 0 þ C 3 x 02 0 ). Since all three terms are proportional to x 2 0 , due to the slope relationship given in Sec. III, we only need consider the first term of the perturbation, ζ ¼ C 1 x 2 0 . This perturbation ðζÞ varies with the position ðz i f Þ of the bunch since z i f ¼ C 0 x 0 . This means there is a correlation between ζ and z i f which is the same as saying "the perturbation is z i f -dependent." The magnitude of the perturbation is ζ ¼ C 1 x 2 0 , and therefore, the shift ðζÞ is small near the origin (z i f ¼ 0) and large near the head and tail (Fig. 13, middle row). Further, all particles that start at a slice shift by the same amount (i.e. no spread) so the x 2 0term perturbation function can we written as To understand the total perturbed longitudinal bunch shape, we need to sum the shifts from the individual slices. The direction of the shift, ζ, is always towards the back of the bunch (Fig. 13, middle row) since the term C 1 x 2 0 is always negative in our case. This is because the coefficients (C 1 , C 2 , C 3 ) are always negative (these coefficient calculations are not included in the paper). If this perturbation is strong (C 1 x 2 0 is large) then a slice that starts near the head can shift beyond a particle that started close to the center causing a large peak to form near z ∼ 1 mm [ Fig. 7(a)]. Summing all of the slice perturbations (Fig. 13, top row) together gives the characteristic shape of the perturbed longitudinal bunch shape due to the x 2 0 -series. The following effects on the shape can be seen in Fig. 7 elongated tail with hard edge which only occurs in this perturbation as no other perturbations generate a hard edge; (peak) unchanged; (ramp) convex; (head) convex or spikelike head.
2. The z 2 0 -series perturbation: z i f -independent, no shift, spread The second set of perturbation terms we consider are the z 2 0 -terms on the second line of Eq. (23) (C 4 z 2 0 þ C 5 z 0 δ 0 þ C 6 δ 2 0 ). Since all three terms are proportional to z 2 0 , due to the slope relationship given in Sec. III, we only need to consider the first term of the perturbation, ζ ¼ C 4 z 2 0 . Since the z 0 distribution has a spread (the bunch has a Gaussian longitudinal distribution at the entrance to EEX), this perturbation (ζ ¼ C 4 z 2 0 ) will result in a spread (Fig. 14, middle and top rows) around the ideal position z i f but without a shift. Further, since z 0 is not correlated with z i f , then this perturbation is not correlated with z i f (i.e. the perturbation is z i f -independent) and the magnitude of this perturbation is constant along the bunch position (Fig. 14, middle and top). This perturbation function will redistribute particles according to where n is the normalization factor for R ζ max 0 PðζÞdζ ¼ 1. The direction of the perturbation can be either forwards or backwards depending on the sign of the coefficient, C 4 . When C 4 > 0, the particles spread forwards, and the characteristic shape of the perturbed longitudinal bunch shape, nðzÞ, is: (tail) a convex shaped tail; (peak) a rounded peak; (ramp) unchanged; (head) a concave shaped and elongated head. When C 4 < 0, (Fig. 14, middle) the particles spread backwards and the characteristic shapes are: (tail) a concave shape tail; (peak) unchanged; (ramp) unchanged; (head) a concave shape head. The total perturbed longitudinal bunch shape for the forward (C 4 > 0) and backward (C 4 < 0) case is shown in Figs. 7(b) and 7(c), respectively.
3. The x 0 z 0 -series perturbation: z i f -dependent, without shift, with spread