SwissFEL: The Swiss X-ray Free Electron Laser

The SwissFEL X-ray Free Electron Laser (XFEL) facility started construction at the Paul Scherrer Institute (Villigen, Switzerland) in 2013 and will be ready to accept its first users in 2018 on the Aramis hard X-ray branch. In the following sections we will summarize the various aspects of the project, including the design of the soft and hard X-ray branches of the accelerator, the results of SwissFEL performance simulations, details of the photon beamlines and experimental stations, and our first commissioning results.


Introduction
X-ray free electron lasers (XFELs) represent a new generation of electron accelerators [1]. They produce bright bursts of X-rays at periodic intervals, where these pulses are both spatially coherent [2][3][4] and ultrashort in duration [5][6][7][8][9]. This combination of high brightness and ultrashort pulses produces extraordinary peak intensities, which has proven extremely attractive for certain fields of research in addition to creating entirely new fields which were not previously feasible, such as nonlinear X-ray signals [10][11][12][13][14][15]. Due to the extensive experience amongst researchers with storage ring X-ray techniques [16], many of the first experiments [17] applied well-established methods, such as X-ray spectroscopy and scattering, but in a time-resolved manner, taking advantage of the ultrashort pulse durations to measure dynamics in matter [18][19][20][21]. As experience with the facilities has increased in recent years, new techniques have been developed, including diffract-before-destruction methods, where the short X-ray pulse scatters from the sample before the atoms can move [22], providing the ability to measure room-temperature, radiation-damage-free structures. This ability has been applied to develop a technique called serial femtosecond crystallography (SFX), where a stream of tiny protein crystals is delivered into the focus of the XFEL, and, though the intense X-ray pulse destroys the crystal, its diffraction pattern is measured before the crystal is destroyed [23,24]. These facilities are still in their infancy, with the first hard X-ray FEL only in operation since 2009 [25], but even in the few short years since their arrival they have attracted significant interest from researchers around the world, with the result that several new XFEL projects are underway worldwide. Here we present an overview of an XFEL project located in Switzerland, which is expected to welcome its first users in 2018.
The SwissFEL XFEL facility is located at the Paul Scherrer Institute [26] (PSI) which is the Swiss national laboratory home for large-scale accelerator-based user facilities. It includes a 3rd-generation synchrotron light source (SLS), the Swiss Muon Source (SµS), the Swiss Spallation Neutron Source (SINQ), and a high-intensity proton accelerator (HIPA). The SwissFEL construction was preceded by an intense R&D period, with the goal to allow for a very compact and economical design, and to have several features which are unique amongst the XFEL facilities presently in operation or under commissioning worldwide. In this review we highlight SwissFEL's expected capabilities and how it fits into the worldwide XFEL community. This article is organized into several sections: Section 2 covers the beam dynamics, injector, linear accelerator, undulator, and beam diagnostics components of the accelerator; Section 3 describes the X-ray optics, photon diagnostics, and experimental laser systems of the photon beamlines; Section 4 provides details on the experimental stations and their instruments, with a subsection on the 2D X-ray detectors available at the facility; finally Section 5 summarizes the infrastructure common to all aspects of the project, including timing and synchronization, motion control and data acquisition.

Accelerator
The fundamental design concept behind SwissFEL is to construct an X-ray Free Electron Laser, capable of lasing at 1 Å, but with investment and operation costs substantially reduced in comparison with other facilities of similar scientific potential. In the following sections we will describe the accelerator components of SwissFEL, illustrating how the project has been able to achieve its goals without sacrificing performance. The accelerator layout is shown in Figure 1.

Beam Dynamics and FEL Concept
The overall design goal of SwissFEL was to build a compact facility to produce FEL pulses down to 1 Å wavelength, with the lowest electron beam energy suitable to drive the FEL. This is constrained by the design of the undulator where a short undulator period (λ u ) reduces the required electron beam energy (γ) to fulfill the resonance condition of the FEL [27] with and undulator strength K = 0.93 · B[T] · λ u [cm] in order to lase at a wavelength of λ = 1 Å. For a compact, in-vacuum undulator [28] we assumed that a period of 15 mm and an undulator K value of 1.2 are feasible. The FEL resonance condition then dictates that the maximally required beam energy to be provided by the linear accelerator is 5.8 GeV. With the nominal beam energy defined, the design value of the beam emittance ( n ) can be estimated from the condition [29] n γ ≈ λ 4π (2) to be met for all electrons to radiate into the fundamental mode of the FEL. This is, however, a rather soft limit, as larger values simply lead to a reduced coherence of the FEL output beam [3] and lower pulse energies. For the design we assumed a target emittance of 430 nm for the longitudinally central parts of the beam. The second consideration concerns the wakefields within the undulator [30,31], which alter the electrons' local mean energy, thereby shifting them away from the resonance condition of the FEL. With an undulator gap of 4.4 mm for the nominal K of 1.2 the dominant wakefields are caused by the finite conductivity of the vacuum chamber. For the chosen material, copper, the characteristic length of the resistive wall wake potential is about 7.6 µm, resulting in a parabolic shape of the wakefields with a length of 20 µm. The mean energy loss can be compensated with a linear taper of the undulator, which recovers 90% of the FEL performance as calculated without wakefields or taper [32]. The SwissFEL machine parameters are listed in Table 1.
The basic operation mode requires a bunch with charge 200 pC, which is compressed in two stages to realize a peak current of 3 kA. The overall compression scheme is based on the stipulation that the wakefields of the C-band structures remove the induced energy chirp needed for the final compression [33]. This approach avoids wasting additional radio frequency (RF) power to remove the chirp actively by off-crest acceleration. To provide shorter but more efficient FEL pulses (in the sense that the number of emitted photons per electron is increased) SwissFEL can operate down to 10 pC bunch charge, starting with a shorter and smaller but brighter beam from the source [34]. Besides this flexibility of tuning to any bunch charge between 10 and 200 pC, SwissFEL offers two special modes. In the first a pulse similar to the one for the nominal 200 pC mode is generated, but with a large correlated energy chirp [35]. This is achieved by overcompressing the bunch in the last compression stage. In this case the wakefields in the main linac now add up to the reversed chirp, resulting in a peak-to-peak energy chirp of 1 to 1.5% at 5.8 GeV. The quadratic dependence of the photon energy on the electron energy Equation (1) yields a chirp in the photon pulse twice as large. The other special mode consists in the full compression of a 10 pC pulse to achieve sub-femtosecond FEL pulses. To avoid the transport of a high peak current through the main linac, which could degrade the beam quality due to the space-charge field [36], the full compression is achieved in the energy collimator right before the undulator, where a certain control over the energy-dependent path length of the electrons is given. The SwissFEL accelerator is designed to drive a second beam line called Athos, providing FEL pulses in the soft X-ray regime between 5 and 0.65 nm wavelength. In the two-bunch operation mode, the machine simultaneously accelerates two electron bunches at 100 Hz, with 28 ns spacing between the two bunches. The Athos beam is extracted at around 3 GeV to allow for the independent tuning of both lines (see Figure 1). With an undulator periodicity of 38 mm it is not required to place the magnet array in vacuum. This in turn opens up the possibility of a more advanced design of the undulator, with better control and tunability of polarization, on-axis field and transverse gradient [37] as compared to the Aramis hard X-ray undulator, which is strictly planar. Another important distinction with respect to Aramis is the shorter length of the undulator modules and the inclusion of delaying chicanes between modules. The inter-undulator chicanes and the special undulator configurations give access to novel operation modes with improved control over power, pulse length, bandwidth and temporal coherence [38][39][40][41][42].

Injector
The generation and preservation of very high brightness electron beams able to drive an FEL requires particular care at the source and in the low-energy section of the machine. The electron source determines the best obtainable emittance at the FEL undulator line and hence the FEL performance. The SwissFEL injector consists of a 2.5-cells S-band (3 GHz) RF photoinjector gun followed by an S-band booster linac providing the necessary energy gain before the first compression stage (BC1). The PSI RF photoinjector gun [43] generates high brightness electron bunches with an energy of 7.1 MeV, an intrinsic emittance of 0.55 µm/mm and a peak current of 20 A. An IR Yb:CaF 2 laser system operating at 1040 nm with frequency multiplication to 260 nm drives the Cs 2 Te coated copper photocathode installed in the backplane of the RF gun. A detailed description of the gun laser system is given in Section 2.2.1.
The ensuing booster linac consists of two sections. In booster 1 two S-band traveling-wave cavities [44] accelerate the electron beam on crest up to an energy of 150 MeV. After this first acceleration stage a set of five quadrupole magnets allows matching the optical functions through a laser heater chicane, whose purpose is the controlled enhancement of the uncorrelated energy spread of the beam to mitigate micro-bunching instabilities in the bunch compressors [45]. Another set of five quadrupoles follows the laser heater modulator undulator to control the matching into booster 2. The second booster section consists of two S-Band RF modules, each including one klystron amplifier and two accelerating cavities. In booster 2 the electrons are accelerated off crest, up to an energy of 345 MeV, to provide the necessary energy-time correlation needed for the longitudinal compression of the bunches. Enough space has been reserved to allow future energy upgrades with a third RF accelerating module. The focusing along booster 2 consists of three FODO cells with 11 m period. To suppress the second-order energy-time correlation two X-band RF cavities (4th harmonic of S-band) [46][47][48] running in decelerating mode precede the 13.5 m long compression chicane, which is typically set to yield compression factors between 10 and 15. The final nominal energy of the injector is 320 MeV.
The compact SwissFEL design hinges on the small beam emittance provided by the injector. Therefore a great deal of experimental effort, carried out mainly at the SwissFEL Injector Test Facility [49], has gone into the characterization and optimization of the emittance at the source [50][51][52], as well as its preservation under acceleration, transport and compression. The starting point of our injector optimization is the effective working point found by Ferrario et al. [53] during the redesign of the Linac Coherent Light Source (LCLS), further refined for the SwissFEL case by numerical optimization [54]. The main empirical tuning steps toward minimal emittance consist in achieving the optimal laser spot size on the cathode with homogeneous transverse and longitudinal pulse profiles, the adjustment of the relative phase between laser injection and gun RF, the optimal setting of the gun solenoid excitation current, the correction of coupling terms by means of small (regular and skew) quadrupole magnets integrated into the gun solenoid as well as further solenoid magnets [55], the centering of the orbit in the S-band booster structures and the correction of spurious dispersion downstream of the booster [56]. For compressed beams special care must be taken to keep adverse effects from coherent synchrotron radiation in the compression chicane under control, e.g., by ensuring a small transverse beam size in the last chicane dipole or by adopting a shallow bending angle for the compression. Our studies also revealed a strong sensitivity of the final slice emittance on the beam optics upstream of the bunch compressor. Therefore a small optics mismatch along the longitudinal position of the bunch turns out to be of great importance for the preservation of the emittance under compression [57].
The normalized slice emittance at the end of the injector with uncompressed beam is expected to be around 0.2 µm for a bunch charge of 200 pC, and nearly preserved under moderate compression (see Reference [49] for details).

Gun Laser
Compact and industrial-grade laser systems with high power stability and ultra-low timing jitter have become a key component in free electron lasers. At SwissFEL the drive laser for the electron gun consists of solid state Yb:CaF 2 chirped pulse amplifier. For electron production the stability of the drive laser plays a crucial role. While Ti:sapphire lasers are standard technology used in many FELs around the world, we considered an Ytterbium-doped gain medium. This laser system offers exceptional long-term amplitude stability, low intrinsic timing jitter, a compact design and very high up-time. The Yb-doped laser is pumped with a telecom-standard semiconductor diode emitting at 976 nm. Such pump diodes are favourable in view of long-term performance and low maintenance costs. The oscillator delivers sub-200 fs, transform-limited soliton pulses centered at 1041.3 nm with an amplitude stability of 0.19% rms over 18 hours. The measured free running jitter of 6.3 fs rms (integrated over 1 kHz to 1 MHz) is ultralow. The system can be actively synchronized with an RF reference signal with a locked timing jitter of 18 fs rms (10 Hz-1 MHz).
The oscillator seeds a commercial Yb:CaF 2 regenerative chirped pulse amplifier system. The amplifier is pumped with a single CW diode module delivering high power at 980 nm. This provides high reliability and a long lifetime of up to 20,000 h. After amplification to 2.4 mJ the stretched pulse is compressed to 700 fs FWHM by means of a transmission grating pulse compressor. Temporal drifts of the chirped-pulse amplification (CPA) system are compensated by employing a feedback loop which stabilizes the drift to <32 fs rms over 250 min. For UV generation two home-made nonlinear frequency conversion stages based on BBO crystals are employed which provide pulses of up to 600 µJ at 260 nm. To lower the electron beam emittance the Gaussian-like temporal pulse shape is transformed into a flattop-like pulse by a set of four birefringent α-BBO crystals. Three different sets of crystals provide the three pulse durations of 3.6, 6.7 and 10 ps for electron bunch production. For transverse beam shaping a variable circular aperture is used to produce a truncated Gaussian beam profile which is imaged over a 20 m distance onto the Cs 2 Te cathode. At the cathode a pulse energy of approximately 100 nJ is used to produce the 200 pC charge.
A small part of the chirped amplified infrared laser beam (150 µJ) is split, compressed (40-50 ps) and directed to the laser heater. Overlapped with the electron bunch in time and space the scheme allows the energy spread of the electrons to be increased to avoid unwanted coherent radiation downstream of the linear accelerator.

