%
% !BIB TS-program = biber
% !BIB program = biber
% !TeX spellcheck = en_US
% !TeX program = pdflatex
%
% support document for version: v 3.00  Feb 2026   Volker RW Schaa
%   
%
\documentclass[%              % paper size definition not needed as JACoW page size is set
               %boxit,        % show page boundaries to check whether paper is inside correct margins
               %refpage       % references placed on separate page
               %biblatex,     % BibLaTeX is to be used
               %nospread,     % flushend option: do not fill with whitespace to balance columns
               %hyphens,      % allow \url to hyphenate at "-" (hyphens)
               %luatex,       % use LuaLaTeX to process the file
               ]{jacow}

\usepackage[english]{babel}

\listfiles

%%
%% Lengths for the spaces in the title
%%   \setlength\titleblockstartskip{..}  %before title, default 3pt
%%   \setlength\titleblockmiddleskip{..} %between title + author, default 1em
%%   \setlength\titleblockendskip{..}    %afterauthor, default 1em

\begin{document}

%%%%% Title - Author block generated from indico contribution details %%%%%
%%%%%%%%%%%%%%%%%%%% Do not modify  %%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% If you need to modify the content of this block, do it by modifying the  %%%%%
\title{MATCHING OF MULTIPLE ENERGY BEAMLINES FOR THE CEBAF ENERGY UPGRADE\thanks{Work supported by Brookhaven Science Associates, LLC under Contract No. DE-SC0012704 with the U.S. Department of Energy.}}

\author{S.J.~Brooks\thanks{sbrooks@bnl.gov}, Brookhaven National Laboratory, Upton, NY, USA}

\maketitle

%%%%% End of Title - Author block %%%%%

%%%%% You can modify the abstract to add LaTeX commands. However, please make sure that it is similar to the one in indico %%%%%
\begin{abstract}
It is currently planned to increase the energy of the CEBAF recirculating linear accelerator to 22\,GeV by adding two new recirculating arcs that contain multiple new energy passes.  These new passes at six different energies must be matched to the existing linac simultaneously, as the beam is continuous (CW), so magnets cannot be ramped.  This paper studies propagating several energies in the same beam pipe with a line of quadrupoles acting on all of them simultaneously, with the goal that the combined effect produces a match for each energy.  Computer optimisation of the performance this system under various constraints (beamline length, number of magnets) is studied.
\end{abstract}

\section{Matching Constraints}
The proposed CEBAF upgrade achieves an energy increase by replacing the highest energy arcs of the racetrack by ones that contain up to six energies \cite{IPAC24-upgrade}, enabling more passes through the two linacs on the North and South of the facility.  The bulk of the 180$^\circ$ angle of each muiti-energy arc is implemented using a fixed-field accelerator (FFA) lattice with permanent magnets \cite{IPAC24-FFAarc-brooks} and homogenous cells.  However, matching these six beams of different rigidities to the linacs is non-trivial.  The parameters to be matched for each energy roughly divide into three groups:
\begin{enumerate}
\item Orbit position and angle $x,x'$ together with their energy derivatives $D_x,D'_x$ (there is no vertical orbit motion in the FFA arcs);
\item Optical functions $\beta_x,\beta_y,\alpha_x,\alpha_y$;
\item Time of flight $\Delta t$ and its energy derivative $R_{56}$.
\end{enumerate}
Matching group 1 for a multi-energy beamline has been experimentally demonstrated at the CBETA FFA \cite{CBETA} using an adiabatic line, with shorter non-adiabatic matches also possible \cite{DejanIPAC24facility} to a reasonable level of accuracy.  Group 3 is hardest to match because changing the time of flight separately for each energy usually requires splitting them into lines taking different paths, as was done at CBETA and is planned for the CEBAF upgrade \cite{IPAC25-splitter}.  Once the energies are separated, matching all the parameters is much easier.  The disadvantage is that multiple split lines (six in this case) can be large and costly, so reliance on these should be minimised.  It is therefore being considered to have split lines only on one side of each linac, to deal with all the time of flight effects, with a merged line on the other side.  This merged line would still have to match the group 2 optical parameters with all six energies in the same line.

