Mail Inspection Based on Terahertz Time-Domain Spectroscopy

One of the most prominent applications of terahertz time-domain spectroscopy is the spectral investigation of materials covered by visibly opaque objects. Therefore, terahertz waves are well suited to inspect the content of mail. We report on our work on mail inspection in this spectral range including machine design, optical layouts, data analysis, and implementations.


Introduction
Concerning the aspect of security, the main problem of postal distribution service is that mail is usually enclosed within visible opaque materials-most often paper or cardboard. Without using imaging techniques based on X-ray radiation, the search for illicit and hazard contents is complicated, if not impossible. Even in the case of finding a suspicious substance, the identification with common techniques is at least hampered, unless a sample can be extracted.
Hence, attacks using letter bombs or letters with lethal substances are still a problem for exposed persons in politics and economy [1][2][3][4][5][6]. Furthermore, it is common to use the postal channel to smuggle relatively small amounts of drugs into drug-free institutions as, for example, correctional facilities. Since all mail arriving in such facilities are typically opened, checked and read-at least on a random basis-there is still one possible way of dealing with drugs via sealed mail left: mail from defenders or from court. They are only allowed to be opened and checked if an initial suspicion exists. There are a few institutions who do have X-ray-based scanners, but operating them is associated with additional costs for maintenance since a qualified radiation protection representative is mandatory.
A comparatively young technology often compared to X-rays is terahertz technologyalso called T-rays-addressing the spectral range between 0.1 and 10 THz. In general, dielectric media are more or less transparent to terahertz radiation, as their photon energy is too low to drive the materials' energy transitions of electrons. Imaging of these dielectric media is therefore possible, providing an X-ray-similar see-through capability. At the same time, this low photon energy is the reason why this radiation is harmless A comparatively young technology often compared to X-rays is terahertz technology-also called T-rays-addressing the spectral range between 0.1 and 10 THz. In general, dielectric media are more or less transparent to terahertz radiation, as their photon energy is too low to drive the materials' energy transitions of electrons. Imaging of these dielectric media is therefore possible, providing an X-ray-similar see-through capability. At the same time, this low photon energy is the reason why this radiation is harmless to humans, animals, and the environment. Hence, compared to X-ray-based devices, no protective measures have to be taken into account, as the radiation is non-ionizing [7,8]. Using continuous-wave (or narrow-bandwidth) terahertz systems, imaging devices for dielectric media have been developed and successfully applied to mail scanning as well [9]. Nevertheless, these systems only allow for a discovery of suspicious substances but not for their identification.
Since many crystalline substances like explosives, drugs, or chemicals are showing characteristic absorption bands-so-called fingerprints-in the terahertz spectral range, they can be identified using terahertz time-domain spectroscopy (TDS) [10][11][12][13][14][15]. These are the reasons why several groups working in the field of terahertz technology are developing and investigating mail scanning systems together with partners from industry and public authorities [16][17][18][19][20][21][22][23][24][25]. Figure 1 shows the imaging result of a mail envelope containing suspicious objects to build a mock-up for demonstration purposes only. The lower figures are showing evaluated data from the time-domain traces: transmission of the peak-value (c) and its delay in time (d). A Ti:sapphire-laser-based terahertz TDS system [14] equipped with an XY-scanning system was used to raster-scan this sample and acquire a complete waveform of 100 ps at . This measurement provides more than one million pixels, but was taken with a solid-state-laser-based terahertz time-domain spectroscopy (TDS) system filling an optical table with an overall measurement time of several hours. (a) Closed envelope as measured with indication of scanned area. (b) Content of the envelope consisting of several layers of paper, a radio-frequency identification (RFID) ski card, various wires and electronic components as well as two bags of substances. (c) Terahertz transmission image based on the transmittance. (d) False-color image retrieved by the evaluation of the time delay of the peak in each pixel's waveform.
A Ti:sapphire-laser-based terahertz TDS system [14] equipped with an XY-scanning system was used to raster-scan this sample and acquire a complete waveform of 100 ps at each pixel. With this, by using the fast-Fourier transformation (FFT), the spectral information is available in each point of the sample. This example provides more than one million spectra acquired within several hours, which is not acceptable for everyday use for frequent inspection of mail. Nevertheless, this demonstrates the principal usefulness of terahertz radiation to inspect mail in closed envelopes. An additional video of evaluation at increasing terahertz frequency can be found at https://youtu.be/r04eTert5Xg. Figure 2 shows another evaluation result of the same data using well-known spectra of two substances, which were inserted in the mock-up as powder bags. each pixel. With this, by using the fast-Fourier transformation (FFT), the spectral information is available in each point of the sample. This example provides more than one million spectra acquired within several hours, which is not acceptable for everyday use for frequent inspection of mail. Nevertheless, this demonstrates the principal usefulness of terahertz radiation to inspect mail in closed envelopes. An additional video of evaluation at increasing terahertz frequency can be found at https://youtu.be/r04eTert5Xg. Figure 2 shows another evaluation result of the same data using well-known spectra of two substances, which were inserted in the mock-up as powder bags. Figure 2. Spectral imaging example. For color-coding of the pixels, the similarity (square of the Pearson-correlation coefficient) to known spectra (a) of two substances (α-Lactose monohydrate and salicylic acid) was used as well as the transmission (gray color coding). The spectral information in each pixel enables the identification of the powder bags included in this sample (b). Spectra are vertically shifted for better readability.
A similarity evaluation by using the square of the Pearson correlation coefficient of each pixel's spectrum and the database spectra enables a pixel-wise identification of the hidden substances inside the envelope. This coefficient is defined as with the -th of spectral amplitudes and of the sample measurement spectrum and database spectrum, respectively, while ̅ and are the means of the spectral amplitudes of the two spectra within the considered spectral width covering elements. This example proves that not only the see-through capability of terahertz radiation can be used, but also the fingerprint-like spectral identification. It should be pointed out that besides the high similarity of bags to the known substances there is also a high dissimilarity of the residual ingredients of the sample. This is also a very important point concerning high detectability, which corresponds to a low false positive rate. Figure 3 shows exemplary spectra of some explosives, drugs as well as so-called simulants. These simulants are often used for research and engineering purposes, as the handling of drugs and explosives is often restricted and of course harmful [15]. Further advantages of using such simulants are their relatively low costs as well as their simple and worldwide access. As can be seen, even though the number and sharpness of the features in the terahertz frequency range is limited-especially in comparison to infrared or midinfrared spectral fingerprints-the spectral fingerprints enable to distinguish between the shown materials. For color-coding of the pixels, the similarity (square of the Pearson-correlation coefficient) to known spectra (a) of two substances (α-Lactose monohydrate and salicylic acid) was used as well as the transmission (gray color coding). The spectral information in each pixel enables the identification of the powder bags included in this sample (b). Spectra are vertically shifted for better readability.
A similarity evaluation by using the square of the Pearson correlation coefficient r of each pixel's spectrum and the database spectra enables a pixel-wise identification of the hidden substances inside the envelope. This coefficient is defined as with the i-th of N spectral amplitudes A i and B i of the sample measurement spectrum and database spectrum, respectively, while A and B are the means of the spectral amplitudes of the two spectra within the considered spectral width covering N elements. This example proves that not only the see-through capability of terahertz radiation can be used, but also the fingerprint-like spectral identification. It should be pointed out that besides the high similarity of bags to the known substances there is also a high dissimilarity of the residual ingredients of the sample. This is also a very important point concerning high detectability, which corresponds to a low false positive rate. Figure 3 shows exemplary spectra of some explosives, drugs as well as so-called simulants. These simulants are often used for research and engineering purposes, as the handling of drugs and explosives is often restricted and of course harmful [15]. Further advantages of using such simulants are their relatively low costs as well as their simple and worldwide access. As can be seen, even though the number and sharpness of the features in the terahertz frequency range is limited-especially in comparison to infrared or mid-infrared spectral fingerprints-the spectral fingerprints enable to distinguish between the shown materials.
Our goal was not to generate a mail scanning system, which is able to check thousands of mails within mail distribution hubs, but systems for small offices and correctional facilities, where the used kind of radiation does not affect the people in the closest surrounding of the device. There were several requirements and challenges at the same time we had to meet. Due to the offices' space restrictions, the system should be as compact as possible on the one hand and fully integrated on the other. A user-friendly graphical user interface and an easy to use intuitive software are very important since the operators working with the mail scanners are normally not technicians. The trade-off between scanning area and scanning speed has to be solved in terms that at least an envelope for DIN A4-letters-that means DIN C4-dimensions of 324 × 229 mm 2 -can be examined within a few minutes only. Figure 3. Spectra of (a) drugs, (b) explosives, (c) mock-up substances (simulants), and (d) isomers of aminobenzoic acids acquired with the terahertz TDS system used in the mail inspection system. While each substance shows characteristic absorption features, the number of features and their amplitude differ significantly. The shown cocaine spectra are typical for the two classes of cocaine that can be found on the market. Spectra are vertically shifted for better readability.
Our goal was not to generate a mail scanning system, which is able to check thousands of mails within mail distribution hubs, but systems for small offices and correctional facilities, where the used kind of radiation does not affect the people in the closest surrounding of the device. There were several requirements and challenges at the same time we had to meet. Due to the offices' space restrictions, the system should be as compact as possible on the one hand and fully integrated on the other. A user-friendly graphical user interface and an easy to use intuitive software are very important since the operators working with the mail scanners are normally not technicians. The trade-off between scanning area and scanning speed has to be solved in terms that at least an envelope for DIN A4-letters-that means DIN C4-dimensions of 324 × 229 mm²-can be examined within a few minutes only.

