You are on page 1of 20

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/330119250

A method for gamma background subtraction using Visual Basic for


Applications code with Microsoft Excel

Article  in  Journal of Radioanalytical and Nuclear Chemistry · January 2019


DOI: 10.1007/s10967-018-06411-7

CITATIONS READS

2 667

5 authors, including:

Jose Antonio Suarez-Navarro Ll. Pujol


Centro Investigaciones Energéticas, Medioambientales y Tecnológicas Centro de Estudios y Experimentación de Obras Públicas
34 PUBLICATIONS   282 CITATIONS    38 PUBLICATIONS   501 CITATIONS   

SEE PROFILE SEE PROFILE

All content following this page was uploaded by Jose Antonio Suarez-Navarro on 28 October 2019.

The user has requested enhancement of the downloaded file.


Journal of Radioanalytical and Nuclear Chemistry (2019) 319:1159–1163
https://doi.org/10.1007/s10967-018-06411-7

A method for gamma background subtraction using Visual Basic


for Applications code with Microsoft Excel
J. A. Suarez‑Navarro1   · Ll. Pujol2 · M. J. Suarez‑Navarro3 · M. Arana1 · G. Hernáiz1

Received: 1 November 2018 / Published online: 3 January 2019


© Akadémiai Kiadó, Budapest, Hungary 2019

Abstract
This work proposes a method for gamma background subtraction by combining several background spectra acquired during
short-term measurements (100,000 s). A dedicated Visual Basic code has been developed, that performs an energy correction
due to gain drifts, via interpolation of the counts, and finally a summation of several background spectra. Three interpolations
were tested: linear, quadratic and cubic, from which the linear was selected after checking the Gaussian fit and accuracy of
the areas of the resulting photopeaks. The activity concentration results using the proposed algorithm in two intercomparable
exercises and different matrices showed the reproducibility of the proposed method.

Keywords  Gamma spectrometry · Background fluctuation · Genie-2000 · Microsoft Excel · HPGe detector

Introduction background subtraction, it is necessary to make sufficiently


