# An Active Irradiation System with Automatic Beam Positioning and Focusing for a Medical Cyclotron
## 2 Materials and Methods
Figure 1: The Automatic Focusing System (AFS) under test in the Beam Transfer Line (BTL) bunker: (1) the Mini-PET Beamline (MBL); (2) drift space; (3) two-dimensional beam profile detector (UniBEaM); (4) \(\pi^{2}\) detector (or, alternatively, two-dimensional UniBEaM detector or target station with current read-out); (5) beam dump. The block scheme of the experimental set-up is reported in Figure 3, where the AFS is highlighted in red. The control system is a specific software based on a feedback algorithm. The beam profiles are measured by the UniBeAM and, if necessary, they are optimized to obtain the desired beam on target by varying the current in the power supplies of the MBL. The power supplies, provided by the Italian company CAEN-ELS, are of two kinds--bipolar (\(\pm\)10 A) for the steering magnets (FAST-PS 1020-200) and monopolar (0-100 A) for the quadrupoles (FAST-PS-M 7508). To avoid overheating in the MBL, the maximum current for the quadrupoles is limited to 75 A. The currents in the magnets of the MBL are indicated as I\({}_{x}\) and I\({}_{y}\) for the two steering and I\({}_{Q1}\) and I\({}_{Q2}\) for the downstream and upstream quadrupoles, respectively. The control system (written in C++ running on Linux) is based on an optimisation algorithm aimed at focusing and steering the beam to irradiate the target region, as defined by the user. The only inputs of the algorithm are the horizontal and vertical profiles acquired by the UniBeam ((3) in Figure 1). In the ideal case, the beam should be fully contained in the target region, where it should feature a flat distribution. A centered but  
Figure 3: Scheme of the experimental set-up in which the Automatic Focusing System (AFS) is highlighted in red. Figure 2: Computer-Aided Design (CAD) drawing of the Magic-Box that allows to operate two one-dimensional UniBeAM detectors (horizontal and vertical) and features five KF-50 flanges and a specific connection for the solid target station (**left**). Particular of the sensing fibers (drawn in red) (**right**). The distance between the planes in which the fibers move is 5 mm. too narrow beam has to be avoided since it may produce overheating and a low production yield. The desired region is defined as two spatial ranges in the target plane, one in \(x\) and one in \(y\), where \(z\) is the beam axis. Once the \(x\) and \(y\) profiles are acquired, the algorithm assigns an optimisation parameter to each of them. It is defined as the product of two sub-parameters--the ratio of the beam intensity in the target region over the overall intensity and the portion of the Full Width at Half Maximum (FWHM) of the beam contained in the target region over the full length of the target region. This second sub-parameter aims at obtaining an almost flat distribution. The higher the optimisation parameter, the better the beam profile is adapted to the target. If, following a scan, the optimisation parameter is found to be lower than a predefined threshold, the AFS starts the optimisation procedure. On the other hand, if the parameter is higher than the threshold, the system waits for the next scan. The time interval between successive scans is defined by the user. At the start of an irradiation, the user sets the MBL parameters according to predefined values which were previously experimentally determined, for example by locating a beam monitoring detector, as the \(\pi^{2}\) or the UniBeaM, exactly at the location of the target. Once the beam deviates from the initial configuration and the profiles give an optimization parameter lower than the threshold, the optimization procedure is triggered. It acts on one of the four currents at the time and their order is defined by the user. Usually, \(\mathrm{I_{Q1}}\) and \(\mathrm{I_{Q2}}\) are first optimized, followed by \(\mathrm{I_{x}}\) and \(\mathrm{I_{y}}\). As soon as the optimization parameter gets over the threshold again, the procedure stops. The optimization algorithm proceeds in steps.