System Design
Using up-to-date technology for applications in a non-scientific environment as postal departments of institutions requires a highly user-friendly system design. The system's task of measuring and evaluating terahertz spectra has to be enabled without users need to know about this spectral range nor understand the used algorithms. For this, a terahertz TDS-based mail inspection system was built for regular office use without laboratory demands.

System Setup
The TDS system realized in the mail scanning device is driven by a femtosecond fiber laser working at telecommunication wavelengths of 1550 nm. The laser system with a repetition rate of 100 MHz provides optical pulses with a duration of about 80 fs and a pulse energy of about 0.3 nJ at each fiber output port illuminating the terahertz transmitter and detector antennas, respectively. The light guidance is completely done within polarization maintaining single-mode fibers, except for the voice-coil based delay-line (up to 40 Hz waveform acquisition frequency). The system is working in transmission only, why the material of the tray has to be highly transparent in the terahertz regime but mechanically Figure 3. Spectra of (a) drugs, (b) explosives, (c) mock-up substances (simulants), and (d) isomers of aminobenzoic acids acquired with the terahertz TDS system used in the mail inspection system. While each substance shows characteristic absorption features, the number of features and their amplitude differ significantly. The shown cocaine spectra are typical for the two classes of cocaine that can be found on the market. Spectra are vertically shifted for better readability.

