Design, specifications, and first beam measurements of the compact linear accelerator for research and applications front end

The compact linear accelerator for research and applications (CLARA) is an ultrabright electron beam test facility being developed at STFC Daresbury Laboratory. The ultimate aim of CLARA is to test advanced free electron laser (FEL) schemes that can later be implemented on existing and future short-wavelength FELs. In addition, CLARA is a unique facility to provide a high-quality electron beam to test novel concepts and ideas in a wide range of disciplines and to function as a technology demonstrator for a future United Kingdom x-ray FEL facility. CLARA is being built in three phases; the first phase, or front end (FE), comprises an S-band rf photoinjector, a linac, and an S-bend merging with the existing versatile electron linear accelerator beam line; the second phase will complete the acceleration to full beam energy of 250 MeV and also incorporate a separate beam line for use of electrons at 250 MeV; and the third phase will include the FEL section. The CLARA FE was commissioned during 2018, and the facility was later made available for user experiments. Significant advancements have been made in developing high-level software and a simulation framework for start-to-end simulations. The high-level software has been successfully used for unmanned rf conditioning and for characterization of the electron beam. This paper describes the design of the CLARA FE, performance of technical systems, high-level software developments, preliminary results of measured beam parameters, and plans for improvements and upgrades. © 2020 authors. Published by the American Physical Society.

The compact linear accelerator for research and applications (CLARA) is an ultrabright electron beam test facility being developed at STFC Daresbury Laboratory. The ultimate aim of CLARA is to test advanced free electron laser (FEL) schemes that can later be implemented on existing and future shortwavelength FELs. In addition, CLARA is a unique facility to provide a high-quality electron beam to test novel concepts and ideas in a wide range of disciplines and to function as a technology demonstrator for a future United Kingdom x-ray FEL facility. CLARA is being built in three phases; the first phase, or front end (FE), comprises an S-band rf photoinjector, a linac, and an S-bend merging with the existing versatile electron linear accelerator beam line; the second phase will complete the acceleration to full beam energy of 250 MeV and also incorporate a separate beam line for use of electrons at 250 MeV; and the third phase will include the FEL section. The CLARA FE was commissioned during 2018, and the facility was later made available for user experiments. Significant advancements have been made in developing high-level software and a simulation framework for start-to-end simulations. The high-level software has been successfully used for unmanned rf conditioning and for characterization of the electron beam. This paper describes the design of the CLARA FE, performance of technical systems, high-level software developments, preliminary results of measured beam parameters, and plans for improvements and upgrades.

I. INTRODUCTION
Free electron lasers (FELs) are sources of electromagnetic radiation with an exceptional set of properties, and as such there is worldwide interest in their development for a wide range of applications. In the past decade, a number of x-ray FEL user facilities have become operational, and a few more are in the design and planning stages. These facilities are mainly based on radio frequency (rf) linear accelerators, both normal conducting and superconducting technologies (for reasonable facility size and cost or to maximize pulse repetition rates and number of beam lines, respectively). The operational facilities are providing ground-breaking results in a wide range of scientific disciplines, but there is still scope to significantly advance the performance of these facilities and to make these facilities more compact and affordable. Even though user facilities could potentially be used for testing FEL concepts and other technologies, there is very little flexibility or availability due to high user demand. Therefore, a dedicated test facility can offer significant advantages to further scientific and technological developments in this field. A general concept of such a facility at Daresbury was proposed [1], and an extensive review of FEL test facilities was undertaken in 2011-2012 [2,3] to assess the prospects to build such a facility at Daresbury Laboratory. The proposal to build the compact linear accelerator for research and applications (CLARA) [4], a dedicated FEL test facility, was based on these developments.
One of the main components of x-ray FEL facilities is an ultrabright electron injector, which is able to deliver ultralow emittance beams at a repetition rate as high as possible. The requirement for ultralow beam emittance leads to the use of electron sources with a cathode field of higher than 100 MV=m that is achievable in rf cavities operating at a frequency of 3 GHz (S band) and higher. Because of rf limitations, the maximum possible repetition rate at this frequency is up to 1 kHz [5]. One of the main goals of the CLARA and the adjoining versatile electron linear accelerator (VELA) [6] facilities is to establish high-brightness, high-repetition-rate injector technology for a future x-ray FEL facility in the United Kingdom. Considering this, the VELA facility has been specially designed for commissioning and characterizing S-band rf electron sources with interchangeable photocathodes operated at a frequency of 400 Hz.
Currently, there are several user and test facilities worldwide with an S-band photoelectron source, of which only very few are operating or being commissioned with interchangeable photocathodes, and none of them at a repetition rate of 400 Hz. There is significant interest in the development of an electron source operating in C and X rf bands, but these projects are in the initial R&D stage and not yet ready to be used in user facilities. Here we give a brief overview of the most recently developed S-band electron sources where state-of-the-art rf and photocathode technologies have been implemented.
The SwissFEL user facility at PSI, Switzerland, operates with 2.5-cell S-band electron source with interchangeable cesium telluride photocathodes and delivers 200 pC bunches with a slice emittance of as low as 0.2 μm rad as measured after the first bunch compressor [7]. Although the electron source has been designed for operation with a repetition rate of 400 Hz, it runs at 100 Hz as per the facility specification.
Collaboration of CERN, Rutherford Appleton Laboratory, United Kingdom, and Laboratoire de L'Accélérateur Linéaire (LAL), France, has developed a 2.5-cell S-band electron source with an interchangeable photocathode [8], originally intended for the CTF3 test facility at CERN to run in a multibunch regime. Commissioning of the source demonstrated a total charge of 5.8 μC in 1300-ns-long micropulse trains. The train repetition rate and electric field amplitude on axis are 1 Hz and 85 MV=m, respectively [9]. The source now operates with cesium telluride photocathodes in single-bunch mode delivering 200 pC charge bunches and is being used in the Advanced Wakefield Experiment at CERN [10]. A similar source has been built for the ThomX facility at LAL for operation with a cathode field of 80 MV=m and repetition rate of 50 Hz [11].
Deutsches Elektronen-Synchrotron (DESY) has developed 1.5-cell S-band electron sources with metal interchangeable photocathodes. These sources are used in the operating Relativistic Electron Gun for Atomic Exploration (REGAE) electron diffraction user facility [12] and for the Short Innovative Bunches and Accelerators at DESY (SINBAD) facility which is now under commissioning [13]. Both sources are developed for operation with ultralow, sub to few pC bunch charges and a repetition rate of 50 Hz.
Among the sources operating with noninterchangeable copper photocathodes, the 1.6-cell S-band electron source of the Linac Coherent Light Source (LCLS) FEL user facility at Stanford Linear Accelerator Center (SLAC) should be mentioned, which operates at a record cathode field of 115 MV=m [14]. This source is able to operate with a repetition rate of up to 120 Hz. A similar electron source is also used in the injector of the FERMI@elettra FEL operating in the frequency range of 10-50 Hz [15].
The CLARA high-repetition-rate electron source is based on a 1.5-cell S-band cavity designed to operate with a field of up to 120 (at a repetition rate of 100 Hz) and 100 MV=m (at a repetition rate of 400 Hz) with interchangeable metal and/or cesium telluride photocathodes. In order to validate the designs and technologies used in developing these electron sources, the VELA beam line has been equipped with a comprehensive beam diagnostic suite to analyze the 6D emittance of the beam. The CLARA beam line is equipped with a booster or buncher linear accelerator, which is also able to operate at up to a frequency of 400 Hz.
In addition to the main goal of testing advanced FEL concepts and capabilities for next-generation x-ray FELs, CLARA will also facilitate research into the underlying beam dynamics and accelerator technology subsystem challenges in photoinjectors, rf acceleration, timing and synchronization, beam diagnostics, accelerator controls, and feedback processes. The ultrabright beam produced D. ANGAL-KALININ et al.
PHYS. REV. ACCEL. BEAMS 23, 044801 (2020) 044801-2 by CLARA will also be used to test new ideas in a wide range of areas such as cancer treatment and novel ideas to accelerate and deflect electron beams as well as development of state-of-the-art diagnostics by industry and academic users. The full CLARA design comprises a normal conducting S-band photoinjector, a 400 Hz, 50 MeV booster and buncher, and three 100 Hz S-band linacs, a dedicated lowenergy experimental beam line for users merging with VELA, a full energy beam exploitation (FEBE) beam line, and an FEL test area. A schematic layout of CLARA is shown in Fig. 1. CLARA is designed to test various novel FEL schemes that require different beam modes varying from ultrashort, very high current bunches (40 fs FWHM bunch length and 1 kA peak current) for a single-spike selfamplified spontaneous emission (SASE) FEL to relatively long bunches (1.8 ps FWHM bunch length and 125 A peak current) for seeded FEL use. Longitudinal compression will be provided either through magnetic compression (with a variable-angle chicane), through velocity bunching, or through a combination of these two methods. An X-band cavity (at the fourth harmonic of the accelerating structures) will be used for linearizing the longitudinal phase space. Microbunching studies carried out [16] indicate that a laser heater may not be required, but a space has been reserved in the layout should it be necessary to incorporate this as a result of future upgrades.
A 2.5-cell 10 Hz repetition rate S-band photoinjector used on the VELA line from 2013 to 2015 [6,17] is at present used as an injector for the CLARA front end (FE). A CLARA 400 Hz photoinjector is currently installed on the VELA beam line. It is planned to use the photoinjector at this location for beam commissioning, as this beam line incorporates a transverse deflecting cavity (TDC) with a dispersive beam line, allowing for full longitudinal and transverse (6D) phase space characterisation. VELA and CLARA are installed in the same accelerator hall and share the same rf and laser infrastructure for both photoinjectors. Once commissioned and characterized with different photocathodes, the 10 and 400 Hz photoinjectors will be swapped to meet the specified CLARA design repetition rate of 100 Hz. In order to improve the operational performance of CLARA for 2020 and later runs, the 10 Hz photoinjector has been upgraded for operation with an interchangeable photocathode compatible with those designed for use on the new 400 Hz photoinjector.
During 2016 and 2017, the CLARA FE was installed in the accelerator hall. The schematic of the CLARA FE with the existing VELA line is shown in Fig. 2. First commissioning of the CLARA FE was carried out in 2018, and the facility was made available for user experiments from November 2018 until the end of April 2019. An experimental commissioning program was carried out, aiming to characterize and optimize the technical systems in terms of the quality of the electron bunches produced and to provide a first set of measurements of the electron beam properties. This was achieved by tuning the beam optics, rf parameters in the photoinjector and linac, and the photoinjector laser. Since much of the user experimental program required transport and optimization of electron bunches in the user area on the VELA line (see Sec. II B), it was necessary to preserve the quality of the beam as much as possible over this distance.
This article is laid out as follows: In Sec. II, the layout of the machine, including a user area for beam exploitation, is described; Sec. III presents beam dynamics simulations from the CLARA photoinjector to the end of the VELA user line; the accelerator technical systems are described in Sec. IV; machine and software development and commissioning results are presented in Sec. V; in Sec. VI, we describe planned upgrades to the machine in preparation for the next commissioning and user exploitation runs; and, finally, a summary is presented in Sec. VII.

II. LAYOUT AND BEAM SPECIFICATIONS
In this section, we describe the layout of the CLARA FE and the planned full CLARA facility. Merging into the CLARA FE is the VELA beam line, at the end of which are two experimental user areas. The design and measured beam properties at two locations in this beam line are also presented.

A. CLARA front end and VELA line
The CLARA FE consists of an S-band rf photoinjector, a 2-m-long S-band linac, a dedicated collimator, quadrupoles, a spectrometer dipole, and diagnostics devices-including screens and cameras, beam position monitors (BPMs), and a wall current monitor (WCM) for charge measurements. An S bend incorporating a spectrometer dipole, a quadrupole triplet, and a lozenge dipole that provides achromatic transport [18] to deliver a high-energy beam from the CLARA FE to the existing VELA beam line as shown in Fig. 2. The spectrometer dipole deflects the beam to the VELA spectrometer beam line, equipped with a beam viewer and Faraday cup (FC) for momentum, momentum spread, and charge measurements. The straight-on CLARA line transports the beam to a temporary FC, which can be removed when this location is required for user experiments.
The 10 Hz rf photoinjector [19], earlier used on VELA, is currently installed on the CLARA beam line. With this photoinjector and linac, the FE of CLARA has demonstrated beam momentum up to 50 MeV=c. However, due to limitations in the linac waveguide (see Sec. IV B 5 for more details), the linac is currently operated at a reduced gradient, delivering a maximum beam momentum of 40 MeV=c at the end of the CLARA FE straight-on line and to beam area 1 (BA1), one of the experimental areas. Beam momentum is currently restricted to 25 MeV=c in beam area 2 (BA2) due to specifications of dipole magnets on this beam line.
Once the 400 Hz rf photoinjector is commissioned and characterized using different photocathodes on the VELA beam line, the photoinjectors will be swapped, enabling CLARA operation at 100 Hz according to the design specification. The VELA beam line will thus maintain the capability of delivering low-momentum bunches (less than 5 MeV=c) as may be desired for certain applications. A summary of the design and measured beam parameters in the CLARA FE and at the BA1 interaction point is given in Table I. Note that not all combinations of the above parameters are achievable simultaneously (e.g., short bunch lengths result in a larger momentum spread).

