Determination of the photon spectrum of a therapeutic linear accelerator near the maze entrance: Comparison of Monte Carlo modeling and measurements using scintillation detectors corrected for pulse pile‐up

PURPOSE
The determination of X-ray spectra near the maze entrance of linear accelerator (LINAC) rooms is challenging due to the pulsed nature of the LINAC source. Mathematical methods to account for pulse pile-up have been examined. These methods utilize the highly periodic pulsing structure of the LINAC, differing from the effects of high-intensity radioactive sources.


METHODS
NaI (sodium iodide) and plastic scintillation detectors were used to determine the energy spectra at different points near the maze entrance of a medical LINAC. Monte Carlo calculations of the energy distribution of scattered photons were used to simulate the energy spectrum at the maze entrance. The proposed algorithm uses the Monte Carlo code, FLUKA, to calculate a response function for both detectors. To determine the effects of the pile-up in the spectra, the Poisson distribution was used, employing the average number of photons per pulse (μ) interacting with the detector. The quantity, μ, was obtained from the ratio of the number of events detected to the number of pulses delivered. The energy spectra at various distances from the maze entrance were measured using NaI and plastic scintillation detectors. From these measurements, the values of µ were calculated, and the pile-up probability was determined. The FLUKA Monte Carlo code was used to calculate the spectrum at the maze entrance and the response matrices of the NaI and plastic scintillation detectors. The algorithm based on the Poisson distribution was applied to calculate the spectrum.


RESULTS
The agreement between the calculated and measured spectra was within the first standard deviation of the variance expected in µ. This agreement confirms that photons at the maze entrance have energies between 30 keV and 240 keV for a maze with three turns, with an average energy of around 85 keV. After pile-up correction, the range of the pulse height distribution with the plastic scintillation detector, which has a low atomic number, was decreased (0 to 140 keV). In contrast, the range of the pulse height distribution with the NaI scintillation detector was closer to the photon spectrum (0 to 240 keV).


CONCLUSIONS
The corrected spectrum demonstrates that using a FLUKA Monte Carlo code and an algorithm based on the Poisson distribution are effective methods in removing the distortion due to the pile-up in LINAC spectra when measuring with NaI and plastic scintillation detectors. The agreement between the corrected and measured spectra indicates that Monte Carlo modeling can accurately determine the spectrum of a LINAC machine at the maze entrance.