long measurements, at least as long as the sample with the
The availability of gamma detectors in environmental radio- longest counting time (about 600,000 s) and a high periodic-
activity laboratories is influenced by: (1) acquisition times, ity [1]. In the case of the gamma spectrometry laboratory
due to the limits of detection that must be achieved, (2) of the Environmental Radioactivity Unit for Radiological
having a high number of samples to analyze, and (3) the Vigilance (URA and VR) of the CIEMAT, the background is
number of detectors in the laboratory. On the other hand, measured every 6 months with a counting time of 600,000 s.
the activity determination is based on two separate measure- In routine laboratory practice, the most recent background
ments (background and sample measurement) over which is subtracted from the sample measurement. The factors
time the natural background can fluctuate [1]. The variable described below make the planning of routine measurements
contribution to the background is due to cosmic radiation, a difficult process.
radon and its progeny [2], and other lesser variables due to In the gamma spectrometry technique it is not advisable
laboratory construction materials [3], shielding, and detector to directly sum the spectra because the possible system gain
constitutive material [4]. Therefore, to carry out a correct drifts that take place, mainly in the preamplifier and detector
due to changes in atmospheric pressure and environmental
temperature, produce resolution losses and enlargement of
Electronic supplementary material  The online version of this
article (https​://doi.org/10.1007/s1096​7-018-06411​-7) contains the photopeaks [5]. These drifts can be corrected though
supplementary material, which is available to authorized users. the following methods: (1) with reference photopeaks from
a reference source; (2) by generating electrical pulses [6], or
* J. A. Suarez‑Navarro (3) by mathematical adjustments [7], which allow the spec-
ja.suarez@ciemat.es
tra to be added together. Initially, the spectra were summed
1
Centro de Investigaciones Energéticas, Medioambientales y by manually adjusting the gains and saving the sum of the
Tecnológicas (CIEMAT – Dpto. Medio Ambiente), Avda. spectra into the analyzer memory [8]. Bossew proposed a
Complutense 22, 28040 Madrid, Spain method based on mathematically correcting the displace-
2
Centro de Estudios y Experimentación de Obras Públicas ments, fitting the energy calibration equations to one of the
(CEDEX), Alfonso XII, 3, 28014 Madrid, Spain spectra [9]. The adjusted channels were decimal numbers
3
Departamento de Hidráulica, Energía y Medioambiente, so it was necessary to interpolate the counts from each
Universidad Politécnica de Madrid, ETSI Caminos, Profesor channel by selecting the linear interpolation for simplicity.
Aranguren, s/n, 28040 Madrid, Spain

13
Vol.:(0123456789)

1160 Journal of Radioanalytical and Nuclear Chemistry (2019) 319:1159–1163

Nevertheless, the function necessary to interpolate the temperature is stabilized at 21 °C by an air-conditioning sys-
counts from each channel before totaling the spectra had tem, and the room is continuously ventilated with fresh air.
to fulfill two conditions: (1) that it correctly reproduced the The radon concentration in the laboratory fluctuates between
spectrum baseline, and (2) that it correctly fit the photopeak 5 and 134 Bq m−3, with an average value of 35 Bq m−3.
of the spectrum. The optimal way to estimate the baseline of
the spectrum is equivalent to the procedure for determining Visual basic code used for spectra summing
the baseline of a photopeak when the area of the photopeak
is determined. The different functions for determining the Appendix S2 details the code developed in Visual Basic for
baseline of the spectrum are: linear [10]; a polynomial equa- Applications that was used for gamma background spec-
tion [11, 12]; an exponential function [13]; or by smoothing tra summing. In addition, the algorithm is mathematically
the counts [14]. Among these functions, that developed by developed and the implementation and features of the code
Quittner [15, 16] should be highlighted. It consists of ini- were described. A further description of the Genie 2000
tially determining the slope parameters of the continuum in CAM file can be found in [18].
the photopeak environment through quadratic adjustments
to evaluate the parameters of the cubic equation with which Photopeaks selected
the baseline of the spectrum is adjusted.
Taking into account the above, our working hypothesis The photopeaks selected in this work correspond to main
is that the activity concentration of the samples suppressing gamma emitters present in the gamma background: (1) due
the gamma background, by means of a spectrum obtained to the material in the detector and shield: 77.1 keV (BiKα1)
by adding together several background spectra (100,000 s), and 238.6 keV (212Pb); (2) structural laboratory materials:
correcting possible displacements using energy calibration 1460.8 keV (40K); (3) cosmic radiation: 558.5 keV (114*Cd);
equations, is statistically comparable to that which results (4) radon daughters: 295.2 keV (214Pb), 351.9 keV (214Pb),
from using a single background spectrum, whose meas- 609.3 keV (214Bi) and 1764.5 keV (214Bi) and (5) the anni-
urement time is equal to that of the sum of the individual hilation peak: 511 keV.
spectra. The aim of this work is, therefore, to develop an
algorithm using Visual BASIC for Microsoft Excel Appli- Selecting the interpolation function for the counts
cations through the Canberra Nuclear DataAccess Library from each channel
[17] to add together different background spectra that can
be used by the Genie 2000 software. For this, it is necessary Linear, quadratic and cubic functions were studied for
to: (1) study which is the best interpolation for calculating interpolating the counts from each channel, considering the
the counts from each channel; (2) verify that the photopeaks most widely used functions for estimating the baseline of
obtained do not broadening; and (3) check that there are no the spectrum when the background of a particular photo-
significant differences between the activity concentration peak is corrected. The interpolation function was selected
values obtained by the proposed method and that typically by employing two tests. The first test determined the Gauss-
used by gamma spectrometry laboratories. ian goodness-of-fit in the calculated counts for each channel
using the statistic χ2 given that the Gaussian function best
reproduces a gamma photopeak [19]. The selected interpo-
Experimental lation is that which gives a critical value of χ2 below the
number of degrees of freedom, corresponding to the chan-
Laboratory description and detectors nels that make up the peak, and which is closest to 0. The χ2
parameter was calculated using InteractivePeakFit in Genie
The gamma spectrometry laboratory of the Environmental 2000 [20]. Once it had been verified that the shape of the
Radioactivity Unit for Radiological Vigilance (URA y VR) peaks was correct, a second study was undertaken consisting
of CIEMAT (Research Center for Energy, Environmental of comparing the areas obtained by applying the proposed
and Technology) has ten high-purity germanium detectors algorithm with those obtained by summing the individual
(Table S1.1, see appendix S1). All of the detectors are con- spectra. The areas were compared by measuring the degree
nected to five chains consisting of ten HV power supplies, of overlap between the areas obtained for a coverage factor
ten spectroscopy amplifiers, and ten ADCs from Canberra of k = 2.
Industries. Spectra were recorded via five acquisition inter-
face modules (AIMs) (Canberra Industries) to the computer Study of the peaks broadening
memory, and were analyzed using the standard Canberra
Genie 2000 software package. The detectors are in a room The proposed algorithm adjusts the possible displace-
located in the basement of a 50-year old building. The ments of the energies of the spectra due to gain drifts which

13
Journal of Radioanalytical and Nuclear Chemistry (2019) 319:1159–1163 1161

would produce a broadening in the photopeaks. For this Results and discussion


purpose, the algorithm considers the energy calibration of
the first spectrum as a reference and corrects the possible Selecting the interpolation function for the counts
displacements of the other spectra (see Appendix S2 for from each channel
more details). It is important to note that all spectra need
to have been calibrated in energy. Therefore, a study was The values of χ2 for the 77.1, 351.9, 609.3, 1460.8, and
carried out of the possible broadening of the FWHM with 1764.5 keV photopeaks of the final spectrum, obtained
increasing energy over the range of energy studied. This after applying the algorithm in 10 detectors, were similar.
study allows verification of whether the spectrum obtained The lowest average value was obtained for the linear fit
can be analyzed using the Genie 2K software package. In (see Tables S3.1, S3.2, and S3.3, see appendix S3). In
this study two curves of the FWHM as a function of energy all cases the values obtained from χ 2 for 10 degrees of
were compared: freedom, which is equivalent to the 11-channel average
of the photopeaks for a background spectrum, were lower
(a) the curve obtained by the proposed algorithm applied than the critical value of χ2 corresponding to 18.31. On
to background spectra; the other hand, the linear fit gave the closest values of χ2
(b) the curve corresponding to the peak shape calibration. to 0 for the three interpolations of the 5 photopeaks and
the 10 detectors.
Curve a was prepared using the peaks shown in the previ- Supplementary Tables S4.1 to S4.9  (see appendix
ous section. S4) show a comparison of the areas obtained using the
proposed algorithm for the three interpolations (linear,
Application of the proposed method for gamma quadratic and cubic) for the 10 laboratory detectors for
background subtraction each of the selected background photopeaks. The percent-
age of statistically indistinguishable values between the
The proposed method was applied to three materials of dif- areas computed through the proposed algorithm and those
fering composition from two proficiency tests: (1) a water obtained with the direct summation, for a coverage factor
sample, (2) an ash sample, and (3) a soil sample. The sam- of k = 2, were higher than 80% for the three interpola-
ples were provided by the International Atomic Energy tions. The smallest overlap was obtained for the annihila-
Agency (IAEA) and the Consejo de Seguridad Nuclear of tion peak of 511 keV; however, since this peak was not
Spain (CSN). used for the calculation, the radionuclide activity does not
The activity concentrations obtained with the proposed imply inconvenience. In the other cases, the percentage
method and the current method of background suppression of overlap was equal to or greater than 90%, meaning the
were compared using the statistical criterion Enumbers (Eq. 1). proposed algorithm allows us to determine the areas of the
The results were compared by checking the Enumber. The main gamma photopeak with the same accuracy as that
Enumbers take into account the absolute deviation of the activ- obtained with a background of 600,000 s.
ity concentration value reported by each laboratory from the Based on the results obtained in the two previous
reference value together with the combination of expanded tests, the linear interpolation was selected as having good
uncertainties associated with them [21]: Gaussian fit in the determined channels and being as accu-
rate as a typical background spectrum, in other words, one
A − A0
Enumbers = √ with a count time of 600,000 s.
( )2 (1)
u(A)2 + u A0

where A is the laboratory results, A0 is the assigned reference Study of the peaks broadening
value, u(A) is the expanded uncertainty of the laboratory’s
result (k = 2) and u(A0) is the expanded uncertainty of the Figure 1 shows FWHM as a function of energy for a spec-
assigned reference value (k = 2). trum obtained with the proposed algorithm for one of the
10 laboratory detectors and that of the energy calibration
of the detector itself. Detector 10 was selected as it had
the most background counts in the various photopeaks and
for which more backgrounds were measured (see Tables
S4.1 to S4.9, see appendix S4), in order to have an equiva-
lent amount of counts in the photopeak areas between the
two curves. The algorithm was executed using the linear

13

1162 Journal of Radioanalytical and Nuclear Chemistry (2019) 319:1159–1163

possible to locate the photopeaks and calculate the area


with the conditions equivalent to any spectrum, and, in
addition, the background suppression can be undertaken
correctly using the Genie 2000 software.

Application of the proposed method for gamma


background subtraction

Table 1 shows the reference activity concentration, the


activity concentration reported with the actual subtraction
method (see “Experimental” section for more details), and
Fig. 1  FWHM (keV) as a function of energy (keV) in the calibration the activity obtained by applying the proposed method in
curve from detector 10 and that obtained using the proposed algo- the proficiency tests organized by IAEA and CSN.
rithm The results obtained were compared following the sta-
tistical E numbers criterion. In the ash sample, equivalent
results were obtained, although those obtained using the
interpolation selected in the previous section. The two current method can be considered more reproducible when
curves exhibit the expected behavior and although there the values are less significantly different. In the case of
is a slight increase in FWHM with respect to the curve the soil sample, the results obtained using the proposed
prepared with the background spectra from 800 keV (dif- method were more reproducible as the current method
ference of 9.25% for 1850 keV), for lower energies FHWM returned 2 significantly different values and one with a
is less (a difference of 21.63% for 50 keV). Therefore, the large deviation (E N  > 1.5). For the water sample, the
proposed algorithm provides a spectrum with an FWHM results were equivalent.
equivalent to the energy calibration. In this way, it is

Table 1  Results of reference Proficiency test Matrix Radionuclide Reference Original target activ- Proposed method
activity, the activity reported activity ity (Bq Kg−1) activity (Bq Kg−1)
with the traditional method (Bq Kg−1)
for gamma subtraction and the Activity ENumber Activity ENumber
activity obtained by applying
214
the proposed method, and their CSN 2014 Ashes Pb 27.9 ± 4.7 24.7 ± 6.7 0.39 25.1 ± 1.5 0.57
corresponding accuracies Bi 214
25.8 ± 5.0 23.7 ± 5.0 0.30 28.4 ± 1.3 0.50
210
Pb 20.4 ± 2.9 22.3 ± 2.4 0.50 23.28 ± 0.71 0.96
212
Pb 19.2 ± 2.5 22.4 ± 3.4 0.76 21.08 ± 0.90 0.71
228
Ac 6.6 ± 1.2 6.98 ± 0.77 0.26 7.86 ± 0.34 1.01
208
Tl 3163 ± 320 3612 ± 109 1.33 3408 ± 218 0.63
40
K 8.06 ± 0.77 7.66 ± 0.45 0.45 7.39 ± 0.25 0.83
134
Cs 8.40 ± 0.80 8.85 ± 0.60 0.45 8.74 ± 0.23 0.41
60
Co 7.94 ± 0.85 8.60 ± 0.72 0.59 8.94 ± 0.16 1.16
57
Co 27.9 ± 4.7 24.7 ± 6.7 0.39 25.1 ± 1.5 0.57
228
IAEA-TEL-2014 Soil Ac 12.1 ± 1.5 11.47 ± 0.36 0.41 11.25 ± 0.32 0.55
212
Bi 15.9 ± 2.4 12.20 ± 0.66 1.49 13.87 ± 0.99 0.78
214
Bi 270 ± 27 290.9 ± 3.3 0.77 267 ± 20 0.09
40
K 19.6 ± 4.5 21.6 ± 3.2 0.36 18.0 ± 1.8 0.33
210
Pb 12.2 ± 1.5 10.89 ± 0.63 0.81 11.36 ± 0.28 0.55
212
Pb 16.8 ± 2.0 13.11 ± 0.54 1.78 15.44 ± 0.90 0.62
214
Pb 15.9 ± 4.9 10.5 ± 1.1 1.08 12.83 ± 0.92 0.62
234
Th 4.10 ± 0.70 3.75 ± 0.12 0.49 3.96 ± 0.13 0.20
208
Tl 12.00 ± 0.40 11.75 ± 0.13 0.59 11.50 ± 0.37 0.92
137
Cs 12.1 ± 1.5 11.47 ± 0.36 0.41 11.25 ± 0.32 0.55
Water 06 226Ra 37.5 ± 3.2 40.3 ± 5.8 0.07 40.1 ± 4.1 0.03

Uncertainties are quoted for k = 2

13
Journal of Radioanalytical and Nuclear Chemistry (2019) 319:1159–1163 1163

Conclusions 5. Pratt T, Luther M (1971) A study of germanium-lithium drifted


gamma spectrum shapes. Nucl Instrum Methods 92(3):317–323
6. Schroettner T, Kindl P (2010) Long term comparison of methods
The method proposed for subtracting the gamma background to sustain energy calibration in low level gamma-ray spectroscopy
when calculating the activity concentration in the samples and investigation of possible sources for drift. Appl Radiat Isot
using a spectrum obtained by summing several background 68(1):164–168. https​://doi.org/10.1016/j.aprad​iso.2009.08.018
7. Hurtado S, García-León M, García-Tenorio R (2006) A revision
spectra produces an activity concentration that is statisti- of energy and resolution calibration method of Ge detectors. Nucl
cally comparable to the method usually used in gamma Instrum Methods Phys Res Sect A Accel Spectrom Detect Assoc
spectrometry labs. The algorithm developed allows several Equip 564(1):295–299
background spectra to be added together, with displacements 8. Hertogen J, De Donder J, Gijbels R (1974) Experimental data
on photopeak integration methods in activation analysis. Nucl
being corrected by means of energy calibration equations. Instrum Methods 115(1):197–212
The most important aspect of the algorithm developed was 9. Bossew P (2005) A very long-term HPGe-background gamma
the interpolation that is necessary to calculate the counts spectrum. Appl Radiat Isot 62(4):635–644
once the possible displacement of the spectrum has been cal- 10. Covell D (1959) Determination of gamma-ray abundance directly
from total absorption peak. Anal Chem 31(11):1785–1790
culated. We tested linear, quadratic, and cubic interpolations 11. Routti JT, Prussin SG (1969) Photopeak method for the computer
as these are used to determine the baseline of the spectrum analysis of gamma-ray spectra from semiconductor detectors.
when the gamma background is suppressed. We selected Nucl Instrum Methods 72(2):125–142
the linear interpolation, since the Gaussian fit of the spe- 12. Kokta L (1973) Determination of peak area. Nucl Instrum
Methods 112(1):245–251. https ​ : //doi.org/10.1016/0029-
cific counts and photopeak areas were reproducible. Since 554X(73)90803​-3
the proposed algorithm is applied to background spectra 13. Helmer R, Heath R, Putnam M, Gipson D (1967) Photopeak anal-
summation, if it is used to sum up spectra containing more ysis program for photon energy and intensity determinations: Ge
complex photopeaks, its reproducibility must be verified. (Li) and NaI (Tl) spectrometers. Nucl Instrum Methods 57:46–57
14. Westmeier W (1981) Background subtraction in Ge (Li) gamma-
The final spectrum obtained was used by the Genie 2000 ray spectra. Nucl Instrum Methods 180(1):205–210
software as the FWHM value is equivalent to the energy cal- 15. Quittner P (1969) Precise peak area determination for Ge (Li)
ibration of the detectors. The proposed method was validated detectors. Anal Chem 41(11):1504–1506
using three samples of two intercomparable exercises, with 16. Quittner P (1969) Peak area determination for Ge (Li) detector
data. Nucl Instrum Methods 76(1):115–124
the same results being obtained as for the current gamma 17. CANBERRA (2002) Programing library user’s manual of model
background suppression method. S560 GenieTM 2000. Canberra Industries, Inc., Meriten
18. Suárez-Navarro JA, Gascó C, Alonso MM, Blanco-Varela MT,
Lanzon M, Puertas F (2018) Use of Genie 2000 and Excel VBA
to correct for γ-ray interference in the determination of NORM
Compliance with ethical standards  building material activity concentrations. Appl Radiat Isot 142:1–
7. https​://doi.org/10.1016/j.aprad​iso.2018.09.019
Conflict of interest  The authors declare no conflict of interest. 19. Mariscotti MA (1967) A method for automatic identification
of peaks in presence of background and its application to spec-
trum analysis. Nucl Instrum Methods 50(2):309–320. https​://doi.
org/10.1016/0029-554x(67)90058​-4
References 20. CANBERRA (2009) Interactive peak fit user’s manual. Model
S506. Canberra Industries, Meriten
1. Dragounová L, Rulík P (2013) Low level activity determination 21. ISO (2005) Statistical methods for use in proficiency testing by
by means of gamma spectrometry with respect to the natural back- interlaboratory comparisons. International organization for stand-
ground fluctuation. Appl Radiat Isot 81:123–127 ardization, Geneva
2. Banjanac R, Dragic A, Udovicic V, Jokovic D, Maletic D, Vesel-
inovic N, Savic M (2014) Variations of gamma-ray background Publisher’s Note Springer Nature remains neutral with regard to
in the Belgrade shallow underground low-level laboratory. Appl jurisdictional claims in published maps and institutional affiliations.
Radiat Isot 87:70–72
3. Wasim M, Arif M, Zaidi J (2010) Statistical data analysis of
gamma-ray background spectra for quality assurance purposes.
Nucleus 47(1):55–60
4. Bucar K, Korun M, Vodenik B (2012) Influence of the thorium
decay series on the background of high-resolution gamma-ray
spectrometers. Appl Radiat Isot 70(6):1005–1009

13
Supporting Information

Appendix S1. Characteristics of the HPGe gamma detectors used in this work
Table S1.1 Parameters for the detectors used in this work

Inner Inner Inner


Resolution Relative Crystal Crystal Outer
shielding- shielding- space Shielding
Detector Model Type at 1.33 efficiency at diameter length shielding
1 1st layer 2nd layer shielding composition
MeV (keV) 1.33 MeV (%) (mm) (mm) (cm) 3
(Cu) (mm) (Zn) (mm) (dm )
01 GC2518 Coaxial 1.72 25.0 52 54 15 1.5 1.5 25 Pb
03 BE5030 Broad Energy 1.83 48.0 80 30 15 2.0 1.5 25 Pb
04 GX4020 Extended Range Coaxial 1.85 42.1 61 60 15 2.0 1.5 25 Pb
07 GXI0022 Extended Range Coaxial 2.04 115.7 84 72 15 3.0 - 25 Fe
10 GC3521 Coaxial 1.83 29.0 57 56 15 1.0 1.0 45 Pb
40 GR2920 Reverse Electrode Coaxial 1.76 29.2 53 60 15 - - 25 Fe
50 GR3321 Reverse Electrode Coaxial 2.04 35.5 58 60 15 - - 25 Fe
60 GR4022 Reverse Electrode Coaxial 2.05 46.8 66 51 15 2.0 1.5 25 Pb
80 GX3519 Extended Range Coaxial 1.73 36.0 62 47 15 - - 25 Fe
90 BE50360 Broad Energy 1.84 48.0 80 30 15 2.5 1.5 25 Pb
1
A thickness of 150 mm iron or lead is sufficient to stop terrestrial radiation (Dragounová and Rulík, 2013).

1
Appendix S2 – Visual basic code used for spectra summing.

S2.1. Visual Basic code developed

Const Order As Integer = 1

Public Sub ReadFilesFromDirectory()


Dim directory As String
Dim sFile As String
Dim iRow As Integer
Dim mat() As String
directory = ThisWorkbook.Path
ReDimmat(0)
iRow = 1
sFile = Dir(directory & "\*.cnf")
Do WhilesFile<> ""
If mat(0) = "" Then
mat(0) = directory & "\" &sFile
Else
ReDim Preserve mat(UBound(mat) + 1)
mat(UBound(mat)) = directory & "\" &sFile
End If
sFile = Dir
iRow = iRow + 1
Loop
SumOfSpectramat()
End Sub

Private Sub SumOfSpectra(ByRefmatFiles() As String)


Dim a1, a2, b1, b2 As Double
Dim time, liveTime As Double
Dim mEs, mT As Variant

2
Dim spAs New CanberraDataAccessLib.DataAccess
Dim spT As New CanberraDataAccessLib.DataAccess
Dim enT, chT, chI, cCounts As Double
Dim x, x1, x2, x3 As Double
Dim i, j, k, l As Integer
Dim y As Double
sp.OpenmatFiles(UBound(matFiles)), dReadWrite
a1 = sp.Param(CAM_F_ECOFFSET)
b1 = sp.Param(CAM_F_ECSLOPE)
time = sp.Param(CAM_X_EREAL)
liveTime = sp.Param(CAM_X_EREAL)
mEs = sp.Spectrum
For i = 0 To UBound(matFiles) - 1
spT.OpenmatFiles(i), dReadOnly
a2 = spT.Param(CAM_F_ECOFFSET)
b2 = spT.Param(CAM_F_ECSLOPE)
time = time + spT.Param(CAM_X_EREAL)
liveTime = liveTime + spT.Param(CAM_X_ELIVE)
mT = spT.Spectrum
For l = 0 To UBound(mT)
chT = (a1 - a2 + (b1 * (l + 1))) / b2
chI = Fix(chT)
cCounts = 0
If chI + 2 <UBound(mT) - 2 And chI> 0 Then
For k = 0 To Order
y=1
For j = 0 To Order
If j <> k Then
y = y * (chT - (chI + j)) / ((chI + k) - (chI + j))
End If
Next
cCounts = cCounts + (y * mT(chI + k - 1))

3
Next
mEs(l) = mEs(l) + Fix((b2 / b1) * cCounts)
End If
Next
spT.Close
Next
sp.Param(CAM_X_EREAL) = time
sp.Param(CAM_X_ELIVE) = liveTime
sp.Spectrum = mEs
sp.Save Replace(matFiles(UBound(matFiles)), Dir(matFiles(UBound(matFiles))),
"SpectraSum.CNF"), True
sp.Close
Set spT = Nothing
Set spectra = Nothing
End Sub

S2.2. CAM File

Genie 2000 stores the data in a file with a *.CNF extension when a sample is counted. This file
contains two kinds of data: parameters and spectral data that are separated into classes of
information that are considered to be independent of the data in other classes. The classes of
information contain the parameters that refer to: acquisition, sample, geometry, processing,
peaks, calibration, nuclide identification, etc. The spectral data is treated differently since it is
handled as in a typical matrix configuration. All these data are controlled by subroutines
collectively called the Configuration Access Method [1]. In this work, we only access the
individual parameters and spectral data.

S2.3. Algorithm description

The algorithm developed allows n spectra to be summed. Each spectrum has an energy
calibration equation that is defined by (1):

4
𝐸1 = 𝑎1 + 𝑏1 ∙ 𝑖
𝐸2 = 𝑎2 + 𝑏2 ∙ 𝑗
(1)

𝐸𝑛 = 𝑎𝑛 + 𝑏𝑛 ∙ 𝑧

where where i,j,...,ii are the channels of each spectrum comprises between 1 and 4096 channels.
The equation of the first spectrum of n spectra is given by the expression:

𝐸 (𝑖+1)
𝑐(𝑖) = ∫𝐸 1(𝑖) 𝑓(𝐸) 𝑑𝐸 (2)
1

The discrete function for f(E) is obtained by equation (1), resulting in:

𝑐1 (𝑖)
𝑓(𝐸) = (3)
𝑏1

To sum the following spectrum (n=2) to the spectrum (n=1) you have to know the value of c2(j)
corresponding to this f(E). The value of c2(j) is obtained through the energy calibration equations
(1) giving:

𝑎1 −𝑎2 +𝑏1 ∙𝑗
𝑐ℎ𝑇 = (4)
𝑏2

The value obtained from chT is decimal and between ⌊𝑐ℎ𝑇 ⌋ and ⌊𝑐ℎ𝑇 ⌋ + 1, with ⌊𝑐ℎ𝑇 ⌋ being the
non-decimal part of chT closest to zero. Therefore, the linear interpolation used by [2] is given by:

𝑓(𝐸1 (⌊𝑐ℎ𝑇 ⌋+1))−𝑓(𝐸1 (⌊𝑐ℎ𝑇 ⌋))


𝑓(𝐸1 (𝑐ℎ𝑇 )) = 𝑓(𝐸1 (⌊𝑐ℎ𝑇 ⌋)) + ∙ (𝐸1 (𝑐ℎ𝑇 ) − 𝐸1 (⌊𝑐ℎ𝑇 ⌋)) (5)
𝐸1 (⌊𝑐ℎ𝑇 ⌋+1)−𝐸1 (⌊𝑐ℎ𝑇 ⌋)

The continuous function (5) becomes discrete, analogous to that produced with functions (2) and
(3), and the following expression is obtained:

𝑏 𝑐2 (⌊𝑐ℎ𝑇 ⌋+1)−𝑐2 (⌊𝑐ℎ𝑇 ⌋)


𝑐1 (𝑐ℎ𝑇 ) = 𝑏1 ∙ (𝑐2 (⌊𝑐ℎ𝑇 ⌋) + (𝑐ℎ𝑇 − ⌊𝑐ℎ𝑇 ⌋) ∙ (⌊𝑐ℎ𝑇 ⌋+1)−⌊𝑐ℎ𝑇 ⌋
) (6)
2

Interpolations of an order equal to or greater than 2 can be obtained with a Lagrangian


polynomial using the expression:

𝑏 𝑐ℎ𝑇 −(⌊𝑐ℎ𝑇 ⌋+𝑏)


𝑐1 (𝑐ℎ𝑇 ) = 𝑏2 ∙ ∑𝑎 (∏𝑏≠𝑎 (⌊𝑐ℎ ) ∙ 𝑐2 (⌊𝑐ℎ𝑇 ⌋ + 𝑎) (7)
1 𝑇 ⌋+𝑎)−(⌊𝑐ℎ𝑇 ⌋+𝑏)

5
where a and b correspond to the order of the polynomial and the other terms have been
previously defined. By means of Equation 7 it is also possible to obtain the linear interpolation
defined above using expression (6).

S2.4. Features of the code

The code has two procedures (in italics) called “ReadFilesFromDirectory” and “SumOfSpectra”.

The first procedure read files in the directory in which the Excel file is contained, and generates a
matrix with the paths of the background file spectra by using the Dir function.

The second procedure called SumOfSpectra takes the matrix of files generated and calculates the
sum of the spectra. A spectrum file is opened as follows: first, a DataAccess is defined using the
CanberraDataAccessLib [1] and, then Open method is called by passing a string parameter that
corresponds to the pathname of a file. At this point, an appropriate energy calibration correction
is necessary to adjust a possible energy calibration displacement due to temperature changes or
electronic adjustments. To this end, the code uses the energy calibration curve parameters to
correct any difference between the two curves. The fixed coefficients of the curve from the last
file of the matrix are considered as the reference values, and are obtained by using the
CAM_F_ECOFFSET and CAM_F_ECSLOPE parameters that represent the energy calibration offset
and slope of the curve, respectively. Other parameters considered were the measuring live time
(CAM_X_ELIVE), measuring real time (CAM_X_EREAL) and acquisition date (CAM_X_ASTIME),
which were used to obtain the total measuring time and the date of the output file. The output
file is generated as follows: the last file of the matrix is considered as the reference file to
transform it finally into the output file and to get the necessary parameters, a next-for loop
containing a nested loop were built. The principal loop was used to read the parameters
contained in the matrix with the paths of the spectrum files. The nested loop has three functions:
i) to make corrections in the energy calibration for each file read, ii) to transform the channels of
the reading spectrum file according the corrected energy calibration, and iii) to sum the counts of
each transformed channel into the output file.