Linac
The main acceleration of the electron beam is achieved in a C-band linac that increases the beam energy up to 5.8 GeV. The linac is divided into three segments: linac 1, linac 2 and linac 3. After linac 1, the electron bunches from the injector are further compressed in a second bunch compressor (BC2) at an energy of 2.1 GeV. At the end of linac 2, at an energy of 3.15 GeV, a switch-yard [58] is installed with which electron bunches can be sent either straight into linac 3 and subsequently the Aramis hard X-ray beam line, or into the Athos soft X-ray beam line, currently under construction. The accelerator scheme is shown in Figure 1. The switch-yard allows the parallel operation of both undulator lines at the full design repetition rate of 100 Hz. This is accomplished by generation of two electron pulses from the injector separated by 28 ns, both accelerated up to 3.15 GeV before separation. At the end of linac 3, two C-band transverse deflecting structures (TDS), provided by Mitsubishi Heavy Industries Mechatronics Systems, allow for measurements of the longitudinal charge profile with a resolution of a few femtoseconds.
The linac consists of a total of 26 C-band modules, where each module comprises four C-band structures that are mounted onto two granite girders (see [59] for a schematic and [60] for further information). The C-band structures [61] were stacked and brazed at PSI [62] from copper cells manufactured at VDL ETG (J-couplers) and VDL ETG Switzerland (regular cells) with micrometer precision using ultra-precision diamond milling and turning. This process renders further tuning steps of the structures unnecessary while still achieving excellent field flatness and phase advance errors (see [59] for an example). The achieved structure straightness is excellent: the maximum measured deviations from a straight line are typically below 20 µm, at the resolution limit of the applied laser tracker. In addition to the four structures, each linac module also comprises a barrel open cavity (BOC) RF pulse compressor [63], machined and brazed at PSI [64]. See Figure 2 for a photo of linac 2 installed at SwissFEL. Most parts of the waveguide distribution and the BOC pulse compression cavities are mounted on the granite support girder. This allowed for preassembly of most of the linac vacuum system in a cleanroom, while only the interconnects between girders and the waveguide run to the klystrons have to be done in the tunnel.
The produced structures have been sorted according to their resonance frequencies, as determined by RF measurements, with the goal of assigning four similar structures to the same module. This grouping is necessary since all structures of one module are cooled and temperature stabilized to the millikelvin level by a single cooling station. Another advantage of the structure sorting is that the RF power overhead required to compensate for the loss in energy gain by deviating slightly from their beam synchronous frequencies is less than 1%. Supplying four structures with a single RF power source represents a challenge for the waveguide network, furnished by Mitsubishi Heavy Industries Mechatronics Systems: the mechanical fit demands a mechanical tolerance of 200 µm between the structures, and the phases at the structure entrances must match within a few degrees. The first requirement was ensured by the manufacturer during the production process by measuring the dimensions of the individual waveguide components and providing accordingly machined correction pieces. To achieve the correct phase relations at the four structures, the complete horizontal waveguide network was assembled and moved away from the structures to measure the phase relations, which were then corrected through suitable deformations of the waveguides.
Linacs 1 and 2 are powered by Type-µ modulators manufactured by Ampegon, whereas linac 3 uses PSI C-band series modulators M1071 provided by ScandiNova. Both modulator types use IGBT for high voltage switching and very precise charging circuits. This allows the pulse-to-pulse voltage variation to be kept well below 20 ppm. All modulators drive Toshiba klystrons of type E37212. The E37212 klystron was specifically developed by Toshiba for an increased pulse length and average power rating in comparison with former C-band tubes. It delivers up to 50 MW with 3 µs pulselength at 100 Hz. The nominal operation point in SwissFEL is 40 MW, thus a 25% power margin is maintained. Furthermore the E37212 is operated with the collector water cooling circuit at 80 • C output temperature. This allows to recuperate the power lost in the collector for use in the PSI building heating network. The installation and commissioning of the main linac RF power stations [65] started in 2016 and will continue through 2017. During this process the beam energy is successively increased as more modulators become available.

Undulator Line
The Aramis undulator line of SwissFEL, shown in Figure 3, consists of 13 in-vacuum undulator modules with 4 m length and 265 periods of 15 mm each. High-performing NdFeB permanent magnets with diffused dysprosium (Hitachi metals; remanence B r = 1.25 T, coercivity H cJ = 2400 kA/m) and poles with a trapezoidal geometry made out of Vacoflux 50, Vacuumschmelze to focus the field on the beam axis, provide a peak field of B = 1.3 T (corresponding to a K value of 1.8) at a minimum gap of 3 mm. Thanks to a reduced pole tip width of 15 mm the magnetic forces can be limited to 25 kN (corresponding to the weight of 2.7 metric tons), under which a gap adjustment precision better than 1 µm is needed. The undulator module design was made by PSI in close collaboration with industry to include specific manufacturing know-how right from the beginning. The production of the modules was carried out by our industrial partners (Daetwyler Industries (Huntersville, NC, USA), RI, VDL, Comvat (Sennwald, Switzerland), Schaeffler Schweiz GmbH (Romanshorn, Switzerland), EPUCRET (Wangen, Germany), Agathon, Rollvis (Plan-les-Ouates, Switzerland)) but the optimization and characterization of the magnet structures were performed in the undulator laboratory inside the SwissFEL building at a rate of one undulator module per month.
An optimization of quality and cost in the early conceptual phase resulted in the following main design principles: a closed O-shaped support structure with cast mineral material, a wedge-based drive system, a common, modular design for in-vacuum, standard or APPLE II configurations, and a magnet keeper design enabling fast field optimization. Further constraints were the requirement for transport without crane and the target beam height of 1.2 m. The closed support structure was chosen because of the superior stiffness compared to a standard C-structure when accessibility for magnetic measurements and pre-installations of vacuum chambers are not an issue. The high stiffness is transferred to the I-beam by a small angle wedge system, a novel concept in undulator design. With our industrial partners we produced a full-size prototype in 2013. With a 70% support by bearings the height of the I-beam can be reduced, and the wedge works as a gear reduction. The drive system only consists of a servomotor and a satellite roller screw with a small pitch of 1 mm per turn. Two wedges move against each other, synchronized by the Beckhoff motion control system. The I-Beam is fixed in the longitudinal direction by a central guiding rod (Agathon). The backlash-free system allows gap changes with a reproducibility of 0.4 µm. The gap position is monitored by absolute linear encoders.
Twenty columns (Comvat) with integrated differential screws provide for the connection to the magnet arrays through the vacuum vessel produced by VDL. The top columns are shifted with respect to the lower ones, which reduces the critical variation of the gap (with an exponential field dependence) but comes at the price of a (less harmful) non-straightness of the magnetic field axis following a hyperbolic cosine dependence.
To meet the critical time schedule and to achieve optimum results in terms of magnetic field profile, a block keeper was designed and realized from extruded aluminum, which allows all magnet-pole pairs to be adjusted in height. An accuracy of better than 1 µm can be achieved with the 3 • wedge shown in Figure 4. The pole height can be tuned within ±30 µm by means of a flexor system, enough for the shimming of all 13 undulators. The magnet arrays on the in-vacuum I-beams have been assembled aligned and pre-measured by RI.
Magnetic field measurements and local field corrections are carried out with an integrated measurement bench based on the SAFALI system developed for measurements of cryogenic undulators [66]: After defining two parallel axes by means of a pointing stabilized laser, the system uses two pinholes around the Hall probes and two position sensitive photodiodes to detect and correct for horizontal and vertical positon as well as pitch in a closed loop with 20 µm accuracy. A custom-made, low-noise Hall probe with a novel ceramic support was developed by SENIS to meet the stringent demands given by the small gap and the required accuracy [67]. For the transport of the undulators inside the SwissFEL building an air-cushion vehicle (AEROFILM Systems) allows for smooth and precise positioning of the undulators onto the camshaft mover system. The 5-axis camshaft movers allow for adjustments of the module with respect to the reference axis. The straightening of the magnetic axis and the correction of long-range errors are accomplished with the adjustable columns. Local field corrections are automatically corrected by an integrated screwdriver robot; the fine adjustment of all magnets in a single module takes slightly more than one hour. All corrections, columns and local keeper are model based and result in a straightforward field optimization. For the installation of the vacuum vessel, however, the magnet array has to be disassembled. At the level of precision needed for the hard X-ray FEL the columns have to be readjusted afterwards using a similar measurement setup, but adapted to the limited space available inside the vessel. Field maps at various gaps provide the raw data needed for modelling the operation of the undulators [68].
Finally, dedicated small alignment quadrupole magnets, realized with permanent magnets, are located at the entrance and exit of each undulator module and adjusted to the magnetic axis. They can be moved in and out with pneumatic drives and are used in conjunction with the module's camshaft mover system for the beam-based alignment of the undulator modules during beam commissioning. This approach is inspired by commissioning work at the LCLS, where the quadrupole magnets in the intersections are used for the alignment of the undulator modules [69]. Since in our case no transfer via any mechanical fiducial system is involved, the achievable accuracy is expected to be better than 20 µm.

Accelerator Instrumentation
SwissFEL has a wide range of instruments that perform measurements on the electron beam properties, help set up different operation modes, and monitor the stable operation of the accelerator. Many of these diagnostics have been specifically developed to meet the stringent requirements of SwissFEL for beam quality and stability. A common design goal for the diagnostics is the relatively low bunch charge at SwissFEL, which ranges between 10 and 200 pC. In several cases, these requirements have led to the design of novel diagnostics or to iterative improvements on existing designs.

Bunch Charge
The total charge of the electron bunches influences several parameters of the accelerator, and its measurement is required to adjust the electron beam optics in the space-charge dominated region in the injector, the proper compensation of wake fields in the accelerating cavities, and finally the FEL process in the undulators. It is also a legal requirement to monitor and record the total charge accelerated by SwissFEL for radiation protection reasons.
The primary measurement of the electron bunch charge is provided by integrating current transformers (ICTs). There are two types of ICTs used at SwissFEL. The first is a conventional ICT, with BCM-IHR readout electronics for reading the total charge from the gun. The second is the Turbo-ICT, developed for the SwissFEL two-bunch operation, with BCM-RF-E readout electronics for signal processing of the bunch charges. The conventional ICT is calibrated for a charge range up to 800 pC [70], whereas the Turbo-ICT is calibrated on the Turbo-ICT/BCM-RF calibration test bench [71] for charges up to 300 pC.
The bunch charge is also monitored with beam position monitors, as described in the following section.

Orbit
The stabilization of the electron beam trajectory throughout SwissFEL is crucial for an optimal beam quality: In the accelerator the proper alignment with respect to the accelerating cavities and quadrupoles minimizes transverse wakefield effects and residual dispersion. In the undulator line the BPMs are essential to steer the electron beam on a straight line to keep the overlap between electron and photon beams.
Beam position monitors [72] (BPMs), based on dual-resonator cavity pickups, measure the beam position in a dipole cavity, while using the signal from a monopole cavity for charge normalization. Injector, linac and transfer line pickups operate at 3.3 GHz with a relatively low loaded quality factor (Q L ) of 40 to resolve the two bunches of the SwissFEL, which are separated by 28 ns when operating both Athos and Aramis simultaneously. The pickups in the undulator line, where only a single bunch is present, work at 4.9 GHz with a higher Q L of about 1000 to achieve better position resolution. The low-Q pickup signals are converted directly to baseband, the high-Q signals to an intermediate frequency of 135 MHz. After sampling with fast 16-bit analog-to-digital converters (ADCs), the digitized signals are extensively post-processed in field-programmable gate arrays (FPGAs) to correct systematic measurement errors, yielding position readings with submicrometer resolution.
The signal arising from the monopole cavity is also used to monitor the bunch charge. It is processed and digitized with low noise, resulting in a charge-independent relative resolution well below 0.1% [72]. At very low charges an absolute resolution of a few fC is achieved.
BPMs at locations with suitable (moderately low) dispersion, e.g., in bunch compressor chicanes near the first and last bending magnets, are also used to measure the electron beam energy.

Emittance
Together with the short undulator period, the small normalized emittance of SwissFEL enables the generation of high-energy photons at a lower electron energy than at the first XFELs [25,73], thereby significantly reducing building size and overall facility cost. The generation of a low-emittance beam at the electron source, as well as the measurement of the emittance along the accelerator to ensure its preservation, are thus important elements for the successful operation of SwissFEL.
Scintillating transverse profile imagers are used to measure the beam profile at several locations along the beam line. SwissFEL uses a novel geometry to image the beam on scintillating crystals, which aims for the suppression of unwanted coherent optical transition radiation (COTR), but allows for a good resolution over a large field of view [74]. The emittance measurement is performed by scanning the electron beam optics while observing the beam profile (see, e.g., [56]).
As a complement to these viewscreens, wire scanners will be used in SwissFEL to measure the transverse electron beam properties. The wire scanners will perform a monitoring of the beam profile along the horizontal and vertical direction either with high spatial resolution-when the 5 µm tungsten wires are used for the scan-or with minimal perturbation of FEL operations-when the 12.5 µm aluminum wires are used instead [75].

Energy Spread
The operation of an FEL demands tight control over the electrons' energy spread: an excessive energy spread in the undulator impedes the FEL process, but a value that is too small may give rise to the coherent emission of synchrotron radiation in the bunch compression chicanes, potentially resulting in beam breakup.
In the bunch compressors the energy spread can be measured by inserting scintillating screens into the dispersed electron beam or by imaging the synchrotron radiation emitted in one of the dipole magnets. At SwissFEL SCMOS cameras (PCO Edge 5.5), equipped with a f = 300 mm lens of 107 mm diameter to avoid vignetting, are installed in both magnetic chicanes to image the synchrotron radiation light emanating from the third dipole of the chicane. As these synchrotron radiation detectors are completely non-destructive they will be used for the routine monitoring of the beam energy and energy spread as well as for the optimization of the bunch compression setup [76,77].
Furthermore, a precise measurement of the energy spread in the injector can be performed by observing the degradation of the coherent modulation of the beam following the laser heater. This measurement will be performed by monitoring coherent transition radiation at a photon energy which is an integer multiple of the laser heater photon energy [78] (see Section 2.2.1).

Time-Resolved Measurements
The electron bunch length and current profile are measured by directly streaking the electron beam with transverse deflecting RF cavities [79], installed at suitable locations in the accelerator beamline, and observing the streaked beam with regular transverse profile monitors [80,81]. The same method also allows the time-resolved measurement of emittance and energy spread along the bunch (so-called "slice" parameters).
Complementary to the transverse RF deflector, an effective streaking in both transverse directions all along the accelerator can be achieved by introducing dispersion to an energy-chirped beam [82].

