Loss monitoring for undulator protection at SwissFEL

At the x-ray free-electron laser SwissFEL, at the Scherrer Switzerland, beam loss monitors are used to determine loss positions along the linear accelerator and protect critical elements such as the undulator magnets from excess radiation. These monitors are integrated into the machine protection system (MPS) allowing beam losses to be limited by dynamically reducing the repetition rate. This paper focuses on the types of loss monitors installed at SwissFEL and their function in protecting the machine. on at the of The generated light is guided via plastic optical fibers of the same 1 mm diameter as the scintillator fibers to the PMT.


I. INTRODUCTION
The linear accelerator of SwissFEL [1] generates and accelerates electron bunches with a charge between 10 and 200 pC and a beam energy up to 6.2 GeV. The nominal repetition rate is 100 Hz and two bunches can be accelerated within a single radio frequency (rf) pulse. The temporal spacing of these two bunches is 28 ns. Each bunch is intended for a particular SwissFEL beam line: Athos for soft x-ray beam lines, or Aramis for hard x-ray beam lines. Beam losses caused by manipulations of the electron beam or screen insertions can be orders of magnitude higher than beam losses generated during standard operation. Losses caused during beam conditioning and wire-scanner or screen insertions can spread tens of meters through the machine. In the event of an entire beam loss it is possible to lose over 125 W of power into the machine. This loss may or may not be distributed, depending on its cause, and is detrimental to any electronics around the machine and especially to the undulator magnets.
The demagnetization of the permanent magnets in undulators has been observed at other facilities as a result of radiation damage. A reduction in magnetic field strength as a function of accumulated radiation dose has been observed for the LCLS undulator segments [2]. Similarly a loss in photon flux due to irradiation of undulator magnets has been measured at SACLA [3], and at the European XFEL a magnetic field degradation higher than 3.5% in the diagnostic undulator was found and associated to absorbed doses up to 4.4 kGy [4]. The mechanisms behind the magnetic degradation are not yet completely understood. Studies have been proposed [5,6] and are subject to discussions in the accelerator community.
To avoid damaging the undulators at SwissFEL, a system was needed to protect the machine while ensuring the independent operation of the two beamlines. This system, known as the Machine Protection System (MPS), reads data from various radiation monitors around the machine and rapidly acts upon this data to stop or reduce the beam rate. For SwissFEL, these monitors have to be sensitive to losses of a few percent or less for bunches with a charge between 10-200 pC and be able to resolve the intensity and position of each bunch loss. There would also have to be a calibrated system as an absolute reference.
Completely stopping the beam for every loss event is not an efficient way of ensuring continuous operation. Thus, signals from the loss monitors are processed by an algorithm that automatically generates and removes MPS alarms, and ensures that a defined dose rate is not exceeded. As a consequence of the alarm, the beam production is stopped. This is achieved by delaying the laser and rf triggers by several tens of microseconds so that they do not coincide. Different sets of delays are used for the lasers and also for the different rf stations so that in case of active laser or rf delays, no beam is produced and also dark current is not accelerated along the linac. This way, the machine remains thermally stable, and both beam and dark current are safely stopped. This is achieved by distributing the MPS alarms in less than 10 ms via the timing/trigger system of the machine. Such an interaction of the MPS with the timing system allows dynamic control of the beam repetition rate.
To meet the abovementioned requirements, loss monitors were developed, installed, and interfaced with the machine protection system. The algorithm for dynamic control of the beam repetition rate is described under the section beam loss monitors. The focus of this paper is the loss monitors that are utilized for the protection of the undulators and ensure the operation of the machine by regulating losses while not impeding its operation.