The code has an integer constant defined as Order, which is used to establish the order of the
polynomial chosen to perform the interpolation. Users who utilize this code can modify the
constant according to their criteria.

6
S2.5. Implementation of the code

To implement the code (see Annex) on a PC it is necessary to install Genie 2000 to access the
dynamic libraries (*.dll). First, you have to access the macro development environment by hitting
Alt+F11 in Microsoft Excel. Next you have to add the Canberra Nuclear DataAccess Library
reference in the Tools-References menu. The code can be entered by creating a module (Insert-
Module menu) and copying or writing the code from the Annex. To execute the code, click on the
macro icon in the Developer menu by selecting the ReadFilesFromDirectory macro. The
background spectra (*.cnf) must be located in the same directory as the Microsoft Excel file.

S2.6. Appendix references


1. CANBERRA (2002) Programing Library User's Manual of Model S560 GenieTM 2000. Canberra
Industries, Inc.,
2. Bossew P (2005) A very long-term HPGe-background gamma spectrum. Applied Radiation and
Isotopes 62 (4):635-644

7
Appendix S3 – Average values of χ2for photopeaks at 77.1 keV (BiK1), 351.9 keV (214Pb), 609.3
keV (214Bi), 1460.8 keV (40K), and 1764.5 keV (214Bi) after applying the algorithm with linear (Table
S3.1), quadratic (Table S3.2), and cubic (Table S3.3) interpolations.