\newcommand{\comment}[1]{}
\comment{
\begin{table*}[!hbt]
   \centering
   \caption{Matching Conditions Before and After the Beamline}
   \begin{tabular}{c|cccc|cccc}
       \toprule
       \textbf{Beam Kinetic Energy} & \multicolumn{4}{c|}{\textbf{Input}} & \multicolumn{4}{c}{\textbf{Output}} \\ 
                         \textbf{(GeV)}     & \textbf{$\beta_x$ (m)} & \textbf{$\beta_y$ (m)} & \textbf{$\alpha_x$} & \textbf{$\alpha_y$}     & \textbf{$\beta_x$ (m)} & \textbf{$\beta_y$ (m)} & \textbf{$\alpha_x$} & \textbf{$\alpha_y$}	 \\
       \midrule
10.55 & 16.63 & 19.75 & 0.14 & 0.03 & 4.157 & 6.515 & 3.049 & -3.19 \\
12.75 & 58.31 & 64.75 & 0.51 & -0.2 & 2.951 & 6.477 & 1.822 & -3.037 \\
14.95 & 61.5 & 64.53 & -0.29 & -0.91 & 2.718 & 6.995 & 1.539 & -3.206 \\
17.15 & 40.81 & 39.37 & -0.65 & -0.88 & 2.602 & 8.035 & 1.399 & -3.636 \\
19.35 & 21.74 & 25.17 & -0.01 & -0.07 & 2.521 & 10.132 & 1.311 & -4.549 \\
21.55 & 26.72 & 33.88 & 0.47 & 0.36 & 2.455 & 16.84 & 1.247 & -7.524 \\
       \bottomrule
   \end{tabular}
   \label{tab:matchconditions}
\end{table*}}

\begin{table}[!hbt]
   \centering
   \caption{Matching Conditions Before the Beamline}
   \begin{tabular}{c|cccc}
       \toprule
       \textbf{Beam $E_k$ (GeV)} & \textbf{$\beta_x$ (m)} & \textbf{$\beta_y$ (m)} & \textbf{$\alpha_x$} & \textbf{$\alpha_y$}    \\
       \midrule
10.55 & 16.63 & 19.75 & 0.14 & 0.03 \\
12.75 & 58.31 & 64.75 & 0.51 & -0.2  \\
14.95 & 61.5 & 64.53 & -0.29 & -0.91 \\
17.15 & 40.81 & 39.37 & -0.65 & -0.88 \\
19.35 & 21.74 & 25.17 & -0.01 & -0.07 \\
21.55 & 26.72 & 33.88 & 0.47 & 0.36 \\
       \bottomrule
   \end{tabular}
   \label{tab:inputmatchconditions}
\end{table}

\begin{table}[!hbt]
   \centering
   \caption{Matching Conditions After the Beamline}
   \begin{tabular}{c|cccc}
       \toprule
       \textbf{Beam $E_k$ (GeV)} & \textbf{$\beta_x$ (m)} & \textbf{$\beta_y$ (m)} & \textbf{$\alpha_x$} & \textbf{$\alpha_y$}    \\
       \midrule
10.55 & 4.157 & 6.515 & 3.049 & -3.19 \\
12.75 & 2.951 & 6.477 & 1.822 & -3.037 \\
14.95 & 2.718 & 6.995 & 1.539 & -3.206 \\
17.15 & 2.602 & 8.035 & 1.399 & -3.636 \\
19.35 & 2.521 & 10.132 & 1.311 & -4.549 \\
21.55 & 2.455 & 16.84 & 1.247 & -7.524 \\
       \bottomrule
   \end{tabular}
   \label{tab:outputmatchconditions}
\end{table}

Previous work on this section \cite{IPAC24-matching} had success with group 1 but difficulty with group 2, so here we concentrate on group 2 and assume that group 1 is already matched to zero with a method similar to \cite{DejanIPAC24facility}.
This paper studies matching from the optical parameters after the linac (Table~\ref{tab:inputmatchconditions}) to the parameters for entry into the FFA section (Table~\ref{tab:outputmatchconditions}), with all six energies going through the same magnets.  The beta functions from the linac are significantly larger than those of the FFA.  As the orbit is at $x=y=0$, only quadrupoles are required.