II. MACHINE PROTECTION SYSTEM
The purpose of the machine protection system (MPS) is to protect the machine from damage due to excessive radiation. There is a separate personnel safety system which limits the radiation dose rates in accessible areas.
The MPS consists of three layers (Fig. 1). The individual radiation monitors that are used to detect losses within the machine are in layer 3 of the MPS system. Each monitor provides its measurement results to a layer 2 system which generates alarms. For certain monitors, layers 2 and 3 can be located on different hardware platforms, although the preferred solution is to have both layers on the same platform. All variables that are required for the calculation of alarms (thresholds, etc.) are configured in each monitor in layer 2.
The top layer (layer 1) collects the alarm states from layer 2 and calculates three possible machine alarms, Level 0, 1, and 2 (in addition to the no alarm state).The alarm levels and appropriate actions are shown in Table I. A Level 0 alarm only leads to the machine repetition rate being reduced to 1 Hz-this rate can be configured. A Level 1 alarm in the Aramis (or Athos) path would cause this path to be put on delay to stop electron bunches being sent to Aramis (or Athos). In case the Level 1 action is not sufficient, then a Level 2 alarm is triggered. Here additional precautions are taken to bring the machine into a safe state; an operator must subsequently reset these manually. Immediately after calculation, layer 1 distributes these alarm signals to all systems via the timing system. Each monitor raises an alarm level uniquely defined according to its function. For instance, the insertion of a scintillating crystal of a screen monitor into the beam path for imaging the beam raises a Level 1 alarm while the screen is moving and a Level 0 alarm when it is inserted. Consequently, imaging takes place at Level 0 beam rate, which is currently set to 1 Hz. Once the screen is removed the alarm status is removed. If a beam loss monitor observes a significant beam loss, it will raise a Level 1 alarm to regulate these losses. Once the cause of the beam loss is removed no further alarms are raised. There is usually no progression from one alarm level to another, and in case of the beam loss monitors, a Level 2 alarm is raised in case a higher average beam loss signal is generated than required to generate a Level 1 alarm.

III. MONITORS FOR BEAM LOSS DETECTION
Two types of systems for beam loss monitoring are used at SwissFEL: slow, yet calibrated dosimetry system (radiation sensing FET [7]), and two types of fast fiber-based loss monitors for tracking losses at the full 100 Hz beam rate. The first of the fiber-based loss monitors is for detecting losses at particular locations (beam loss monitors, BLM) while the second type is for locating losses along the machine (longitudinal loss monitors, LLM). In the undulator regions, the RadFETs are installed at the entrance of each undulator segment. In addition, BLMs are also placed between the undulators for their protection (Fig. 2).
The radiation sensing FETs, being slow systems that are read out only every 20 s, are interfaced to the MPS via software. The fiber-based loss monitors, which detect the loss signal of every single electron bunch, are interfaced to the MPS via the programmable logic controller (PLC) layer.

A. Beam loss monitors
There are currently a total of 50 BLMs installed in SwissFEL: 15 are for protecting the Aramis undulators, and an initial 3 are for protecting the Athos undulators. The BLMs consist of 2 m long, 1 mm diameter organic scintillating fibers (Saint Gobain BCF-20) wound around a 35 mm diameter 3D printed holder (Fig. 3). Each end of the fiber is connected to a clear plastic optical fiber that runs from the accelerator tunnel up to the technical gallery where the light detectors and data acquisition (DAQ) systems are located. One of the plastic optical fibers (POF) propagates the scintillators output to a photomultiplier tube (PMT) [8] and the other one carries the light from a pulsed light-emitting diode (LED) [9] through the scintillator to the PMT. The pulsed LED provides a system-live check for observation of light transmission through the connected fibers to enable radiation damage of the optical fibers to be measured, even while the system is in operation.
In addition to loss monitoring for machine protection, as already described, the BLMs are also used in conjunction with wire scanners [10,11] for measuring transverse beam size. The sensitivity of the BLMs can be adjusted by nearly 3 orders of magnitude. This allows detecting charge losses as low as 0.01 pC, as demonstrated when using the BLMs for wire scans with a bunch charge below 1 pC, at maximum gain (highest sensitivity) [11].