B. Beam area 1
Experimental area BA1 has a dedicated beam line for user experiments with a large (2.3-m-long), easily accessible vacuum chamber and a set of standard diagnostics [including energy spectrometer, yttrium-aluminum-garnet (YAG) screens, and beam position monitors]; see the schematic in Fig. 3. The beam line is designed to accept electron beams with energies of up to approximately 50 MeV. The vacuum chamber is equipped with further YAG screens on motorized translation stages and a multiaxis in-vacuum motorized support system for user devices at the interaction point (IP). The layout is fully reconfigurable in order to optimize for a particular experiment and allows for flexibility to add additional components, e.g., beam collimators, coherent transition radiation (CTR) targets, etc. A number of user experiments require accurate characterization of generated CTR or coherent Cherenkov radiation in the terahertz range. This is accomplished with a Martin-Puplett interferometer positioned outside the chamber. The radiation from terahertz sources is collected and collimated with an off-axis parabolic mirror and transported out through a z-cut quartz window. The interferometer is removable to provide space for experiments not requiring terahertz measurements.
Many user experiments in BA1 require the smallest transverse beam size achievable at the IP (<100 μm rms) and the shortest subpicosecond bunch length as a baseline machine setup. Further flexibility is required in terms of the bunch charge (from ≈250 pC down to a few tens of pC), bunch length (from subpicosecond to a few picoseconds), and the sign of the energy chirp (on either the rising or falling side of the rf waveform). A generic baseline machine setup was developed that satisfied the variety of requirements with only minor adjustments in machine settings. This was achieved by (i) keeping the rf photoinjector gradient and off-crest phase constant resulting in a fixed beam momentum of 4.4 MeV=c at the photoinjector exit, (ii) varying the bunch length, and bunch chirp, with the linac off-crest phase but keeping the beam momentum of 35.5 MeV=c constant by adjusting the linac gradient at each phase, and (iii) adjusting beam optics, if necessary, with BA1 magnets only.
Setting transverse beam dynamics is relatively straightforward, resulting in no-loss beam transport to BA1 and transverse beam sizes of 70-100 μm rms at the IP (with a potential of further improvement with improved quality of the electron beam). Special care was taken to ensure minimization of the β x optical function at the position of the energy spectrometer screen resulting in an estimated energy resolution of better than 50 keV.

III. SIMULATIONS OF CLARA FE AND CLARA TO VELA
Since the user program for the CLARA FE required a wide range of beam properties in terms of the transverse beam size, bunch length, momentum, and momentum spread, a simulation program has been underway to optimize the beam properties. A PYTHON-based simulation framework has been developed to interleave a number of tracking codes and to allow for scans over various machine parameters. In this section, the impact of the requirements of the full CLARA design and the current CLARA FE experiments on the simulation program are described, and some examples of simulated beam properties at two locations are given.

A. Beam dynamics with 10 Hz photoinjector and linac
Many applications of CLARA, in particular, investigations of new FEL schemes, require electron bunches of charge up to 250 pC, with lengths ranging from ≈100 fs to picosecond scale. To provide this wide range of bunch lengths at a high bunch charge, the initial design of the CLARA FE was specified so that bunch compression could be achieved via both magnetic compression at a high beam energy and velocity bunching at low and intermediate energies to suit various machine operational modes. In order to achieve kA-level peak currents for, e.g., singlespike SASE FEL operation, the CLARA FE was optimized around the velocity bunching scheme [20,21]. This scheme utilizes the first linac operating at the zero-crossing phase to impart a time-velocity correlation along the bunch. The bunch then compresses in the following drift space. Velocity bunching can be carried out only in the first CLARA linac, as the bunch from the photoinjector is not yet ultrarelativistic. The length of the linac was set at 2 m to maximize the amount of compression that could be achieved-the bunch does not remain at the zero-crossing phase due to phase slippage and, thus, gains energy. A longer linac section thus brings the bunch into the ultrarelativistic regime where velocity bunching cannot occur and does not provide additional bunching (see Fig. 4). The second linac was then placed at the position where the bunch length is at a minimum to rapidly accelerate the beam and "capture" the short bunch length. Since linac 2 will not be installed until CLARA phase 2, the FE can use velocity bunching only when an experimental station is placed at the bunch length waist. Simulations have shown kA-peak currents can be achieved from a 100 pC beam which produced single-spike SASE output [22]. An example of an ASTRA [23] simulation of the bunching process in the injector linac for different linac lengths is shown in Fig. 4. Solenoids are required around the linac to control the transverse beam size during the velocity bunching. These solenoids are not required for the standard acceleration mode if the beam is properly matched into the linac. Two 1-m-long solenoids provided to STFC by PSI, Switzerland, are placed around the injector linac.
To transport the higher-momentum (up to 55 MeV=c) beam from the exit of the CLARA linac 1 into VELA, an S bend was designed to bridge the parallel CLARA and VELA lines. The main constraint was the short 1.2 m distance between the two beam lines. The S bend consists of a 45°dipole, a symmetric quadrupole triplet, and a lozenge dipole. The first dipole is sector type with a zero edge angle on entrance and exit. It has been specified to operate up to 55 MeV=c, which will allow characterization of the highest-momentum beam possible from linac 1 in the spectrometer line. The quadrupole triplet is designed to make the system achromatic in the VELA line. The lozenge dipole-which can provide a bending angle of 45°replaces the previous VELA spectrometer dipole. This design allows the CLARA beam to be transported into the FC on the VELA spectrometer line or used to direct the beam into the main VELA line for transport to the two beam user areas. The lozenge dipole is designed such that the beam experiences a zero edge angle at all entrances and exits. This is important, because the restricted geometry implies strong focusing to meet the achromatic condition. A consequence of this is that a lack of space precludes the correction of any further vertical focusing caused by nonzero edges. The beam from linac 1 to the VELA line accumulates a first-order momentum compaction (R 56 ) of −78 mm and a second-order momentum compaction (T 566 ) of −2.794 m. In order to provide matching into the S bend, four quadrupoles are located between the linac and the bend. These were initially located in order to keep space for the VELA TDC to be moved here to allow longitudinal beam characterization of the CLARA FE. However, this move has not occurred, and a variable collimator was installed in its place to block some of the dark current [24].

B. Cathode to BA1 simulations
Simulations of the CLARA FE lattice have been performed in a variety of codes and utilizing a PYTHON-based framework to manage the interface between different codes and different sections of the machine. The framework consists of a lattice definition and a simulations definition file. Switching between codes can be toggled on a sectionby-section basis, and we utilize a HDF5-based [25] global file format for interchanging data. The framework also extracts beam distributions at all relevant diagnostic elements and automatically labels the data in a consistent manner. Historically, the design of the photoinjector and linac sections has been performed using ASTRA. We use a 1D rf field map for the photoinjector and linac structure, taking advantage of the built-in traveling wave linac model in ASTRA. Linac wakefields are included on a cell-by-cell basis. Extensive comparison studies were performed with GPT [26] to ensure consistency of output and to quantify, optimize, and find convergence with the space-charge algorithms in both codes. For the postlinac beam line, including the compression S bend, we utilize a variety of codes, depending on the requirements. Our base code remains ASTRA, but qualitative results can be generated using ELEGANT [27], which is significantly faster than ASTRA but does not include transverse space-charge effects. Coherent synchrotron radiation (CSR) effects are included in ELEGANT (using a 1D model [28]) and GPT (using a 2.5D model) [29,30] but not in ASTRA.
Nominal simulation parameters for the photoinjector are shown in Table II. In general, the photoinjector rf phase and amplitude are kept constant, while the linac phase is varied to modify the bunch length after the compressing S bend. The beam momentum is kept constant at 35.5 MeV=c by varying the linac amplitude. The machine is matched transversely to achieve symmetric beta functions in the S bend and a reasonably constrained beam size in the main VELA beam line, as shown in Fig. 5. Ideally, VELA would be matched with a Focussing-Drift-Focussing-Drift (FODO) structure, but, to achieve a tight transverse beam focus in the BA1 interaction point, we must moderate the symmetry in this section. The horizontal transverse emittance in the BA1 is dominated by the higher-order chromatic components in the S bend when we have a large longitudinal chirp for bunch compression. In Fig. 6, we show the normalized transverse emittances with a linac phase of −10°, at maximum compression, along with the bunch energy spread and the bunch length. The horizontal emittance increases by a factor of 3 in the compressing S bend, with no increase in the vertical plane, as expected. The highly compressed bunch then undergoes a longitudinal space-charge blowup in the long VELA-BA1 beam line, also increasing by approximately 300%.
Simulations have concentrated on optimizing and modeling the longitudinal properties of the bunch under maximum compression in the CLARA S bend and subsequent transport of this beam to the BA1 IP. In Fig. 7, we show the relative longitudinal phase space at various offcrest linac 1 phases-from −15°overcompressed to −5°u ndercompressed and around maximum compression at −10°-for the three tracking codes (ASTRA, ELEGANT, and GPT) utilizing 2 18 (262,144) particles and with identical input beams derived from an ASTRA simulation of the CLARA 10 Hz photoinjector at þ5°from the phase of maximum energy gain. Excluding CSR effects, we see very good agreement between all three codes, as expected.
However, at maximum compression we must significantly increase the longitudinal space-charge meshing in ASTRA to accurately simulate the space-charge-induced energyspread increase. This is not an issue in either ELEGANT or GPT using the spacecharge3dmesh algorithm. Other spacecharge algorithms in GPT do exhibit similar behavior to that seen using ASTRA. In Fig. 8, we repeat the same analysis, but including CSR effects in both ELEGANT and GPT. While ELEGANT shows a minimal effect of CSR on the longitudinal bunch properties (for a wide range of CSR parameters), we do see a significant effect in GPT, which is currently under investigation.

C. Cathode to CLARA FE straight-on simulations
The electron beam can also be provided for user experiments in the straight-on location of the CLARA FE, without longitudinal compression in the S bend. In Fig. 9(a), we show the properties of an electron bunch of 70 pC charge with minimal momentum spread, with the linac operating to compensate the longitudinal chirp from the gun. An alternative tuning of the FE, shown in Fig. 9(b), utilizes linac 1 in a velocity bunching scheme, which allows for longitudinal bunch lengths down to ≈100 fs, but with a reduced beam momentum of approximately half the nominal value. In this case, the linac parameters were optimized such that the minimum bunch length is reached at the CLARA FE straight-on interaction point, at around 7 m from the cathode. Figure 9(c) shows the transverse beam properties for both longitudinal modes.

D. Parameter scans
The CLARA to BA1 ASTRA model [23] has been parameterized to 36 variable inputs, read from the command line or via a PYTHON-based Graphical User Interface (GUI). The 36 parameters include physical quantities such as the laser dimensions, cavity phases and gradients, and magnet setting, along with simulation parameters such as numbers of particles and the inclusion, or otherwise, of space-charge forces. For the purposes of optimizing the model, the beam line can be run piecewise and subdivided into as many sections as required. Physical input parameters are mapped to the Experimental Physics and Industrial Control System (EPICS) control system, modulo conversion factors, and saved routinely during machine running. Interaction between the script and control system will be finalized in the next commissioning period, when it will be possible to simulate in near-real time with a low number of macroparticles (1000), so as determine the trends in the local parameter space. In the first instance, we believe it will be useful to have a model which is qualitatively, if not quantitatively, valid and where further refinement of the model can be performed offline.
From an initial set of parameters, it is possible to make a comparative scan to find optimum beam line settings. This scan should not involve more than a couple of parameters at a time, in order to keep the results manageable. Furthermore, unlike conventional optimizers, this method ensures that the final parameters, arrived at after scanning, are stable. This gives an improved understanding for what happens operationally, together with the ability to make much more specific predictions.
An additional suite of scripts has also been created to aid in data processing from multiple scans. The first main postprocessing script compares values of the various beam characteristics (beam size, bunch length, emittance, beam divergence, and energy spread), as a function of the scan number. If the scan is performed in a consistent and systematic manner, plots can be made of certain parameters, and, provided not too many parameters are scanned at once, an optimal setup may be identified. This is illustrated in Fig. 10, where the combined strength of the bucking coil and emittance compensation solenoid are varied together, from 0.2 to 0.25T in steps of 0.01T, as is the off-crest phase in the main linac which takes the values −5°, 0°, and 5°, respectively.
The second main postprocessing script compares two simulation runs and gives plots of physical parameters at all screens and BPMs, as well as unobservable quantities such as emittance, bunch length, and energy spread along with the full transverse and longitudinal phase spaces. Furthermore, every parameter run is indexed so that runs are not repeated, minimizing computation time-the user can then select two runs with similar properties in order to compare them in more detail.
All scripts originated in a similar approach as was used in the modeling of the ALICE injector at Daresbury Laboratory [31], which worked extremely well in practice.

IV. ACCELERATOR TECHNICAL SYSTEMS
In this section, we describe the main technical systems of the CLARA FE, including the photoinjectors and linac, photocathodes, rf and laser systems, electron beam diagnostics, and control systems. Measurements and results from the recent commissioning period are presented, with some lessons learned for future development.