System Design
Using up-to-date technology for applications in a non-scientific environment as postal departments of institutions requires a highly user-friendly system design. The system's task of measuring and evaluating terahertz spectra has to be enabled without users need to know about this spectral range nor understand the used algorithms. For this, a terahertz TDSbased mail inspection system was built for regular office use without laboratory demands.

System Setup
The TDS system realized in the mail scanning device is driven by a femtosecond fiber laser working at telecommunication wavelengths of 1550 nm. The laser system with a repetition rate of 100 MHz provides optical pulses with a duration of about 80 fs and a pulse energy of about 0.3 nJ at each fiber output port illuminating the terahertz transmitter and detector antennas, respectively. The light guidance is completely done within polarization maintaining single-mode fibers, except for the voice-coil based delay-line (up to 40 Hz waveform acquisition frequency). The system is working in transmission only, why the material of the tray has to be highly transparent in the terahertz regime but mechanically stable at the same time. Therefore, we used a special plastic foil stretched within a metal frame. This frame is mounted on a XY-scanner to exactly place the sample to the single-pixel terahertz sensor (see also next section).
The inner setup of the system is reminiscent of a sandwich: in the center plane, the XY-scanner with the tray is fixed in between two breadboard-like metal sheets with a distance of about 80 mm. The terahertz emitter and detector units are located on the facing sides each. Therefore, the detector unit is hanging upside down, which does not affect its performance. Fiber-coupled photoconductive switches (PCS) are used for terahertz generation and detection while the terahertz beam guiding is realized with plane goldcoated mirrors and parabolic mirrors for collimating and refocusing at the measurement points and the PCS, respectively.
An early, exemplary version is shown in Figure 4, accepting DIN C5 envelopes (229 × 162 mm 2 ) to be placed on the automated scanner. eration and detection while the terahertz beam guiding is realized with plane gold-coated mirrors and parabolic mirrors for collimating and refocusing at the measurement points and the PCS, respectively.
An early, exemplary version is shown in Figure 4, accepting DIN C5 envelopes (229 × 162 mm²) to be placed on the automated scanner.  [25]. An automated XY-scanner accepts the envelopes to be inspected.

Side Swap Mechanism
Realizing a sample scanning system with a stationary beam path, the required footprint is at least four times the sample size to reach the extremes (corners) of the sample with the beam. In addition to this minimum size, additional space is required for the beam guiding optics and peripherals. Especially when doubling the sample size of DIN C5 to DIN C4, it is challenging to keep a compact system design, still fitting to office environments. This compact system design limits the system footprint to 600 × 600 mm², which corresponds to the design shown in Figure 4. Obviously, the four times area of DIN C4 does not fit into the system when realizing the scanning principle with one stationary beam path (focus). Therefore, we implemented a switching of the terahertz beam within two possible measurement locations on the sample, which lowers the demand on the system footprint. Figure 5 shows a schematic of this so-called side swap mechanism. Depending on which side of the DIN C4 envelope has to be scanned (sketched in two colors in Figure 5), the prism reflectors are automatically moved in parallel, switching to beam paths. This transition is completed within approximately 1 s. A photograph of this mechanism in an early prototype status is shown in Figure 6.  [25]. An automated XY-scanner accepts the envelopes to be inspected.