INTRODUCTION
The determination of the dose near the maze entrance of linear accelerator (LINAC) rooms is a crucial aspect of radiation protection in modern radiotherapy departments. 1 The photon energy spectrum and radiation components at this location are required to achieve good dosimetric precision, 2 but few studies have determined the energy spectrum outside LINAC rooms. Measurements of LINAC spectra with scintillation detectors have been carried out by multiple centers. [3][4][5] Furthermore, a measurement 6 of the photon energy spectrum at the maze entrance was taken with a hyper-pure germanium detector (HPGe) for a 6 MV LINAC beam with a field size of 2 9 2 cm 2 . In this latter case, the spectrum taken at a maze entrance with two turns ranged from a few keV up to 450 keV, with an average energy of about 150 keV. The spectral components include photons that scatter from the phantom and the concrete walls, with leakage from the LINAC scattering through the maze, as well as the photons that penetrate the maze walls.
Several studies disagree with this finding. These studies, using Monte Carlo calculations of energy spectra at the maze entrance, have suggested that the average energy for a maze with two turns is about 100 keV, ranging from 30 to 300 keV. [7][8][9][10] The Monte Carlo techniques used for these simulations had photon energies ranging from 0.5 to 30 MeV. The shape of the spectra was shown to be somewhat independent of the energy of the primary beam due to the Compton process, which leads to large changes in the energy of scattered photons. The difference between the measurements and calculations may be due to the contribution of leakage photons, which are difficult to implement in the calculation. However, differences may also be introduced due to the pulsed nature of a LINAC beam. The pulse duration is in the range of 4-10 µs, and the pulse repetition frequencies are in the range of 100-1000 Hz, which can lead to a form of pulse pile-up. [11][12][13][14] The pulse structure of the LINAC can lead to two or more photons being detected at the same time and recorded as a single event with a high energy bin, similar to a pulse pileup. This significant phenomenon occurs at high counting rates for many radiation detectors. 12,15,16 With pile-up, the total energy of an event is recorded at a higher energy bin and is equal to the sum of energies of coincident individual photons that consequently distort the energy spectrum shape. Different approaches have been proposed in the literature to overcome the pile-up deformation of the energy spectrum. These include using a hardware amplifier system, fast asynchronous digitization, the application of real-time or live-time counting digital pile-up correction, free-loss counting, genetic algorithms, and artificial neural-network techniques. However, as a result of pile-up rejection, information on the energy distribution using these methods would be lost. [17][18][19] In the case of the LINAC pulse structure, all the energy is deposited in the detector; therefore, if the number of events is known, it is potentially possible to correct for the effect of the pile-up.
In this study, a novel algorithm based on the Poisson distribution is suggested; one that analyzes and corrects for the pile-up effects on the energy spectrum in scintillation detectors. A Monte Carlo code, FLUKA, was employed to calculate the scattered photon spectrum at the maze entrance but does not consider the contribution of photons from leakage. The FLUKA code was used to create a response matrix for each detector and to calculate the spectra of photons emerging from the maze. The photon fluence is converted to a pulse-height spectrum according to the detectors' materials and dimensions. The measurements were conducted with sodium iodide (NaI) and plastic scintillation detectors for a 6 MV LINAC room at Singleton Hospital in Swansea, UK. The NaI Scintillation Detector (Type: 905-3, 2-9 2-in. crystal, 2-in. tube) has a high atomic number that makes the photoelectric absorption a relatively important process and subsequently has a high intrinsic detection efficiency. 20 The plastic scintillator (Type: 51 B 51/ 2M -P EJ-200, Serial:  SFP284, ORTEC SCIONIX HOLLAND, hydrogen and carbon) is a tissue-equivalent detector that has a low atomic number of constituents and thus very low photoelectric interaction probabilities. 16 It is assumed that the total energy recorded in the detectors is conserved, that is, there would be no loss in energy and events.
The Poisson distribution is used in this algorithm to determine the effects of the pile-up in the spectra by utilizing the average number of photons per pulse (l). The quantity l is obtained from the ratio between the total number of events detected and the number of pulses generated by the LINAC during a particular time, whereas, the number of events detected close to the LINAC is almost the same as the number of pulses. This method takes into account the relationship between the distances from the maze entrance and the number of incoming photons. Therefore, as the position of the detectors is moved nearer to the entrance, the number of incoming photons would be higher, and subsequently, the pile-up effect would be increased.