A. Electron source
According to original design specifications, the CLARA injector is required to deliver ultrashort electron bunches (down to 40 fs FWHM at 20 pC bunch charge) and longer bunches (between 0.5 and 1.8 ps with a charge of 250 pC) at a repetition rate of 100 Hz with a transverse normalized emittance of less than 1 μm rad. To meet this challenge, a 1.5-cell S-band photoinjector with a field of up to 120 MV=m and coaxial coupling has been designed and constructed. To deliver ultrashort bunches at a low charge, Cu photocathodes have been chosen. While this photoinjector is under commissioning on the VELA line, the existing low-repetition-rate 10 Hz photoinjector previously used at the VELA facility is currently being used as the electron source of the CLARA FE.

Low-repetition-rate 10 Hz photoinjector
The 10 Hz photoinjector was originally designed for the Advanced Laser-Plasma High-energy Accelerators towards X-rays (ALPHA-X) project [19] and is provided to STFC from the University of Strathclyde. This photoinjector is a 2.5-cell normal conducting S-band rf cavity with a detachable back wall, which serves as the photocathode. The cavity is fed through a coaxial coupler connected to a doorknob transformer with a single waveguide input. The temperature of the cavity is maintained at 30°C with a water cooling jacket, which allows the photoinjector to operate with an average rf power of 300 W. Temperature stability at a level of 85 mK peak to peak and 16 mK rms is maintained with an efficient water chiller with a selfcorrecting Proportional-Integral-Derivative (PID) controller loop. The electromagnetic design of the cavity and simulated distribution of the electric field are shown in Fig. 11; a picture of the photoinjector is shown in Fig. 12.
The cavity is fed with a Thales klystron with a maximum power of a 10 MW. Because of losses in the rf network, the power delivered to the cavity is limited to around 6 MW as measured with a directional coupler installed at the front of the rf window. This, in combination with a lower than expected quality factor, does not allow fields higher than 70 MV=m to be reached, which limits the beam momentum to 5.0 MeV=c (see Sec. V E for more details). An upgrade of the photoinjector klystron is under consideration in order to achieve 100 MV=m maximum field in the cavity.
The photoinjector is operated with a copper photocathode illuminated by the third harmonic of a Ti:sapphire laser (266 nm). The photocathode is a polycrystalline, oxygenfree, copper disk, diamond turned to 20 nm roughness. It forms an integral part of the 2.5-cell photoinjector cavity and is the back wall of the first half cell. More details on photocathode preparation and experience are described in Sec. IVA 3.
The beam emitted by the photoinjector is focused with a large aperture solenoid that surrounds the cavity. The solenoid provides a magnetic field of up to 0.4 T. The field of the main solenoid is compensated in the photocathode emission plane with a compact low-power-consuming bucking coil, which is installed behind the photocathode. Unfortunately, the iron yoke of the bucking coil significantly concentrates the field of the main solenoid, thus providing a strong radial magnetic field.
The photoinjector is pumped down and baked to 150°C to achieve operational pressure in the region of low 10 −9 mbar, in order to provide a long operational lifetime of metal photocathodes. The emission area of the photocathode plate is locally baked to a temperature of 250°C. Vacuum in the photoinjector is maintained with an ion pump connected to the waveguide slot. Table III summarizes the design, measured, and operational parameters of the photoinjector.
Although the pressure in the photoinjector is maintained at a very low level, the bunch charge delivered by the photoinjector has been seen to reduce over the course of operation. One of the reasons for this might be deterioration of the photocathode quantum efficiency (QE), which eventually would require the photocathode to be replaced. The current procedure of the replacement requires ventilation of the photoinjector, installation of a fresh photocathode, bakeout of the photoinjector and the photocathode, and high-power rf conditioning of the entire cavity, which is highly time consuming. This process results in CLARA downtime varying from 2 to 4 wk depending on the progress in the rf conditioning. In order to reduce the downtime, it has been decided to upgrade the 10 Hz photoinjector for operation with interchangeable photocathodes without breaking the vacuum. To benefit from the compatibility with the newly built 400 Hz photoinjector, which is under commissioning, and with photocathodes manufactured and used elsewhere, the photocathode design and transport system have been made compatible with the ones used at DESY, Lawrence Berkeley National Laboratory (LBNL), and Fermi National Accelerator Laboratory (FNAL). The current photoinjector design allows the upgrade without severe intervention and modification of the cavity. In order to improve the quality of the emitted beam, the existing bucking coil has been replaced with a high-aperture bucking solenoid which does not disturb the radial magnetic field of the main solenoid in the emitting area of the photocathode. The design of the upgrade is shown in Figs. 13(a) and 13(b). The manufacturing and low-power commissioning of the 10 Hz photoinjector upgrade is complete, and the photoinjector will be installed in the CLARA beam line before machine operation restarts.

High-repetition-rate 400 Hz photoinjector
The photoinjector for CLARA was developed at STFC Daresbury Laboratory in collaboration with the University of Lancaster and the Institute for Nuclear Research RAS, Moscow. The specification for the photoinjector can be seen in Table IV, and a drawing of the cavity design is shown in Fig. 14. For delivering a high-brightness beam for CLARA FEL experiments, the required cathode field is 120 MV=m at a repetition rate of 100 Hz. The cathode field is lowered for the 400 Hz mode to 100 MV=m. The photoinjector must therefore have high-power handling capabilities of up to 6.8 kW.
A choice of 1.5-cell design for this photoinjector minimizes the power requirements for the cavity, and the beam experiences less phase slippage, and has, therefore, been chosen as the baseline design over a 2.5-cell cavity. The length of the first cell was determined by Superfish [33] and ASTRA simulation. A first cell length of half of the full cell length was found to give an acceptable transverse emittance while minimizing bunch length and longitudinal emittance. The curvature in the longitudinal phase space was seen to increase for longer first cell lengths [34].
The rest of the cavity geometry was optimized using a Mathematica [35] front-end simplex optimizer for a Superfish model. The iris radius and shape and cell edge curvature were chosen to maximize the R/Q, ensure a mode separation of greater than 20 MHz, and minimize the iris surface electric field and cell equator magnetic field.
The cavity is fed by a new coupler design: the H coupler [36]. This consists of a coaxial coupler with a doorknob transition to a dual-feed rf input with phase adjustment of each feed to suppress any dipole component in the coaxial coupler line, thereby eliminating any transverse kick to the beam as it exits the full cell. The cavity was designed to have nearly matched coupling, as the power available from the klystron is 10 MW. The beam focusing is provided with a 0.4 T main solenoid and a bucking coil.
The electrons are produced from interchangeable photocathodes illuminated with a UV laser. The photocathode plug design and vacuum transport system, shown in Fig. 15, is compatible with those used at DESY, Lawrence Berkeley National Laboratory, and FNAL, which allows for collaboration and sharing of photocathodes for testing. An on-site photocathode preparation and characterization facility is now under commissioning.  To achieve the stringent amplitude and phase stability requirements, an rf probe is required for feed-forward correction. This was placed inside the full cell, 3 mm longitudinally from the equator. In order to minimize the localized heating caused by the rf probe from strong wall currents, its aperture was rounded by 2 mm in diameter. In order to preserve symmetry, a dimple was added on the opposite side of the cavity. A depth of 1 mm is sufficient to ensure that the frequency and field flatness are unaffected. A robust thermostabilization system is required to meet the stability requirement. The system incorporates nine cooling channels in the copper cavity structure, the locations of which are optimized for heat load distribution and to maximize cooling of the rf probe region. The cooling design of the cavity was performed using magnetic field distribution, calculated with Microwave Studio CST [32] in combination with the ANSYS CFX code [37] for fluid calculations and ANSYS Workbench for estimation of displacements, frequency shift, and stresses due to rf heating. The simulated temperature profile at the photoinjector cavity surface can be seen in Fig. 16, with the highest temperature rise of 14°C at the probe position and a maximum of 10°C elsewhere. The channels are fed by an advanced high-resolution control system developed at Daresbury.
The cavity was manufactured at Research Instruments GmbH [38]. The water channels prohibit the use of tuning studs, so a novel procedure was developed to tune the field flatness and frequency before brazing [34]. The cavity was tuned by taking prebraze clamped low-power rf measurements and using the data to trim the cavity cells to the optimum length [39]. The trimming was performed over three steps covering 1=3 of the required frequency correction each, with rf and Coordinate Measuring Machine (CMM) dimensional measurements taken after each step. This allowed testing of the method so that corrections could be made if the effect of the trimming was not as expected.
The frequency at each tuning step can be seen in Fig. 17. The field flatness, defined as a ratio of amplitude of the electric field in cell 2 to the amplitude of the electric field in cell 1, was determined using a bead-pull technique. A 0.2 mm nylon string was strung through the center axis of the cavity, through a 0.5 mm diameter hole in the cathode. On the string was a small cylindrical dielectric bead approximately 2 mm in length and 1 mm in diameter. The bead was pulled through the cavity and the change in the reflected phase measured. The half-cell data were fitted with a squared cosine function to remove the effect of the bead image charge on the cathode.
Low-power tests after brazing have confirmed the cavity resonant frequency of 2.9985 GHz at 48°C operating temperature with a field flatness of 98 AE 1%. This can be seen in Fig. 18. The field flatness, defined as a ratio of amplitude of the electric field in cell 2 to the amplitude of the electric field in cell 1, was determined using a bead-pull technique. A 0.2 mm nylon string was strung through the center axis of the cavity, through a 0.5 mm diameter hole in the cathode. On the string was a small cylindrical dielectric bead approximately 2 mm in length and 1 mm in diameter. The bead was pulled through the cavity and the change in the reflected phase measured. The half-cell data were fitted with a squared cosine function to remove the effect of the bead image charge on the cathode. The surface finish was carefully specified in order to achieve a high-quality factor Q 0 . This was measured to be 13350 AE 280 with a Mo photocathode plug, which increased further to 14230 AE 120 using a Cu photocathode plug. The difference is due to the electrical contact of each material with the spring. The cavity is overcoupled by a small amount with a coupling coefficient β equalling 1.07 AE 0.008 [40]. Figure 19 shows the cavity installed on the VELA beam line, before the waveguide, cathode exchange system, and solenoids were installed.
The rf conditioning was begun at the end of 2018, but, due to a shared klystron with the operational CLARA line, time was limited. The conditioning was performed using an automatic conditioning software developed at Daresbury (described in Sec. V B) [41]. Conditioning began with the klystron rf operating at 750 ns pulse length, and the power rose steadily over 64 million pulses to 2.65 MW, with an allowed breakdown rate of 5 × 10 −6 breakdowns per pulse. This is equivalent to approximately 2.5 × 10 −5 breakdowns per pulse per meter of structure length. The scaled gradient [42] over the last 36 million pulses, along with the cumulative number of breakdowns, is shown in Fig. 20. This parameter allows for a comparison between conditioning data at varying pulse lengths and breakdown rates and is defined in Eq. (1) [42]: where E 0 is the cavity gradient, τ is the rf pulse length, and BDR is the breakdown rate. The fractured nature of the conditioning time meant that some reconditioning was required at the beginning of each shift, and for some shifts the klystron was not warm at the beginning and so took ≈40000 pulses to come back to the previous output power for the same set point. Conditioning will recommence after the 2019 shutdown.