Table S3.1. χ2 values for the linear interpolation in 77.1 keV (BiK1), 351.9 keV (214Pb), 609.3 keV
(214Bi), 1460.8 keV (40K) and 1764.5 keV (214Bi) photopeaks in the ten detectors from the
laboratory for the final spectrum after applying the proposed algorithm.

Detector 77.1 keV 351.9 keV 609.3 keV 1460.8 keV 1764.5 keV Average
D01 0.9 0.82 1.6 0.97 0.71 1.00
D03 0.18 1.9 0.71 0.25 0.72 0.75
D04 0.13 1.1 0.86 3.2 1.7 1.40
D07 2.7 0.76 0.64 0.49 0.76 1.07
D10 1.9 2.3 0.52 1 0.6 1.26
D40 1.3 0.82 1.4 1 1.2 1.14
D50 1.1 1.3 1.1 1 0.92 1.08
D60 0.9 0.82 1.6 0.97 0.71 1.00
D80 1.2 1.4 1.3 0.43 0.99 1.06
D90 1.4 1.1 0.34 1.2 0.54 0.92
Average 1.17 1.23 1.01 1.05 0.89 1.07

Table S3.2. χ2 values for the quadratic interpolation in 77.1 keV (BiK1), 351.9 keV (214Pb), 609.3
keV (214Bi), 1460.8 keV (40K) and 1764.5 keV (214Bi) photopeaks in the ten detectors from the
laboratory for the final spectrum after applying the proposed algorithm.