Side Swap Mechanism
Realizing a sample scanning system with a stationary beam path, the required footprint is at least four times the sample size to reach the extremes (corners) of the sample with the beam. In addition to this minimum size, additional space is required for the beam guiding optics and peripherals. Especially when doubling the sample size of DIN C5 to DIN C4, it is challenging to keep a compact system design, still fitting to office environments. This compact system design limits the system footprint to 600 × 600 mm 2 , which corresponds to the design shown in Figure 4. Obviously, the four times area of DIN C4 does not fit into the system when realizing the scanning principle with one stationary beam path (focus). Therefore, we implemented a switching of the terahertz beam within two possible measurement locations on the sample, which lowers the demand on the system footprint. Figure 5 shows a schematic of this so-called side swap mechanism. Depending on which side of the DIN C4 envelope has to be scanned (sketched in two colors in Figure 5), the prism reflectors are automatically moved in parallel, switching to beam paths. This transition is completed within approximately 1 s. A photograph of this mechanism in an early prototype status is shown in Figure 6.

Closed-Loop Dry Air Purging
One of the main reasons why stand-off detection of explosives over several tens of meters is still a challenge, is the signal absorption due to water vapor in the environmental air [26]. Within a relatively tiny mail inspection system, the overall beam-path length is much lower and hence the influence of water vapor is less. Still, a significant drop of the dynamic range at the main water absorption lines can be observed [27]. Figure 7 shows a simulation of the effect of water vapor on the dynamic range for an 80 cm long beam path in 40% relative humidity (rh) of the environment (black curves). The complete spectral detection window is strongly rugged by the sharp absorption lines-at some single frequencies for e.g., around 1.4 THz or 1.86 THz the dynamic range of the terahertz signal gets completely lost. Due to the fact that, in general, solid-state materials as drugs and explosives have relatively broad absorption bands compared to the narrow water lines (see Figure 3), this is not critical for the function of the system itself. Appl. Sci. 2021, 11, x FOR PEER REVIEW 6 of 14  . Side swap mechanism. Two 45° plane mirrors (forming a prism-like reflector) are located on a servo-driven linear stage to enable the scanning of a DIN C4 envelope with a reduced system footprint. The switching of the terahertz beam path to achieve the two possible measurement locations (a and b, respectively) is indicated.

Closed-Loop Dry Air Purging
One of the main reasons why stand-off detection of explosives over several tens of meters is still a challenge, is the signal absorption due to water vapor in the environmental air [26]. Within a relatively tiny mail inspection system, the overall beam-path length is much lower and hence the influence of water vapor is less. Still, a significant drop of the dynamic range at the main water absorption lines can be observed [27]. Figure 7 shows a simulation of the effect of water vapor on the dynamic range for an 80 cm long beam path in 40% relative humidity (rh) of the environment (black curves). The complete spectral detection window is strongly rugged by the sharp absorption lines-at some single frequencies for e.g., around 1.4 THz or 1.86 THz the dynamic range of the terahertz signal gets completely lost. Due to the fact that, in general, solid-state materials as drugs and explosives have relatively broad absorption bands compared to the narrow water lines (see Figure 3), this is not critical for the function of the system itself.  . Side swap mechanism. Two 45° plane mirrors (forming a prism-like reflector) are located on a servo-driven linear stage to enable the scanning of a DIN C4 envelope with a reduced system footprint. The switching of the terahertz beam path to achieve the two possible measurement locations (a and b, respectively) is indicated.