\section{Optimisation}
The optimisation has $6\times4=24$ constraints and as many variables as there are quadrupole gradients.  The lengths are not varied, as this made seemed to make the optimisation more prone to local minima.  Even without varying the lengths, getting stuck in a local minimum of the sum-of-squares error was very common.  The basic optimisation method is to take the Jacobian response matrix and apply SVD to yield a damped pseudo-inverse equivalent to the Levenberg--Marquardt method \cite{BrooksSVD}.  Some higher-order corrections \cite{BrooksOptimiser} were also added.  However, this optimisation was restarted to random points (`basin hopping') multiple times before getting the first 30-magnet solution shown below.

For the shorter beamline with 40 magnets, simulated annealing was applied.  In this, random steps are accepted with probability $\min(1,e^{-\Delta E/T})$ where $\Delta E$ is the change in sum-of-squares error and $T$ is a `temperature' parameter, which here decreases by $10^{-4}T$ on every step.  The difficult part is generating suitable random steps that are not so large they always get rejected, nor are so small they do not adequately explore the landscape, which is required for annealing to statistically choose the lower minimum.  Rather than generating random steps in terms of the input variables, the output goals were temporarily displaced by random amounts proportional to a step size $S$ and then a single step of that displaced optimisation was taken, effectively stepping in `output space' instead.  The step size $S$ was determined adaptively: increasing by $10^{-2}S$ whenever a step was accepted and decreasing by the same when it was rejected.  Note that this adaptivity should be on a faster time scale than the annealing temperature cooling schedule.

\section{Beamline Solutions}

\begin{table}[!hbt]
   \centering
   \caption{Comparison of Matched Beamline Solutions}
   \begin{tabular}{lcc}
       \toprule
       \multicolumn{3}{c}{\textbf{Design Constraints}} \\ 
       \midrule
Total length & 60\,m & 48\,m \\
Quadrupoles & 30 & 40 \\
Quadrupole length & 1.8\,m & 1.0\,m \\
Drift length & \multicolumn{2}{c}{0.2\,m} \\
Maximum gradient & \multicolumn{2}{c}{$\pm$50\,T/m} \\
       \toprule
       \multicolumn{3}{c}{\textbf{Optimised Results}} \\ 
       \midrule
Maximum $\beta_x$ & 150.9\,m & 2416\,m \\
Maximum $\beta_y$ & 614.9\,m & 1101\,m \\
Maximum $\sigma_x/\sigma_{x,in}$ & 3.013 & 12.05 \\
Maximum $\sigma_y/\sigma_{y,in}$ & 5.580 & 7.466 \\
Largest gradient & 34.54\,T/m & 50.00\,T/m \\
Maximum $|\beta-\beta_{goal}|$ & 1.75\,$\mu$m & 9.42\,$\mu$m \\
Maximum $|\alpha-\alpha_{goal}|$ & $8.70\times10^{-7}$ & $3.85\times10^{-6}$ \\
       \bottomrule
   \end{tabular}
   \label{tab:solutions}
\end{table}

Two solutions were investigated with the parameters given in Table~\ref{tab:solutions}.  A shorter beamline was possible by adding more magnets, but the magnets had to be stronger.  Drift spaces of 0.2\,m were assumed throughout.  The matches are close to exact, with $\sim$$10^{-6}$ level deviations from the goal values.

\subsection{60m Length, 30 Magnet Solution}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THP5306_f1}
   \caption{Quadrupole gradients in the 60\,m beamline.}
   \label{fig:longquads}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THP5306_f2}
   \caption{Horizontal beam size $\sqrt{\beta_x}$ in the 60\,m beamline.}
   \label{fig:longbetax}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THP5306_f3}
   \caption{Vertical beam size $\sqrt{\beta_y}$ in the 60\,m beamline.}
   \label{fig:longbetay}
\end{figure}

A beamline with 30 quadrupoles spaced at 2\,m intervals found a solution with the gradient values in Fig.~\ref{fig:longquads}.  Plotting $\sqrt{\beta}$ as it is proportional to beam size, the horizontal and vertical beam sizes for all six energies are plotted in Figs.~\ref{fig:longbetax} and \ref{fig:longbetay} respectively.  There is general tendency for the lowest energies, with low rigidity, to have the most severe swings in beta function.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=0.9\columnwidth]{THP5306_f4}
   \caption{Horizontal phase advance in the 60\,m beamline.}
   \label{fig:longphix}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=0.9\columnwidth]{THP5306_f5}
   \caption{Vertical phase advance in the 60\,m beamline.}
   \label{fig:longphiy}
\end{figure}

Figures~\ref{fig:longphix} and \ref{fig:longphiy} show the phase advance evolution through the beamline, with the expected tendency for higher energies to have lower phase advances.

\subsection{48m Length, 40 Magnet Solution}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THP5306_f6}
   \caption{Quadrupole gradients in the 48\,m beamline.}
   \label{fig:shortquads}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THP5306_f7}
   \caption{Horizontal beam size $\sqrt{\beta_x}$ in the 48\,m beamline.}
   \label{fig:shortbetax}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=\columnwidth]{THP5306_f8}
   \caption{Vertical beam size $\sqrt{\beta_y}$ in the 48\,m beamline.}
   \label{fig:shortbetay}
\end{figure}