Photocathodes
The photocathode for the 10 Hz rf photoinjector is a polycrystalline, oxygen-free, copper disk processed to produce a surface of low average roughness, which is required to minimize its contribution to the intrinsic emittance. The photocathode forms an integrated part of the 2.5-cell photoinjector cavity and is the back wall of the first half cell. Once the cathode is installed, access is available only through the 15 mm electron exit aperture. This makes it virtually impossible to process the cathode's surface in situ without contaminating the photoinjector cavity. To achieve an acceptable QE, it was therefore necessary to establish a cleaning procedure that produces a surface with a low work function, while at the same time minimizing any changes to the surface topography prior to installing the cathode into the photoinjector.
Early in the development of the VELA/CLARA accelerator, the photocathodes were prepared using diamond polishing. However, while this process was effective in reducing roughness to <100 nm, it was subsequently discovered that it led to a considerable number of diamond particles being left half-buried in the surface (see Fig. 21) [17]. Although no direct evidence was obtained to show that this was a significant problem, it was felt that the diamond occlusions could provide sites for breakdown and potentially lead to a higher dark current. Diamond turning has since been adopted as an alternative method for preparing the surface, which again results in a low surface roughness (<30 nm) but without any occlusions; this is now the default method for obtaining the desired surface finish [43].
Initially, a study was performed that identified oxygen plasma cleaning and in situ (in-vacuum) annealing to 250°C as the preferred procedure to produce a suitable low work function surface. An early photocathode prepared in this way appeared to give satisfactory QE performance FIG. 19. 400 Hz photoinjector installed on the VELA beam line before the waveguide, cathode exchange system, and solenoids were installed. (≈10 −5 ) [44]. However, at that time, very short and intense laser pulses (with a FWHM pulse length of ≈180 fs) were being used in the photoinjector, and, hence, there is a possibility that some cleaning action occurred (probably via ablation) to remove any residual oxide film left by the oxygen plasma treatment which would otherwise suppress emission. For subsequent operation periods, the laser pulse was stretched to ≈2 ps (FWHM), and under those conditions a very low QE of ≈10 −6 was measured for oxygen plasma cleaned photocathodes. At this QE level, it was impossible to obtain bunch charges of 100-250 pC that may be required for some operational modes with the laser power available. Unfortunately, it was not possible to easily revert to the shorter pulses to use the laser for photocathode cleaning, and in any case the laser-modified surface was found to be subideal as an electron source for reasons detailed further on in this section. Subsequently, a second cathode preparation study was conducted to determine a practical solution to obtain a higher QE. Argon plasma treatment has been used since then, because it leaves a thinner oxide layer which is more easily removed by the modest heat treatment (250°C baking of the photoinjector), allowing a more acceptable QE of ≈10 −5 to be obtained once again [45].
Experience with using the solid copper photocathodes has been mixed. Directly after installation and bakeout, the photocathode can usually deliver bunch charges of up to or even in excess of 250 pC, which is the highest required according to the accelerator design. However, with use, the maximum achievable bunch charge typically falls (and in some cases has been below 100 pC), which can be a problem for some modes of operation. The reason for this reduction cannot be attributed to a single cause and is most likely a combination of a reduction in laser transport performance over time (particularly the reflectivity of the final in-vacuum mirror) coupled with some reduction in the QE.
Postoperation analysis of the copper photocathodes used in early runs with the shorter laser pulse revealed features in the active region of the cathode where the laser had hit to produce the electrons (Fig. 22). These features certainly indicate an increased roughness in this region and most likely a reduction in the QE at the same time [46]. Optical interferometry measurements of the undamaged and damaged areas indicated an increase in peak-to-peak roughness from ≈20 to ≈250 nm. However, for the most recent cathode, where the longer 2 ps (FWHM) laser pulse was employed, no such features were visible to the naked eye. It is still possible that a reduction in the QE occurred as a result of either damage not visible to the eye and/or contamination of the surface during operation. To reduce the possibility of damage to both the photocathode and the laser transport optics, it would be advantageous to use a photocathode with an orders of magnitude higher QE where much less laser power would be required. Both bulk magnesium and thin film-coated copper and magnesium are under consideration to be used in the short term. In the longer term, we plan to upgrade to cesium telluride photocathodes (see Sec. VI E).

Linac
CLARA linac 1 is a 2-m-long 2π=3 phase advance traveling wave linac designed and built by Research Instruments. It is designed to operate at up to 400 Hz and has constant power dissipation along the cavity to provide a constant heat load to each cell; as such, it is neither constant gradient nor constant impedance. The design filling time of the cavity is 0.54 μs; however, due to the relatively short structure length, the time taken for each cell to fill is non-negligible in comparison to the overall filling time. For all cells to be filled entirely takes ≈0.64 μs. The operational pulse length is 0.75 μs, to give a flattop in the rf field that is robust to timing jitter. The cavity design parameters are given in Table V. The cavity is operated with phase stabilization feedforward control. A proportional integral (PI) loop in the I-tech Libera [47] software is used to control on the phase of the probe in the 58th cell. This successfully limits the slow variation of the phase in the cavity as seen in Fig. 23 and the corresponding beam momentum drift.

Transverse deflecting cavity
The TDC on the VELA line is a 9-cell standing wave S-band cavity designed to enable longitudinal bunch characterization of the photoinjectors [48]. The cavity was designed to provide 10 fs temporal resolution for the 250 MeV beam from CLARA. The cavity has shortened end cells in order to reduce the net transverse deflection seen by a low-momentum beam. This is further compensated by corrector magnets on either side of the cavity. The rf parameters of the cavity are given in Table VI, and the cavity, along with on-axis fields, can be seen in Fig. 24.
The cavity was fabricated by Research Instruments [38], and the field flatness was 85% on arrival as seen in Fig. 25. The field flatness, defined as the percentage ratio of the H field in the cell with the lowest H field to that with the highest, was measured with a bead-pull technique. A 2.15-mm-diameter metal bead was pulled through the cavity on a taught Kevlar thread. Because of operational time constraints, the cavity was not tuned. However, as the cavity is not peak-field limited (due to the lower input power required to achieve the specified resolution at lower beam momentum), the overall deflecting voltage is not affected. Simulations showed the corrector strengths needed to be rebalanced to match the field profile, with a lower-strength entrance corrector and a higher-strength exit corrector. The cavity was used to characterize the longitudinal beam characteristics of the 10 Hz photoinjector [49].   Before swapping the high-repetition-rate photoinjector from the VELA to CLARA line, the photoinjector will be fully charaterized on the VELA line using the TDC for different photocathodes. This will provide measurements of the 6D phase space of this photoinjector.

rf reference and distribution system
The master oscillator is used as the reference for the machine's rf, laser, and timing system so that synchronization can be preserved. The oscillator is located in the laser sync room and produces a 2.9985 GHz reference for the machine with a jitter performance of 1.9 fs over the frequency range of 1 kHz to 10 MHz; this is manufactured by Laurin.AG [50]. The reference is used directly by the photoinjector laser as its system clock (see Sec. IV C).
The reference is also transmitted to the rf modulator room (30 m) using the I-Tech Sync3 reference distribution system. This is a constant wave laser-based system that provides a low drift (<40 fs pp per day) and low jitter (3.8 fs rms, 10 Hz to 10 MHz) [51] clock reference for the LLRF systems for the photoinjector and linac systems. Each Sync3 has two outputs of þ15 dB m which can be used for reference clocks.

Low-level rf
Our previous experience with LLRF on VELA was with in-house developed software and the LLRF4 board; however, with the timescales of CLARA, it was necessary to purchase commercially available systems. The LLRF installed on the CLARA machine is the Libera [47] LLRF with a temperature stable up-and down-convertor front end to produce and receive signals at 2.9985 GHz from the rf system. Measurements performed using the LLRF on the photoinjector klystron with a waveguide connected to the CLARA photoinjector revealed an amplitude jitter of 0.09% and a phase jitter of 0.04° [52].

High-power rf system
The photoinjector high-power rf system consists of a Scandinova K2 10 MW modulator and a 10 MW pulsed Thales TH2157 klystron [53]. Transmission of the highpower pulsed rf is via a MEGA [54] waveguide with SF6 pressurization. A circulator from Ferrite is included at the output of the klystron.
The linac modulator is a Diversified Technologies Inc. [55] system capable of 45 MW and a Thales TH2100 pulsed klystron. The waveguide to transmit the rf power is MEGA with SF6 pressurization at 3 bar. Currently, this system is limited to 20 MW after sparking issues with the waveguide flanges and circulator. The circulator has since been removed, and operation continued satisfactorily, albeit at a lower gradient, without this device.
A TDC modulator has been built in house, with a Thales TH2056 6 MW pulsed klystron. A circulator from Ferrite [56] is installed on the output of the klystron, and a MEGA waveguide is used to transmit the rf power to the cavity.

Photoinjector and laser transport
The CLARA photoinjector laser is based on commercial Ti:sapphire technology and incorporates various developments to deliver high-quality, variable ultraviolet laser pulses to the photocathode.
The laser oscillator (Element; Newport-Spectra Physics [57]) is synchronized to the CLARA master rf clock (Femtolock; Newport-Spectra Physics [57]) at 2.9985 GHz, lasing with a fundamental repetition rate of 83.292 MHz (36th subharmonic). The residual timing jitter of the laser-rf locking has been measured as 13 fs [10 Hz-1 MHz].
The laser amplifier (Legend HE, Coherent [58]) incorporates regenerative and single-pass amplification stages to nominally deliver 6 mJ pulses at 800 nm, with a repetition rate variable between 10 and 400 Hz. The pulse duration measured postcompression is 50 fs. Conversion to the ultraviolet is made through frequency tripling in a pair of β-Barium borate (BBO) crystals, configured to deliver a maximum of 560 μJ at 266 nm. Pulses are stretched from 180 fs to a variable 2-8 ps Gaussian (FWHM) longitudinal profile using a prism-based stretcher, incorporating forward and return passes of two fused-silica prism pairs. These pulses are then incident on a motorized circular aperture that forms the object plane of a relay imaging system delivering light to the photocathode. To remove hot spots in the spatial profile during beam operation to the end of the first quarter of 2019, a vacuum spatial filter was installed prior to longitudinal shaping planned later in 2019.
Approximately 50% of the UV light generated at the source is lost in the consecutive transverse and longitudinal shaping stages, with additional losses (typically 50% for standard operations) dependent on the degree of truncation at the object plane. The relay imaging to the cathode is performed in vacuum over 16.7 m using dielectric mirrors and incorporates a demagnification of 2. The laser light is directed on to the cathode at an angle of 4°using an aluminum-coated mirror mounted upstream. This mirror is susceptible to damage due to high levels of UV energy, with the recorded reflectivity falling from 80% to 45% over 12 months of operation. This, combined with a variable vacuum transport reflectivity (decreasing with decreasing pressure) loss of 10%-20% results in typically ≈10% net transport efficiency from the UV source to the cathode. The light box mirror was replaced prior to the commencement of beam operations in late 2019.
Relay imaging results in stable transverse properties on the cathode which can be achieved without active control. The rms (100 shots) transverse laser pulse jitter (2% in both transverse dimensions) and daily drift (4%) are within specification. The rms (100 shots) laser pulse energy stability is 1.2%. Pulse energy drift is a function of the laser room temperature and has benefited from an upgrade to the environmental control which stabilizes the daily temperature variation to better than 0.1°C. Jitter in the temporal profile, including arrival time on the cathode, is the subject of ongoing investigation.
To monitor the position of the laser spot on the photocathode, a virtual cathode consisting of a luminescent screen and (optional) reticule is visualized using a network camera. Changes in the position and focus of the beam on the real cathode are matched one to one by changes on the virtual cathode. A similar system for visualizing the laser position on the CLARA light box mirror has recently been implemented and was available for operations beginning in late 2019.

Terawatt laser and transport
CLARA benefits from access to a commercial terawattlevel Ti:sapphire laser system, housed in the Lasers, Terahertz and Terawatt Experiments (LATTE) Laboratory immediately adjacent to the CLARA beam line. While not formally part of the CLARA facility, access to the laser system for combined electron beam-laser experimentation can be made through a collaborative agreement with ASTeC. The system at delivery was capable of delivering 860 mJ, 50 fs pulses following compression in a vacuum; it is now nominally operated at a lower energy (≈200 mJ) due to degradation of components over a decade of operation. A program of upgrades to restore the pulse energy and provide advanced control elements is currently underway. The laser oscillator is synchronized (Synchrolock-AP, Coherent) to the photoinjector laser oscillator fundamental rf clock at 83.292 MHz to within 104 fs (upper-bound, 10 Hz-1 kHz locking bandwidth). Coarse control of the relative timing of the laser with respect to the electron beam is made through the CLARA master timing system; fine control (≈300 fs step size) is achieved using a phase shifter on the clock reference input.
Laser light is delivered to CLARA BA1 in a vacuum. An off-axis parabola (1780 mm effective focal length) and holed (5 mm) turning mirror can be used to introduce focused laser light parallel to the electron beam axis, upstream of the multipurpose vacuum experiment chamber. Alternatively, laser light at lower pulse energies can be brought back into air, onto a breadboard parallel to the chamber, to allow manipulation prior to interaction with the electron beam.

Bunch charge monitors
The CLARA FE and VELA beam lines are equipped with three types of bunch charge monitors. These are (i) two WCMs of FNAL and STFC Daresbury design [59] installed at the exit of corresponding rf photoinjectors, (ii) two "in flange" commercial integrating current transformers (ICTs) located in the VELA beam line, and (iii) several FCs. The FCs are installed at the end of the CLARA FE line, in the VELA spectrometer line, and at end of the BA1 and BA2 beam lines. These FCs also serve as full energy beam dumps.
The FCs together with corresponding electronics are calibrated directly using a specially designed pulse source that mimics the electron bunch charge. The WCMs and ICTs have been cross-calibrated against FCs using an actual electron beam and ensuring no beam losses between pairs of monitors (see Fig. 26). The laser energy was inferred via an energy meter after transport through a 90∶10 beam splitter. As the laser energy grows beyond around 60 μJ, the increase in the bunch charge with the laser energy becomes slightly nonlinear, indicating that the emission of electrons from the photocathode is limited by space charge. Further investigations are needed to characterize this regime in full. Across the whole range of bunch charges, the difference in readings from all monitors does not exceed 5%.

Beam position monitors
For routine bunch trajectory tracing, ten circular threequarter wavelength stripline BPM pickups exist between the CLARA FE injector and the end of BA1 (see Fig. 2). The BPM pickups are instrumented by the single-bunch or turn-by-turn electronics originally developed and built for the button-type BPM-equipped electron machine for many applications (EMMA) [60,61]. The pickup vessels themselves incorporate survey monuments and are installed and aligned with respect to the measured quadrupole magnet axes. The residual zero offset (including any BPM electronics zero offset) is expected to be within 200 μm. It is required that the BPMs have an operable bunch charge range from 250 pC down to several pC. At the lower range of charge, thermal noise will limit stripline BPM accuracy to ≈30 μm, while a resolution of ≈20 μm is expected for the higher-charge modes.
The existing BPMs process the multiplexed signals from the front end electronics, taking the envelope of them and then sampling them with analog-to-digital converters (ADCs)-ADC1 and ADC2. To get the maximum signal from the envelopes, the sample clocks for ADC1 and 2 are set with the ADC clock block and two digital delay parameters. This circuit was designed for multibunch machines (ALICE and EMMA) [61,62], and, in order to use it on CLARA (single bunch, variable charge), attenuators have to be used. This has been seen to affect the clock signal given to ADC1 and 2, necessitating recalibration for different attenuations. Within a calibration, a variation in the charge causes a variation in clocks and, therefore, an error in the position estimate. By sampling the output of the horizontal or vertical signals (or by replacing them with similar electronics) and reconstructing the signal, we avoid the need to reconstruct and tune the sample clock and can cope with various gain settings.
The BPM system requires calibration in order to minimize noise at the individual pickups and to ensure that the cable lengths from the BPM to the digitizers are similar, such that the beam signal sampled at the BPM is optimal for all four pickups. In addition to this, there is a limited range over which the ADCs-which take the direct signal from the BPMs and are processed by the control system-have a linear response. Beyond these limits (AE1 V), the position measurements from the BPMs may give spurious readings. The calibration of these BPMs has now been automated such that their position readings are reliable over a wide range of bunch charges (from 20 to 250 pC).
Nevertheless, when the beam position is at a large deviation from the nominal axis (greater than 10 mm), a BPM pickup can still saturate, resulting in unreliable position readings. This is of particular importance in dispersive regions, for example, in the S bend that transports beam from CLARA to VELA (C2V). Experiments performed with a beam, and comparing the BPM readings with camera images, have confirmed the linear response range of the BPMs. As an example, see Fig. 27 for horizontal position measurements from this BPM and camera as a function of the dipole current. For lower dipole currents (below 65 A), the beam was lost between the dipole and the camera, and so the BPM reading was unreliable. This could be confirmed by monitoring the raw signals from both horizontal pickups, one of which was saturated. As the dipole current is increased, the beam began to be visible on the camera, and the BPM and camera readings are more in agreement. Using the Controls Abstraction to Accelerator Physics (CATAP) software suite (see below, Sec. VA 3), BPM data can be tagged according to their reliability, and users can discard readings which are known to be unreliable. A number of conditions must be fulfilled for a BPM measurement to be considered reliable in addition to the raw voltage readings, including timing settings and shot update frequency.
The BPM module within CATAP can also be used to measure the bunch charge at each of the BPMs, showing good agreement with the charge diagnostic devices (see Fig. 28). Provided that the BPM is calibrated correctly for a given bunch charge, the charge reading at the BPM can be calculated simply as the sum of the voltages on the four pickups, multiplied by a calibration factor. The error on the charge measurements from the BPMs is larger than that from the dedicated charge diagnostics as the bunch charge increases, possibly due to an incorrect setting of the attenuation, but, due to the low number of noninvasive charge diagnostics between the CLARA FE and BA1, the bunch charge readings from BPMs proved very useful in optimizing beam transport through CLARA and VELA. From the measurements at the maximum laser pulse energy in Fig. 28, it appears that the regime of space-chargelimited emission was approaching, but more data at a larger pulse energy would be needed in order to characterize this regime in more detail.

Diagnostic screens
The YAG screens in VELA utilize a simple design comprising a 45°YAG facilitating a 90°camera view. This system has proved practical but has a very limited depth of field (therefore having only a small usable field of view) and resolution. Additionally, they frequently require physical intervention to refocus, making it more difficult to compare results recorded at different times. The thickness of the YAG also causes a blurring in the direction of the electron beam, making precise measurements challenging.
The CLARA design [63] improves on these characteristics in a number of ways. First, the cameras and optics are rail-mounted in an aluminum enclosure, providing flexibility in design as well as set-and-forget robustness. Second, the ITO-coated, 200-μm-thick YAG is mounted orthogonally to the beam with a 45°metal-coated-silicon mirror mounted behind. This removes the smearing effect along the beam direction and allows for a large field of view without the requirement for large and complex Scheimpflug designs [64]. Calculations predict that the potential for Optical Transition Radiation (OTR) emission from the mirrors will not be an issue, but investigations are underway to implement a temporal gating scheme to separate the slow Ce:YAG fluorescence decay and any instantaneous Optical Transition Radiation emission if it is present. Third, the imaging system consists of a pair of fixed achromatic lenses providing stability, high resolution, and no discernible distortions. Also, a calibration and focusing grid is mounted parallel to the YAGs, allowing focus confirmation and distortion calibration by simply moving the YAG screen assembly along. A similar system has been demonstrated to have excellent resolution not limited by "smearing" effects common in 45°YAG arrangements [65].
The optical point spread function in the central region is ∼13 μm FWHM in the plane of the YAG, as measured experimentally, exceeding the desired 20 μm rms specification (and far exceeding the essential 60 μm value). The depth of field extends over a millimeter scale thanks to the small numerical aperture of the system and was verified on a test bed by translating a 5 μm pinhole through the screen plane. As previously stated, it is expected that the blurring associated with scattering, viewing angle, and reflections with the YAG will be insignificant. At present, sufficiently small electron beams have not been available to test this. The field of view is >30 mm, covering the entire YAG area and approximately equal to the vacuum pipe in which the electron beam resides.
In order to achieve this combination of field of view, resolution, and high repetition rates (100 Hz full frame, 400 Hz cropped to 1=4 image height), a state-of-the-art camera system was needed-a PCO.edge5.5 sCMOS with cameralink high speed (HS) interface [66]. These cameras have a large 2560 × 2160 array of 6.5 μm pixels and are fiber linked to control and acquisition computers in a remote rack room. EPICS integration has been achieved by porting the areaDetector [67] driver pcocam2 [68] from Diamond Light Source to work with the latest PCO Software Development Kit (SDK) for Linux and now operates routinely. Example images captured by this system can be seen in Sec. V G.
The PCO.edge 5.5 cameras are 16 bit, with a dynamic range of 27000∶1. In situations where this, in combination with fixed ND filters, is not adequate for a station's imaging tasks, a continuously variable attenuator based on crossed polarizers has been designed and tested. This system provides an experimentally verified variable attenuation from ∼1=2 (both polarizers parallel) down to <1=20000 (polarizers orthogonal).

E. Timing and synchronization
Since CLARA is a pulsed machine, a stable and reliable timing system tightly integrated with the control system is essential for subsystem synchronization, triggering, and also beam synchronous data acquisition. The timing system enables reliable and adaptable triggering to support flexible beam rates and also allows users to benefit from custom triggering particular to their experiment. The CLARA timing system is realized using a Micro-Research Finland (MRF) system. Specifically, the MRF 300 series boards are used. This system is capable of delay and drift compensation [69] to correct variations in timing caused by varying fiber path lengths and local temperature variations in the transmission path between the event master and each receiver. The event masters are Virtual Machine Environment (VME) form factor and the receivers are a mixture of VME and peripheral component interconnect express (PCIe). PCIe is used in the systems responsible for diagnostic camera integration and will provide pulse numbering at the full machine repetition rate for all acquired images. VME is used for electronic trigger generation across the facility and also for pulse numbering in VME Field-programmable Gate Array (FPGA)-based data acquisition systems. The system runs internally at 83.29 MHz, in common with the photoinjector laser, which results in a delay resolution of ≈12 ns. A higher resolution delay can be obtained from dedicated delay modules. The system is synchronized to the 50 Hz ac mains and is used to synchronize various technical subsystems with high precision and is also crucial for beam synchronous data acquisition.

F. Control system
The control system for CLARA [70] is an evolution of the control system developed for VELA. It retains the use of the EPICS [71] software toolkit and input-output controllers (IOCs) running the Linux operating system on the PC/x64 platform but extends this architecture to support the additional requirements of CLARA. After their intentional absence on VELA, the implementation of the control system for CLARA sees a return to VME architecture for several systems due to the requirement for an integrated timing system and demanding data acquisition systems. For the VELA line and CLARA FE, there are currently around 60 IOCs, running various versions of the Linux operating system. The control system also supervises a status and interlocking system for machine protection, which is implemented using Omron CJ2M Programmable Logic Controller's (PLC's) and also a personnel safety system implemented using Omron NE1A safety controllers [70].
For graphical user interfaces (UIs), there are currently a combination of EDM UIs running in a Linux virtual machine and also .NET UIs running in Windows 10. All UIs will soon be moved to the Windows platform.

Digitization of diagnostics
Parameters from the WCM, FCs, ICTs, oBLMs (an optical beam loss monitoring system developed by the University of Liverpool/D-Beam [72]), and other beam diagnostic signals previously determined from oscilloscope traces are now acquired into the EPICS control system using dedicated data acquisition hardware. This allows for the acquisition of diagnostic waveforms and parameters at the full machine repetition rate.
Two different data acquisition systems are used, one based on VME hardware from IOxOS, which gives us integration with the CLARA electronic timing system, and another based on the DRS4 evaluation board from PSI, which provides the high sample rate of 5 Gsps needed to acquire waveforms for the oBLM [73]. Both systems are fully integrated into the EPICS control system, and they transmit their data over the channel access network. This allows monitoring and archiving of parameters using the EPICS archiver appliance [74]. Data acquired using this system can be correlated easily and have been used in studies of beam stability across many diagnostics, rf breakdown, laser diagnostics, charge scans, and long-term monitoring of machine performance. Data are currently time stamped using the local clocks synchronized with NTP (network timing protocol).
There have been ongoing problems with the VME-based hardware freezing, and we suspect that this is related to the Linux driver issues identified by PSI in utilizing the development kernel driver supplied by IOxOS; we plan to implement the kernel driver written for PSI by DENX [75] to address the issues.
To support operation during the user exploitation period, a number of modifications to the electronic timing system were requested. This included supporting multiple repetition rates for laser and e-beam interaction and also providing a timing signal well in advance of laser operation to allow preinjection of gas jets.

V. MACHINE DEVELOPMENTS AND HIGH-LEVEL SOFTWARE
CLARA must provide robust, flexible, high-quality beams to support the machine's diverse range of applications that include academic and industrial users as well as the underpinning accelerator science and technology research. The machine development (MD) program aims to provide this by combining the commissioning, characterization, operation, and optimization of the beam and ancillary technical systems. Recent advances in machine learning and intelligent controls have shown a potential to impact the performance of all accelerators [76][77][78] and, therefore, have been included as a fundamental constituent of MD. It was recognized that, in order to deliver the required beam and provide the most flexibility for future upgrades and operating modes, (i) tasks should be automated with an easy-to-use common tool set that allow shared solutions to problems; (ii) CLARA simulations and measurements should be integrated through a virtual machine; and (iii) archiving of coherent, high-quality, calibrated data is essential.
These goals have been achieved through a coherent system of software, tools, protocols, and data stores that underpin the entire MD program. This system is called CLARA-NET (see Sec. VA, in which we describe the structure of, and methodology behind, these tools). In Secs. V B-V I, we present a number of experimental results detailing the measured beam properties under a range of conditions. The development of these routines allowed for fast optimization of the beam properties for user experiments and provides a solid foundation for future improvements. with data archives. Working within CLARA-NET allows the pool of available developers to be increased while building portable, maintainable shared solutions that provide stability, consistency, and maintainability. The workflows and tools provide a natural progression from commissioning to characterization to optimization. A schematic of the key components with logical groupings is given in Fig. 29. These groupings (described in more detail below) are (i) physical-CLARA.-the real machine; (ii) data stores.-archives of simulation data and offline and online machine data; (iii) virtual-CLARA.-a digital copy of the physical machine; and (iv) software.-various tools used to control and operate the machine. As well as showing the vertical hierarchy of components, Fig. 29 highlights the horizontal alignment between analogous physical and virtual parts. As will be explained, this horizontal alignment helps to integrate simulations with the experiment.

Data stores
Virtual-CLARA and software require input data and generate output data, managed through various data stores. The input data come in the form of the "master lattice"; the output data contain two archives: one for simulation output and the other for machine output, in addition to the logs from the various applications used to operate the machine.
Master lattice.-This is a mark-up language repository of all "offline data" such as element specification, measured performance, lattice positions, controls variables, etc. It also includes magnet and rf field calibration measurements, diagnostics measurements such as BPM centers, camera pixel to millimeter calibrations, and all other offline data that are known about the machine. The master lattice is used to generate simulation lattices and imported by software so that offline information is available to all high-level software.
Simulation archive.-This stores all the input and output data from each simulation run through the simulation framework (see Sec. III B). This repository of simulation data has two main purposes. When a user runs a simulation, the input parameters are checked against the database, and the most efficient simulation is run. There are three common situations: (i) These parameters have already been simulated, and so previous results are returned. (ii) The input parameters are "new" (meaning they have not been simulated before), and so a new simulation is run; for example, if a new photoinjector laser beam shape was being considered. (iii) Part of the simulation has been performed before and part of the simulation diverges from previous simulations. Perhaps the standard photoinjector setup is used with new parameters being trialled for a particular experiment. The simulation database returns the results for the injector, there is no need to rerun that part of the simulation, and then the new parameters are simulated from the point the parameters diverge from existing simulation data.
A second, longer-term goal is that by saving all simulation data CLARA will have a large dataset carried out within a coherent framework that can be mined and used with machine learning techniques such that the beam physics of CLARA can be "learned". If this can be achieved, then new and better optimized machine setups may be discovered.
Machine archive.-The aim is to store in perpetuity the machine parameters from the control system and results from beam measurements, with metadata tagging. In general, it is assumed that it is unknown what data will be required up front, and so the aim is to save as much as practical from systems that directly affect and monitor the beam, from laser, rf, magnets, and beam diagnostics to environmental data in the accelerator hall (pressure, temperature, and humidity). The most vital metadata is the time stamp or shot number. This must be consistent between all parameters so that the exact machine setup at any time can be known. Other metadata tagging can be defined as needed, for example, the validity of diagnostic data. As an example, we have started tagging BPM data as "good", "bad", "in the nonlinear regime", "false positive", etc., (see Sec. IV D 2). As well as data being retrieved for offline analysis, the archive can be used for a number of purposes: Previous machine states (setups) need not be directly stored by operators; only a time stamp is required.
Similar to the simulation archive, the long-term vision is that this archive will be a robust dataset for future data mining, analytics, and applied optimization algorithms (machine learning).

Virtual accelerator
Virtual-CLARA is used to simulate the physical machine, including aspects of the hardware and control system. It is used for developing high-level software and for applications integrating simulations with an experiment, such as optimizing beam setups and creating virtual diagnostics. CLARA beam dynamics is modeled using the simulation framework. In addition, virtual-CLARA contains the "online model", the most accurate simulation of the measured machine performance. FIG. 29. Schematic of the connections between the physical and virtual accelerators, the low-, mid-, and high-level control interfaces, and the machine's data stores.
As well as being able to simulate the beam dynamics, there are "virtual hardware" components linked via a "virtual control system" that simulate an interaction with the physical machine. All of the main hardware types required to control and monitor the beam such as magnets, rf, beam position and charge diagnostics, etc., have a virtual implementation. Each component has configurable features that simulate the real behavior. For example, virtual magnets can have a magnetic field ramp time and power supply ripples, noise can be added to virtual diagnostic readings, etc. Each component is controlled through instances of the virtual control system that users can dynamically instantiate. The virtual control system is directly analogous to the physical machine's control system, with a copy of all the main control parameters for main hardware types typically controlled and monitored during beam operations. Multiple copies of the virtual control system can be created, each independent of one another, each controlling different virtual hardware.
When running the online model, a flag can be set to enable parameters to be read from physical-or virtual-CLARA. If the parameters are run from virtual-CLARA, then after the model is run diagnostic values, such as beam position, charge, and screen images, can be written to the appropriate virtual diagnostic devices. As the simulation model has access to unobservable (or difficult to observe) beam parameters such as the bunch length, energy spread, and transverse emittance, these are also written to parameters in the virtual control system that have no direct analog on the physical machine. The online model can be used to optimize the machine setup during beam time. For example, perhaps a current CLARA user experiment requires an optimized beam parameter at the experiment interaction point; in this case, the existing physical machine setup can be transferred to a copy of virtual-CLARA, and this virtual model is optimized to find an improved setup. This new setup can then be directly applied to the physical machine.
High-level software tools can interact with the physical or virtual control system via a simple flag indicating whether the virtual or physical CLARA is being used. This means that it is possible for much application development for machine characterization to be prototyped in the virtual environment independent of the beam time and operations. Used in this way, it is easy to see how virtual-CLARA can be an invaluable tool for designing high-level software applications.
We also plan to build "nondestructive diagnostics": Here the aim is to combine experimental and simulation data with machine learning to build a model that has learned to predict (for example) the beam transverse emittance, or bunch length, etc. These predictions would be real-time shot-to-shot estimations of these parameters without disrupting the beam.
These are just the first few applications of the virtual-CLARA; it is planned to continue to exploit these tools.
As the data stores are filled and future optimization and statistical techniques with machine learning algorithms are developed, we expect to find new ways to control and optimize CLARA.

Software
This category contains the machine control system (discussed in Sec. IV F) and general optimization routines that will not be further discussed here, as most of the effort has been toward developing high-level applications for beam setup, characterization, and operations that rely on CATAP, a C++/PYTHON library that forms a simple to use interface to the physical and virtual control systems.
CATAP is a C++/PYTHON software library that contains multiple modules that provide easy read-write access to the main types of accelerator hardware through the control system. In addition to basic control and data reading, standard procedures and analysis techniques are included. CATAP' s main design goals are to be easy to use, extensible, and able to perform any conceivable application. Each module has human readable functions and variable names; end users have only to create a single object and everything else automatically follows. Once imported and initialized, CATAP abstracts away all the configuration, connections, and communications with the controls system. Using this extended tool set, it is possible to build "any conceivable beam experiment", all written at a relatively high level that allows developers to concentrate on the experimental procedure and not on the intricacies of controlling and monitoring multiple hardware types. The source code is written in C++ and is therefore easily included in any C++ application and has also been compiled into PYTHON modules using Boost [79]. PYTHON is an easy to use scripting language that can be used by novices and experts, thereby widening the pool of possible developers. CATAP creates containers of virtual hardware objects that represent the data associated with each hardware type. Online data are automatically updated from the controls system. Offline data are read from the master lattice. Each hardware type has relevant methods: For example, a magnet object knows how to switch on and off, set a field, degauss, etc.; a BPM object knows how to calculate the beam charge and position. Using this approach, it is possible to aggregate hardware types into logical subsystem groupings. For example, the CLARA photoinjector module groups together the relevant modules required to control and monitor the system: the photoinjector laser position and intensity, virtual cathode camera, camera image data, image analysis, photoinjector laser transport shutters and valves, and the WCM. In this way, different systems of multiple hardware types can easily be created.
Extensibility with ease of maintenance and management is achieved through dynamic instantiation at run time after reading the master lattice, as new hardware comes online, or is upgraded-all that is required is an update to the master lattice for these changes to be propagated to all users of CATAP. CATAP provides a framework for shared solutions. Simple procedures are contained within CATAP, meaning that the writing of procedures are problems that need solving only once. As solutions become accepted and robustly tested, they can be moved down the tool chain. For example, a cathode charge scan (see Sec. V C) was developed as a PYTHON application enabling quick prototyping and testing of different methods. When the procedure was agreed upon, it was then implemented at the C++ level, making it available to all users of CATAP. A next stage could then be to implement the procedure within the controls system, which would be even more robust.
As the code is compiled into PYTHON modules from a C++ source, it is very simple to create managed, external user versions of the CATAP library. These libraries will have stricter limits on the control of hardware suitable for external users while also giving them the ability to monitor all signals and design their data acquisition accordingly.
High-level applications (HLAs) are an automated set of procedures or protocols to perform a specific task on the machine (e.g., a beam measurement). Two of the aims of this part of CLARA-NET are to encourage new developers from a pool of staff with little application development experience and set common standards of design, tools, and workflow such that different developers can take over existing applications with minimum overhead. To achieve this, there are a number of preferred tools used by all HLAs. Agile project management tools, such as Github [80], Trello [81], and Slack [82], provide open access to all stages of the application life cycle. HLAs are written in PYTHON, using a small set of libraries, including PyQT [83] and NumPy [84]. All HLAs make use of CATAP. To enforce standards, software should pass acceptance and quality assurance tests before being allowed in the release environment; this is achieved through Gitlab [85].

B. rf conditioning
It has been demonstrated using statistical data that an rf cavity conditions with the number of pulses, not the number of breakdowns [42]. Breakdowns are well known to damage the surface of cavities and limit the gradient [86]. In light of this research, it is clear that limiting the number and severity of breakdowns during conditioning is best practice, particularly for high-gradient structures, such as the 120 MV=m CLARA photoinjector. To condition in a reliable and repeatable way, and to switch off the rf power quickly after a breakdown in order to avoid followup breakdowns [87], the conditioning must be automated.
No-operator automated rf conditioner (NO-ARC) is a dedicated control room application suitable for conditioning all rf structures that have similar low-level rf electronics. An automated, unmanned application is important for CLARA due to the amount of time required for conditioning all the rf structures and the limited staff resources available. The application increases the power following a predetermined power ramp while continuously monitoring for breakdowns, dark current, and vacuum activity. When events happen, the application sets the rf power to zero for some time and then reapplies it following defined protocols. Key components and design choices are explained below.
A modular design within CLARA-NET (see Sec. VA) allows for easy refactoring and extension and is the best path to prepare for future developments and ensure long-term stability. For example, the breakdown event detection module currently utilizes a mask method, which characterizes a breakdown as any point on the rf power trace falling outside of a boundary defined by the mean power at all points AE a user-defined deviation. Improved methods are being developed which, when operational, will be implemented within NO-ARC. Use of our in-house software library CLARA-NET ensures that solutions are shared throughout the entire project and that multiple developers can contribute.
The rf forward and reverse phase and power traces generated by the low-level rf system are monitored to detect breakdown events. Currently, a breakdown event is defined as a configurable deviation from previous traces. This method can lead to complications on starting up, where there are few previous traces to compare to, and limits the power increase and the traces. Therefore, novel techniques using neural networks to learn how to characterize a breakdown event have been prototyped offline using measured data and are ready to be implemented during the next conditioning run.
Settings are configurable through a plain-text configuration file. This includes the rf repetition rate, the rate at which the rf power is increased, and the increase step size, mask parameters for breakdown detection, breakdown detection threshold for dark current and vacuum spikes, traces to monitor for breakdowns, and the option to monitor the phase as well as the power. This allows the program to be easily adapted to condition different rf structures without the need for advanced knowledge of the code.
The higher the repetition rate, the faster the cavity will condition. The Libera LLRF system measures the rf pulse amplitude and phase at each directional coupler and distributes these data to the control system. NO-ARC monitors traces at 100 Hz and, when a breakdown event is detected, switches off the rf before the next pulse. Thorough benchmarking was completed to verify 100 Hz operation. The repetition rate was not increased beyond this level, as the system relies on the CLARA network, with NO-ARC running in the main control room. Further improvements might be gained if the conditioning script could run on more local hardware, thereby reducing the effect of network latency.
An automated high-power rf restart application was written that operates within the CLARA control system. This application returns the high-power rf system to operation after a machine protection interlock trips it off, for example, after a large vacuum event. rf power is returned only if the rate of the tripping interlock being triggered was below a level of 3 per half hour. If too many interlocks are triggered or the modulator does not come back on for any reason, the klystron filament heater is switched off to protect the klystron lifetime. A conditioning keep-alive system was created, where the conditioning script continually sends an "alive" signal to the control system. If for some reason the conditioning script fails (e.g., application crashed, host computer crashed, network error, etc.), then the control system would turn off the high-power rf system. This allows unmanned conditioning.

C. Charge scans
Scans of the laser position on the photocathode were an inherent aspect of the beam alignment studies (see Sec. V D) and thereby provided the tools to run automatic measurements of the bunch charge dependency on laser steering. These scans (measuring the bunch charge on the WCM located at 0.7 m from the cathode) were carried out regularly throughout the operational period and demonstrated significant charge variation over the scan, as shown in an example in Fig. 30. The laser steering was changed using a single mirror in the laser transport path, upstream of the final mirror which directs the laser onto the cathode. The laser position was measured and positioned on the virtual cathode using the same image analysis software developed for the beam screens. Part of the observed charge variation is due to the variations in reflectivity of the final laser transport mirror, which was measured independently. Variations in the cathode QE with position may also contribute. The example in Fig. 30 was taken at the end of the exploitation period when the laser-spot-shaping aperture was removed to maximize the bunch charge, which meant that the laser spot was larger than nominal, at approximately 0.6 (0.3) mm in x (y) (rms).

D. Photoinjector solenoid and rf center alignment
The generated beam position and its initial trajectory in the photoinjector are determined by the laser position on the photocathode and are measured and controlled using the virtual cathode. The centering of the beam in the photoinjector rf field was found by observing the beam steering effect due to varying the photoinjector phase (with the solenoids turned off), measured on the first screen after the photoinjector. The laser position which resulted in the minimum steering gives this centering, which is illustrated in Fig. 31. It was also observed that the dark current pattern indicates the central position, and this could be used to quickly position the beam in the central field region with reasonable accuracy.
After the beam is centered in the photoinjector rf field, some degree of beam steering is observed when the main solenoid field is varied, indicating misalignment of the main solenoid field. Because the effect was not large enough to cause problems with beam setup during CLARA user experiments, this effect has not yet been quantified in detail or corrected.
During CLARA operation, the laser position was determined by that which gave maximum charge (as desired for user experiments) rather than correct alignment in the photoinjector and solenoid fields and steering effects adequately managed via downstream magnetic correction.

E. Momentum and momentum spread
An application has been written to automate the measurement of momentum and momentum spread on CLARA in order to ensure consistency and repeatability. The design philosophy for the app was to mimic the established procedures used to make measurements by hand, but automating each stage in turn.
The procedure for measuring momentum on CLARA is essentially identical to that used earlier on VELA, where a dedicated spectrometer line was incorporated for that purpose. Once the beam is established, the dipole is degaussed and the beam accurately aligned straight through using the steerers while monitoring the position on BPMs and YAG screens both before and after the magnet. Then the dipole current is increased until the beam is centered in the spectrometer line, normally using a BPM directly after the magnet. When the beam is centered in the spectrometer line, the momentum can be calculated using the defined angle of deflection (45°) and the known calibration of a magnetic field with a dipole current.
Momentum spread measurements are made using the first YAG screen following the dipole magnet, where the beam size is a convolution of the beta function and the momentum spread. If the beta function is sufficiently minimized, then the beam size is dominated by the momentum spread, which can be calculated if the dispersion is known. Key parts of the momentum spread measurement procedure are the dispersion measurement and the minimization of the beta function. Minimization of beta is accomplished by using the quadrupole magnets before the dipole. This can be difficult, because close to minimum beta the response is flat, since the beam size is then dominated by the momentum spread. The approach used is to identify where the beam size starts to increase on each side of the minimum and use a setting midway between. The quadrupole magnets between the dipole and screen control the dispersion, and, once they have been set correctly, they should not be adjusted further. The dispersion is typically set in such a way that even for the largest momentum spread likely to be measured the beam size does not exceed a third of the screen size. Dispersion measurement is made by scanning the position of the beam across the YAG screen using the dipole magnet and then recording the position of the beam centroid to determine the slope.
Measuring the momentum spread requires the YAG screen image size to be measured in the plane of dispersion, and a number of approaches have been used to do this. Gaussian fitting of both 2D projected data and the full 3D data have been trialled, but ultimately a moments-based approach has been adopted, where the first moment indicates the average position and the difference between the positions of the second moments gives the width. This method has the advantage of being noniterative, so it can be carried out in real time to provide data at the electron bunch repetition rate of the accelerator. A significant issue with image processing is removing spurious signal (for example, electrons scattered by the screen), so a mask is used to select only the area of interest for analysis. This mask is adaptive, such that it resizes itself based on the signal seen in any given image.
While mounted on the VELA line, the 2.5-cell 10 Hz gun was characterized by measurements of both the momentum and momentum spread as a function of parameters such as rf power and phase and, for momentum spread, solenoid settings and charge. Since the gun has been transferred to the CLARA FE, a more limited set of measurements has been made that show similar behavior. Figure 32 shows a comparison of the gun momentum with rf power for both positions for data taken at the on-crest phase.
For both sets of data, the relationship between the rf power and momentum can be fitted using the equation given below: where ΔE is the momentum gain, P f and P r are the forward and reverse power measurements, respectively, L is the cavity length, and Z eff is the effective shunt impedance, which is related to the efficiency with which the cavity accelerates electrons. For the measurements made in the VELA position, Z eff was found to be 23.3 MΩ=m but in the CLARA position measurements indicated a higher value of 30.6 MΩ=m. The reason for this improvement is twofold. First, the cathode surface was remachined to improve its geometric flatness, and second, considerable time was taken to establish an improved procedure for bolting on the cathode to a well-defined torque in order to optimize rf performance, in particular, the field flatness. The improved performance was predicted accurately by the offline rf measurements. The relationship between the rf phase and momentum for the CLARA FE photoinjector is shown in Fig. 33; the relationship is broadly in line with expectations from ASTRA simulations of the CLARA FE where the rf field in the cavity has been set to 70 MV=m.
Simulations of momentum spread as a function of the phase for the gun in the VELA position indicate that the minimum momentum spread occurs at a large off-crest phase, where there is a significant energy chirp on the beam. Therefore, the back of the bunch has higher momentum than the front, i.e., the rising side of the rf waveform. Early measurements of the phase for minimum momentum spread gave values between 14°and 39°off crest, where the large variation was probably due to phase drift which has since been corrected. The minimum rms momentum spread was in the region of 0.2%, or 9 keV=c, and corresponded to settings of both the main gun solenoid and bucking coil that were close to optimum. Lowest momentum spread also required the bunch charge to be 20 pC or less, since at larger values higher momentum spread was expected due to space-charge effects.
Momentum spread versus gun phase measurements were also made at the CLARA position, but in this case with the linac set to a fixed rf phase and power setting (thus, the total momentum is higher and not constant across the dataset). These data are shown in Fig. 34, where the minimum momentum spread is seen to be at 23°off crest, in the data with the ASTRA simulations having a 3°offset despite having the correct shape with a varying phase. This discrepancy between the phase of minimum energy spread is at present unexplained. The minimum measured momentum spread seen is 16 keV=c compared with a simulated value of 15 keV=c, with 6 keV=c coming from the gun and the remainder a consequence of the momentum gain in the linac.
In addition to the measurements for the gun, both momentum and momentum spread measurements have also been made as a function of the linac power and phase. The dependence of momentum on the phase is described well by a cosine relationship, as expected for electron bunches that are already close to relativistic. The momentum gain as a function of the linac power (forward minus reverse) at the linac crest is shown in Fig. 35 again be fitted with a square root dependence, and an implied effective shunt impedance of 55.4 MΩ=m could be calculated (taking into account the predicted attenuation factor between the input power and dissipated power). This value is approximately 85% of the manufacturer' s modeling, which agrees with the estimate for typical "real-world" performance. A limited number of momentum spread measurements as a function of linac parameters were made. Figure 36 shows plots of the momentum spread versus linac phase for various bunch charges. As expected, it appears that there is a minimum when the beam is near crest. In fact, the position of this minimum is strongly affected by the offcrest phase of the gun (in this case, þ5°), since the minimum momentum spread will occur when any energy chirp induced by the gun is compensated for by the linac phase. ASTRA simulations of the expected behavior are also shown. The match between the data and simulations can be improved by a 1°change in phase, which is the accuracy typically used during cresting. A 30% increase in momentum spread values for the data compared to the simulations is also seen, but this is unsurprising, since the simulations represent an ideal situation with, for example, perfectly uniform longitudinal and transverse laser profiles. For the current data, the minimum rms momentum spread observed was 0.13% (or 46 keV=c for a 35 MeV=c beam).

F. Dark current measurement
Dark current from the 10 Hz photoinjector has been measured on an ongoing basis through its first conditioning and numerous changes of photocathode [46]. The WCM, located at 0.7 m from the photoinjector, is the principal diagnostic in these measurements. For the photoinjector cathode used throughout 2018 and 2019, a relatively low amount of dark current-compared to previous operational periods [17]-was seen during first conditioning, which due to some inconsistency in diagnostic results could be quantified only as >120 pC per rf pulse. After a brief shutdown and machine startup in early 2018, the dark current brightness on the first screen had decreased significantly and was no longer measurable on the WCM. The dark current was observable in the diagnostics on some of the experiments during the CLARA exploitation period but was not problematic.

G. Emittance measurements
A number of techniques have been implemented to characterize the transverse phase space of the beam, providing information on the emittance, optics, and details of the charge distribution. All the methods are based on observation of the transverse beam profile on YAG screens at different locations with various settings for the quadrupole strengths. High-level software tools have been developed to automate the data collection.
The three methods mainly used so far for emittance and optics measurements are, first, analysis of the beam images on screens at three separate locations, with fixed strengths of quadrupoles between those screens; second, analysis of the dependence of the rms beam size on a single screen on the strength of the upstream quadrupoles; and third, reconstruction of the phase space distribution using a tomographic analysis of the beam images on a single screen observed for different strengths of the upstream quadrupoles. Each technique can be validated by comparing the beam image on a given screen predicted using the measurement results and the actual image observed on that screen at the time of the data collection.
So far, measurements have been made in the section of beam line following the linac in the CLARA FE, at a nominal beam momentum of 30 MeV=c and with a range of conditions including different bunch charges and strengths of the bucking coil in the photoinjector. Three screens (YAG-01 to YAG-03) and five quadrupoles (QUAD-01 to QUAD-05) located between the exit of the CLARA linac and the CLARA FE straight-on FC have been used for observing and controlling the transverse beam profile. The results presented below are all for measurements taken with a bunch charge of 10 pC.
The three-screen analysis and quadrupole scan techniques are well-established methods for measurement of the beam emittance and optics in accelerator beam lines [88]. In each case, screen images are used to find the width of the phase space distribution at different phase angles. By combining the data over a range of phase angles, it is possible to characterize the overall size and shape of the beam distribution. However, the description of the distribution obtained may lack significant details because of the limited amount of data used. For example, beam images from screens at three different locations provide the phase space projections at three different phase angles, which can be used to describe a simple Gaussian elliptical distribution; but if the real phase space distribution has a more complicated structure, then such a description may not provide reliable or useful results. By using a larger number of phase angles (for example, from a quadrupole scan), it is possible to describe more general distributions. However, the conventional quadrupole scan analysis uses only a single parameter to characterize the width of the distribution at each phase angle: This again can lose important information for describing the beam behavior in the machine. In the case of the CLARA FE, at the time the measurements described here were made, it was found that the three-screen and quadrupole scan techniques provided information of limited value for understanding the beam properties. The application of a more sophisticated measurement technique, phase space tomography, showed that this was because of the detailed structure of the beam distribution in phase space.
Phase space tomography has been used on a variety of different types of machine to provide valuable detailed information on beam properties and behavior (see, e.g., [89][90][91][92][93][94][95][96]). Data collection can be performed in the same way as for a quadrupole scan; however, instead of using simply a single measure of the width of the distribution at each phase angle, tomography uses the full shape of the profile over the range of phase angles to construct a more complete representation of the phase space distribution. Where the distribution has significant detailed structure, as in the case of the beam in the CLARA FE, phase space tomography can be a more appropriate and useful way to characterize the beam than specifying only the emittance and Courant-Snyder parameters obtained from a quadrupole scan (for example).
A number of different standard algorithms have been developed for using the beam profile observed over a range of phase angles to reconstruct the phase space distribution (see, e.g., [97][98][99]). We use a form of the algebraic reconstruction technique (ART), which expresses the observed profiles in terms of the phase space distribution through a set of linear equations. Working in normalized phase space improves the ability to resolve detailed structure in the phase space distribution [100]. Solving the equations is computationally intensive but can be readily achieved using standard numerical algorithms. Generally, phase space tomography is applied to the beam distribution projected onto either the horizontal or vertical axis, to give either the horizontal or vertical phase space distribution (respectively). However, by treating the horizontal and vertical phase spaces separately, information about beam coupling is lost. Information on the coupling can be important in a machine such as CLARA, where a solenoid is used to provide focusing in the electron source. A nonzero solenoid field on the photocathode generates coupling, so a bucking coil is used to cancel the local solenoid field on the cathode where the electrons are produced. To achieve the optimum emittance, the bucking coil must be correctly adjusted to compensate exactly the solenoid field [101]. For the commissioning of the CLARA FE, we have extended the ART tomography algorithm to use the full two-dimensional image observed on a screen during a quadrupole scan, which allows reconstruction of the four-dimensional phase space distribution [102]. Typical results are shown in Fig. 37. In this case, the bucking coil was deliberately detuned to give a nonzero solenoid field on the photocathode: The coupling in the beam is apparent in the tilt of the distribution in projections of the phase space onto a plane with axes corresponding to phase space variables from different (transverse) degrees of freedom (d.o.f.). By repeating the measurement with different currents in the bucking coil, it is possible to identify the optimum current to minimize the coupling.
In performing the tomography analysis in the CLARA FE, images collected on YAG-03 are used to reconstruct the phase space at YAG-02. Since YAG-02 is upstream of the quadrupoles used in the phase scan, and the image on this screen is not used in reconstructing the phase space distribution, it is possible to validate the tomography results by comparing the image observed on the screen with the image obtained by projecting the reconstructed fourdimensional phase space distribution onto the x-y plane. An example of such a comparison (corresponding to the phase space distribution in Fig. 37) is shown in Fig. 38. We see that, when the phase space is projected onto the x axis, the tomography is able to reproduce detailed features observed directly in the beam image. In the vertical direction, the agreement is less good; however, we note that the resolution of the four-dimensional phase space is limited by the computer memory required to store the large volumes of data involved in the reconstruction, and this can lead to the reconstructed beam size appearing somewhat larger than that observed directly on the screen.
Results from the quadrupole scan and tomography analysis are shown in Table VII. In this case, measurements were made with nominal machine settings (30 MeV=c beam momentum, 10 pC bunch charge, photoinjector and linac rf on crest) but with the bucking coil detuned to give a nonzero solenoid field on the cathode. The values shown in the table are obtained from the covariance matrix describing the second-order moments of the beam distribution in fourdimensional phase space, using the methods described in Ref. [103]: The results are consistent with the beam sizes observed directly on the screen at YAG-02. Note, however, that in the (normal mode close to the) horizontal plane, there is some difference between the quadrupole scan and tomography results for the values for the emittance and beta function: More detailed analysis [104] shows that this is a consequence of details in the phase space structure that are not captured by the quadrupole scan.
Overall, the studies of the transverse phase space show that, although simple and well-established techniques for emittance and optics measurements (such as beam size measurements at three different locations in the beam line) can be performed relatively quickly and easily, in the case of the CLARA FE, where there may be significant detailed structure in the phase space distribution, phase space tomography allows a more detailed characterization of the beam properties and provides a valuable tool for machine optimization.
Future work will aim at developing the tomography technique to reduce the computational resources required and, thus, to allow an increase of the resolution in the reconstructed (four-dimensional) phase space distribution. It is also planned to apply the four-dimensional phase space tomography to perform detailed studies of effects such as coupling and space charge in the photoinjector.