Closed-Loop Dry Air Purging
One of the main reasons why stand-off detection of explosives over several tens of meters is still a challenge, is the signal absorption due to water vapor in the environmental air [26]. Within a relatively tiny mail inspection system, the overall beam-path length is much lower and hence the influence of water vapor is less. Still, a significant drop of the dynamic range at the main water absorption lines can be observed [27]. Figure 7 shows a simulation of the effect of water vapor on the dynamic range for an 80 cm long beam path in 40% relative humidity (rh) of the environment (black curves). The complete spectral detection window is strongly rugged by the sharp absorption lines-at some single frequencies for e.g., around 1.4 THz or 1.86 THz the dynamic range of the terahertz signal gets completely lost. Due to the fact that, in general, solid-state materials as drugs and explosives have relatively broad absorption bands compared to the narrow water lines (see Figure 3), this is not critical for the function of the system itself. Figure 6. Side swap mechanism. Two 45 • plane mirrors (forming a prism-like reflector) are located on a servo-driven linear stage to enable the scanning of a DIN C4 envelope with a reduced system footprint. The switching of the terahertz beam path to achieve the two possible measurement locations (a and b, respectively) is indicated.
However, the shorter the beam path in humid air, the lower the influence of water absorption to the detected spectra and the higher the overall system performance. Hence, nearly the complete terahertz beam path of 80 cm-except the inner part of the sandwich structure where the sample is moved within the terahertz focus (about 8 cm)-is covered with a transparent housing. This is sketched in Figure 8. The housing is made out of poly-carbonate since its water storage capability is lower than polymethyl methacrylate (PMMA). The terahertz windows to the humid region (sample area) are realized by two thin polytetrafluoroethylene (PTFE) foils, each. Although the housings of the upper beam path and the lower beam path are more or less hermetically sealed, a slight leakage can be detected. Hence, a closed loop setup is realized by the serial arrangement of the beam path's housings, an air filter filled with zeolite and a small air circulation pump. Appl. Sci. 2021, 11, x FOR PEER REVIEW 7 of 14 Figure 7. Simulation of the effect of water vapor in the terahertz beam path of 80 cm in comparison to 8 cm using the HITRAN database [28]. By purging 90% of the terahertz beam path in the system, the spectral quality can be significantly enhanced.
However, the shorter the beam path in humid air, the lower the influence of water absorption to the detected spectra and the higher the overall system performance. Hence, nearly the complete terahertz beam path of 80 cm-except the inner part of the sandwich structure where the sample is moved within the terahertz focus (about 8 cm)-is covered with a transparent housing. This is sketched in Figure 8. The housing is made out of polycarbonate since its water storage capability is lower than polymethyl methacrylate (PMMA). The terahertz windows to the humid region (sample area) are realized by two thin polytetrafluoroethylene (PTFE) foils, each. Although the housings of the upper beam path and the lower beam path are more or less hermetically sealed, a slight leakage can be detected. Hence, a closed loop setup is realized by the serial arrangement of the beam path's housings, an air filter filled with zeolite and a small air circulation pump.  Figure 5. A closed loop containing a zeolite reservoir for air drying is enclosing most of the terahertz beam path. A humidity regulated pump is used to circulate the air and ensuring the interaction of the humid air with the zeolite granulate.
Since the covered volume is kept as small as possible, the pump system is able to reduce the relative humidity in the closed loop setup within approx. 10 min from ambient condition to below 3% rh. This procedure is only needed when powering up the system after a longer shut down. To ensure dry and stable measurement conditions, the pump is permanently running in a low power mode even when the humidity level inside the system is lower than 3% rh. Therefore, only 10% of the terahertz beam path is left within humid air. Figure 7 shows the difference between purged (red curves) and not purged (black curves) conditions to the dynamic range of the system. As a result, the influence of Figure 7. Simulation of the effect of water vapor in the terahertz beam path of 80 cm in comparison to 8 cm using the HITRAN database [28]. By purging 90% of the terahertz beam path in the system, the spectral quality can be significantly enhanced. Figure 7. Simulation of the effect of water vapor in the terahertz beam path of 80 cm in comparison to 8 cm using the HITRAN database [28]. By purging 90% of the terahertz beam path in the system, the spectral quality can be significantly enhanced.
However, the shorter the beam path in humid air, the lower the influence of water absorption to the detected spectra and the higher the overall system performance. Hence, nearly the complete terahertz beam path of 80 cm-except the inner part of the sandwich structure where the sample is moved within the terahertz focus (about 8 cm)-is covered with a transparent housing. This is sketched in Figure 8. The housing is made out of polycarbonate since its water storage capability is lower than polymethyl methacrylate (PMMA). The terahertz windows to the humid region (sample area) are realized by two thin polytetrafluoroethylene (PTFE) foils, each. Although the housings of the upper beam path and the lower beam path are more or less hermetically sealed, a slight leakage can be detected. Hence, a closed loop setup is realized by the serial arrangement of the beam path's housings, an air filter filled with zeolite and a small air circulation pump.  Figure 5. A closed loop containing a zeolite reservoir for air drying is enclosing most of the terahertz beam path. A humidity regulated pump is used to circulate the air and ensuring the interaction of the humid air with the zeolite granulate.
Since the covered volume is kept as small as possible, the pump system is able to reduce the relative humidity in the closed loop setup within approx. 10 min from ambient condition to below 3% rh. This procedure is only needed when powering up the system after a longer shut down. To ensure dry and stable measurement conditions, the pump is permanently running in a low power mode even when the humidity level inside the system is lower than 3% rh. Therefore, only 10% of the terahertz beam path is left within humid air. Figure 7 shows the difference between purged (red curves) and not purged (black curves) conditions to the dynamic range of the system. As a result, the influence of  Figure 5. A closed loop containing a zeolite reservoir for air drying is enclosing most of the terahertz beam path. A humidity regulated pump is used to circulate the air and ensuring the interaction of the humid air with the zeolite granulate.
Since the covered volume is kept as small as possible, the pump system is able to reduce the relative humidity in the closed loop setup within approx. 10 min from ambient condition to below 3% rh. This procedure is only needed when powering up the system after a longer shut down. To ensure dry and stable measurement conditions, the pump is permanently running in a low power mode even when the humidity level inside the system is lower than 3% rh. Therefore, only 10% of the terahertz beam path is left within humid air. Figure 7 shows the difference between purged (red curves) and not purged (black curves) conditions to the dynamic range of the system. As a result, the influence of the water absorption is much lower which enhances the quality of the detected spectra and the overall system performance, too.

