{'fraction_non_alphanumeric': 0.02477973568281938, 'fraction_numerical': 0.022577092511013214, 'mean_word_length': 4.194470924690181, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Beam-based alignment procedure for small gap In-vacuum undulators at the Taiwan photon source

We have developed a beam-based alignment procedure for small gap, in-vacuum undulators (IVUs) at the Taiwan Photon Source (TPS), which allows us to determine the field and mechanical center within 0.1 mm accuracy. Measurement methods and results are discussed in this paper.


Introduction
The TPS is a 3 GeV storage ring with seven phase-I beamlines. Top-up user operation at 300 mA started in September 2016 and the operating beam current has been gradually raised to 400 mA by November 2017.
As a monthly routine task, linear optics corrections are done at 30 mA stored beam current together with beam-based alignment for the beamlines in order to continually ensure a long beam lifetime and thermal equilibrium for storage ring and beamlines [1,2]. Trajectory scans and beam lifetime observations with small gap IVUs failed due to noise induced by fluctuation of the DCCT at 30 mA.
During beamline commissioning, we executed also beam-based alignments to determine the field centers of all insertion devices in each beamline and adjusted the height of the insertion device as required. The reference orbit is determined by optimizing the spectra observed in beamlines by maximizing the ratio of odd and even harmonics in the on-axis photon spectra. Recently, we tried to lower the gap of two IVUs from 7 to 5mm to meet the needs of users. A three meter tapered IUV located at port 21 serves the X-ray Nano-diffraction beamline, and another three meter IVU at port 23 is for the X-ray Nano-probe beamline. A serious beam loss was observed when the gap of the port 21 IVU was reduced to 6.7 mm at 400 mA in top-up mode. By contrast, the gap of the port 23 IVU could be reduced to 5 mm without any beam lifetime problem.
To find the cause of the problem, we checked the mechanical centers of the IVUs. These checks allowed us to determine that the electron beam was scraped when the port 21 IVU gap was reduced to 6.7 mm or less.

Methods and results
The photon spectrum is measured during each beamline commissioning to ensure the expected performance of the ID. The beam-based alignment procedure for spectra optimization is based on the undulator equation [3].  (1) and the deflection parameter K is expressed as: where for the TPS energy g = 5871, lu = 22 mm for the IVU, n is the harmonic number and the field is B0 = 0.81 Tesla at a 7 mm gap. The first step of the procedure is to find the IVU field center. Since the deflection parameter K, being proportional to the IVU magnetic field B0, decreases off the midplane it is scanned along the trajectory through the ID. A typical result of the trajectory scan is shown in Fig. 1 and we achieved an optimum energy spectrum with a beam offset of 0.2872 mm. A series of scans with the purpose to find the optimum photon spectrum can help to determine the trajectory through the IVU field center. Similarly, scans at different angular directions can help to find the optimum odd/even harmonic ratios.
A typical optimized spectrum for a 7mm IVU gap is shown in Fig. 2 in comparison with the theoretical spectrum [4]. The measured spectrum is composed of two energy ranges, 5-12 keV and 12-20 keV, with a 600 Å Rh coating and 50 Å on top of a 250 Å Pt layer, respectively.
A method has been developed to determine the mechanical center of IVUs due to the difficulty faced by trying to lower the gap of the port 21 IVU. The vertical beam offset causes a vertical net kick to the trajectory due to a parasitic quadrupole field component and impedance of the three meter long narrow gap undulator [5,6]. The orbit distortion caused, can be expressed by: where ∆ ( ) is the orbit distortion at location s, 7 is the location of the IVU, = the IVU quadrupole field component, L the IVU length and 7 the trajectory offset in the IVU. The measurement is performed by employing 2 mA single bunch beams (3.5 nC) chosen to be high enough to get reliable orbit information and we used the same beam current for all scans to eliminate any current dependence of the BPM electronics. The orbit distortion is proportional to the parasitic quadrupole field at different IVU gaps. The current dependence of the BPM electronics can be found in Fig. 3. A 2 mA bunch beam current is scraped to 1 mA when the gap is reduced to 5.5 mm in the port 21 IVU and the BPM reading showed different characteristics compared to BPMs number 105 to 125.   Figure 4 shows results of the first three trajectory scans (+1.05 mm, 0, -1.05 mm) with a high asymmetry in the orbit deviation, indicating that the reference trajectory does not pass through the mechanical center of the IVU.

Discussion
Presently, the e-beam trajectory seems to have a -0.5 mm offset with respect to the mechanical center of the port 21 IVU, which we hope to adjust in May 2018.
It was shown that the field and mechanical center were quite close to each other and we must ask the question why the e-beam gets scraped when the gap is reduced to 6.7 mm or less? By analyzing the tapered structure and end-block foil cover, as shown in Fig. 6, we found that there is a bump in the endblock structure and we plan to further investigate the two end-block structures in the lower IVU plane. Figure 6. The end-block foil cover has an uneven surface.
Determination of the field and mechanical center of small gap IVUs will be done to allow us to adjust this misalignment.