Detector 77.1 keV 351.9 keV 609.3 keV 1460.8 keV 1764.5 keV Average
D01 0.9 0.84 1.6 1.1 0.92 1.07
D03 0.32 2.1 0.76 0.29 0.94 0.88
D04 0.21 1.6 1.3 4.6 1.7 1.88
D07 2.7 0.74 0.66 0.55 1.1 1.15
D10 1.9 2.3 0.5 0.97 0.6 1.25
D40 1.3 1.1 1.4 1.1 1.3 1.24
D50 1 1.2 1.1 0.98 1.4 1.14
D60 0.9 0.84 1.6 1.1 0.92 1.07
D80 1.4 1.5 1.3 0.4 1.1 1.14
D90 1.8 1.2 0.32 1.3 0.69 1.06
Average 1.24 1.34 1.05 1.24 1.07 1.19

8
2 214
Table S3.3. χ values for the cubic interpolation in 77.1 keV (BiK1), 351.9 keV (
Pb), 609.3 keV
214 40 214
( Bi), 1460.8 keV ( K) and 1764.5 keV ( Bi) photopeaks in the ten detectors from the
laboratory for the final spectrum after applying the proposed algorithm.

Detector 77.1 keV 351.9 keV 609.3 keV 1460.8 keV 1764.5 keV Average
D01 0.64 0.87 1.6 1.2 0.87 1.04
D03 0.56 2.3 0.8 0.4 1.3 1.07
D04 0.36 2.1 1.7 4.4 1.7 2.05
D07 2.7 0.77 0.5 1 0.66 1.13
D10 1.9 2.3 0.5 1 0.66 1.27
D40 1.4 0.88 1.5 1 1.4 1.24
D50 1.1 1 1.04 1.18 1.17 1.10
D60 0.92 0.87 1.6 1.2 0.87 1.09
D80 1.5 1.5 1.2 0.49 1.2 1.18
D90 1.9 1.1 0.42 1.3 0.78 1.10
Average 1.30 1.37 1.09 1.32 1.06 1.23