Evaluation Methods
For evaluation of spectra with respect to identifying known substances, a plethora of methods is conceivable. In the case of a restricted identification problem, where the expected spectra are completely covered by the database and not covered by unknown influences, a principal component analysis is suitable [29][30][31][32]. The PCA method reduces the dimensions of the spectra by a coordinate transformation into a lower dimension, taking the spectral components into account, which contain the most significant information to describe all expected spectra. Then, in dependence of the location of a spectrum under evaluation in this new coordinate system, it is classified by the location of known spectra taken into account. The decision can be made by suitable classifiers, which are e.g., based on k-nearest neighbors algorithm (k-NN), linear discriminant analysis (LDA), or support vector machines (SVM). Since most classifiers are not parameter free, at this point sensitivity and specificity are assessed by analyzing the influence of the parameters on the decision. Receiver operator characteristic curves (ROC) are used to design the best possible true positive rates while limiting false positive rates [33][34][35].
In case of a non-restricted identification problem, where also unknown spectra have to be considered, this PCA might not be suited best. As unknown spectra possibly carry new, significant information differing from the expected spectra-describing the difference-the PCA might drop this significant difference (as its transformation only bases on the known, expected spectra) and lead to a false classification.
In the case of paper-packed envelopes, multiple reflections have to be considered that can lead to extinction variation throughout the whole spectrum. This can lead to unfavorable false-positive detections as well as to false-negative results. As will be shown, in the following, this can be overcome by making use of reflection properties.

Suppression of Multiple Reflections
Considering realistic mail inspection scenarios, multiple reflections at paper sheets have to be considered. Mail envelopes and contents are mainly paper of various thicknesses, densities, and distributions. Therefore, no constant, but alternating contributions can be considered. One attempt to overcome this problem is to vary the angle of incidence and evaluate the sample's response in dependence on the angle of incidence [36,37]. As the material intrinsic response (absorption) is independent of the angle of incidence, the contributions of multiple reflections are not: they base on angle-of-incidence-dependent reflectivity and interferences which themselves depend on optical path lengths, varying with the angle of incidence. Therefore, one can discriminate the constant contribution of the hidden substance and the varying contribution of multiple reflections [38,39].
As the enclosure is most commonly of the same material (paper or cardboard), one can assume that its refractive index is more or less defined. Considering the polarizationdependent reflectivity at various angles of incidence, a much more elegant solution can be applied to the problem of multiple reflections: angle of incidence at Brewster's angle [40] α Brewster = arctan(n), (2) with the refractive index of the enclosure material n and assuming the measurement in air environment (n air = 1), which will be the case for all mail scanning systems. Assuming a mean refractive index of n~1.5, the angle of incidence has to be chosen to be approximately 56 • . A comparison of substances embedded in paper stacks at normal incidence and Brewster's angle can be seen in Figure 9, where the spectra at normal incidence are vertically shifted for better readability. The results show that at normal incidence multiple reflections lead to additional spectral features that cover those of PABA. This is significantly suppressed when using an incidence at Brewster's angle, where the spectral features of the substance are unaffected as the multiple reflections are physically prevented.
To investigate the influence of the angle of incidence change on the detection performance, a plethora of measurements on negative samples (paper stacks and mail without substances) were made with both incident angles and compared to positive measurements (with substances). Depending on the correlation threshold of the detection algorithm (sharpness of detection), one can find the true positive and false positive rate. The farther they are apart, the better. Figure 10 shows the results of these measurements and demonstrates the benefit of measuring at Brewster's angle. At a correlation threshold of 0.2, the false positive rate was suppressed in our exemplary measurement set by a factor of about 14 and 10 for PABA and α-Lactose mh., respectively. In practice, a certain correlation threshold has to be set for each substance. Depending on the acceptable false positive rate, one can then gain a true positive rate and vice versa. When applying the Brewster's configuration, the resulting true positive rate is enhanced for a desired acceptable false positive rate [41].
Appl. Sci. 2021, 11, x FOR PEER REVIEW 9 of 14 This is significantly suppressed when using an incidence at Brewster's angle, where the spectral features of the substance are unaffected as the multiple reflections are physically prevented. Figure 9. Comparison of the obtained spectra of a PABA sample enclosed in eight sheets of paper (a) and 16 sheets of paper (b) under normal incidence (red curves) and incidence at the Brewster's angle (black curves). The spectral quality is greatly enhanced due to the suppression of multiple reflections. The used paper was standard office paper with 80 g/m². Spectra are vertically shifted for better readability.
To investigate the influence of the angle of incidence change on the detection performance, a plethora of measurements on negative samples (paper stacks and mail without substances) were made with both incident angles and compared to positive measurements (with substances). Depending on the correlation threshold of the detection algorithm (sharpness of detection), one can find the true positive and false positive rate. The farther they are apart, the better. Figure 10 shows the results of these measurements and demonstrates the benefit of measuring at Brewster's angle. At a correlation threshold of 0.2, the false positive rate was suppressed in our exemplary measurement set by a factor of about 14 and 10 for PABA and α-Lactose mh., respectively. In practice, a certain correlation threshold has to be set for each substance. Depending on the acceptable false positive rate, one can then gain a true positive rate and vice versa. When applying the Brewster's configuration, the resulting true positive rate is enhanced for a desired acceptable false positive rate [41]. Figure 10. Improvement of false positive rates (FP) when using an incidence of the terahertz radiation at the Brewster's angle compared to normal incidence for the two simulants PABA (a) and α-Lactose monohydrate (mh.) (b). TP: true positive rate.