B. Signal processing
The same front-end electronics, firmware, and software is used to capture waveforms from the photomultipliers of both the BLMs and the LLMs. Details about the DAQ system can be found in [12]. Each PMT signal is digitized by an individual 12 bit ADC synchronized to the machine, which samples at 428.4 MSamples/s (2 ns=sample). Each digitized trace has 2048 samples, giving a time window of 4 μs.
The digitized waveforms are processed thus: To remove any baseline fluctuations, a region of 32 samples is defined to measure the average background level approximately 1 μs before the expected beam loss signals, this is then subtracted from the signals. Two regions of interest (ROI) are defined one for each of the expected positions in time of the two bunches. A field programmable gate array (FPGA) integrates the signals in each of these regions. This is repeated for every acquisition. Figure 4 shows an example of the beam loss signal detected by a photomultiplier, indicating the samples used to determine the baseline value and the two regions of interest.
The acquisition scheme is sensitive to the setting of the triggers from the timing system. The timing is crucial for setting the loss signals inside the ADC acquisition window. Once the timing is set, the ROIs are set around the loss signals. Any change of the timing means shifting the loss signal out of the ROI, which affects the loss calculations. For this reason, the trigger settings for all loss monitors are set to the same value. All settings are saved in reference files that are loaded after every shutdown. During operation, the settings are checked to ensure the beam loss signals fall within the correct time windows. However, these settings of the acquisition time windows are a possible failure scenario of the system and should be further improved in the future.  3. Scintillator fibers are placed inside a plastic jacket to prevent ambient light leaking in, and wrapped around a holder mounted on the beam pipe at the location of interest. The generated light is guided via plastic optical fibers of the same 1 mm diameter as the scintillator fibers to the PMT.

C. MPS algorithm
The integrals I 1 and I 2 are filtered by an infinite impulse response filter, resulting in a filtered loss signals: where t filt is the filter time-constant which defines the response time of the beam loss signal for the MPS, t rep is the period the loss monitors are set to in our case 10 ms, I i n is the sum of the samples within a region-of-interest for shot i, and I i−1 filt is the previously calculated filtered beam loss figure. The algorithm was coded in firmware (VHDL) to calculate in real time (<500 μs). Level 1 and Level 2 alarms are generated by comparing the filtered loss, I i filt , to the two respective alarm thresholds. Once an alarm is generated, it remains active until I i filt falls below the threshold. All calculations are performed at 100 Hz, regardless of the beam repetition rate.

D. Example of repetition rate reduction
The beam loss monitors are not calibrated. To determine appropriate alarm thresholds, losses are purposely generated by guiding the electron beam into the beam pipe at various locations along the accelerator, or by inserting thin metal foils or scintillating crystals of the SwissFEL screen monitors. The gains of the photomultipliers are then set in a way that the maximum allowed beam loss at this location given by the MPS alarm threshold for the Level 1 alarm can be properly detected, but such that only a small fraction of the ADC dynamic range is utilized. This allows the BLMs to also detect significantly larger beam losses without saturating.
In the undulator region, the alarm thresholds are set using the maximum observed dose rate as measured by the RadFETs and refined several times during operation until acceptable maximum dose rates are reached. Figure 5 illustrates the principle of the MPS algorithm. The top graph shows a beam on flag which is one when a beam is generated. In the center graph, an assumed instant beam loss signal is displayed. In this case, no losses are detected for the first 20 bunch triggers. Hence, the filtered beam loss signal shows zero (third plot). This remains the case until the beam loss signals are detected around the 20th bunch trigger. The sudden generation of beam loss signals cause the filtered beam loss signal to increase and once it passes the MPS alarm threshold, the beam is stopped (50th bunch trigger). The missing bunches (beam on flag is 0) with no beam losses lead to a decreasing filtered beam loss signal, and once below the alarm threshold, the alarm is cleared and another bunch is sent through the accelerator. This process dynamically reduces the bunch repetition rate of the accelerator and stabilizes the averaged beam loss signal around the alarm threshold. The 100th bunch trigger illustrates what happens when an even larger beam loss is detected. The time for the filtered beam loss signal to fall below the alarm threshold is even longer and thus the repetition rate is lower. This algorithm allows the operators of the accelerator to react and tune the beam while the allowed beam losses are still effectively limited.
The effects of the described MPS algorithm can be seen in Fig. 6(a) and Fig. 6(b), which demonstrate the described procedure when a collimator in the first bunch compressor is moved into the beam path. Figure 6(a) shows both the instant loss signal for bunch charge of 200 pC at 100 Hz, and the filtered loss signal from an LLM. The beam loss signal is shown in blue and the filtered loss signal is shown in green. There are background losses in the bunch compressor when beam is present, with the scraper retracted. As the scraper is moved in, the losses increase, and the filtered loss signal rises. When the filtered loss signal reaches the MPS Level 1 alarm threshold, the beam is stopped. The region in the black dashed box is enlarged in Fig. 6(b), where the behavior of the LLM is clearly shown. The larger the beam loss, the longer it takes for the filtered loss signal to reach the alarm threshold and allow the beam through the machine again.