A beamline with 40 quadrupoles spaced at 1.2\,m intervals found a solution with the gradient values in Fig.~\ref{fig:shortquads}.  The horizontal and vertical beam sizes are plotted in Figs.~\ref{fig:shortbetax} and \ref{fig:shortbetay} respectively.  This beamline has more severe swings in beta function than the 60\,m length one, so may be more sensitive to errors and aberrations.

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=0.9\columnwidth]{THP5306_f9}
   \caption{Horizontal phase advance in the 48\,m beamline.}
   \label{fig:shortphix}
\end{figure}

\begin{figure}[!htb]
   \centering
   \includegraphics*[width=0.9\columnwidth]{THP5306_f10}
   \caption{Vertical phase advance in the 48\,m beamline.}
   \label{fig:shortphiy}
\end{figure}

Figures~\ref{fig:shortphix} and \ref{fig:shortphiy} show the phase advance evolution through the beamline, which is similar in both planes, whereas the 60\,m length beamline had a smaller horizontal phase advance.

\section{Conclusion}
These beamlines exactly solve the challenging problem of matching the optics of six different rigidity beams simultaneously.  The overall lengths of 48 and 60\,m are shorter than the beamlines in \cite{IPAC24-matching}.  The 48\,m beamline has higher peaks in beam size, while the 60\,m beamline looks more practically attainable, with lower gradients as well.  It is hoped future work will look at these tradeoffs and further explore the space, ideally resulting in more reliable optimisation methods to find these exact matches.

%\begin{thebibliography}{99}   	% Use for  10-99  references
\begin{thebibliography}{9} 		% Use for 1-9 references
	
%	\bibitem{ref:jacow-paper}
%		A. Alpha and B. T. Beta, 
%		“Novel techniques for future TeV electron accelerators”, 
%		in \textit{Proc. IPAC’23}, Venice, Italy, May 2023, pp.~57-59. 
%		\doi{10.18429/JACoW-IPAC2023-PAPERID}
	
	\bibitem{IPAC24-upgrade}
		D. Z. Khan \emph{et al.}, ``Current Status of the FFA@CEBAF Energy Upgrade'', in \textit{Proc. IPAC’24}, Nashville, TN, May 2024, pp.~474--477. 
		\doi{10.18429/JACoW-IPAC2024-MOPR08}

	\bibitem{IPAC24-FFAarc-brooks}
		S. J. Brooks, ``Optimisation of a Permanent Magnet Multi-Energy FFA Arc for the CEBAF Energy Upgrade'', in \textit{Proc. IPAC’24}, Nashville, TN, May 2024, pp.~1053--1056. 
		\doi{10.18429/JACoW-IPAC2024-TUPC22}
		
\bibitem{CBETA} A. Bartnik \emph{et al.}, ``CBETA: First Multipass Superconducting Linear Accelerator with Energy Recovery'', \textit{Phys. Rev. Lett.}, vol. 125, no. 4, p.~044803, Jul. 2020. \doi{10.1103/physrevlett.125.044803}

\bibitem{DejanIPAC24facility}
    D. Trbojevic, G. Mahler and S. Brooks,
    ``FLASH proton therapy facility design with permanent magnet'',
    in \emph{Proc. IPAC'24}, Nashville, TN, May 2024, pp. 3613--3616.
    \url{doi:10.18429/JACoW-IPAC2024-THPR46}

	\bibitem{IPAC25-splitter}
		R. M. Bodenstein \emph{et al.}, ``Current Status of Conceptual Horizontal Splitter Design for FFA@CEBAF Energy Upgrade'', in \textit{Proc. IPAC’25}, Taipei, Taiwan, June 2025, pp.~810--813. 
		\doi{10.18429/JACoW-IPAC2025-MOPS126}

	\bibitem{IPAC24-matching}
		B. R. Gamage \emph{et al.}, ``Resonant Matching Section for CEBAF Energy Upgrade'', in \textit{Proc. IPAC’24}, Nashville, TN, May 2024, pp.~3075--3078. 
		\doi{10.18429/JACoW-IPAC2024-THPC37}

%	\bibitem{ref:journal-paper}
%		A. Alpha \textit{et al.}, 
%		“A new 12\,GHz electron linear accelerator”, 
%		\textit{Nucl. Instrum. Methods Phys. Res. A}, vol. 12, no. 6, pp.~127-136, 2024. \doi{10.1016/j.nima.2024.170083}
		
\bibitem{BrooksSVD} S. J. Brooks, ``Bounded Approximate Solutions of Linear Systems using SVD'', BNL-223624-2022-TECH (2015).  \doi{10.2172/1895088}
\bibitem{BrooksOptimiser} S. J. Brooks, ``Higher-Order Corrections to Optimisers based on Newton’s Method'', arXiv:2307.03820 (2023).

\end{thebibliography}

\end{document}