Bunch Arrival Monitoring
The monitoring of the bunch arrival time is important for maintaining the longitudinal stability of the linac. The bunch arrival-time monitors (BAMs) [83] developed for SwissFEL provide non-destructive, shot-to-shot arrival time information relative to a highly stable pulsed optical reference (see Section 5.1) with resolution better than 5 fs and less than 10 fs drift per day [84,85]. The electron beam generates an S-shaped bipolar transient with a steep slope (15 ps peak-to-peak) in a pick-up with 40 GHz bandwidth [86]. This pickup-signal is probed by a single reference laser pulse and the arrival time is encoded in its amplitude. The bunch arrival-time monitors are used for feedback on machine parameters with impact on the arrival time, such as the accelerating cavity amplitudes and phases. By measuring the electron arrival time after the last undulator, the BAM allows event correlation for the experiments at the fs level.

Bunch Compression Monitoring
In addition to the destructive bunch length measurement with transverse deflecting cavities and screens, a non-destructive online monitoring of the compression process will be performed by a spectral analysis of the coherent radiation emitted at the edge of the bunch compressor dipoles.
At the first bunch compressor this radiation occurs in the THz spectral range and is monitored by two Schottky diodes, each equipped with a different high-pass filter to select specific wavelength regions. These detectors have been demonstrated to provide excellent sensitivity with good signal-to-noise ratio, therefore enabling very accurate measurements of accelerator changes [87].
Radiation emitted by the sub-picosecond bunches after the second bunch compressor is in the far infrared spectral region. At this location the bunch compression will be monitored by a spectrometer equipped with 32 mercury cadmium telluride (MCT) detectors.
In the sub-femtosecond pulse mode of SwissFEL (see Section 2.1) the final compression of the electron bunches takes place in the energy collimator chicane before the undulator line. Again a spectrometer will be used to analyze the coherent edge radiation, in this case reaching the near-infrared and visible regions of the spectrum.

Loss Monitoring
Electron beam losses along the accelerator give rise to radiation damage of accelerator components and may disturb accelerator performance by inducing measurement backgrounds. To protect the machine from excessive radiation we monitor such losses by measuring Cherenkov light emitted in fused silica fibers installed along the accelerator beamline. The loss location can be determined from the time of arrival of the light at the photodetectors.

First Commissioning Experience and Outlook
A detailed summary of the commissioning of elements of SwissFEL in the former SwissFEL test facility can be found in [49], here we will focus on our recent commissioning activities after installation in the facility, including the generation of our first FEL photons. The commissioning of the electron gun started in August 2016. Once the electron source was operating, electrons were further accelerated with two S-band RF stations to an energy of 145 MeV and transported to the injector beam dump for the first time in early September 2016. At that time only the first two S-band RF stations were available. Soon after the first injector transmission, however, the first of the linac C-band modules could be integrated into the acceleration process, thereby increasing the available beam energy to about 380 MeV. The first transmission through the entire accelerator including the undulator line was achieved at this energy in mid-November. The initial commissioning of essential accelerator instrumentation systems (charge and beam position monitors, screens) was also performed at this energy.
For the occasion of our official inauguration event in December 2016 an attempt was made to lase with the 380 MeV beam. To reach a sufficient charge density the beam was somewhat compressed in the first bunch compressor, while the accrued energy chirp was compensated for in the one available C-band module. After some further tuning, characteristic FEL radiation from the SASE process could be observed with a photodiode located after the undulator line. The photon wavelength derived from the beam energy and the undulator parameters was in the UV range (24 nm or 50 eV).
By mid-2017, all injector RF stations as well as two more linac RF stations had become operational, pushing the beam energy close to 1 GeV. This resulted in successful SASE soft X-ray operation at 4.1 nm (300 eV) in May of 2017 (see Figure 5). In the following months the beam energy will be further increased step-by-step in accordance with the availability of the remaining RF stations. First pilot experiments are foreseen at a beam energy of 3 GeV towards the end of 2017, with hard X-ray user operation in 2018. ). An image of the photon beam at saturation, as recorded with a Ce:YAG scintillating screen, is shown on the right.

Photon Beamlines
The Aramis branch of SwissFEL is designed to produce photons from 1.77-12.4 keV (1-7 Å), at 100 Hz repetition rate, <50 fs pulse duration (FWHM), and around 10 12 photons/pulse (see Section 2.1 for more details). In order to allow users to take full advantage of the unique properties of these photons, including the ultrashort pulse durations and the spatial coherence of the beam, careful design of X-ray optics and diagnostics is necessary. This is especially challenging at SwissFEL since the photon beamlines need to cover the "tender" X-ray photon energy range from 2-5 keV, which is unique amongst XFELs and requires careful beamline design. In addition to X-ray optics (Section 3.1) and diagnostics (Section 3.3), this section includes descriptions of the pulse picker (Section 3.2), to allow users to select the X-ray pulse frequency, and the experimental laser systems (Section 3.4), to allow users to perform pump-probe experiments. We will focus on describing the components in the Aramis-1 and Aramis-2 beamlines which will be the first two operational beamlines ready for user operation in 2018.

X-ray Optics
Free Electron Lasers are by design single user machines in the sense that every electron bunch serves only once as a source of light. This is in contrast to storage rings, where a finite number of bunches circulate for many hours, or even days, and repetitively deliver photons to many beamlines in parallel. From this it is evident that FELs can supply only one beamline at a time, meaning that beamtime is quite expensive and in high demand.
To make full use of the valuable beamtime it is mandatory to have several experimental setups in parallel with the ability to switch between them in a fast and reproducible way. The beamline design [88] has to provide the ability to alternate between several experimental stations, while giving full access to the unused experimental hutches. This is achieved with the help of pairs of offset mirrors (OM) in front of the beamline as shown in Figure 6. They are located as far upstream as possible to achieve a reasonable lateral separation at the end. The beam is subsequently directed towards two independent double crystal monochromators (DCM) and finally focused by sets of bendable Kirkpatrick-Baez mirrors [89] (KB) to the experiments. Two instruments are installed in line at experimental station Alvra on Aramis-1 (see Section 4.1) and will be operated by changing the focal distance of the KB system. A similar pair of KB mirrors are installed at experimental station Bernina on Aramis-2, but as instrument exchange is accomplished using a rail system perpendicular to the photon beam, all three planned instruments can take advantage of the minimum focus of the mirrors (see Section 4.2). A pair of harmonic rejection mirrors (HRM) after the DCM is foreseen in the Aramis-1 beamline from the beginning and as an optional extension for the Aramis-2 beamline. The Aramis-3 beamline is not yet specified and is under design concept phase in combination with the third experimental station, Cristallina. As one option, a simple pink beam beamline without monochromator and nanometer focusing at the end is considered and is shown in Figure 6. A set of two horizontally deflecting offset mirrors direct the beam into the Aramis-1 beamline with a total deflection angle of 12 mrad. The central Aramis-2 beamline stays in the direction of the FEL beam and uses two vertically deflecting offset mirrors in a zigzag geometry. For Aramis-3 a second pair of horizontal offset mirrors with a total deflection angle of 8 mrad is considered as worst case scenario with respect to spatial restrictions along the beamlines and the end stations.
All offset mirrors are coated with low-and mid-Z materials to prevent single shot damage by the intense FEL beam [90][91][92]. However, this limits the deflection angle and two mirrors with small deflection angles instead of a single one with large deflection angle became necessary. The mirrors are coated with two bilayers leaving a blank area of uncoated silicon between them. The low-Z bilayer, 10 nm B 4 C on top of 36 nm SiC, should withstand the FEL beam at all photon energies and reflect over the full energy range of the FEL. Its B 4 C-layer is effective at lower photon energies and prevents the drop in reflectance at 1.8 keV due to the silicon K-edge absorption of the subjacent SiC-layer. At higher photon energies the B 4 C layer becomes transparent and reflectance is supported by the SiC layer with a critical energy of 12.4 keV. The mid-Z bilayer, 15 nm B 4 C on top of 20 nm Mo, extends the operation range up to the Mo K-edge at 20 keV but has a higher damage risk and may be used only at reduced fluence. In between both coatings a stripe of uncoated silicon serves as third reflecting area. It has the lowest critical energy of all coatings and may be used at low energies when high harmonic rejection becomes an issue. All mirrors are mounted in benders with two actuators, allowing bending radii from flat to ±10 km. By this, the offset mirrors can produce a line focus at the experiment stations.
Both beamlines include double crystal monochromators, each containing three pairs of crystals. Two pairs of silicon crystals, Si (111) and Si(311), are foreseen for standard and high resolution applications. An additional pair of InSb(111) crystals extends the wavelength range up to 7 Å (1.77 keV). The crystals are mounted on a common Bragg-rotation axis that sets the Bragg angle for both crystals from 5 • to 80 • . The translation of the second crystal perpendicular to its surface allows for a constant beam offset of 20 mm as well as for a variable beam offset in the harmonic rejection mode. The second crystals are long enough to omit the translation parallel to their surface and therefore the beam spot moves along the second crystal while the photon energy is scanned. As the average heat load on the crystals is quite low, a side cooling or even intrinsic cooling scheme is not required.
However, for temperature stabilization the first crystals are mounted on a common water-cooled copper block. The second crystals are temperature stabilized via copper braids connected to this block.
To allow for experimental flexibility both beamlines must be able to operate in both monochromatic and broad bandwidth (pink) beam modes with the same beam path downstream of the monochromator. The switching from monochromatic mode to pink beam mode is accomplished in two different ways as sketched in the insets of Figure 6. Aramis-1 has to retract the crystals as well as the HRMs, passing the beam untouched through both vessels, whereas Aramis-2 has to retract the crystals and instead insert the OMs into the beam path. Both methods differ in the number of optical elements that are in the beam at a time. Aramis-2 has always two optical elements in the beam, not counting the retractable refocusing KB mirrors. Aramis-1 utilizes two optical elements in pink beam and six optical elements in monochromatic mode. This rather large number of optical elements became necessary to improve the spectral purity in monochromatic mode. It is accomplished with the help of the two HRMs directly downstream of the DCM-1. Both HRMs are mounted in a fixed distance but the height of the first HRM as well as the beam offset in the DCM are variable. When setting a new deflection angle both mirrors are rotated. Due to the fixed separation of both mirrors, the height of the first HRM and the beam offset must be set to keep the beam with the new deflection angle in the center of the second (fixed height) HRM.
A pair of retractable KB mirrors is foreseen for refocusing in both beamlines. They combine achromaticity with a high throughput. The KB mirrors with 500 mm optical length and B 4 C/Mo-coating are bendable and operate with two sets of deflecting angles. Above 4 keV a deflection angle of 8 mrad improves reflectance and below 10 keV a deflection angle of 12 mrad increases the acceptance. By this an acceptance of more than 5σ can be achieved down to 2.5 keV decreasing to 3.5σ at 1.8 keV. The surface quality of the mirrors must be extremely good to reflect the FEL beam without deteriorating the wavefront even at the shortest wavelengths. According to the Maréchal criterion, the maximum allowed rms-profile error σ in a beamline with N mirrors and grazing incidence angles θ must not be larger than λ/(2 × 14 √ N sin θ). This condition must be met over the illuminated length of the mirror. As the beam divergence is proportional to the photon wavelength, the central part of the mirrors must have the highest quality while its outer parts are only illuminated at longer wavelengths where the Maréchal criterion tolerates larger surface errors. Figure 7 shows the maximum allowed profile error as a function of the beam footprint, i.e., the length of central mirror part, for a KB mirror in the Aramis-2 beamline.
The beamline performance was evaluated with PHASE, a computer code for physical optics simulations. The results for the Aramis-1 beamline are summarized in [93]. Spot sizes below 1 µm and peak power densities of up to 10 21 W/m 2 can be expected. Due to the larger distance to the focal spot from the KB mirrors, the Aramis-2 beamline has a slightly larger spot size with reduced power density.

Pulse Picker
SwissFEL operates at a repetition rate of 100 Hz. For some experiments it is desirable to have only half or quarter of the base repetition rate or even any arbitrary pulse pattern. The SwissFEL accelerator is capable of producing any pulse pattern by controlling the gun laser but this is undesirable for two reasons: (1) The optimal stability and tuning of SwissFEL is achieved at 100 Hz repetition rate and (2) a non-standard repetition rate would affect other beamlines like the future Athos soft X-ray branch. Therefore an X-ray pulse picker has been designed and developed together with Dynamic Structures and Materials [94]. The pulse picker can operate at a continuous rate of 50 Hz to allow the selection of every other X-ray pulse. Furthermore it can generate any desired pulse pattern. The pulse picker blades, made of tungsten, are individually mounted which allows them to be exchanged in case of damage over time due to ablation by the mJ-level X-ray pulses.
The shutter mechanics are UHV compatible and are installed in a dedicated chamber, which is mounted on a translation stage based on the same design as for the photon backscattering monitor (PBPS, see Section 3.3). The mechanical mount also acts as a heat conductor to transfer the heat from the shutter to the chamber. The shutter is equipped with a Type-K thermocouple and measurements have shown that the temperature of the shutter does not exceed more than 40 • C over ambient temperature, without active cooling and at 50 Hz continuous operation.

Photon Diagnostics
Photon diagnostics for FELs is a new research field that has arisen as a response to the development and increased use of FELs. The SASE process used to generate the X-ray FEL pulses leads to changes in the characteristics of the beam on a shot-to-shot basis. The complicated structure of the machine and the many variables one has to oversee in the experiment are also prone to drifts that need to be measured and controlled. Data collected by researchers needs to be correlated with the intensity, position, spectral, and temporal properties of the FEL pulses to yield a clear picture of the effect that is being observed.
To facilitate the better operation of the machine, and to help the SwissFEL users better be able to use the full capabilities of the photon beam, PSI has implemented a full online photon diagnostics suite meant to measure every property that a researcher might need on a shot-to-shot basis. Wherever possible, the instruments were made for non-destructive measurements in the energy region the experiments are to take place. The devices installed at SwissFEL are presented here, and their capabilities are discussed.