E. Longitudinal loss monitors
Similar to SACLA [13,14] and FERMI [15,16], SwissFEL uses long quartz fibers to locate losses along the machine. There are 8 quartz fibers installed for the main accelerator and the Aramis branch and 3 for the Athos branch, each covering around 80 m along the machine. The PMTs are located at the Gun end of the fiber and digitized by an ADC synchronized to the machine, which samples with the same specifications as the BLMs (428.4 MSamples/s). Though loss observation depends a lot on the causes and loss geometry, a difference of 1 m between two loss points is easily observed with this system.
The signal processing for the LLMs is identical to one for the BLMs, except that the signals from the LLMs are divided into eight regions-of-interest (ROI) (Fig. 7). The sum of the samples within each ROI is divided by the ROI width.
To calibrate the longitudinal axis from ADC sample number to a position in meters, losses are created by either inserting Ce:YAG screens or wires from wire scanners at known locations or setting the quadrupole magnets to their maximum current to defocus the entire beam. This assigns a position value to one ADC sample of the loss signal and this corresponds to its approximate position in meters. The relation between ADC sample number and loss point is linear.
Since LLMs cover the entire range of the machine, in addition to loss tuning, they are also used to monitor the dark current generated by the C-band accelerator modules. The LLMs allow quickly identifying the locations where large losses are generated. When dark current losses are too large for radiation protection, accelerating gradients can be adjusted accordingly.

F. Dose rate monitors
To monitor the integrated dose accumulated in the regions of the undulator, commercial radiation-sensing field-effect transistor (RadFETs) and compatible DOSFET L-02 controllers [17] are used. The RadFET is a p-channel MOSFET type of integrating radiation dosimeter, where the output voltage can be calibrated to a value for accumulated dose [18]. A calibration effort was made at the Paul Scherrer Institute by irradiating a number of RFT-300-CC10 RadFET sensors with gamma radiation from a Caesium-137 source [17]. Additional calibration effort for zero bias voltage was carried out by [19].  Along the accelerator and the Aramis branch, there are a total of 42 RadFETs installed. 28 of these cover the regions around the undulator segments: two at the entrance of each undulator flange and two at the exit of the last undulator. The RadFETs are mounted close to the beam pipe to maximize the detected signals. In the Athos beam line, currently 3 out of 6 RadFETs are positioned in a similar fashion in the undulator region.
To increase their sensitivity, the RadFETs are operated with a 25 V bias voltage [17]. They are read out every 20 s. Since this dose monitoring system is slow, they have a software connection to the MPS. If the detected dose increase exceeds certain thresholds, a Level 1 Aramis or Level 1 Athos alarm is generated, which has to be acknowledged by the operator.
The plot in Fig. 8(a) shows the accumulated dose at the entrance of all Aramis undulator segments from October 1, 2017 onwards, when the first beam was transported through the machine. The plot in Fig. 8(b) shows doses accumulated at the RadFET in front of the first undulator in Aramis as of October 1, 2017 until January 01, 2020. The figures show that most of the dose was accumulated in short periods when either dark current or fractions of the beam were lost and no appropriate actions were taken. With a proper beam setup, the dose detected by the RadFET monitors is almost constant. Gaps in data are due to limited data archiver availability. Until January 2020, the maximum dose accumulated by a RadFET is 9.26 Gy.

IV. CONCLUSIONS AND OUTLOOK
The SwissFEL beam loss monitors are crucial instruments for protecting the accelerator, especially the undulator magnets, from excess radiation. For this purpose, two types of fast beam loss monitors, using signals generated in scintillating or quartz fibers, are employed. The detectors measure the beam losses at a 100 Hz rate and are interfaced with the machine protection system. The fast bunch-bybunch real-time loss detection helps to dynamically minimize losses and protect the undulators.
Slow monitors, based on RadFET sensors, are used for integrated dose measurements in the undulator regions. These monitors are used for adjusting the alarm thresholds of the fast beam loss monitors, for long-term monitoring, and as a last safety element.
Having both slow calibrated loss monitors (RadFETs) and fast uncalibrated monitors (BLMs, LLMs) gives the option to calibrate the signals of the fast detectors. In the future, it is hoped that this could add to the information about the beam loss distribution along the machine. As yet, no long-term experience is available about acceptable dose rates to guarantee the longevity of various electronics in the tunnel. A better calibration of the fast monitors also could help in understanding this.