9
Appendix S4 – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra (Tables S2.1 to S2.9).

Table S4.1. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for BiKα1 (77.1 keV).

Number of BiKα1 (77.1 keV)


Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 1194 ± 152 966 ± 72 1017 ± 72 1012 ± 72
03 11 1645 ± 206 1912 ± 357 1929 ± 94 1903 ± 95
04 15 2699 ± 270 2415 ± 139 2409 ± 138 2402 ± 138
07 7 1741 ± 168 1632 ± 151 1631 ± 103 1630 ± 216
10 19 7807 ± 167 7859 ± 169 7867 ± 169 7864 ± 169
40 13 7976 ± 25 8261 ± 248 8269 ± 250 8266 ± 250
50 10 1102 ± 20 1085 ± 102 1088 ± 102 1084 ± 102
60 11 1342 ± 30 1171 ± 95 1171 ± 95 1170 ± 95
80 12 4318 ± 180 4816 ± 163 4805 ± 161 4787 ± 160
90 9 2097 ± 16 1889 ± 70 1926 ± 70 1890 ± 70
The uncertainties are quoted for k=2.

Table S4.2. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 212Pb (238.6 keV).

212
Number of Pb (238.6 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 987 ± 138 934 ± 135 937 ± 135 930 ± 212
03 11 412 ± 103 265 ± 117 280 ± 117 278 ± 117
04 15 1460 ± 246 1428 ± 151 1417 ± 149 1429 ± 150
07 7 572 ± 98 531 ± 121 531 ± 119 534 ± 119
10 19 10881 ± 163 10852 ± 164 10866 ± 164 10872 ± 164
40 13 7155 ± 218 7181 ± 272 7177 ± 308 7176 ± 302
50 10 1345 ± 186 1467 ± 97 1463 ± 97 1467 ± 97
60 11 925 ± 190 795 ± 86 797 ± 85 798 ± 85
80 12 2339 ± 279 2854 ± 48 3356 ± 157 3353 ± 96
90 9 985 ± 125 715 ± 148 757 ± 148 778 ± 148
The uncertainties are quoted for k=2.

10
Table S4.3. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 214Pb (295.2 keV).
214
Number of Pb (295.2 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 3690 ± 173 3548 ± 173 3461 ± 150 3443 ± 150
03 11 2960 ± 148 2959 ± 155 2964 ± 155 2958 ± 155
04 15 5487 ± 278 5653 ± 314 5664 ± 314 5668 ± 314
07 7 4056 ± 159 3967 ± 171 3990 ± 160 3963 ± 171
10 19 12426 ± 279 12487 ± 294 12472 ± 294 12480 ± 294
40 13 7581 ± 215 7507 ± 219 7493 ± 219 7501 ± 219
50 10 3863 ± 216 3839 ± 202 3847 ± 202 3852 ± 202
60 11 2609 ± 130 2822 ± 101 2825 ± 101 2828 ± 101
80 12 4596 ± 360 4157 ± 302 4162 ± 302 4165 ± 302
90 9 2813 ± 172 2471 ± 154 2462 ± 154 2452 ± 154
The uncertainties are quoted for k=2.

Table S4.4. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 214Pb (351.9 keV).
214
Number of Pb (351.9 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 6101 ± 245 6112 ± 163 6256 ± 154 6128 ± 163
03 11 5160 ± 154 5352 ± 148 5357 ± 148 5350 ± 148
04 15 9909 ± 270 9751 ± 317 9745 ± 317 9745 ± 317
07 7 7328 ± 160 7289 ± 184 7286 ± 184 7289 ± 184
10 19 21181 ± 272 20692 ± 258 20698 ± 258 20700 ± 258
40 13 13366 ± 230 13371 ± 225 13379 ± 225 13396 ± 225
50 10 6943 ± 199 6801 ± 209 6804 ± 209 6807 ± 209
60 11 4830 ± 187 4898 ± 182 4909 ± 182 4903 ± 182
80 12 7262 ± 313 7137 ± 286 7128 ± 287 7141 ± 287
90 9 4389 ± 141 4401 ± 143 4393 ± 143 4386 ± 143
The uncertainties are quoted for k=2.

11
Table S4.5. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for β+/β- (511 keV).

Number of β+/β- (511 keV)


Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 15089 ± 562 15951 ± 189 15931 ± 189 15924 ± 189
03 11 15745 ± 188 15019 ± 184 15026 ± 184 15031 ± 184
04 15 24171 ± 285 23997 ± 282 24010 ± 282 24006 ± 282
07 7 24285 ± 221 24426 ± 223 24438 ± 223 24440 ± 223
10 19 46642 ± 301 46512 ± 298 46534 ± 298 46528 ± 298
40 13 29445 ± 244 29556 ± 245 29565 ± 245 29572 ± 245
50 10 13954 ± 200 14357 ± 202 14353 ± 202 14352 ± 202
60 11 27106 ± 247 27313 ± 253 27315 ± 253 27302 ± 253
80 12 18430 ± 288 15989 ± 240 16009 ± 240 15994 ± 240
90 9 16115 ± 180 15195 ± 177 15226 ± 177 15229 ± 177
The uncertainties are quoted for k=2.

Table S4.6. Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 114*Cd (558.46 keV).

114*
Number of Cd (558.46 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 882 ± 78 813 ± 116 760 ± 91 763 ± 85
03 11 761 ± 94 775 ± 99 766 ± 99 768 ± 99
04
07
10 19 6106 ± 172 5810 ± 106 5809 ± 90 5807 ± 79
40 13 3198 ± 144 3111 ± 156 3106 ± 156 3109 ± 156
50
60 11 3950 ± 130 4170 ± 131 4174 ± 130 4174 ± 131
80
90 9 3081 ± 116 3105 ± 116 3123 ± 110 3088 ± 116
The uncertainties are quoted for k=2.

12
Table S4.7. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 214Bi (609.3 keV).
214
Number of Bi (609.3 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 4559 ± 109 4434 ± 137 4424 ± 137 4431 ± 137
03 11 3511 ± 107 3393 ± 112 3388 ± 112 3383 ± 112
04 15 8192 ± 203 8018 ± 195 7938 ± 185 7971 ± 174
07 7 5910 ± 166 6024 ± 162 6029 ± 161 6028 ± 161
10 19 17290 ± 222 17615 ± 229 17616 ± 229 17618 ± 229
40 13 10453 ± 197 10376 ± 175 10368 ± 175 10368 ± 175
50 10 5452 ± 144 5553 ± 151 5549 ± 150 5550 ± 151
60 11 3647 ± 120 3811 ± 122 3805 ± 122 3807 ± 122
80 12 4901 ± 390 5324 ± 180 5326 ± 180 5328 ± 180
90 9 3255 ± 116 3225 ± 121 3236 ± 115 3245 ± 115
The uncertainties are quoted for k=2.

Table S4.8. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 40K (1460.8 keV).

40
Number of K (1460.8 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 458 ± 50 577 ± 62 583 ± 64 577 ± 64
03 11 351 ± 48 473 ± 60 449 ± 60 461 ± 60
04 15 14376 ± 148 14434 ± 152 14434 ± 152 14428 ± 152
07 7 1519 ± 75 1477 ± 79 1475 ± 79 1476 ± 79
10 19 14680 ± 156 14724 ± 167 14715 ± 167 14723 ± 167
40 13 5906 ± 111 5991 ± 118 5991 ± 117 5983 ± 117
50 10 5368 ± 95 5346 ± 97 5341 ± 97 5318 ± 92
60 11 2578 ± 76 2614 ± 84 2672 ± 87 2667 ± 87
80 12 12790 ± 640 12895 ± 137 12894 ± 137 12880 ± 137
90 9 1159 ± 67 1195 ± 73 1192 ± 73 1198 ± 73
The uncertainties are quoted for k=2.

13
Table S4.9. – Comparison between the areas obtained by means of the various interpolation
functions used (linear, quadratic, and cubic) and the area obtained by directly summing the
spectra for 214Bi (1764.49 keV).

214
Number of Bi (1764.49 keV)
Detector background Direct Lineal Quadratic Cubic
spectra summation Interpolation interpolation interpolation
01 12 695 ± 48 724 ± 52 736 ± 52 740 ± 52
03 11 412 ± 41 577 ± 53 579 ± 51 582 ± 53
04 15 2931 ± 78 3025 ± 90 3038 ± 90 3028 ± 90
07 7 1161 ± 62 1238 ± 78 1238 ± 71 1235 ± 71
10 19 4758 ± 102 4823 ± 108 4845 ± 108 4866 ± 108
40 13 2486 ± 74 2558 ± 89 2557 ± 89 2545 ± 89
50 10 1426 ± 58 1492 ± 59 1493 ± 59 1486 ± 61
60 11 1122 ± 66 1167 ± 66 1159 ± 66 1179 ± 66
80 12 2072 ± 75 2101 ± 78 2109 ± 78 2106 ± 78
90 9 661 ± 54 627 ± 57 624 ± 57 620 ± 57
The uncertainties are quoted for k=2.

14

View publication stats

You might also like