Sample Scan Strategies and Visualization
When investigating mail and searching for a specific content, the scan strategy strongly depends on the speed of data acquisition. As TDS systems are mostly singlepoint measurements, this is an important topic when realizing mail inspection systems, Figure 9. Comparison of the obtained spectra of a PABA sample enclosed in eight sheets of paper (a) and 16 sheets of paper (b) under normal incidence (red curves) and incidence at the Brewster's angle (black curves). The spectral quality is greatly enhanced due to the suppression of multiple reflections. The used paper was standard office paper with 80 g/m 2 . Spectra are vertically shifted for better readability. Figure 9. Comparison of the obtained spectra of a PABA sample enclosed in eight sheets of paper (a) and 16 sheets of paper (b) under normal incidence (red curves) and incidence at the Brewster's angle (black curves). The spectral quality is greatly enhanced due to the suppression of multiple reflections. The used paper was standard office paper with 80 g/m². Spectra are vertically shifted for better readability.
To investigate the influence of the angle of incidence change on the detection performance, a plethora of measurements on negative samples (paper stacks and mail without substances) were made with both incident angles and compared to positive measurements (with substances). Depending on the correlation threshold of the detection algorithm (sharpness of detection), one can find the true positive and false positive rate. The farther they are apart, the better. Figure 10 shows the results of these measurements and demonstrates the benefit of measuring at Brewster's angle. At a correlation threshold of 0.2, the false positive rate was suppressed in our exemplary measurement set by a factor of about 14 and 10 for PABA and α-Lactose mh., respectively. In practice, a certain correlation threshold has to be set for each substance. Depending on the acceptable false positive rate, one can then gain a true positive rate and vice versa. When applying the Brewster's configuration, the resulting true positive rate is enhanced for a desired acceptable false positive rate [41]. Figure 10. Improvement of false positive rates (FP) when using an incidence of the terahertz radiation at the Brewster's angle compared to normal incidence for the two simulants PABA (a) and α-Lactose monohydrate (mh.) (b). TP: true positive rate.

Sample Scan Strategies and Visualization
When investigating mail and searching for a specific content, the scan strategy strongly depends on the speed of data acquisition. As TDS systems are mostly singlepoint measurements, this is an important topic when realizing mail inspection systems, Figure 10. Improvement of false positive rates (FP) when using an incidence of the terahertz radiation at the Brewster's angle compared to normal incidence for the two simulants PABA (a) and α-Lactose monohydrate (mh.) (b). TP: true positive rate.