2.A. Calibration of NaI and plastic scintillation detectors
The NaI scintillation detector was calibrated using spectroscopic-grade radioactive sources. The energy spectrum for the sources had either single or multiple photopeaks. Full-energy peaks of a plastic scintillation detector spectrum were not observed in a typical pulse-height spectrum; the peaks that appeared with the plastic scintillator detector were related to the Compton back-scattering energy (E 180 ) of the radioactive source energies (E). The following relationship calculated the E 180 : ( where m e is the mass of the electron, and c is the speed of light.
A linear equation was fitted in both cases to represent the channel calibration against energy in the detector.

2.B. Measurements
NaI and plastic scintillation detectors placed at the height of 1 m above the floor were used to obtain energy spectra at the maze entrance. The signals from the scintillation detectors were read out using an ORTEC digiBASE supplied with MAESTRO multichannel analyzer (MCA) emulation software. A radiotherapy room at the Singleton Hospital in Swansea was used for the measurements, and the energy spectrum of the background was recorded. The LINAC beam Medical Physics, 47 (9), September 2020 was incident on a phantom made from SolidWater material, which is tissue equivalent, the dimensions of which were 0.3 9 0.3 9 0.3 m 3 . The LINAC machine (Elekta) delivered a 6 MV photon beam of 1000 MU and a dose rate of 419 MU/min. The source to surface distance (SSD) was 1 m from the phantom and oriented at a gantry angle of 270°, that is, facing the corridor. The average energy spectrum was measured three times.
The output files from the MCA software were processed and imported into MATLAB (version R2016a MathWorks) for subsequent processing of the spectra. The spectra were divided by the real time of the acquisition to obtain the spectra in counts per second, and the background energy spectrum was subtracted from the output files of the energy spectra. The field size of the LINAC machine was 0.3 9 0.3 m 2 . The measurements of the energy spectra were taken at different distances beyond the maze entrance laser curtain, as shown in Fig. 1. The NaI and plastic scintillation detectors were placed at 0, 0.1, 0.2, 0.3, 0.4, 0.6, 0.8, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 6, 7, 8, 9, 10, and 10.5 m.

2.C. FLUKA Monte Carlo simulation
The FLUKA Monte Carlo code was installed on a Linux Ubuntu operating system with an Intel COREi7 desktop computer to conduct the simulations. Initially, the validation from the FLUKA code was achieved by comparing the calculated percentage depth dose (PDD) with that of the hospital for 6 MV, as shown in Fig. 2. The FLUKA calculated PDD was carried out by simulating a 0.4 9 0.4 9 0.4 m 3 water phantom that consisted of 0.002 9 0.01 9 0.01 m 3 water dosimeters irradiated by a conical photon beam. The dosimeters were rectangular sheets set at varying depths along the central axis, and the SSD of the beam source was 1 m.
The simulation of the room and maze was carried out using NCRP 21 concrete walls of density 2340 kg.m À3 , which is similar to the density and content of the concrete used for the radiotherapy room. The geometry of the bunker room with its maze entrance is illustrated in Fig. 3. The source was a conical beam of photon positioned at 1 m distance from the surface of the water phantom, which had a volume of 0.4 9 0.4 9 0.4 m 3 . The simulated photon beam had a radius of 0.0565 m at the phantom surface, which is equivalent to a field size of 0.1 9 0.1 m 2 . Rayleigh scattering was taken into account in the simulation. The energy cutoff for photons was set to 10 keV, and the kinetic energy cutoff for electrons was set to 100 keV. The fluence spectrum of backscattered photons was scored in an air sheet that was positioned at the maze entrance. The simulated detector was 1.87 m in width, 0.01 m in depth, and 2 m in height. The USRTRACK code was used to obtain the photon fluence distribution (S E ) through the detector as a function of energy. A summary of the FLUKA simulation is presented in Table I, as suggested by the AAPM Research Committee Task Group 268 (2018). 22

2.D. Poisson distribution convolution
The Poisson distribution is a probability analysis function that describes random discrete events in a specific FIG. 1. The energy spectrum per second at distances outside the maze entrance.
represents the spectrum at the laser curtain, represents the spectrum at 0.4 m, represents the spectrum at 1 m, represents the spectrum at 2 m, represents the spectrum at 5 m, and represents the spectrum at 10 m. (a) Using a NaI scintillation detector and (b) using a plastic scintillation detector. The measurements were repeated three times, and the uncertainty was within 2%. Medical Physics, 47 (9), September 2020 time or space interval. 23 This distribution, based on the mean number of successes (µ), is a positive value. A convolution (conv) between two integral functions (S 1 and S 2 ) was used to determine the energy distribution associated with the absorption of multiple numbers of photons in the detectors.
Complete saturation of the detector counts was observed at the highest count rates, that is, every LINAC pulse resulted in a photon being detected. For this varying distance method, the ratio of counts between the spectra determined at the farthest distance,x, from the maze entrance with lowest counts (e.g., at 10.5, 10, 9) to the number of LINAC pulses delivered in the same period should be equal to counts x=pulses ¼ 1 À pois 0; l ð Þ: µ can, therefore, be calculated to give the pile-up probability of the photon counts (P 1 , P 2 , P 3 ,. . ...P n ) for the energy spectra at low count rates. This method of calculation of µ is unsuccessful as the ratio in Eq.
(2) approaches 1 if it is assumed that the spectra of low and high count rates are almost the same. µ has a direct relation to the total energy that is absorbed by the detector and can be obtained by the area under the spectrum curve. The relationship of µ and the energies was plotted. A curve was fitted at the low count rates, where its equation was used to predict the µ at high count rates.

2.E. Response matrices
The response matrices of the 2" 9 2" NaI and plastic scintillation detectors were calculated using the FLUKA code. The simulated detector was a cylinder with a radius of 0.0254 m and a height of 0.0508 m in the beam direction. The thickness of the aluminum covering the detector was 0.000812 m, with a 0.002997 m air gap. To irradiate the whole detector, the photon beam entered the front face of the detectors with a 0.05842 9 0.05842 m 2 field size. The material used for the plastic detector was PLASCINT, which had a density of 1032 kg.m À3 and an elemental composition by weight of hydrogen 8.5% and carbon 91.5%. The range of energies was from 10 to 600 keV in 10 keV intervals. The result of each energy could be obtained as spectra or data from a DETECT card that enabled the energy deposition to be recorded on an event by event basis. 24 A MATLAB code was used to import data for all 60 energies and to combine them into a 60 Â 60 matrix for each detector, called the response matrix (R M ).
The function S E was taken from the FLUKA USRTRACK output for the maze entrance detector. The spectrum for each detector was used to determine S 1, which was calculated by multiplying S E by the response matrix (R M ) of the particular detector using the Eq. (3): The convolution function was then used to get S 2 , S 3 , . . .. S n where n was dependent on the pile-up probability of the detectors' spectra. In the MATLAB program, the convolution code was "conv(u,v)," which in this research will be: Medical Physics, 47 (9), September 2020 The final function of the spectrum with pile-up was obtained from S PC (Poisson convolution) in Eq. (5): S PC was determined as a function of photon fluence plotted against the energy interval. This function was normalized to the total energy (T E ) from the measurement spectra that represented the area under the energy curve. The equation of the area under the energy curve can be given as the following: Counts at each bin Â DE:

RESULTS
The relationship between the total recorded counts per second of the photon spectra and the distance from the maze entrance that were obtained by the NaI and plastic scintillation detectors is shown in Fig. 4. Figure 5 shows the relationship between the total energy per second, for each spectrum, and the distance from the maze entrance.
The value of µ can be calculated using Eq. (2), which is equal to the ratio between the low counts rate spectrum (e.g., at 10.5, 10, 9 m) to the total number of pulses. A plot of the total energy spectrum vs µ is extrapolated along a straight line to obtain an estimate of µ at high counts, as illustrated in Fig. 6. The procedure assumes that the photon spectrum is not changing.
Based on Fig. 6, the relationship between the µ and the energy at certain distances for the NaI scintillation detectors is: l NaI ¼ 2:969 Â 10 À5 Â Total Energy NaI À 0:177 (7) and for plastic scintillation detectors is: l plastic ¼ 8:066 Â 10 À5 Â Total Energy plastic À 0:349 (8) The µ is then calculated by Eqs. (7) and (8) from the linear parts of the NaI and plastic detectors' curves. From µ, the pile-up probability of the photon counts for the energy spectrum at measured points using the NaI and plastic detectors can be determined.
The fluence spectrum at the maze entrance calculated with the FLUKA code is shown in Fig. 7. The FLUKA energy spectrum S E is multiplied by the detector response matrix (R M ) to get S 1 , followed by S 2 , S 3 , . . .., and S n . Hence, the spectrum with pile-up S PC can be obtained by the convolution of Eqs. (3), (4), and (5).
The calculated spectrum S PC and the measured spectrum at certain distances were normalized to the total energy of the measured spectrum using Eq. (6). Figures 8 and 9 show a comparison between the measured and the calculated spectra for NaI and plastic scintillation detectors, respectively, at various distances. The calculated spectra include the response matrices and pile-up effects. The same method and the same value of µ in Eqs. (7) and (8) are also used to calculate the spectra with different field sizes of the LINAC compared with the measured spectra. The measured spectra were taken at 0.1 m from the maze entrance using the NaI and plastic detectors. Then, the calculated and the measured spectra for different field sizes were normalized to the measured total energy by using Eq. (6). Figure 10 represents the comparison between the calculated spectra, including the response matrix and pile-up effects, and the measured spectra for the NaI scintillation detector. Figure 11 represents the comparison between the calculated spectra, including the response matrix and pile-up effects, and the measured spectra for the plastic scintillation detector.
For the NaI scintillation detector, the comparison of the measured spectrum with the calculated spectrum, including the response matrices and pile-up effects, showed an agreement within 7% at 10.5 m, 3% at 2 m, 1% at the laser curtain of the maze entrance, 6% for a 3 9 3 cm 2 field size, 4.8% for a 10 9 10 cm 2 field size, and 2% for a 30 9 30 cm 2 field size. For the plastic scintillation detector, the comparison of the measured spectrum with the calculated spectrum showed an agreement within 13% at 10.5 m, 7% at 2 m, 4% at the laser curtain of the maze entrance, 10% for a 3 9 3 cm 2 field size, 6.8% for a 10 9 10 cm 2 field size, and 4% for a 30 9 30 cm 2 field size.
The normalized counts of the corrected photon energy distributions using the NaI and plastic scintillation detectors are shown in Fig. 12. This figure represents the pulse height distributions without pile-up at the maze entrance while also comparing the FLUKA calculation distribution. Medical Physics, 47 (9), September 2020

DISCUSSION
The FLUKA Monte Carlo code and an algorithm based on the Poisson distribution were successfully developed to predict an accurate spectrum at the maze entrance of a radiotherapy room. Validation of the FLUKA code has shown that the PDD (Fig. 2) agreed with the measurement to within 3%. The FLUKA code was used to simulate the spectrum at the maze entrance of the radiotherapy room. The code was also used to calculate the response matrices for the NaI and plastic scintillation detectors.
In both detectors, the measurements at high count rates, which were taken close to the maze entrance, showed saturation. The total count number (Fig. 4), however, shows that all LINAC pulses are recorded and lie within the range of the detectors, whereas, the total energies of the spectrum increased almost exponentially as the count rate increased, as shown in Fig. 5. The saturation effect on the NaI scintillation detector Medical Physics, 47 (9), September 2020 was observed at a distance of <5 m, while on the plastic scintillation detector, the effect started at a distance of <2 m. The degree of the stability of the total counts number and the increasing of total energies at high count rates indicated that multiple pulses are being recorded as a single event. The pileup probability and its effect of the photon energy spectra in the occupational area can be obtained from the µ value.
The total counts per second reached a saturation point in the detectors, as shown in Fig. 4 when the pulse rate was about 400 Hz. This count rate reflects the number of LINAC pulses per second which has recently been measured by Velthuis et al. 14 In this study, they used a diamond detector irradiated by the Elekta LINAC machine that was also used in this experiment.
The novel algorithm presented here used a method to estimate the µ of the Poisson distribution, the simulation of response matrices of the detectors, and simulation of the spectrum at the maze entrance of the radiotherapy room to compare calculated and measured spectra. The agreement between the measured and calculated spectra confirms the importance of the use of the simulation of the spectrum at the maze entrance; the response matrices of the detectors have been calculated to predict the pulse height distribution of the scintillation detectors without a pile-up effect.
The energy range of the fluence determined by the Monte Carlo code was between 30 keV and 240 keV, with an average energy around 85 keV. The range of the pulse height distribution with the NaI scintillation detector was between 20 and 240 keV, with an average energy near 85 keV, the range with the plastic scintillation detector, which has a low atomic number, was from 0 up to 140 keV. These pulse height distributions show that the NaI scintillation detector has the same range of photon fluence due to its high atomic number and resulting high intrinsic detection efficiency. However, even at low count rates, some pile-up does influence the NaI detector. In contrast, the escape of Compton scattered photons leads to a reduced energy range in the plastic scintillator.

CONCLUSIONS
This work shows that high photon count rates were recorded as new events, migrated to higher energy bins, with the conservation of the total photon energy. This phenomenon is a form of pile-up that appears as a result of the pulsed nature of the LINAC output. Agreement between the calculated and measured spectrum using the NaI and plastic scintillation detectors was always within the first standard deviation of the variance expected in µ, which is acceptable in the field of radiation protection. Therefore, the measurements of photon energy spectra confirm the current and previous estimates of LINAC energy spectra outside the maze. This novel algorithm, which depends on a Monte Carlo simulation with the FLUKA code and a correction for the pile-up effect with the Poisson distribution, gives the real range of a photon energy spectrum. The agreement indicates that Monte Carlo modeling is a valuable tool in determining the spectrum of photons at the maze entrance generated by a medical LINAC.
FIG. 11. The pulse height distributions calculated and measured at 10 cm away from the maze entrance using the plastic scintillation detector. (a) for 3 9 3 cm 2 field size, (b) for 10 9 10 cm 2 field size, and (c) for 30 9 30 cm 2 field size.
represents the calculated spectrum and represents the measured spectrum. [Color figure can be viewed at wileyonlinelibrary.com] FIG. 12. Pulse height distribution corrected for pile-up at the maze entrance using the NaI and plastic scintillation detectors and compared with FLUKA calculation distribution.
represents the FLUKA calculation distribution, represents the distributions corrected for pile-up using the NaI scintillation detector and represents the distributions corrected for pile-up using the plastic scintillation detector.