Position and Intensity Diagnostics
The first photon diagnostics devices downstream of the undulators and the beam dump is the gas-based photon beam intensity and photon beam position monitor (PBIG and PBPG). This dual-purpose device, developed by the photon diagnostics group at DESY for hard X-ray FEL pulse characterization [95,96], uses a gas-filled ionization chamber and sets of split electrodes and multipliers to measure the position of the beam and its absolute and relative intensity on a shot-to-shot basis. The gas-based nature of the device leads to non-destructive diagnostics for photon energies between 25 and 12,000 eV, with the transverse position of every X-ray photon pulse position being measured to an accuracy of 10 µm, and the beam flux measured to a relative accuracy of about 1%, and an absolute value accuracy of about 10%. The gas-based detector is always on, but is located before any optics or mirrors in the beamline. The position and flux values measured before the optics section are not the same as the values at the experimental stations, since the intensity and position of the photon beam is affected by the beamline optics. However the position and flux values of the photon pulses at the experimental stations can be easily calculated when the data from the detector is combined with the X-ray transmission values of the beamline.
The next device downstream of the gas detector is the photon backscattering monitor (PBPS). The device, similar to those developed at LCLS [97] and SACLA [98], use thin CVD diamond disks with thicknesses of 30, 50 and 100 µm to scatter a portion of the incoming light onto four photodiodes that are placed out of the path of the beam in a backscattering geometry (see Figure 8). In addition to the device downstream of the gas detector, SwissFEL also has a PBPS placed at the entrance to the KB mirrors before each of the experimental stations, and has the option of being placed behind the experiment. This device measures the relative flux to about 1% accuracy and the absolute position of the beam to about 10 µm accuracy. The thickness of the disks means that the transmission of the incoming X-ray beam is somewhat compromised, with about 15% of the intensity lost at 5 keV. However, the transmission is higher than 90% at photon energies higher than 6 keV, and reaches 95% at energies above 8 keV. Operating the device at energies lower than 4 keV raises the risk of damaging the diamond crystals used for the backscattering due to the amount of energy that would be deposited in them from the incoming X-ray pulses. To allow the PBPS to operate a lower photon energies the disks can be switched out for thinner targets (down to 10 µm) if required. The next device for profile and position measurement of the FEL beam is the photon profile monitor (PPRM). This is a Ce:YAG screen that scintillates when a photon pulse impacts it, with the image relayed to a 100 Hz camera via a mirror and a lens. This setup is destructive since no beam is transmitted through the device, though it can be used as an online diagnostic after the experimental stations where the experiment allows for this. Since this technique is common in both synchrotron [99,100] and FEL [101] facilities worldwide it does not need further discussion. The only unique features of the device are that it sports three different thicknesses of Ce:YAG crystals (30, 50, and 100 µm), and has an optical geometry developed at PSI [74] that has the mirror always being in the same spot relative to the camera, ensuring that any movement we see on the screen comes only from the motion of the beam itself and limiting the damage the mirror may suffer from the FEL beam.
Additional diagnostics are available for pre-SASE beam, mainly used for the setup and commissioning of SwissFEL. The photon diode intensity monitor (PDIM) is a simple Si PIN diode that can be inserted into the photon beam to measure the intensity of the spontaneous radiation before lasing is achieved to measure gain curves from different undulator configurations. The photon spontaneous radiation detector (PSRD) uses an MCP-and-screen setup to acquire profile images of the spontaneous radiation. It is meant to be used behind the Aramis-2 monochromator when the FEL is still emitting only spontaneous radiation to adjust the radiation to the right wavelength. The PDIM and PSRD are not meant for regular use with experiments, and are both destructive.

Temporal Diagnostics
The measurement of the arrival time of the X-ray pulse relative to a laser pulse is crucial for pump-probe experiments that are an important category of research performed at FELs. The monitoring of temporal lengths of X-ray pulses is similarly important for both experiments and for the optimization of the performance of the machine. PSI has installed several diagnostics to monitor and record both of these properties over a wide range of X-ray intensities and photon energies.
The first device is based on techniques developed at LCLS [102,103] and SACLA [104] that measure the arrival time of the FEL pulse relative to a pump laser using spectral encoding. The method works by using a chirped laser pulse that passes through a dielectric substance and with the change in transmission being measured. The wavelength corresponding to the change in transmission is directly linked to the arrival time of the FEL on the dielectric material due to the spectrally chirped nature of the laser beam. As the chirped laser pulse is derived from the same laser beam that is used for the experiment, the time-arrival information can be used to directly sort the experimental data. The photon spectral encoder (PSEN) is located a few meters before the experimental chamber and is projected to have an accuracy of measurement of the arrival time of 20 fs or better. It has a large number of thin membranes of different materials and thicknesses to allow for online measurement of the arrival time over a range of 1-1.5 ps without a significant loss of X-rays for the experiment. However, the device will require a minimum of 5-10% transmission losses to be able to measure the arrival times accurately.
The second device SwissFEL will have for temporal diagnostics is the photon arrival and length monitor (PALM), which uses THz streaking [7,105] to measure both the arrival time and pulse length of the incoming XFEL pulses relative to a THz beam generated from the same source as the experimental pump laser [106], as shown in Figure 9. The method has proven to work well with soft X-rays at FLASH [7] and with hard X-rays at SACLA [107], where the PALM demonstrated measured arrival time accuracies to a precision of about 5 fs [108]. The device measured pulse lengths with an HHG source down to 25 fs rms with accuracies typically between 4 and 10 fs [109]. The device is gas based, and is virtually non-destructive, with X-ray absorption typically being less than 0.1% of the incoming flux. However, unlike the PSEN with its large time window, the PALM has an acceptance window for arrival time measurement that is typically between 400 and 600 fs. If the X-ray/laser timing jitter is larger than this value the PALM requires additional timing information, for example from the PSEN, to be used. Future upgrades are planned to both increase the range of the PALM and to improve the time resolution of both the arrival time and pulse length measurements.

Spectral Diagnostics
As with the beam position, intensity, and temporal properties, the spectral content of the SASE beam changes on a shot-to-shot basis. Since both experimental data analysis and accelerator operation often benefit from high-resolution spectral information about the FEL beam, the SwissFEL photonics team designed a photon single-shot spectrometer (PSSS) [110]. The PSSS is meant to non-destructively measure the hard X-ray photon spectrum on a shot-to-shot basis.
The basic operating principle of the PSSS is simple: the FEL beam passes through a thin diamond transmission grating that splits off the first order light and illuminates a bent crystal spectrometer downstream. The spectrometer is meant to function at photon energies above 4 keV, covering a 0.5% bandwidth with a ∆E/E resolving power of 10 −5 to 10 −4 . The device has been successfully tested in its prototype phase at LCLS [111], and it will be fully operational at SwissFEL. Further concepts for spectral measurements at longer wavelengths are being developed with similar properties, and will be implemented as they are commissioned and fully developed.

Experimental Laser
One of the unique advantages of an FEL is the ultrashort pulse duration in the X-ray range. Therefore a large number of experiments are time resolved. The SwissFEL experimental laser facility [112] provides lasers for both pump-probe experiments, as well as for certain specialized diagnostic techniques which provide feedback on FEL operation (see Section 3.3.2). The critical parameters are availability, performance, and stability. The laser systems are based on a commercial 100 Hz Ti:Sapphire amplifier system from Coherent. An enhanced diagnostics system ensures the long-term stability of the laser. The laser output is combined with nonlinear conversion stages and allows access to a broad spectral range, including UV, visible, near-IR, mid-IR, and THz, as well as the generation of ultrashort (<10 fs) pulses. In addition to the femtosecond laser systems a tunable (UV to IR), ns pulse-duration laser system which will be fibre-coupled to the experimental stations is also planned to allow experiments to take advantage of the short XFEL probe pulses, for example using "diffract-before-destroy" techniques [22,113,114], but with more efficient optical excitation resulting from the longer duration excitation pulses. The accessible timescales from ns to ms with this laser system are especially relevant for dynamics in proteins [115][116][117][118][119].
The laser infrastructure is distributed over two floors. The two identical laser amplifiers are located in a dedicated pump laser room (LHx), on the floor above the experimental stations ( Figure 10), while the nonlinear conversion stages are installed on optical tables inside the experimental hutches, close to the experiment. This layout allows the simultaneous and independent operation of both end stations, and, in case of a failure of one system, the beam from the remaining laser can be redirected to both experimental stations and assure uninterrupted operation.

The Experimental Laser Facility
Authors: C. Erny, Y. Deng, J. Rehault, M. Csatari Divall, C. P. Hauri One of the advantages of a FEL is the ultrashort pulse duration in the X-ray range. Therefore a large number of experiments are time resolved. For pump probe experiments The SwissFEL Experimental laser Infrastructure [1] is available for the FEL users. The critical parameters are availability, performance, and stability. It is based on a commercial 100 Hz Ti:Sapphire amplifier system from Coherent. An enhanced diagnostics system assures the long term stability of the laser. The laser output is combined with nonlinear conversion stages and allows accessing a broad spectral range, including UV, Visible, Near-IR, Mid-IR, and THz, as well as the generation of short (< 10 fs) pulses. The infrastructure is distributed over two floors. The two identical laser amplifiers are located in a dedicated pump laser room (LHx), on top of the end stations (Figure 1), while the nonlinear conversion stages are installed on optical tables inside the end stations, close to the experiment. This layout allows the simultaneous and independent operation of both end stations. In case of a failure of one system, the beam from the remaining laser can be redirected to both end stations and assure operation for pump probe experiments The uncompressed amplifier output is sent through an evacuated transfer line from LHx to ESA and ESB (Figure 2). The pulse can be compressed to < 30 fs and has a total pulse energy of 20 mJ. Arriving on the The uncompressed amplifier output is sent through an evacuated transfer line from LHx to ESA and ESB (Figure 11). The pulse can be compressed to <30 fs and has a total pulse energy of 20 mJ. Arriving on the optical table inside the end station, the laser beam is split into two branches, one for diagnostics and one for the pump-probe experiment. Each branch is equipped with its individual optical compressor. Normally the available laser energy is split equally between the two branches. The diagnostics branch is used to operate the pulse arrival time and length monitor (PALM) [107,108], as well as the spectral encoding (PSEN) [102,120] for X-ray arrival time measurements (see Section 3.3.2). The major part of the diagnostics branch laser energy is used for the THz source to operate the PALM. It is based on the tilted pulse front scheme in LiNbO 3 [121] with a typical field strength of 100 kV/cm, centered at 0.5 THz [107]. The rest of the laser energy is used for chirped white light generation for the operation of the PSEN [102,122].
1100 nm the corresponding data can be collected single shot and beam synchronous an complete reconstruction of the experiment from the laser side.   For user operation the following modes are available: Mode 1 is the standard compressed output of the laser (10 mJ, <30 fs, 800 nm), which, when used in combination with an optical parametric amplifier (OPA), can generate wavelengths from 1100 to 2600 nm with up to 2 mJ pulse energy (Mode2a). Mode 2b combines the OPA output with subsequent conversion modules and extends the spectral range to the visible and UV (NirUVIS), to the IR (NDFG up to 15 µm) and to the THz range (1-10 THz, depending on the crystal used [123][124][125]). Mode 3 is the short-pulse option, delivering <10 fs pulses with >200 µJ. It is based on a hollow core fiber compressor [126]. For the first user experiments, Mode1, Mode2a and the UV/VIS module will be available at ESA and Mode1, Mode2a, DFG, THz, and <10 fs will be available for ESB. In the future all SwissFEL experimental stations will have access to all laser operation modes, with additional modes currently under development. The operation modes available for the user operation on the experimental branch are summarized in Table 2. A laser diagnostics system will inform the user about the typical laser performance, such as energy, pulse duration, beam pointing, spot size, and spectrum. For the visible and near infrared range up to 1100 nm the corresponding data can be collected single shot and beam synchronous and allow a complete reconstruction of the experiment from the laser side. The two laser systems are locked to the optical reference timing distribution in several locations. In the final setup the two oscillators will be optically synchronized to the reference timing. For this stabilized optical links are installed between the timing hutch and the LHx, as well as the end stations (see Section 5.1). This will allow a timing jitter <10 fs rms between reference and oscillator and drifts of <10 fs over 24 h to be achieved. Nevertheless the optical path between the oscillator and the experiment is exposed to environmental changes, such as pressure, humidity and temperature. This will lead to drifts between FEL pulse and optical laser on the order of 100 fs and more within a few hours [127] at the experiment. The laser arrival time monitor (LAM) measures these drifts relative to the reference timing system and can be used for drift compensation and data binning [127,128]. For the same reasons drifts on the order of 100 fs over several hours are expected between the diagnostics branch and the experimental branch, though both are located within the same hutch environment. To compensate for this a reference pulse is guided through an evacuated beam pipe along the FEL beam from the diagnostics branch and the timing drift with respect to the experimental branch is measured by a balanced cross-correlator setup (PALM-C). This provides a correction value to the arrival time measured by PALM and increases the accuracy for long-term measurements.

Experimental Stations
The layout of the SwissFEL experimental hutches is shown in Figure 12. The Athos soft X-ray experimental area is contained within one large hutch with a floor space of 692 m 2 . Space within this hutch is allocated for the optical laser. The Aramis hard X-ray experimental hutches have a combined floor space of 523 m 2 in three separate experimental hutches. The three experimental stations are called Alvra, Bernina, and Cristallina. Both Alvra and Bernina will be ready for users in 2018, with Cristallina to be installed in Phase II concurrently with the Athos installation. The optical laser room is located directly above the first experimental hutch and delivered to the experiment using vacuum transfer-lines (see Figure 10). Further details on the experimental lasers can be found in Section 3.4. In addition to the experimental areas there is lab space allocated in the SwissFEL building for both biological and chemical sample preparation, and a large work area for experimental testing and assembly. Users will also have access to the lab facilities at PSI, including the sample crystallization and characterization facilities at the Swiss Light Source for protein crystallography experiments [129]. In the following sections we will provide details on the two hard X-ray experimental stations, Alvra and Bernina, which will begin user operation in 2018.