H. Bunch length measurement in BA1
The bunch can be compressed longitudinally in the C2V section that connects CLARA FE and VELA beam lines  with R 56 ¼ −78 mm and T 566 ¼ −2.794 m, when a positive energy chirp (that is, with the head of the bunch at a higher energy than the tail, i.e., on the falling side of the rf waveform) is introduced in the linac. This is followed by a long beam transport of ≈15 m to reach the IP in BA1. At 35.5 MeV=c beam momentum, simulations demonstrate that, although the bunch length is only weakly affected by space charge, the energy spread increases significantly over that distance, especially in the case of maximum compression. This is illustrated in Fig. 39, where the FWHM energy spread ΔE measured in the S bend and in BA1 are shown as a function of the linac phase. The difference between energy spread values increases steadily with farther offcrest linac phases until approximately −8°, where a sharp increase in ΔE takes place, indicating the minimal bunch length. A drastic drop in ΔE at ≈ − 10°can be attributed to the bunch overcompression at this linac phase, while the energy chirp becomes negative with a following "dechirping" along the beam transport line to BA1 due to space charge. At linac phases less than −10°, the bunch chirp remains negative, and the energy spread is expected to approach the values in the S bend as the bunch length increases. However, this expected trend was not observed at a larger off-crest phase below ≈ − 15°and is a subject of further detailed investigation. The above interpretation of the measured energy spread dependence on the linac phase is corroborated by direct measurements of the total CTR power in BA1 as shown in Fig. 40. Indeed, a peak of CTR was observed at 8°linac phase, where maximum bunch compression is expected. A second larger peak was registered at 10.5°from the crest that approximately coincides with the phase at which the minimum energy spread was also seen (Fig. 39). This can be attributed to the overcompression of the bunch in the S bend and, as a result, to a development of a short current peak in the longitudinal bunch distribution. Simulations of the overcompressed bunches using the ELEGANT code [27] confirm that a sharp peak at the head of the bunch and a longer decaying tail are developed in this regime of machine operation. This behavior of the bunch longitudinal distribution is also responsible for asymmetrical shape of the CTR signal versus linac phase dependence.
The bunch length was measured with three different methods. At the entrance to the linac, the bunch length was evaluated by the phase scan method with the linac itself acting as a phase scanner. The method involves measuring the energy spread in the C2V line (acting as an energy spectrometer) as a function of the linac phase and fitting data with where ΔE 0 is the uncorrelated energy spread (fit parameter), E 0 is the energy gain in the linac on crest, λ is the rf wavelength, Δz is the bunch length (fit parameter), ϕ is the linac phase, and ϕ 0 is the linac phase at which the minimal energy spread is achieved (fit parameter). A typical phase scan and corresponding fit are shown in Fig. 41. In a baseline machine setup, the bunch length was measured to be 2.6 ps FWHM; however, depending on the rf photoinjector settings and bunch charge, the bunch length could vary between 2 and 3.3 ps FWHM. The bunch length in BA1 was evaluated by two further methods. First, we employed the effect of beam energy modulation introduced along the bunch when the beam passes through a dielectric lined waveguide (DLW) and excites strong wakefields similar to that demonstrated in Ref. [105]. The planar DLW structure with variable gap was designed with thin dielectric layers of 25 μm that ensured narrow-band and single-mode operation of the device with variable intensity of the Cherenkov radiation as a function of the structure gap. An example of observed  energy modulation at two linac off-crest phases and a DLW gap of 540 μm is given in Fig. 42. The frequency of the fundamental mode is structure gap dependent and was measured, using the interferometer, to be 0.65 THz in the example shown. With this known frequency, the bunch length can be evaluated, and the data are presented in Fig. 43. Because of the peculiar shape of the energy spectra ( Fig. 42), data are given as an approximately full bunch length (at 10% of the peak level). The energy modulation method is not applicable to shorter electron bunches where the bunch length is smaller than a wavelength of Cherenkov radiation. In this case, the CTR interferogram fitting technique [106,107] was used instead, and the data are presented in Fig. 43. In the analysis of the interferograms, the bunch longitudinal profile was assumed Gaussian and resulted in ð0.2-0.3Þ AE 0.1 ps rms values of the bunch length at maximal compression around the 8°linac off-crest phase. The full bunch length points in Fig. 43 were calculated as four times the corresponding rms values.
ELEGANT simulations predict similar behavior of the dependence of the bunch length on the linac off-crest phase but appear to be shifted by approximately 2°with respect to experimental data. If, however, this 2°shift toward the linac crest phase is added (see Fig. 43), simulation and experimental data would match with good accuracy. The reason for this discrepancy is under investigation.

I. Jitter and stability
A study to measure and understand jitter and drifts in rf systems on CLARA is underway. Hardware systems and software codes required to record rf and other relevant parameters have been developed. A dynamic digital signal processing code, employing multiprocessing framework, has been developed in PYTHON to analyze the waveform and data. Input control parameters of the photoinjector and linac 1 klystrons are scanned to calculate the sensitivity of the output amplitude and phase and to determine the correlation or prediction function. To study the stability of the photoinjector rf system, CLARA was operated without linac 1 at 4.6 MeV=c momentum. Input controls of the klystron were scanned to determine their effect on the output rf amplitude ðP PI;Kly-fwd Þ, phase ðϕ PI;Kly-fwd Þ and the resultant beam momentum, as shown for the modulator cathode voltage in Fig. 44. These sensitivity relations are used to predict the contribution of each input control to the output jitter or to overcome measurement resolution limitations of the input controls.
The shot-to-shot jitter and slow drifts observed in the photoinjector and linac 1 rf systems are summarized in Table VIII. The stability of the photoinjector rf system over three and half hours of undisturbed running is plotted in Fig. 45, during which the klystron power drifted slowly by AE0.09%, while the klystron phase drifted by 0.5°, which together caused a beam momentum fluctuation of AE0.15% peak to peak. The drifts in beam momentum showed a strong correlation with AE0.75°C drift in cooling water temperature. The photoinjector klystron power and phase had a pulse-to-pulse jitter of 0.09% and 0.04°, respectively.
Measurements of linac 1 rf systems were dominated by power fluctuations of the order of 2.7%. With modifications in the klystron driver path, the power jitter was reduced to 0.038%. A plant model has been developed to predict jitter and drifts in klystron power and phase, which derives prediction relations using a nonlinear Singular Value Decomposition (SVD)-based algorithm. The algorithm has predicted the photoinjector power and phase over a period of 7 days with an accuracy of 1% and 0.2°, using a training dataset of only two and a half hours.

VI. PLANNED UPGRADES
Several upgrades are planned in 2019-2021 aiming to improve the beam quality to meet specifications of CLARA and VELA. These include an upgrade of the10 Hz photoinjector; improvements in the photoinjector laser; commissioning of a beam arrival monitor; and preparation to move to cesium telluride photocathodes. We briefly describe these plans.

A. 10 Hz photoinjector upgrade
From mid-2019 onward, the 2.5-cell 10 Hz photoinjector will be equipped with a cathode exchange system that will allow the photocathode to be replaced without breaking the vacuum. In-vacuum transfer can allow a much wider variety of photocathode preparation techniques to be employed. At present, the two more favored methods of preparing a copper photocathode for the photoinjector are by thin film deposition of copper onto the molybdenum  photocathode pucks using magnetron sputtering or by the use of multipart molybdenum and copper pucks where the active area is a small copper insert. Work to evaluate the effectiveness of these two approaches is ongoing.

B. Photoinjector laser improvements
Upgrades to the photoinjector laser will focus on transverse and longitudinal shaping of the UV laser pulses in line with CLARA specifications. Transverse shaping from (truncated) Gaussian to a flattop profile will be performed using an aspheric lens shaper and the impact on the electron beam quantified through dedicated measurement. Longitudinal shaping from Gaussian to a flattop profile will be performed using amplitude or phase modulation of incident pulses in a 4-f arrangement, achieved using an acousto-optic modulator.
The impact of laser amplification on timing jitter and drift is currently unknown and will be measured (and stabilized as necessary) through balanced optical correlation. A laser arrival monitor (LAM) will be installed to compare the relative timing jitter of the photoinjector laser oscillator and optical master oscillator, with the option of locking the photoinjector laser oscillator implemented should a substantial benefit to synchronization be provided.

C. Bunch compression monitor
Measurements of the bunch length in a subpicosecond range require complex diagnostic systems, e.g., terahertz interferometric or electro-optic, that either have to be operated by dedicated specialists or do not provide a single-shot capability. It is essential, however, that the bunch length is monitored on a shot-to-shot basis and that a suitable diagnostic is readily accessible by all machine operators.
The total pulse terahertz energy from a CTR target is highly sensitive to the bunch length, and, although this does not provide absolute values for bunch lengths, it does contain information on bunch compression. We plan to develop and implement such a bunch compression monitor (BCM), similar to that reported in Ref. [108], at the end of the VELA beam line.
The BCM will consist of two pyroelectric detectors, one of them for picking up the background noise and the other one for receiving the terahertz signal. Pyroelectric detectors provide a cost-effective and robust method for measuring the CTR pulse energy. The detector sensitivity will be enhanced by subtracting the considerable electromagnetic and acoustic background noise from the accelerator hall. The CTR radiation will be collected and transported by a TPX lens system to the detector, reducing the contamination of the signal from upstream terahertz sources.
The BCM output will be cross-referenced with absolute measurements of the bunch lengths over a full range of bunch charges and machine settings, thus providing semiquantitative information on bunch length and shot-to-shot stability during routine machine operation.

D. Beam arrival monitor
The full CLARA facility, including phase 3, will include six beam arrival monitors (BAMs) to measure the beam arrival time with respect to an optical master oscillator. The optical master oscillator is a Er:Yb-based fiber oscillator (Origami, OneFive) delivering exceptional phase noise performance at a repetition rate of 249.875 MHz (12th subharmonic of the master rf clock). The optical clock is locked to the master rf clock at 2.9985 GHz directly to improve the noise performance at a lowfrequency offset. Laser light from the oscillator is delivered via fiber to different points in the CLARA facility, including the CLARA FE. The fiber length is stabilized to femtosecond precision using a balanced optical crosscorrelator to compare pulses entering the fiber with those reflected from the end station.
The CLARA FE includes one beam arrival monitor after linac 1 (BAM1). The pickup incorporates a novel leaf-type design, with a wide transverse width to generate a large signal, while maintaining high bandwidth (≈20 GHz) through low longitudinal width. rf signals from the pickup are referenced against optical pulses from the stabilized fiber link in an electro-optic intensity modulator. The relative arrival time encoded into the amplitude of pulses exiting the modulator, which are filtered, amplified, and FIG. 45. Slower drifts in photoinjector power and amplitude (normalized) and temperature, and the associated variation in the beam momentum. The data were smoothed using a moving Gaussian window with 2 s width. inverted prior to analysis by differential ADC. The expected start-to-end arrival-time resolution of the system is 10 fs. First tests on BAM1 will begin in 2020.

E. Cesium telluride photocathodes
In the longer term, it is hoped to be able to replace copper as the photocathode material with cesium telluride, which has an orders of magnitude higher QE (≈0.1%) [109]. Cesium telluride photocathodes have the advantage of still running with UV light so that the same photoinjector laser system can be used, but now with much reduced intensity. A new deposition chamber has been constructed for the growth of thin films of cesium telluride on the molybdenum pucks using evaporation techniques. While the chamber has been successfully commissioned and is under UHV, the sources for the deposition of cesium and tellurium and some other ancillary equipment are still being procured.

VII. SUMMARY
The front end of the CLARA test facility at Daresbury Laboratory was commissioned in 2018. A maximum bunch charge of ≈250 pC was achieved using an argon plasma cleaned cathode and a stretched photoinjector laser pulse. However, there was degradation in the bunch charge over time, and typically around 100 pC bunch charge was routinely achieved. A beam momentum of ≈5 MeV=c was achieved at a lower rf power, validating the tuning procedure developed for the S-band photoinjector. The beam was further accelerated in a 2-m-long S-band linac to ≈50 MeV=c and was transported through the S bend to the VELA beam line. Because of arcing in the linac waveguide, the maximum available momentum was limited to ≈40 MeV=c. A program of implementation of high-level software and beam characterization was followed by a period of user experiments. The focus of the machine development program was on developing the measurement procedures and relevant high-level scripts with preliminary measurements of beam parameters such as the beam momentum, projected emittance, momentum spread, and bunch length. The developed procedures and software made the measurement procedures and beam setups consistent, providing a highly repeatable and robust beam for the user exploitation program.
However, during this period, there were several limitations achieving the design parameters, e.g., hot spots in the photoinjector laser, degradation of the bunch charge over time, limitations on rf power in the linac waveguide, a bucking coil configuration on the 10 Hz photoinjector, stability in the photoinjector and linac, etc. Some of these issues are currently being addressed and some issues are to be addressed in future upgrades. This should reduce the differences between design and measured parameters in the operational period beyond 2019. The focus during future operation will be to match the machine design to the experimental model, to provide a reliable and repeatable high-quality beam to CLARA users, and progress with rf conditioning of the 400 Hz photoinjector on VELA using an automated rf conditioning script at a higher repetition rate, followed by beam commissioning and characterization of this photoinjector. With tremendous progress made on many fronts, we hope to achieve all these goals in the near future.