Sample Scan Strategies and Visualization
When investigating mail and searching for a specific content, the scan strategy strongly depends on the speed of data acquisition. As TDS systems are mostly single-point measurements, this is an important topic when realizing mail inspection systems, especially if they should work mainly automated. Conventional TDS systems (based on mechanical delay lines) are acquiring up to some tens of spectra per second. With this, scanning of the whole sample area is often too time-consuming, so alternative strategies have to be implemented. Our approach bases on the fact that we assume areas of interest with substances larger than the terahertz focal spot size. If in a measured point, a spectrum is detected that is in our database, its vicinity is set on the list of points to be scanned. If the new points are evaluated to be positive as well, this continues, until the area of the substance is completely covered. This procedure is very helpful, if the data acquisition per spectrum is slow. A time-lapse video of a test measurement of this feature can be found at https://youtu.be/fc3DBzWsPDA. Four screenshots at significant times can be seen in Figure 11. with substances larger than the terahertz focal spot size. If in a measured point, a spectrum is detected that is in our database, its vicinity is set on the list of points to be scanned. If the new points are evaluated to be positive as well, this continues, until the area of the substance is completely covered. This procedure is very helpful, if the data acquisition per spectrum is slow. A time-lapse video of a test measurement of this feature can be found at https://youtu.be/fc3DBzWsPDA. Four screenshots at significant times can be seen in Figure 11. First, random points in a defined area of interest are measured and evaluated for suspicious spectra, which indicate forbidden substances. These points are marked as white spots in the graphical user interface on an optical image of the sample, which is taken at the moment of the pull-in of the sample drawer. Once a measured point is identified by comparing its spectrum (after filtering and preprocessing) with a spectrum of the database, it is marked red (positive detection) and the surrounding of this point is defined to be investigated (white spots surrounding the red one), instead of further random points across the sample. This leads to a spread of this detection area, until the hidden substance area is covered with measurement points. After this, the random-like investigation is continued. Negative results (no detection) are marked with green in this example of visualization. First, random points in a defined area of interest are measured and evaluated for suspicious spectra, which indicate forbidden substances. These points are marked as white spots in the graphical user interface on an optical image of the sample, which is taken at the moment of the pull-in of the sample drawer. Once a measured point is identified by comparing its spectrum (after filtering and preprocessing) with a spectrum of the database, it is marked red (positive detection) and the surrounding of this point is defined to be investigated (white spots surrounding the red one), instead of further random points across the sample. This leads to a spread of this detection area, until the hidden substance area is covered with measurement points. After this, the random-like investigation is continued. Negative results (no detection) are marked with green in this example of visualization.
Further, as local inhomogeneities can cause singular false positive detections, a consistency check of the surrounding can be made. Depending on the result of the surrounding, the first detection is revised. Of course, this can be made dependent on thresholds, so that too good correlations are not overwritten afterwards. This procedure is helpful to judge results at the edge or above the edge of detection. An example is shown in Figure 12, where a suspicious point (marked with yellow) is investigated in its surrounding and then revised, as the surrounding is identified to be negative results.
Further, as local inhomogeneities can cause singular false positive detections, a consistency check of the surrounding can be made. Depending on the result of the surrounding, the first detection is revised. Of course, this can be made dependent on thresholds, so that too good correlations are not overwritten afterwards. This procedure is helpful to judge results at the edge or above the edge of detection. An example is shown in Figure  12, where a suspicious point (marked with yellow) is investigated in its surrounding and then revised, as the surrounding is identified to be negative results. Figure 12. Procedure of result dependent search strategy and suspect handling. First, random points on the sample surface are inspected (a). In case of a suspect (not clearly positive), the surrounding is scanned (b,c). In case of surrounding measurement points with negative results, the suspect is declared negative (d). In this case, a fast-scanning system was used in contrast to Figure  11. Therefore, lines of points result instead of single measurement points.
Two examples of the implemented visualization possibilities are shown in Figure 13: (a) shows an extension of the already described traffic-light format (green-yellow-red) classification with an orange visualization inserted. Depending on the similarity of the measurement points spectrum with one of the spectra of the database, this false-colorcoding is used. Figure 13b shows a discrimination visualization example, which uses black-to-color indication of different substances. With this, not only a true-positive, but a substance-specific classification is visualized, which provides the user with more information about the content of the investigated sample. Figure 12. Procedure of result dependent search strategy and suspect handling. First, random points on the sample surface are inspected (a). In case of a suspect (not clearly positive), the surrounding is scanned (b,c). In case of surrounding measurement points with negative results, the suspect is declared negative (d). In this case, a fast-scanning system was used in contrast to Figure 11. Therefore, lines of points result instead of single measurement points.
Two examples of the implemented visualization possibilities are shown in Figure 13: (a) shows an extension of the already described traffic-light format (green-yellow-red) classification with an orange visualization inserted. Depending on the similarity of the measurement points spectrum with one of the spectra of the database, this false-colorcoding is used. Figure 13b shows a discrimination visualization example, which uses black-to-color indication of different substances. With this, not only a true-positive, but a substance-specific classification is visualized, which provides the user with more information about the content of the investigated sample.

Conclusions
Terahertz time-domain spectroscopy provides unique possibilities to nondestructively inspect mail with the aim of identification of drugs and explosives. As typical enclosures used for mail are of dielectric nature and therefore more or less transparent for terahertz waves, this application fits well to this part of the electromagnetic spectrum.

Conclusions
Terahertz time-domain spectroscopy provides unique possibilities to nondestructively inspect mail with the aim of identification of drugs and explosives. As typical enclosures used for mail are of dielectric nature and therefore more or less transparent for terahertz waves, this application fits well to this part of the electromagnetic spectrum. Further, relevant drugs and explosives show specific absorption features, which allow the identification by using terahertz spectroscopy. Nevertheless, the transition from lab demonstration requires advances in applicability and usability.
We have successfully shown that our developed mail scanning system based on terahertz time-domain spectroscopy is able to reliably identify suspicious substances hidden in mail. With the help of some engineering refinements as the side swap mechanism, the system completely fulfills the demands to be used in small offices as for example in correctional facilities. Especially the artificial absorption bands induced by multiple reflections from the mail paper sheets could be strongly suppressed, which results in a dramatic drop in the false positive rate of our evaluation algorithm. Additionally, the dry air purging of already 90% of the terahertz beam path leads to a remarkable improvement of the overall system performance. The presented different sample scan strategies as well as the various visualization options are helpful features to make the invisible visible. Last but not least, the intuitive graphical user interface helps operators who do not have a technical background to easily use the system to reliably check the daily mail.

Data Availability Statement:
The data presented in this study are available on reasonable request from the corresponding authors.