Experimental Station Alvra
The layout of the Experimental Station Alvra (ESA) hutch is shown in Figure 13. Alvra is focussed primarily on two techniques: X-ray spectroscopy [18,130] and Serial Femtosecond Crystallography (SFX) [131,132]. X-ray absorption spectroscopy (XAS) involves measuring the X-ray transmission or X-ray fluorescence of a sample as a function of incident monochromatic X-ray energy [16]. These measurements can provide information on the local electronic and geometric structure around the absorbing atom [130] and can be applied to ordered or disordered samples in almost any form, including species in solution or solid state samples. SwissFEL will be particularly suited for these experimental techniques due to its variable-gap undulators [133,134] (see Section 2.4) which can easily scan the X-ray energy of the XFEL over a very wide range, allowing techniques such as X-ray absorption near-edge structure (XANES) and extended X-ray absorption fine structure (EXAFS) to be used [130]. SFX [19] is an XFEL technique that has been developed for protein crystallography where a stream of micrometer-sized crystals is delivered into the focussed X-ray beam using a range of different injector techniques [135][136][137], and the diffraction pattern from each crystal is recorded on a large two-dimensional pixel detector. Though the intense XFEL pulse destroys the crystal, because an ultrashort X-ray pulse (<50 fs) is used the diffraction occurs before the atoms have time to move from their lattice positions [22,138]. SFX can resolve room-temperature protein structures to better than 2 Å resolution on very small crystals [19,131], which expands the technique to include samples that are difficult to crystallize, such as membrane proteins [139] and 2D protein crystals [140,141]. A complementary technique with similar technical requirements to SFX that will also be possible at Alvra is wide-angle X-ray scattering (WAXS, also called X-ray diffuse scattering or XDS), where the sample under investigation is a liquid solution [142]. The result of the X-ray scattering measurement is powder-diffraction-like rings, containing information on the pair-distribution function of the sample [143,144]. This technique has proven particularly useful in measuring large-scale, light-activated functional protein motions [145][146][147][148]. ESA has the additional capability of performing X-ray emission spectroscopy (XES) which uses X-ray diffraction from an analyzer crystal to measure the scattered or fluorescence X-ray photons with high energy resolution [149]. ESA uses short focal length crystals (25 cm) in a dispersive von Hamos geometry [150] to measure a range of XES energies in a single measurement. This spectrometer can also be used for a variety of other scattering measurements include off-resonant techniques [151][152][153][154] and inelastic X-ray scattering (IXS) [155].
The ability to measure both X-ray scattering and spectroscopy simultaneously has proven to be a powerful combination for resolving structural and electronic dynamics in both molecules and proteins [115,[156][157][158].

KB mirrors
Timing tool Figure 13. The Experimental Station Alvra X-ray hutch. The X-rays come from the Optics hutch, to the left of the schematic and move from left to right in the figure. The various components located in the hutch are labelled. The ESB beam pipe chicane is a motorized beam pipe that can be moved vertically to either allow the XFEL beam to be delivered to Bernina, or to allow easy access to the Alvra instruments. The same motorized elements will be used in a similar fashion for an ESC beam pipe chicane in the future.

X-ray Optics and Diagnostics
A detailed summary of the X-ray optics is given in Section 3.1 and of the X-ray diagnostics in Section 3.3, here we will focus on the aspects specific to Alvra. The layout of the Aramis-1 beamline is shown in Figure 14. The key components are two horizontal offset mirrors that work at incidence angles of 6 mrad, for a total deflection angle of 12 mrad, followed by a fixed-exit double-crystal monochromator which deflects the beam vertically, and two harmonic rejection mirrors which return the beam vertically to its original beam path. This allows both monochromatic and pink beam paths to be identical downstream of the optical elements (see insets A and B in Figure 6). The monochromator contains 3 crystal pairs, which include Si(111), Si(311), and InSb (111) to cover the full Aramis photon energy range with varying bandwidth and energy resolution. The final optical components are two KB mirrors, with a working distance of 1.5 m from the center of the last mirror. These achromatic focusing optics are capable of achieving a 1.5 µm focal spot (FWHM). The optics have been designed to be used over the full range of the Aramis X-ray energies: 1.77-12.4 keV.  One crucial aspect of the Aramis-1 beamline is to allow for measurements in the 2-5 keV energy range. At these photon energies the optics will all function flawlessly at the higher harmonic energies as well, providing no discrimination for these photons. The HRM optics allow the incidence beam angle to be tuned, allowing the harmonics to be greatly suppressed when the monochromator is used. Calculations for the HRMs indicate we can achieve a contrast of at least 10 −3 for these higher photon energies, with up to 10 −5 achievable under certain optics configurations [88]. Note that the expected harmonic contribution from the XFEL is ∼1% for each subsequent odd harmonic, which could result in up to 10 9 photons per pulse in the 3rd harmonic if no suppression is used.
The photon diagnostics described in Section 3.3 have all either been tested with or designed for X-ray photon energies above 4 keV. This implies the development of these diagnostics components in the 2-4 keV range will need to be evaluated once SwissFEL is operational. Several of the elements are capable of lower energy measurements, including the gas-based photon beam intensity and position monitor (PBIG and PBIM). The solid photon backscattering monitors (PBPS) can be used with thinner scattering films, such as 200 nm of Si 3 N 4 , which will allow them to be used at lower photon energies.

ESA Prime and Flex
The techniques introduced in Section 4.1 will be applied at two instruments, which are located in line with the X-ray beam: ESA Prime and ESA Flex (see Figure 15). Due to the bendable KB mirrors the X-rays can be focussed at either instrument, with the minimum focus of 1.5 µm achieved at ESA Prime. Both instruments can be used with the optical laser for pump-probe experiments, with an anticipated time resolution of better than 50 fs [108].
ESA Prime is chamber that can be operated under vacuum, He, or neutral atmosphere and combines a large 2D 16 M JUNGFRAU scattering detector [159][160][161] and a dual-crystal von Hamos X-ray emission spectrometer [150,162,163]. This allows experiments to be performed using both scattering and emission techniques simultaneously, which has proven to be a powerful combination for molecular [156,157] and protein [115,158] samples. The chamber has the possibility of using different types of sample injectors, including several specifically for SFX sample delivery [135,164]. The expected achievable resolution of the crystallography measurements at 12.4 keV is better than 1.5 Å (Q max = 7 Å −1 ) and the X-ray spectrometer will be capable of measuring the full photon energy range of SwissFEL resonantly, with non-resonant measurements from 1-2 keV. This energy range is shown in Figure 16 with the elements labelled and the available analyzer crystals shown (see Table 3).
The Bragg angle range covered by the spectrometer is from 40 • to 80 • . Thanks to the dual-crystal design this spectrometer is capable of measuring multiple signals simultaneously, for example the Kα and Kβ X-ray emission from a 3d transition metal. The detector used for these measurements is a 4.5 M JUNGFRAU, which consists of 9 × 0.5 M modules in a linear geometry with an area of 4 × 72 cm. This allows the detector to cover all possible Bragg angles without requiring motion of the detector. The regions of interest containing the X-ray signals can be read out without reading out the entire 4.5 M detector. Due to the excellent noise characteristics of the detector, this spectrometer will be capable of single-photon sensitivity below 2 keV when operated in a high gain mode [159,165]. The scattering or serial femtosecond crystallography experiments benefit greatly from the per-pixel dynamic gain switching of the JUNGFRAU detector, which has 3 levels of gain, resulting in a dynamic range of 10 4 photons at 12 keV. This gain switching occurs automatically, allowing the detector to handle transparentally the broad range of incident intensities expected at SwissFEL. Further details on the JUNGFRAU detector can be found in Section 4.3. The detector is mounted on the back flange of the ESA Prime chamber, and has two holes to allow the beam to pass through the detector. This will allow the detector to be positioned in two scattering geometries: one where the beam is centered on the detector, to allow for fully symmetric scattering measurements, and one where the beam is close to one edge of the detector, which increases the scattering range of the detector, while simultaneously increasing the maximum accessible Bragg angle of the von Hamos spectrometer. The minimum sample-to-detector distance is fixed at 10 cm.
ESA Flex is a flexible instrument that allows users to build up the experiment as required. It is mounted on a motorized table, allowing user-supplied chambers to be installed for the measurement. ESA Flex also includes a configurable X-ray spectrometer that can be mounted in a variety of positions to measure a range of scattering angles, in both vertical and horizontal geometries. The 3-crystal spectrometer can be used from 40 • to 85 • Bragg angles, and uses a 1.5 M JUNGFRAU pixel detector. When used with large Bragg angles (>85 • ) and segmented X-ray crystals [150] this spectrometer is capable of 100 meV energy resolution. ESA Flex is shown on the left of Figure 15.   Figure 16. The tender X-ray energy range covered by the ESA Prime X-ray spectrometer. The dashed lines are the various crystals available for use with the spectrometer (see Table 3), covering the full range of energies at the various Bragg angles available in the spectrometer. The energies of various X-ray emission transitions are also marked to provide a sense as to what elements can be measured in this photon energy range.
The crystals available for both von Hamos spectrometers are listed in Table 3. As noted in the caption of Table 3 the crystals are either curved or segmented. In general the curved crystals provide excellent focusing capabilities (2 × X-ray spot size on the sample in the focusing direction), with some loss of energy resolution due to the crystal curvature, while the segmented crystals provide focal spots of 2 mm (2 × 1 mm segment size) but much improved energy resolution (essentially the Darwin width of the crystal reflection). The contributions of the various components in the spectrometer to the final energy resolution, including X-ray focal spot, detector pixel size, and geometry Bragg angle, can be found in reference [150]. Table 3. List of von Hamos geometry spectrometer crystals available for use at either ESA Prime or ESA Flex. Note that higher-order reflections have been omitted for clarity. Curved means smooth crystals, segmented mean diced along the focusing axis, but perfect flat crystals along the dispersive axis [150].

Optical Laser System
The femtosecond optical lasers available to the experimental stations have been described in detail in Section 3.4. The primary short-pulse excitation source anticipated for ESA is the 240-2600 nm output from the OPA (see Table 2), which covers the UV to IR range in which most molecular or biological samples absorb light. In addition to the femtosecond laser, ESA will also have access to a long pulse laser, which is tuneable from the UV to the IR. This laser will operate at 100 Hz, and can produce >1 mJ/pulse from 200 nm to 2 µm with pulses from 3-6 ns in duration. This laser can be used to more efficiently excite samples and measure on timescales ranging from ns out to ms. These experiments will take advantage of the fact that SwissFEL will have more photons available in a single pulse (>10 11 ) than a 3rd-generation storage ring in 1 ms (∼10 9 ), making them better at time-resolved experiments even on longer timescales, under certain conditions. The approach of using long-pulse excitation has proven particularly attractive for measurements on biological samples, where the relevant timescales can often be slow (µs to ms), but when performed at XFELs the measurements can take advantage of the room-temperature, damage-free conditions [115,[117][118][119].

Experimental Station Bernina
The Experimental Station Bernina (ESB) is designed to pursue femtosecond (fs) time-resolved (tr) hard X-ray pump-probe (XPP) diffraction and scattering experiments in condensed matter systems [166]. Its main emphasis is on the electromagnetic response in correlated crystalline materials, but it is sufficiently flexible to host a variety of hard X-ray experiments that benefit from short pulses. Frequently in correlated systems many of the energy scales such as charge-transfer energy, magnetic exchange, Jahn-Teller splitting, hopping integral or Hubbard interaction, are of similar size (∼0.15-4 eV). The ground states obtained by minimizing the total energy include ferro-and antiferromagnetism (FM, AFM), multiferroics, charge and spin density waves (CDW, SDW), high-T c superconductors (SC) and topological insulators. Due to the fine balance of all the energy scales new electronic and magnetic phases emerge with competing ground states. Small changes of external conditions such as temperature, pressure, magnetic or electrical fields, and carrier doping, can cause switching of ground states and large changes in functional properties. A new avenue is to dynamically excite the system with photons employing pump-probe photon-in and photon-out techniques. The spin, charge, orbital and lattice degrees of freedom can be coupled via electron-phonon and spin-lattice interactions. One way to understand the competing interactions and to clarify cause and effect in such coupled systems is to follow their different response in the time domain by selective pumping and probing of specific modes using tailored pulses, properly matched in time structure, wavelength, polarization and intensity. This allows new type of pump-probe experiments: selective excitation and probing of low energy electronic, magnetic and structural dynamics; photo-induced (non-thermal) phase transitions away from equilibrium (such as new metastable states and light induced symmetry breaking); coupling, control and switching in multiferroic systems; correlations and fluctuations in non-equilibrium systems. In a pump-probe experiment the time response-which for coherent excitation is oscillatory followed by dephasing and relaxation-is measured by precisely varying the time distance between pump and probe. The pump pulses are derived from an optical fs laser system. The sample is probed by fs X-ray pulses in SASE mode employing time-resolved resonant and non-resonant X-ray diffraction (tr(R)XRD), diffuse scattering (trDS), and resonant inelastic X-ray scattering (trRIXS).

Aramis Beamline
Bernina is installed on the Aramis-2 beamline of SwissFEL [167]. The schematic of the optical layout is shown in Figure 17 and the engineering layout of the ESB hutch is shown in Figure 18. The beamline covers (2.7) 4.5-12.4 keV in the tender to hard X-ray range of the fundamental, which covers the absorption energies of the 3d K-edges, 4f L-edges and 5d L-edges. To cover the 4d L-edges, which occur at tender X-ray energies (2-5 keV), virtually windowless operation is foreseen where the X-ray been will be delivered entirely through vacuum up to the sample position. The SwissFEL Aramis modes of operation are described in Section 2.1. At 7 keV the flux and pulse length for the two operation modes are expected to be around 1.3 × 10 12 ph/s/0.1% bw with 5 fs FWHM (10 pC, 100 Hz), and 2.1 × 10 13 ph/s/0.1% bw with 50 fs FWHM (200 pC, 100 Hz). There is the plan to operate Aramis in self-seeding mode [168]

X-ray Optics
A detailed summary of the X-ray optics is given in Section 3.1, here we will focus on the aspects specific to Bernina. The layout of the X-ray optics [88] is shown in Figure 17. For pink beam a pair of bendable plane elliptical mirrors (offset mirrors, coating SiC/B 4 C, Si, Mo/B 4 C) installed in the optics hutch (OH) deflect the beam vertically by 6 mrad. For monochromatic beam the offset mirrors are retracted. In this case the double crystal monochromator (DCM) is the first optical element in the beam. A motorized horizontal translation allows switching between Si(111), Si(311) and InSb(111) crystal pairs. The DCM has a variable offset (20-32 mm) to allow for future operation in combination with harmonic rejection mirrors (HRM, coating B 4 C/SiC) with variable deflection angles in a 4-bounce scheme.
Installed in the ESB hutch at working distance 2.6 m upstream of the sample position, a pair of bendable KB mirrors provide achromatic focusing with horizontal and vertical spot size of (1)2-100 µm FWHM for (ideal) real performance of the focusing optics. Upstream of the KB mirror pair free space is allocated to optionally install a movable in-vacuum Be compound refractive lens (CRL) transfocator for in-line focusing or to install an in-line electron time-of-flight (eTOF) polarization monitor to allow online monitoring of the incident polarization once a phase retarder is installed.

Phase Retarder
There is the option to install an in-vacuum double X-ray phase-retarder (XPR) setup in the OH hutch downstream of DCM-2 (see Figure 6). Circular and arbitrary linear polarization can be generated for X-rays with energy above 4 keV using diamond quarter-wave plates and half-wave plates, respectively. When operated in Bragg/Laue transmission geometry such an XPR can provide flexible polarization control with a high degree of polarization (≥90%) [169,170].

Photon Diagnostics
Multiple X-ray diagnostics both upstream and downstream of the sample position are available including profile-intensity monitors, intensity-position monitors, and X-ray timing diagnostics (see Section 3.3 for further details on these diagnostics). The PALM and PSEN components (see Section 3.3.2) are installed in the ESB hutch upstream of the diamond/Si solid state attenuators. The attenuator stacks are available to tune the incident X-ray flux to the desired level. By taking advantage of all the available timing diagnostics (in order of distance from the experiment: BAM, LAM, PALM, PSEN) will allow pump-probe measurements with time resolution ≤50 fs FWHM. The BAM and LAM diagnostics are independent of X-ray intensity, allowing them to be used with all modes of the accelerator.

Optical Laser System
The femtosecond laser system available for experiments at Bernina is described in detail in Section 3.4. For pump-probe experiments several excitation options (UV/NIR/FIR) are available [112]. An optical parametric amplifier (OPA) with subsequent difference frequency generation covers the spectral range 1100-15,000 nm. This output can also be used to generate intense THz pulses in organic crystals with field strengths exceeding 1 MV/cm [123] and pulse energies up to 10 µJ in the frequency range 1-10 THz. Very short pulses (<10 fs) are available at 800 nm by pulse compression in a gas filled hollow core fibre [126]. To compensate for drifts in the amplifier system, a laser arrival time monitor (LAM) will be installed directly after the compressor. A variety of laser diagnostics will provide all relevant laser parameters for the user.

Laser In-Coupling
Downstream of the KB mirror pair the laser in-coupling (LIC) section is installed to facilitate pump-probe experiments under ambient conditions, nitrogen or helium atmosphere or in vacuum when HV/UHV conditions are required. Two vacuum chambers are mounted on a heavy load hexapod: the LIC diagnostic chamber, which is permanently installed, and the LIC mirror chamber which can be moved to clear space for in-air laser optics when experiments are performed at ambient conditions. The diagnostic chamber houses clean-up slits, an intensity-position monitor (PBPS) and a spectral encoding timing tool (PSEN). A motorized laser mirror assembly is mounted in the mirror chamber to allow for both collinear and non-collinear laser excitation geometries. The chambers are separated by valves. A diamond window of thickness 50 µm is mounted in the vacuum valve at the exit of the diagnostic chamber to pass the X-ray beam when experiments are performed in-air at atmospheric pressure.

Experimental Instruments
The layout of the experimental X-ray hutch is shown in Figure 18. The endstation design emphasizes rapid reconfiguration capability in terms of flexible sample environment, goniometers, spectrometers and detector geometries to support a wide variety of experiments. There are two instruments operated at a single focal position, the general purpose station (XPP-GPS) and the six-circle X-ray diffractometer (XPP-XRD). These stations are mounted on rails, which enables them to be easily moved in and out of the X-ray focus. Sample stages designed as single modules can be swapped and mounted at both stations. Heavy load capability allows the stations to support and precisely align a variety of custom built 'modules' such as spectrometers, analyzers and various sample environmental setups provided by an experimental team or user group. Sample modules would include in-air goniometer stages, HV/UHV vacuum chambers for temperatures below 20 K, cryostats for super-conducting high field magnets or cryogenically cooled pulsed magnet systems to study H-induced transient states [171], and a cold finger cryostat with a high pressure diamond anvil cell.

General Purpose Station
The XPP-GPS station is a general purpose station for XPP experiments in non-scanning mode. It consists of a non-magnetic heavy load sample goniometer with six degres of freedom, a rotary table to mount spectrometers or detectors, and a large robot detector arm carrying a 16 M JUNGFRAU pixel detector. The JUNGFRAU pixel detector, which has been developed by the SLS detector group [172], is a charge integrating detector with pixel size 75 × 75 µm 2 . It has variable gain switching with dynamic range 10 4 (12 keV) that allows measurement of intense reflections and low intensity diffuse scattering simultaneously with a good signal-to-noise ratio (see Section 4.3). By swapping stages a variety of sample environmental modules can be accommodated. The large robot detector arm is mounted on a linear slide attached to the ceiling and can be retracted up to 3 m downstream (∼ 3.7 m from the focal position) to enable coherent diffraction and small-angle X-ray scattering (SAXS) experiments. For these experiments a He flight tube between the sample and detector will be installed.

XRD and Six-Circle Diffractometer
The XPP-XRD station is dedicated to X-ray pump-probe resonant and non-resonant X-ray diffraction experiments. Whereas the change of regular Bragg peaks provides information about structural changes of the atomic lattice, incommensurate superlattice reflections are sensitive to symmetry changes driven by charge, orbital or spin dynamics. By tuning the X-ray energy to specific absorption edges, these dynamics can be directly probed by reflections which are allowed by the symmetry of the underlying unit cell. In the past at the FEMTO endstation at the SLS numerous trXRD experiments have been performed on the structural dynamics of semiconductors and semimetals, colossal magneto resistance (CMR) manganites, CDW systems, magnetic shape memory alloys, high-T c SCs and ferroelectrics [173]. Recent trRXRD experiments were performed at the LCLS XFEL on a non-equilibrium phase transition in CMR manganites [174] and on THz-induced excitation of an electromagnon in a multiferroic, probed by soft X-ray resonant diffraction [175]. A first THz-pumped trXRD experiment in the hard X-ray range on a ferroelectric semiconductor has also been performed at FEMTO [176], demonstrating the feasibility of such experiments. The XPP-XRD station consists of a high precision '4S + 2D' six-circle Kappa-diffractometer with dual-detector arm carrying a 1.5 M 2D pixel detector (JUNGFRAU) and a polarization analyzer stage with beam collimation and point detector. Offset in scattering angle (∼20 • ) allows rapid switching from measurements with a point detector to measurements with a 2D pixel detector. The design of the diffractometer allows the Kappa-goniometer to be replaced by a hexapod sample-stage or by an open χ-circle [170] with cryostat carrier. Operated in scanning mode both in energy and momentum (reciprocal space), tr(R)XRD experiments can be performed on samples under a variety of environmental conditions by replacing the in-air Kappa-goniometer by custom built sample environmental chambers.

trRXRD and Polarization Analyzer
To analyze the polarization properties of the diffracted beam the complete analyzer stage can be rotated around the scattered beam axis while the cross-slit system stays fixed. The analyzer crystal is mounted with angle θ p = 45 • ± 5 • towards the diffracted beam and the point detector is positioned at 2 θ p . Once phase retarders are installed to provide flexible linear and circular polarization of the incident X-ray beam (see Section 4.2.3), polarization scans will allow measuring the dependence of the diffracted intensity on the Stokes parameters to disentangle the different contributions to the resonant cross section, determining the magnetic moment or orbital orientation, and analyzing chiral spin structures.

trRIXS and Energy Analyzer
In 5d transition metal oxides such as iridates, the strong spin-orbit coupling-in addition to the complex interactions of spin, charge, orbital and lattice-mixes spin and electronic degrees of freedom. New classes of materials are predicted such as quantum spin liquids, topological insulators and new superconductors. High resolution hard X-ray spectrometers (resolving power 2 × 10 5 ) to perform momentum resolved RIXS (qRIXS) experiments exist at synchrotrons [177,178] and a first fs time-resolved qRIXS experiment has recently been performed to directly determine the dynamics of magnetic correlations for the Mott insulator Sr 2 IrO 4 [179]. At Bernina to study mixed electro-magnetic modes and spin correlation dynamics in Ir-perovskites, a dedicated compact qRIXS spectrometer is being designed that can be mounted both on the GPS goniometer and on the dual-arm of the six-circle diffractometer. It is operated in horizontal scattering geometry with the incident photon polarization in the scattering plane. Using the Si(444) reflection of the DCM Si(111) and a spherically-bent, diced Si(844) crystal located one meter away from the sample, the overall energy resolution at the Ir L 3 -edge (11.216 keV) is <100 meV. The position-sensitive detector is a 0.5 M JUNGFRAU pixel detector or a position-sensitive silicon microstrip detector mounted in Rowland geometry with the diced spherical analyzer. Momentum-resolved trRIXS will greatly benefit from the enhanced spectral flux by self-seeding operation [168,180] of Aramis in the future.

ESB-MX Station
Until Experimental Station Cristallina (ESC) becomes operational, fixed target protein crystallography [140,141,[181][182][183][184][185] will be implemented at Bernina [186]. A dedicated station (ESB-MX) is currently under construction. It will allow for serial femtosecond crystallography experiments at up to 100 Hz from 3D micro-crystals of size below 1 µm, as well as synchrotron-like data collection schemes from large crystals [187]. The crystals will be placed on a solid support, for example a chip with a silicon nitride window. The measurements can be performed in air or in helium atmosphere for photon energies from 5-12.4 keV. The samples will be either at room temperature or maintained under cryogenic conditions by a cold nitrogen or helium gas jet. The movable ESB-MX station can be installed and aligned within one day in the Bernina hutch.
The installation requires the GPS and XRD stations to be moved to the side along the rails. The main element of the station will be a sample diffractometer suitable for various data collection schemes which require a precise and fast tracking of the crystal positions. The station also includes an experimental chamber for the diffractometer and the cryo-jet, the room temperature and liquid nitrogen sample storage, as well as a robot for automated sample exchange. The diffraction images from the protein crystals will be collected with the 16 M pixel array JUNGFRAU detector positioned immediately downstream of the chamber with the large robot arm fixed to the ceiling. In this configuration, a resolution of better than 1 Å and 2.5 Å can be achieved with 12 keV and 5 keV radiation, respectively.

Overview of Current Detector Developments for XFELs
Several dedicated detection systems are under development for photon science at XFELs. Importantly, single photon counting detectors (like PILATUS [188], EIGER [189] or Medipix [190]) are not suitable for the high photon fluxes at XFELs, and the use of charge-integrating detection systems becomes crucial. Each of the following new detection systems for XFELs is tailored to meet the specific requirements of their respective light source. These detector systems comprise the Cornell-SLAC Pixel Array Detector (CSPAD) [191] and the new ePix family [192] for the SLAC Linac Coherent Light Source, the Adaptive Gain Integrating Pixel Detector (AGIPD) [193], the Large Pixel Detector (LPD) [194] and the DEPFET Sensor with Signal Compression (DSSC) [195] for the European X-ray Free Electron Laser and the Silicon-On-Insulator PHoton Imaging Array Sensor (SOPHIAS) [196] for the SACLA FEL.
None of these detection systems is capable (Table 4) of meeting the specific needs of the Aramis beam line and its user stations Alvra and Bernina. In particular, no detector system can provide at the same time single photon resolution at 2 keV photon energy and a dynamic range suitable for crystallography experiments. Therefore, a dedicated, state-of-the-art application-specific integrated circuit (ASIC) and detector system named JUNGFRAU (adJUstiNg Gain detector FoR the Aramis User station) has been developed in house [161]. Table 4. Comparison of the main characteristics of the current state-of-the-art pixel detection systems for XFEL hard X-ray light sources. The design characteristics which would limit the applicability of the detection system to SwissFEL are highlighted in yellow.

Detector Geometry
The development of the JUNGFRAU detector reuses, whenever possible, design blocks which have already been developed and successfully used for other PSI detectors in order to minimize the development time and to keep the project cost at an affordable level. In particular the geometrical dimension of the EIGER project [189] has been inherited by JUNGFRAU, so that a common silicon sensor can be used for the two projects.
Geometrically, the final JUNGFRAU chip comprises 256 × 256 pixels of 75 × 75 µm 2 each. Arrays of 2 × 4 chips (512 × 1024 pixels) are tiled to form modules of 38.4 × 76.8 mm 2 sensitive area, i.e., about 500 kPixel per module. The chips are coupled to 320 µm or 450 µm thick p+ on n silicon sensors (Hamamatsu Photonics, Hamamatsu, Japan). Multi-module systems of 1 MPixel (2 modules), 4 MPixel (8 modules, Figure 19), 8 MPixel (16 modules), 16 MPixel (32 modules) are envisioned and can be tiled in application specific geometries. The gap between two adjacent JUNGFRAU modules is about 500 µm (short) and 2.7 mm (long side) which corresponds to an insensitive area of about 7 pixels and 36 pixels respectively. The total dead area is 7% on a unit cell, or 5% on a typical 4 M detector.

Readout Chip Design
The JUNGFRAU readout chip (ROC) is designed in United Microelectronics Corporation (UMC) 110 nm CMOS technology with aluminum-only interconnects. JUNGFRAU is a charge-integrating detector rather than a single photon counter. Most hybrid pixel detectors for synchrotron radiation are based on the photon counting principle, which cannot meet the requirements of XFEL applications. In photon counting detectors, an event in the sensor causes a response in one or more ASIC pixels. Whenever such a response pulse reaches a user-set threshold level in a photon counting ASIC, the event is "counted". Photon counting is inaccurate when multiple photons arrive at the detector the same time, since two or more photons are counted as one. Charge integrating ASICs record a signal proportional to the number of photons interacting with the sensor, at least in the case of monochromatic light, independently of the time structure of the incoming beam.

Pixel Design
The design of the front-end block of the JUNGFRAU pixel is based on the automatic gain switching principle previously used in GOTTHARD [197] and AGIPD. A schematic view of the pixel circuit is shown in Figure 20. The pixel front end consists of several blocks: • a preamplifier with three selectable gains: high (G0), medium (G1) and low (G2), • an automatic gain switching block consisting of a comparator with tuneable threshold and switching control logic, • a correlated double sampling (CDS) stage to remove the preamplifier low frequency and reset noise in high gain, • a storage array for 16 images, • a buffer needed to drive the column bus during the readout phase.
The preamplifier gain is variable: a fixed small size feedback capacitor is used for the high gain, while the insertion of two capacitors, ∼10 and ∼100 times bigger respectively, lowers the gain to a medium or low value. While the gain setting can be fixed with an external signal, in the normal mode of operation the control of the gain is automatically handled by the front-end circuit itself, pixel by pixel. For this purpose, the output of the preamplifier is monitored, during the integration, by a comparator. When the signal level crosses the threshold the gain switching logic is triggered. The threshold voltage is common for all the channels and is placed at the upper limit of the output range of the preamplifier. The digital logic, based on delay stages and latches, controls the insertion of the feedback capacitors and lowers the gain first to medium, then to low until the output of the preamplifier is brought back into the preamplifier output range. In the idle state the preamplifier is kept in reset at the low gain mode, so that all the feedback capacitor are emptied. A few nanoseconds before the beginning of the measurement these capacitors are disconnected so that the gain is set to high. Then the reset switch is opened and the input charge starts to be integrated. The amplifier switches depending on the amount of input charge flowing into the readout channel. The output voltage and the gain (encoded in two digital bits) are sampled at the end of the integration time. Together, these allow the determination of the incoming charge with the help of a gain calibration curve.
A precharge scheme for the feedback capacitors has been introduced to achieve the requested dynamic range of 10 4 photons per pixel per pulse even if the maximum available feedback capacitance in a 75 µm pixel is rather small (<8 pF); during the preamplifier reset, the output side of the capacitor is not charged to the preamplifier reset level but is set to a tuneable voltage level which is chosen such that the preamplifier output is at the lower end of its range for signals just higher than the switching point. For low photon energy operation, the starting gain of the preamplifier can be increased, by a factor of ∼2, to HG0, decreasing the noise but also the dynamic range before the first switching. In this case the gain switching sequence is HG0, G1 and G2. As in the GOTTHARD ROC, the CDS stage is bypassed in case of gain switching so that the (higher) noise of the high gain is not added to the (lower) noise of G1 and G2. 16 analogue storage cells are present in-pixel, each one with the corresponding 2 bit digital latches to store the gain information. In burst operation, up to 16 images can be stored on the ROC before readout.

Periphery and System Architecture
The 256 × 256 pixel matrix of the ROC is organized in four super-columns of 256 × 64 pixels, each of which is served by its own off-chip driver. This results in a readout time for the full ASIC of 256 × 64/(40 MHz) = 410 µs where 40 MHz is the design ADC clock speed. This readout time corresponds to a frame rate greater than 2 kHz. The fully differential off-chip driver is designed to directly drive the external ADCs, minimizing the number of components and the cost of the readout printed circuit board (PCB). The readout system is composed of a single PCB organized around an Altera Cyclone V Field Programmable Gate Array (FPGA). The FPGA generates the control signals for the readout ASICs and receives the data stream from the 14 bit 40 MHz ADCs digitizing the multiplexed analogue output from the chips. The data stream is reorganized such that contiguous images are formed and routed to a 10 Gigabit Ethernet (10 GbE) link for the data download to a receiving/storage server. This 10 GbE data link can sustain frame rates in the 1 kHz range, well in excess of the 100 Hz SwissFEL repetition rate. A CM-BF537 system-on-a-board (SOB) (BlueTechnix, Vienna, Austria) is present on the module. The SOB features a 100 Mbit Ethernet connection and runs a server that implements the configuration interface for the detector (slow control).

First Characterization Results
The first full size JUNGFRAU modules have been extensively characterized with continuous X-ray sources and electrical or optical stimulation. The following performance has been measured: • Noise in HG0 of 52 e.n.c. This allows single photon detection at energies <2 keV • Noise in G0 lower than 70 e.n.c.
• Noise in G1 and G2 of 0.5 and 4 12 keV photons rms, well below Poisson statistical fluctuations • Saturation level higher than 10,500 12 keV photons • Linearity better than 1% rms.
• Radiation hard up to 10 MGy A noise distribution for all the pixels of one module, measured using copper X-ray fluorescence radiation, is presented in Figure 21. A 1 M JUNGFRAU system has been tested at the LCLS X-ray Correlation Spectroscopy (XCS) instrument. Data was collected using Cu fluorescence, providing uniform illumination of the sensor, and with powder and single crystal diffraction samples. The data from LCLS confirmed the previous characterization, in terms of noise, dynamic range and spatial resolution. As an example, Figure 22 shows the measured number of photons hitting the sensor, averaged over a number of LCLS pulses, for a silver behenate powder sample and 9.3 keV illumination. The pixels in the inner rings recorded intensities covering most of the medium gain range (G1). The width and double structure of the rings is due to the geometry of the capillary.

Common Systems
The following sections describe hardware and software systems that are common to both the accelerator and photonics sections of the SwissFEL facility.

SwissFEL Timing Reference Generation and Distribution
The stringent stability requirements of SwissFEL sub-systems demand an ultra-stable timing reference distribution system with the highest flexibility, reliability and availability. In order to achieve all these goals and to optimize costs, a mixture of adapted technologies is applied to build the reference timing system. These are presented in the following sections.
The most critical clients require <10 fs jitter (rms) and down to 10 fs peak-to-peak temporal drift per day [49]. Therefore the key technology is the generation of both ultra-stable and low-noise reference signals in the RF as well as in the optical domain and the distribution of those signals as timing reference and precise clocks to the clients. Full remote control and monitoring of the components is necessary for smooth operation and debugging of the system and the facility as a whole.
The origin of the timing reference generation and distribution system resides in an environmentally controlled room at the electron gun end of the SwissFEL facility. The specified nominal temperature is 24 • C ± 0.1 • C and the relative humidity is controlled to within 42.5 %rH ± 2.5 %rH.

Optical Master Oscillator and Signal Generation
The optical master oscillator (OMO) Origami-15 from OneFive GmbH has two fiber-coupled outputs. One port with 2 mW optical power at 1 550 nm wavelength is used to produce the 142.8 MHz sinusoidal signal for the clock distribution. The other port, with 87 mW average output power, is used to generate 2.9988 GHz for S-band stations in the accelerator and laser synchronization as well as 2.856 GHz for C-band stations (see Figure 23). Both optical ports are connected to an ultra-low phase noise harmonic extraction unit (ULNHEU), where these signals originate from temperature-stabilized photo-detection, harmonic extraction and amplification. The output signals are linked to the corresponding distribution systems via temperature stable RF cables (Andrew Heliax tempered 1 /4", drifts −6 fs/m/K at 42.5 %rH around 24 • C for the relevant frequencies and about 0.2 fs/m/%rH at 24 • C). The absolute jitter of the microwave signal extracted from the free running Origami-15 and measured at the C-band frequency of 5.712 GHz including the noise of the optimized photo-receiver and the post amplifier is as low as 1.6 fs rms (1 kHz-10 MHz).

Pure Optical Pulse Distribution
The second port of the OMO is first split into four fiber-optic ports. One of these ports is fed through a variable optical attenuator (VOA) with a feedback loop for power stabilization down to 0.01 dB (Keysight N7764A). This helps reduce AM/PM conversion for subsequent components. That output is used as input to the harmonic extraction unit for RF signal generation. The three other fiber-optic connections can be used for clients who directly need the optical pulses (see Figure 23). Once ready, this optical splitter will be replaced by a stabilized optical amplifier including symmetric splitting for transmission in pulsed optical links.

Optical Master Oscillator Synchronization
For optimized overall phase noise performance, including the lower acoustic frequency regime, the OMO is synchronized to a master oscillator (MO, SMA 100A from Rohde & Schwarz GmbH) at 2.9988 GHz, which itself is locked to a 10 MHz Rubidium frequency standard (SRS FS725). The synchronization is implemented with a phase-locked loop (PLL), for which the master oscillator serves as reference input and the photo-detected filtered OMO signal coupled out from the harmonic extraction unit output is used as the comparator signal. Both are fed into a phase detector and the resulting error signal is sent to an amplifying piezo driver unit via a PID controller. The amplifier output drives a mirror mounted on a piezoelectric stage in order to keep the frequency output of the laser cavity extremely stable. Thus the integrated absolute jitter from 10 Hz to 1 MHz is as low as 14 fs rms. In the near term it is foreseen to develop an all-digital PLL with similar performance.
In addition to the piezo-electrical fine tuning, the OMO has a coarse tuning range of 6.4 kHz. Depending on the environmental conditions it can be necessary to bring the laser frequency into the fine tuning range by changing the frequency via the coarse tuning. This is done by regulating the temperature of the laser's base plate. This synchronization procedure is automated as well as the survey of all relevant signals such that the OMO can be kept synchronized for months. If necessary, the synchronization program corrects the laser temperature in order to keep the piezo-driving voltage in its range between 0 V and 150 V. Since the automated search for synchronization between the OMO and the MO via the laser temperature could be very time-consuming, an additional phase-frequency detector unit was implemented. This allows determining the sign of the phase difference between both signals and therefore simplifies the search.

Client Requirements
The clients of the ultra-stable timing reference generation and distribution system are to date: High power RF via LLRF, Bunch Arrival Monitor (BAM), Laser Arrival Monitor (LAM), Gun and Experimental Lasers to be synchronized to the reference, diagnostic monitors all along the machine, Event timing system, and switch-yard kicker.
The stability requirements concerning reference signal drift and integrated jitter depend very much on the various clients. Therefore distribution sub-systems based on adapted technologies and adequate performance were either developed or purchased with an emphasis on an optimized ratio of performance to investment in equipment. The types of links and the final performance goals are listed in Table 5. In the following sections the technologies of the different links and their realization/installation status is described in more detail. The RF transmission to the LLRF stations is done with so-called "CW optical links" [198]. These are radio-over-fiber type links based on standard telecom single mode fibers as the transmission medium, which have been developed in collaboration between PSI and Instrumentation Technologies Ltd.
(Solkan, Slovenia) The operating principle of the "Libera Sync 3" fiber-optic links is based on intensity modulation of CW laser diode light with additional group delay stabilization between the transmitter input signal and the photo-detected light reflected from the link end receiver.
The performance goal of these links was set to less than 40 fs drift peak-peak over 24 h (the typically measured drift is approximately 20 fs peak-peak for a 500 m link) and less than 10 fs rms integrated jitter in the frequency range from 10 Hz to 10 MHz (typically measured jitter is around 2.4 fs rms for a 500 m link and is limited by the measurement setup). Nearly 90% of the links which are needed for SwissFEL operation are currently at PSI (no spares in case of failure), all of which have been tested for drift and jitter performance and have gone through a burn-in phase of about 1000 h. To date, about 70% of the links are installed in SwissFEL and are in operation. For the operation of the links, communication between transmitter and receiver over ethernet is necessary. Because of initial problems with high network traffic and ethernet module failures of the link devices, the CW links have their own virtual LAN along the entire machine. Furthermore, for a full maneuverability during setup and operation, an EPICS based remote control interface was built, which can be used in parallel for all links.
For the injector, 6 slightly de-tuned European standard S-band frequencies and one European X-band frequency link are needed. The three linac sections need 9, 4 and 14 American standard C-band frequency links, correspondingly. Based on the de-tuned S-band (2.9988 GHz), the de-tuned X-band (11.9952 GHz) and the C-band (5.712 GHz) frequency, a reasonably high base frequency could still be found (142.8 MHz), which needs to be a common subharmonic of those frequencies and was chosen as the repetition rate of the OMO. All frequencies throughout the SwissFEL accelerator, which need to be synchronous in some way, are derived from this source of the timing reference distribution.
Concerning the transmission of the C-band frequency, it was decided to use the Libera Sync 3 links to transmit half of the actual C-band frequency (2.856 GHz), for which the S-band links could be used with only minor modifications. At the output of those links, an ultra-stable RF frequency doubler with amplitude/phase stabilized power amplifier will be used to provide the necessary frequency and amplitude level. The frequency doubler was developed at PSI and a prototype has been successfully tested.
For the X-band transmission, a similar philosophy is adapted: an S-band link together with an ultra-stable quadrupler unit built in-house is installed and in operation.

CW Fiber-Optic Links for Clock Distribution
For most diagnostic monitors along the machine, the kicker systems as well as the controls event timing distribution system, the drift and jitter requirements are less stringent. Therefore a distribution system was developed in collaboration with and purchased from SINTEC Microwave Systems GmbH, which is adapted for the needs of SwissFEL with respect to the number of clients, their location along the machine, the requested power levels and the jitter performance. Our clock signal at 142.8 MHz serves as input signal to a transmitter module, where the signal is amplified and split into 8 outputs. Each of these outputs is fed into an optical transmitter module where it modulates an optical carrier at 1310 nm wavelength. After transmission through the fiber connection, the optical carrier input signal is demodulated in a Receiver module, converted back to a 142.8 MHz electrical signal and amplified. Emanating from the 8 Receiver stations along the machine, a local coaxial T-shaped sub-distribution supplies several diagnostic monitors. The added jitter of the clock distribution in the offset range from 10 Hz to 10 MHz is 73 fs rms and lies well below the most demanding specified value among the clients of 200 fs (rms). This system is installed in SwissFEL, operational and remotely monitored with respect to RF power levels at the receiver stations, module temperatures, amplifier and laser diode currents.

Pulsed Optical Links for Reference Signal Distribution to Critical Clients
Clients like the BAM, the LAM, gun and experiment lasers, and X-band RF station require ultimate long-term stability below 10 fs peak-to-peak drift per day. In addition, they may need direct optical input signals. Therefore these clients will be fed with reference signals from stabilized pulsed optical links. This technology is commercially available and it is planned to purchase this system together with an optical power amplifier and splitter system. The evaluation process is ongoing.

Laser Arrival Monitor
The LAM is one example of a client that directly uses the pulses from the OMO. The Gun-LAM (next to the photocathode, including beam propagation through laser chain and transfer line) employs a novel scheme, where the current generated by the UV pulses impinging on a photodiode directly drives an electro-optic intensity modulator acting on the optical reference. Thus, arrival time is directly encoded onto the amplitude of the reference pulse train. A balanced photoreceiver in combination with a fast analog-to-digital converter (ADC) decodes this information shot-by-shot, limited by the ADC sampling rate. Expected temporal resolution is low tens of fs. A laser arrival time jitter of around 40 fs (rms) at the gun would lie within the tolerance budget to ensure that FEL beam fluctuations stay within intrinsic fluctuations at 200 pC as well as for 10 pC electron beam charge mode [199].
The experiment LAM is based on a spectrally resolved cross correlator [127]. The incoming IR pulses from the experiment laser and the reference pulses (stretched and chirped) mix in a nonlinear crystal and their relative timing results in wavelength change that is read out with a spectrometer. A resolution of 5 fs (rms) should be achievable for this application. The tolerable laser jitter at the Experimental Stations is 25 fs (rms).
For the LAM at the electron gun, which is still close to the source of the reference generation and distribution, the link will initially be realized with a few tens of meters of temperature stable fiber with low drift (3 fs/m/K and 0.4 fs/m/%rH). The LAM at the experimental stations will initially get a pulsed link prototype.

Bunch Arrival Monitor and Other Clients
The first BAM will initially get a pulsed link prototype. In addition, the second BAM will use a second redundant OMO, synchronized to the MO, as a pulsed source. With an additional RF phase shifter it will be possible to time delay the optical pulses as needed. It is likely that BAM 1 will then also be added to this system. The BAM is described in more detail in Section 2.5.6.

Motion Control
Motion control is an integral part of any large research facility. This motion ranges from moving several tons with micrometer accuracy (e.g., undulators) to moving samples with nanometer accuracy and almost everything in between. There are several hundred motion axes with diverse applications. In order to minimize the variety of hardware used and thus also the requirements from the Controls group to support all the different platforms, standards were set at an early stage. Although PSI has a motion control system for the SLS, which is controlling over 1000 axes and has proven to be very reliable, special requirements for SwissFEL made it necessary to evaluate a new system to cover all these requirements.
A wide range of requirements and specifications need to be met. These are among others: • Complex coordinated motions, • Large distances between motion controller and motor, • Interface to the timing system and • Low cost per axis.
In order to cover the widest possible range without having too many different systems, the motions were categorized into 3 different groups: 1. High performance motion axis 2. Simple motion axis 3. Piezo positioners for sub-µm motions After an evaluation phase of one year, the DeltaTau PowerBrick IMS motion control system was chosen for the high performance motion axis. Based on the PowerPMAC motion controller, the PowerBrick IMS motion control system is custom built by DeltaTau UK. The PowerBrick is used at several research facilities around the world. The following sections describe the various requirements.

Complex Coordinated Motions
Complex motions become more important for motion control systems in research. For example, an X-ray mirror mounted on a tri-pod (mover with three vertical translation stages) can move vertically as well as being tilted in the horizontal plane. In order to define a motion around a fixed point in space, in this case the center of the mirror surface, coordinated motion of all three axes is required. This can be easily implemented with the PowerBrick. Another example is the energy change of a monochromator where several motions need to be coordinated for a smooth change of the energy. Furthermore, a linear scan of the energy requires non-linear motion of the motors. This can be achieved through coordinate transformation inside the PowerBrick.

Timing Interface
As SwissFEL is a pulsed source, the timing plays an important role in motion control. This can range from reading out a motor position, i.e., encoder, when an X-ray pulse arrives and "tagging" the value with the pulse ID, to controlling the exact positioning of a motor based on the arrival of the X-ray pulses. PSI uses a "Timing and Event System" from Micro Research Finland. This sends "event codes" over an optical fiber link to the "event receivers", which can then generate low jitter hardware trigger outputs and/or generate interrupts to a controlling CPU. It can also send real-time data to the event receivers which can be interpreted by the controlling CPU. The system must be able to synchronize and trigger motions on different remote motion controllers as well as to implement synchronous encoder readout during a measurement and tag the readings with real-time data from the timing system at a trigger rate of at least 100 Hz. An event receiver card is integrated into the PowerBrick and communicates through the PCIe bus directly with the motion control CPU. User programs and event receiver driver software run on the internal CPU of the PowerBrick.

Large Distances
SwissFEL spans well over 700 m from the electron gun to the last experimental station, Cristallina. Furthermore, for the accelerator, electronics need to be placed outside the tunnel due to high radiation levels. This results in the need for a distributed system as well as the need to drive motors over long cables. In contrast to the SLS, where motor cables are around 20 m, at SwissFEL they can be up to 50 m. As the motion controllers are decentralized and spread out over the entire length of the machine, remote control of all settings and parameters as well as status readback need to be possible. The PowerBrick allows for complete parametrization over the network. In fact, the system is built in such a way that if a driver unit would need to be replaced, a completely unconfirmed unit can be used simply by setting the host name, the PowerBrick motion controller becomes fully parameterized when booted.

Simple Motion Axis
The PowerBrick is a very powerful motion controller but beyond what is required for simple motion applications, such as moving a screen into the X-ray beam. For such simple motion axes the Schneider Electric MDrive Stepper Motor was selected. The MDrive come in a variety of sizes ranging from 36 mm to 85 mm flange size with holding torques from 13 Ncm to 770 Ncm. Another advantage is that the motion controller and driver are integrated into the motor. The controller can also read incremental encoders to form a positioning feedback. The Schneider Electric MDrive motors can be used wherever the radiation levels are limited, where no interface to the timing system is required and where no coordinated motion is required.

Piezo Positioners for Sub-µm Motions
There are several applications where small masses need to be moved but to very high precision, e.g., alignment of optical laser mirrors or positioning small samples in the micro-focused X-ray beam. This is where piezoelectric positioners have an advantage. Making use of the piezoelectric effect, piezo positioners can be built to be compact and move with nm resolution. For SwissFEL we have chosen the piezo positioners from SmarAct in Germany. SmarAct offers a wide range of positioners with a small form factor for many different applications. Furthermore, SmarAct positioners have been used at the SLS for several years with very good results.

Data Acquisition
Within SwissFEL there are two categories of data: beam synchronous and asynchronous data. All beam synchronous data from any part of the machine can be correlated and can be associated to an individual FEL pulse/bunch. Asynchronous data neither can be correlated directly nor be related to an individual pulse/bunch. Regardless of the class of data, each reading from sensors, detectors, motors, etc. is available via so called channels. Each channel is identified by a channel name that is unique within the whole facility.
As there are two categories of data, the SwissFEL data acquisition system is split into two systems: a system dealing with beam synchronous data and a system dealing with asynchronous data. As the asynchronous system does not differ from the systems used at other facilities at PSI, it is therefore described only briefly in Section 5.3.1. The remaining sections will focus on the aspects related to the beam synchronous system.
Although SwissFEL is comprised of various sections (e.g., accelerator, beamlines, experimental stations, etc.) and include components that are operated and maintained by different groups, data from all parts of the facility needs to be collected and retrieved via the same systems and tools.

Asynchronous DAQ
The asynchronous data acquisition system is based on EPICS [200] and data can be retrieved and subscribed to via the Channel Access protocol. To retrieve data from applications and scripts, standard EPICS tools and libraries can be used.
For continuous recording and long-term archiving, a dedicated instance of the EPICS Archiver Appliance [201] is in place. Any asynchronous channel can be recorded and archived via this system. Data from the EPICS Archiver Appliance can be retrieved and viewed via the same APIs and tools as for the beam synchronous data which are described in the following sections.

Beam Synchronous DAQ
The beam synchronous data acquisition system is a new development centered around the idea of data streaming. Load and code complexity on data sources are reduced by immediately streaming raw data out as soon as it becomes available. For a given pulse, data from all configured channels of a source is collected, serialized and sent out in an atomic message. Along with the data of all channels, this message also contains the unique pulse-id of the machine pulse the data belongs to as well as other metadata. As the pulse-id is needed by all systems providing beam synchronous data simultaneously, all these systems need to be connected to the global SwissFEL real-time timing system.
Load balancing and fail-over is built into the system by design since it uses the ZeroMQ protocol [202] for data transport. Channels to be streamed out by the data sources can be configured dynamically without the need of restarting or interrupting the data collection.
To prevent data sources from being overwhelmed by client requests, the only client collecting data directly from sources is the Dispatching Layer. Beside data source isolation, this subsystem, as described in the next section, also provides transparent and synchronized access to all incoming data. This layer can also reduce the incoming data streams, e.g., by reducing the frequency, to meet client requirements and capabilities. As not all clients can cope with the incoming data rates and volumes the system also provides a buffering layer in order to provide data for retrieval at a later point in time, namely DataBuffer and ImageBuffer. Although these are two separate subsystems, data is accessible via a common API.
The subsystems of the beam synchronous data acquisition systems take care of all beam synchronous data, except the primary experimental station pixel detectors (e.g., JUNGFRAU). This data is collected and processed through a system derived from [203], but will be nevertheless synchronized with all the rest of beam synchronous data.

Dispatching Layer
The Dispatching Layer is a cluster of machines that take care of retrieving and providing data from all data sources except the primary experimental station 2D detectors. This layer shields all the data sources from other clients and acts as the single point of access to live data. Via this layer clients can subscribe to customized and synchronized data streams of channels from any part of the facility. Clients can request channels in various frequencies and combinations. This architecture allows clients to retrieve any combination of channels regardless of their origin as if they came from a single source, i.e., the data of a given machine pulse of all requested channels is in the same message alongside the pulse-id and other global metadata. The synchronization of data is close to real time and data emitted can be used for immediate online monitoring, data analysis and processing. Requests and calls to this layer are done via a central REST API. Data streams provided by the layer are based on ZeroMQ.

DataBuffer/ImageBuffer
All beam synchronous data is buffered and stored for a configurable amount of time. By doing so users are able to retrieve historical data if needed. The systems taking care of the buffering are DataBuffer and ImageBuffer. Both systems take care of and are optimized for different classes of data. DataBuffer takes care of small data, i.e., of all scalar and one dimensional arrays (waveform) data. The ImageBuffer system takes care of all beam synchronous images from cameras and detectors running at the facility except the JUNGFRAU detector data.
The DataBuffer system is currently a cluster of 12 machines and uses Cassandra [204] for persistent data. The ImageBuffer system is based on Spectrum Scale [205] and an in-house data format. Data from both systems is accessible to users via the DataAPI interface described in Section 5.3.5.

DataAPI
The DataAPI acts as the single point of access to all archived and buffered data from SwissFEL. It currently provides beam synchronous data from the DataBuffer, ImageBuffer as well as asynchronous data from the EPICS Archiver Appliance. It is a REST based API that is easily accessible from almost any programming language. Data can be retrieved based on channel names and time or pulse-id (for beam synchronous data) ranges. Besides the ability to retrieve raw data the API also provides the means to retrieve reduced data for the requested range, e.g., for later studies and documentation.

Data Web Frontend
The Data Web Frontend provides an easy-to-use and visual frontend to the DataAPI. It is a web based interface based on the latest web technologies, namely Web Components [206] and Plotly [207]. It is accessible from all computers within the Paul Scherrer Institute that have a modern web browser installed. The web interface provides advanced means to browse large amounts of data quickly and to extract the most important information, without retrieving and drawing the complete raw data. This is achieved through data reduction strategies provided by the DataAPI backend.

Experimental Data Container
Experimental data will be saved in the Experimental Data Container. HDF5 [208] has been chosen as file format due to its widespread adoption in the scientific community and the possibility to save data and metadata in the same file. Data will be retrieved directly from the Dispatching Layer: users will select a list of data channels to be written into the final file. Further data can be added at a later time from the Data/ImageBuffer.

Conclusions and Outlook
The SwissFEL project has made remarkable progress since it first broke ground in 2013, culminating in first SASE lasing in the soft X-ray domain in May 2017. The Aramis hard X-ray branch of SwissFEL will be operational for users in 2018, with its first call for proposals in the beginning of 2018. Installation of the Athos soft X-ray branch has begun, with expected user operation after 2020 on three photon beamlines. In addition to the components and systems we have described in this review the project has several near-term future upgrades planned, including hard X-ray self-seeding [168,180] and the addition of a third experimental station (Cristallina). Beyond the currently defined Aramis and Athos accelerator infrastructure there are plans to add a third undulator beamline. The building was designed to allow space for this installation in the accelerator tunnel and internal discussions have begun on what the parameters of this project might be. We look forward to joining the thriving hard X-ray free electron laser community [209-212] and welcoming researchers from around the world to our exciting new facility in the coming years.
Author Contributions: All authors have contributed in some way to the concept, design, installation and commissioning of different aspects of the SwissFEL project. All authors contributed to the paper either during the writing or editing phases.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: