XECON is a
set of C++ routines that can be used to perform analysis of 2D beta-gamma
spectra from radioxenon systems producing data on IMS format 2.0. XECON is
licenced under the GNU General Public Licence (GPL).
The script
is indended to be used with the physics analysis package ROOT, developed at
CERN. ROOT is under "GNU lesser general public license" and can be
downloaded from http://root.cern.ch/ for
most platforms.
The scripts
have been developed when working with data from the SAUNA radioxenon system,
but are applicable to any system producing data on the format IMS 2.0.
The first
version of these pages and the software were written by anders.ringbom@foi.se.
This library consists of a collection of
C++ functions that uses the ROOT environment
to analyze data from the SAUNA system (or any other system that uses the
beta-gamma coincidence technique and stores data on IMS 2.0 format).
A complete measurement consists of data stored
on three files (go to link to view examples of these files):
The analysis consists of parsing the data
from the files, calculate the activity concentration of 133Xe, 131mXe,
133mXe, and 135Xe, and plot histograms. Results are also
written to output text files for further usage by other programs.
The analysis is based on the so called net-count method (alternate download here). The original equations have been
updated with a correction for the decay of 133mXe
to 133Xe not included in the
first version.
The scripts are executed in the ROOT
environment, which can be used at most platforms.
The distribution of XECON contains the
following files (XECON releases can be downloaded at the Sourceforge project page):
Installation instructions for Windows:
1)
Create
a working directory, for example c:\xecon\, and extract all xecon files into
that directory.
2)
If
required, install ROOT, either by using the source supplied in this
distribution, or by installing ROOT from http://root.cern.ch/.
3)
Start
the Command prompt in Windows.
4)
Go
to the working directory by entering e.g. "cd c:\xecon" in the
command window.
5)
Start
ROOT by entering "root".
6)
At
the ROOT prompt, you can now execute the script by entering: ".x
xecon("example_input.txt",0,0)"
7)
In
this case, the example data is analyzed and the result should be written to the
standard output (the command window).
8)
Still
at the ROOT prompt, enter: ".x xecon("example_input.txt",0,1)"
9)
In
this case, the same analysis is performed as in 6), but now histograms and
energy calibration are plotted as well.
10)
Check
that the files xecon_result.txt and xecon_data.txt are created in directory
c:\xecon\.
11)
Note
that the file xecon_result.txt is overwritten each time a new analysis is
performed.
12)
You
have to save it under a different filename if you want to keep it.
xecon.c analyses and plots a sample (consisting of
one SAMPLEPHD, GASBKPHD, and DETBKPHD files respectively). The results of the
calculations are stored in output text files like this.
The script xecon requires the following files
to be installed in the same directory (you can of course put them wherever you
like, but then you have to change xecon accordingly):
nlib.c
- Routines used by xecon.c
param.txt
- A parameter file usd by the analysis. Contains optional ROI
definitions, gain calibration tweak parameters, and the memory effect
correction factor.
<input file> A text file holding the
data directory name and names of the
data files to be analyzed.
Two files are produced by xecon.c:
xecon_result.txt - The result of the analysis. Produced
each time the script is executed. The previous xecon_result.txt is replaced.
xecon_data.txt - The main results written on a single
line. Results are concatenated to xecon_data.txt when the script is executed.
Execution of
XECON:
At the ROOT - prompt, write:
.x xecon.c("<input
file>",<roi flag =0,1>, <plot flag = 0,1>)
<input file> : The name of the input file
holding the data directory and the data file names.
<roi flag> : =0 use ROIs from original data, =1 Use ROI
definitions from param.txt
<plot flag> : =0 do not create and plot histograms, =1
create and plot histogram
Example:
.x xecon.c("my_data.txt",0,0)
This will perform and plot an anlysis using the
data files in my_data.txt.
Histograms will in this case not be plotted,
and ROI definitions from the original data are used.
The file <input file> should have the
following format:
--------------------------------------------------------------------------------------------------------------------
<directory path to the directory holding the
data files>
<sample file name 1> \t <gas background
file name 1> \t <detector background file name 1> \t <optional
analysis flag = x>
<sample file name 2> \t <gas
background file name 2> \t <detector background file name 2> \t
<optional analysis flag = x>
...
...
--------------------------------------------------------------------------------------------------------------------
If the analysis flag "x" is included,
the file names will be read; otherwise the sample will be skipped.
The file
nlib.c contains functions and global constants used by
XECON.
The following global constants
are used:
double ks = 1.6449;
double Xe133_lam=1.52956e-6; //Decay
constant for 133Xe(g) (1/s)
double
Xe131m_lam=6.72467e-7; //Decay constant for 131Xe(m)
double
Xe133m_lam=3.66326e-6; //Decay constant for 133Xe(m)
double
Xe135_lam=2.10657e-5; //Decay constant for 135Xe(g)
double
bg_br_133Xe_80=0.37289; //Branching ratio for beta/80 keV gamma
decay of 133Xe
double
bg_br_133Xe_30=0.48940; //Branching ratio for beta/30 keV X-ray
decay of 133Xe
double
bg_br_131mXe_30=0.54000; //Branching
ratio for EC/30 keV X-ray decay of 131mXe
double
bg_br_133mXe_30=0.55770; //Branching
ratio for EC/30 keV X-ray decay of 133mXe
double
bg_br_135Xe=0.90000; //Branching ratio for beta/250 keV
gamma decay of 135Xe
double
Xe_air=0.087; //Volume (ml) of Xe per m3
of air
double
Rn222_lam = 2.0974e-6; // radon decay constant
double
bg_br_222Rn = 0.376; // radon branching ratio for 352
keV (ROI1)
Here is a list of all functions in
nlib.c ( the link will give more information for each function):
Parsing functions for IMS 2.0 files:
int datatype(char
*file, char *dtype)
int header(char *file,
char *station, char *detector)
double collection(char
*file, char *start_date, char *start_time, char *stop_date, char *stop_time)
int processing(char
*file, double* vol, double* yield)
int acquisition(char
*file, char *start_date, char *start_time, double* atime)
int g_energy(char
*file, double* ene, double* chan, double* err)
int b_energy(char
*file, double* ene, double* chan, double* err)
int g_resolution(char
*file, double* ene, double* res, double* err)
int b_resolution(char
*file, double* ene, double* res, double* err)
int ROI_limits(char
*file, int* roi, double* b_low, double* b_high, double* g_low, double* g_high)
int GetGate(char *file,
double* coord)
int GetTweak(char
*file, double* shift)
double GetMemf(char
*file)
void GetFilenames(char*
file, char* sf, char* gf, char* df)
int bg_efficiency(char
*file, int* roi, double* eff, double* err)
int ratios(char *file,
int* roi1, int* roi2, double* rat, double* rat_err)
int* g_spectrum(char
*file, int* chan)
int* b_spectrum(char
*file, int* chan)
int* bg_spectrum(char
*file, int* chan)
int get_roi_counts(char*
file, int* roi_counts, TCutG *roi[30],
char *hname, int* bg_chan_ene, int calplot)
int get_roi_counts_shift(char*
file, int* roi_counts, TCutG *roi[30],
char *hname, int* bg_chan_ene, double* shift, int calplot)
int get_own_roi_counts(char*
file, int* roi_counts, TCutG *roi[30],
char *hname, int* bg_chan_ene, int calplot)
void add_write_bg(char
*file1, char *file2, char *sumfile)
Functions for filling
and manipulating histograms and gates:
void project(char* hname
,int b_low, int b_high, int g_low, int g_high)
void fill_1D_hist(int*
val, int* ch_en, char *hname)
void fill_2D_hist(int*
val, int* ch_en, char *hname)
void fill_2D_hist_all_chan(int*
val, int* ch_en, char *hname)
void fill_cut_2Dhist(int*
val,int* ch_en, char *hname, TCutG *gate)
void histarr_add(int* val1, int* val2, int* ch_en)
int GetMaxBinRange(char
*hname, int lowx, int highx)
void MakeGate(int np,
double *gate, TCutG *mgate[30])
Data fitting functions
void cal_fit_plot(double*
eg, double* ec, double* eg_err, int n, double *pec, double *pce, char* opt,int
use_err)
void cal_fit(double* eg,
double* ec, double* eg_err, int n, double *pec, double *pce, char* opt,int
use_err)
void fitpeak(char
histname[80], double x1, double x2, double scale, double mean, double sigma,int
lin)
Functions implementing
the net-count method
double calc_F(double
lambda, int tao, double s_live, double s_real, double g_live, double g_real)
double get_xe_counts(int
*roi, int *roib, double *R, double sf, double *k, double *Vk, double *LK, int
*xrf)
double get_net_counts(double
*ks, double *kg, double *Vks, double *Vkg, double *nc, double *Vn, double *LCn,
double *F)
int get_conc_roi(double
*nc, double *Vn, double *eff, int tc, int tp, int ta, double *Vxe, double *croi, double *cerr_roi, double *kroi)
double calc_conc(double
lambda, int tc, int tp, int ta, double *Vxe)
double xi(double lambda1,
double lambda2, int tc, int tp, int ta)
void get_conc(int cas,
double *croi, double *cerr_roi, double *conc, int tc, int tp, int ta)
void get_LC_n(double
*nc, double *Vn, double *kroi, int cas, double *lc, int tc, int tp, int ta)
void get_LCA_n(double
*nc, double *Vn, double *karoi, int cas, double *lca)
void get_MDC(double
*LCn, double *lc, double *kroi, int cas, double *mdc)
void get_MDA(double
*LCn, double *lca, double *karoi, int cas, double *mda)
void get_act_roi(double
*nc, double *Vn, double *eff, int ta, double *aroi, double *aerr_roi, double
*karoi)
double calc_act(double
lambda, int ta)
Other functions:
void polconv(double* x,
double* y, double * p, int nx)
int date_time_conv(char
date[20], char time[20])
========================================
int datatype(char *file, char *dtype)
========================================
Reads
DATA_TYPE from an IMS file
file : name
of IMS file
dtype : DATA_TYPE read from file
return -1
if fails to open *file
else
returns 0
=====================================================
int header(char *file, char *station, char *detector)
=====================================================
Reads
header information from an IMS file
file: name of IMS file
station : station code read from file
detector : detector code read from file
return -1
if fails to open *file
else
returns 0
====================================================================================================
double collection(char
*file, char *start_date, char *start_time, char *stop_date, char *stop_time)
====================================================================================================
Reads
collection start and stop times from an IMS sample file
file : name of IMS file
start_date
: collection start date on the format yyyy/mm/dd
start_time
: collection start time on the format hh:mm:ss.s
stop_date :
stop date on the format yyyy/mm/dd
stop_time :
stop time on the format hh:mm:ss.s
return -1
if fails to open *file
else
returns 0
=========================================================
int processing(char
*file, double* vol, double* yield)
=========================================================
Reads
processing parameters from an IMS sample file
file : name of IMS sample file
vol[0] :
stable xenon volume (ml)
vol[1] :
stable xenon volume error (ml)
yield[0] :
xenon yield (defined as the ratio (processed xenon volume)/(sampled air volume
x 0.087)
yield[1] :
xenon yield error
return -1
if fails to open *file
else
returns 0
================================================================================
int acquisition(char *file, char *start_date, char
*start_time, double* atime)
================================================================================
Reads
acquisition times from an IMS file
file : name of IMS sample file
start_date
: acquisition start date on the format yyyy/mm/dd
start_time
: acquisition start time on the format hh:mm:ss.s
atime[0]: : acquisition livetime [s]
atime[1]: : acquisition realtime [s]
return -1
if fails to open *file
else
returns 0
=========================================================================
int g_energy(char *file, double* ene, double* chan, double*
err)
=========================================================================
Reads gamma
energy calibration from an IMS file
file : name
of IMS sample file
ene : gamma
energy [keV]
chan :
channel corresponding to ene
err : error in chan
return -1
if fails to open *file
else
returns 0
=========================================================================
int b_energy(char *file, double* ene, double* chan, double*
err)
=========================================================================
Reads beta
energy calibration from an IMS file
file : name
of IMS sample file
ene : beta
energy [keV]
chan :
channel corresponding to ene
err : error in chan
return -1
if fails to open *file
else
returns 0
=========================================================================
int g_resolution(char *file, double* ene, double* res,
double* err)
=========================================================================
Reads gamma
energy resolution calibration from an IMS file
file : name
of IMS sample file
ene : gamma energy [keV]
res : gamma energy resolution [keV]
err : error in gamma energy resolution [keV]
return -1
if fails to open *file
else
returns 0
=========================================================================
int b_resolution(char *file, double* ene, double* res,
double* err)
=========================================================================
Reads beta
energy resolution calibration from an IMS file
file : name
of IMS sample file
ene : beta energy [keV]
res : beta energy resolution [keV]
err : error in beta energy resolution [keV]
return -1
if fails to open *file
else
returns 0
===================================================================================================
int ROI_limits(char *file, int* roi, double* b_low, double*
b_high, double* g_low, double* g_high)
===================================================================================================
Reads ROI
limits from an IMS file
file : name
of IMS sample file
roi : ROI
number
b_low : low
beta ROI limit [keV]
b_high :
high beta ROI limit [keV]
g_low : low
gamma ROI limit [keV]
g_high :
high gamma ROI limit [keV]
return -1
if fails to open *file
else
returns 0
================================================
int GetGate(char *file, double* coord)
================================================
Reads
coordinates for a 2D gate from a text file.
file : name
of IMS sample file
coord: the
gate coordinates (coord[0] = x1, coord[1]=y1, etc..)
The block
#Gate is parsed from the text file.
The #Gate
block should contain at least 3 points.
The format
of the block should be as follows:
---------------------
#Gate
<x1> <y1>
<x2> <y2>
...
<xn> <yn>
#
---------------------
where
(xi,yi) is the coordinates of the gate.
return -1
if fails to open *file
else
returns 0
================================================
int GetTweak(char *file, double* shift)
================================================
Reads the
calibration tweak parameters (gamma and beta) from a text file.
file : name
of IMS sample file
shift: the
tweak parameters (shift[0] = gamma offset, shift[1]=gamma tweak,
shift[2]=beta
offset, shift[3]=beta tweak).
The block
#Tweak is parsed from the text file.
The format
of the #Tweak block should be as follows:
---------------------
#Tweak
<gamma offset [chan]>
<gamma tweak (0-1)>
<beta offset [chan]>
<beta tweak (0-1)>
#
---------------------
return -1
if fails to open *file
else
returns 0
================================================
double GetMemf(char *file)
================================================
Returns the
memory effect parameter from a text file.
file : name
of IMS sample file
The block
#Memf is parsed from the text file.
The format
of the #Memf block should be as follows:
---------------------
#Memf
<memory
effect parameter>
#
---------------------
===========================================================
void GetFilenames(char* file, char* sf, char* gf, char* df)
===========================================================
Reads three
filenames from a text file if the row ends with a "x".
file : name
of file containing the sample file information
sf: sample
file
gf: gas
background file
df:
detector background file
The format
of the file should be as follows:
--------------------------------------------------------------------------------------------------------------------
<directory
path to the directory holding the data files>
<sample
file name 1> \t <gas background file name 1> \t <detector
background file name 1> \t <optional analysis flag = x>
<sample
file name 2> \t <gas background file name 2> \t <detector
background file name 2> \t <optional analysis flag = x>
...
...
--------------------------------------------------------------------------------------------------------------------
If the
analysis flag "x" is included, the file names will be read,
otherwhise the sample
will be
skipped.
=========================================================================
int bg_efficiency(char *file, int* roi, double* eff, double*
err)
=========================================================================
Reads
beta-gamma efficiencies for all ROIs from an IMS file
file : name
of IMS sample file
roi : ROI
number
eff :
efficiency
err : efficiency uncertainty
return -1
if fails to open *file
else
returns 0
=========================================================================
int ratios(char *file, int* roi1, int* roi2, double* rat, double*
rat_err)
=========================================================================
Reads
interference factors between ROIs from an IMS file
file : name
of IMS sample file
roi1 : ROI
number 1
roi2 : ROI
number 2
rat:
interference factor
rat_err:
error of interference factor
return -1
if fails to open *file
else
returns 0
=========================================================================
int* g_spectrum(char *file, int* chan)
=========================================================================
Returns a
gamma singles spectrum from an IMS file
file : name
of IMS sample file
chan:
number of channels (chan[0]=# of channels, chan[1]=endpoint energy [keV])
=========================================================================
int* b_spectrum(char *file, int* chan)
=========================================================================
Returns a
beta singles spectrum from an IMS file
file : name
of IMS sample file
chan:
number of channels (chan[0]=# of channels, chan[1]=endpoint energy [keV])
=========================================================================
int* bg_spectrum(char *file, int* chan)
=========================================================================
Returns a
beta-gamma spectrum from an IMS file
file : name
of IMS sample file
chan:
number of channels (chan[0]=# of gamma channels, chan[1]=# of beta channels,
chan[2]=endpoint gamma energy [keV], chan[1]=endpoint beta energy [keV]))
=========================================================================
void project(char* hname ,int b_low, int b_high, int g_low, int
g_high)
=========================================================================
Creates
projections of a 2D histogram using given limits in channels.
The beta
and gamma projections are drawn in a new canvas.
hname: name
of histogram
b_low:
lower beta limit [chan]
b_high:
higher beta limit [chan]
g_low:
lower gamma limit [chan]
g_high:
higher gamma limit [chan]
===========================================================
void fill_1D_hist(int* val, int* ch_en, char *hname)
===========================================================
Fills a 1D
histogram with pulse heigh data from an IMS file
val:
histogram data pointer
ch_en:
channel information pointer (ch_en[0]=# of channels, ch_en[1]=endpoint energy
[keV])
hname: name
of histogram
The
histogram should be defined as follows:
TH1F *hist
= new TH1F("hname","<title>", ch_en[0]+1, 0,
ch_en[0]+1);
===========================================================
void fill_2D_hist(int* val, int* ch_en, char *hname)
===========================================================
Fills a 2D
histogram with pulse heigh data from an IMS file
Channel 0
is not included (in both dimensions)
val:
histogram data pointer
ch_en:
channel information pointer
(chan[0]=#
of gamma channels, chan[1]=# of beta channels,
chan[2]=endpoint
gamma energy [keV], chan[1]=endpoint beta energy [keV]))
hname: name
of histogram
The
histogram should be defined as follows:
TH2F *hist
= new TH2F("hname","<title>", ch_en[1]+1, 0,
ch_en[1]+1,ch_en[0]+1, 0, ch_en[0]+1);
===========================================================
void fill_2D_hist_all_chan(int* val, int* ch_en,
char *hname)
===========================================================
Fills a 2D
histogram with pulse heigh data from an IMS file
Channel 0
is included (in both dimensions)
val:
histogram data pointer
ch_en:
channel information pointer
(chan[0]=#
of gamma channels, chan[1]=# of beta channels,
chan[2]=endpoint
gamma energy [keV], chan[1]=endpoint beta energy [keV]))
hname: name
of histogram
The
histogram should be defined as follows:
TH2F *hist
= new TH2F("hname","<title>", ch_en[1]+1, 0,
ch_en[1]+1,ch_en[0]+1, 0, ch_en[0]+1);
====================================================================
void fill_cut_2Dhist(int* val,int* ch_en, char *hname,
TCutG *gate)
====================================================================
Fills a 2D
histogram with pulse heigh data from an IMS file using a pre-defined cut
val:
histogram data pointer
ch_en:
channel information pointer
(chan[0]=#
of gamma channels, chan[1]=# of beta channels,
chan[2]=endpoint
gamma energy [keV], chan[1]=endpoint beta energy [keV]))
hname: name
of histogram
The
histogram should be defined as follows:
TH2F *hist
= new TH2F("hname","<title>", ch_en[1]+1, 0,
ch_en[1]+1,ch_en[0]+1, 0, ch_en[0]+1);
gate: pre-defined cut
=======================================================
void histarr_add(int* val1, int* val2, int* ch_en)
=======================================================
Adds data
for two histogram data pointers.
val1: histogram data pointer 1
val2: histogram data pointer 2
ch_en:
channel information pointer
(chan[0]=#
of gamma channels, chan[1]=# of beta channels,
chan[2]=endpoint gamma energy [keV], chan[1]=endpoint beta energy [keV]))
The result
is stored in val1.
=====================================================
int GetMaxBinRange(char *hname, int lowx, int highx)
=====================================================
Returns the
bin with max value in range lowx - highx
hname: name
of histogram
lowx: lower
limit
highx:
higher limit
=======================================================
void MakeGate(int np, double *gate, TCutG *mgate[30])
=======================================================
Creates a
gate
np: number
of points in gate
gate: gate
pointer
mgate: gate
(or cut)
==================================================================================================================
void cal_fit_plot(double* eg, double* ec, double* eg_err,
int n, double *pec, double *pce, char* opt,int use_err)
==================================================================================================================
Performs a
second order polynomial fit to energy or resolution calilbration pairs (gamma
or beta)
The result
is drawn in a new canvas.
eg: gamma energy
ec: gamma channel
eg_err:
gamma energy uncertainty
n: number
of calibration pairs
pec:
channel vs energy polynom y =
pec[0]+pec[1]x + pec[2]*x**2 ; pec[3]=chisquare
pce: energy
vs channel polynom y = pec[0]+pec[1]x +
pec[2]*x**2 ; pec[3]=chisquare
opt:
"gammaen" : perform gamma calibration, "betaen": perform
beta calibration
use_err: if
use_err= 0, do not use error in fit, if use_err=1, use error in fit.
=========================================================
void polconv(double* x, double* y, double * p, int nx)
=========================================================
A second
degree polynom
x: x-values
y: y-values
nx: number
of data points
====================================================
int date_time_conv(char date[20], char time[20])
====================================================
Returns
number of seconds since 2004-01-01, 00:00. for a given date and time.
date: date
on format <year/month/day OR
year-month-day>
time: time
on format <hour:min:sec>
==================================================================================================================
void cal_fit(double* eg, double* ec, double* eg_err, int n,
double *pec, double *pce, char* opt,int use_err)
==================================================================================================================
Performs a
second order polynomial fit to energy or resolution calilbration pairs (gamma
or beta)
eg: gamma energy
ec: gamma channel
eg_err:
gamma energy uncertainty
n: number
of calibration pairs
pec:
channel vs energy polynom y =
pec[0]+pec[1]x + pec[2]*x**2 ; pec[3]=chisquare
pce: energy
vs channel polynom y = pec[0]+pec[1]x +
pec[2]*x**2 ; pec[3]=chisquare
opt:
"gammaen" : perform gamma calibration, "betaen": perform
beta calibration
use_err: if
use_err= 0, do not use error in fit, if use_err=1, use error in fit.
=============================================================================================================
int get_roi_counts(char* file, int* roi_counts, TCutG *roi[30], char *hname, int*
bg_chan_ene, int calplot)
=============================================================================================================
Extracts
the number of counts in a ROI. Data are read from an IMS file. Calibration is
performed as a
part of the
routine. The 2D histogram is has to be defined and filled in advance.
file: name
of IMS file
roi_counts:
counts in the ROI
roi: roi
cuts created by the routine
hname: name
of pre-defined beta-gamma histogram.
bg_chan_ene:
channel information pointer
(bg_chan_ene[0]=#
of gamma channels, bg_chan_ene[1]=# of beta channels,
bg_chan_ene[2]=endpoint
gamma energy [keV], bg_chan_ene[1]=endpoint beta energy [keV]))
calplot:
calibration plot option (0= plotted in new canvas, 1= plotted in new canvas)
returns
number of ROIs read from the file.
=============================================================================================================
int get_roi_counts_shift(char* file, int*
roi_counts, TCutG *roi[30], char *hname,
int* bg_chan_ene, double* shift, int calplot)
=============================================================================================================
Extracts
the number of counts in a ROI. Data are read from an IMS file. Calibration is
performed as a
part of the
routine. The 2D histogram is has to be defined and filled in advance. The
calibration tweak parameters are used to shift the roi limits.
file: name
of IMS file
roi_counts:
counts in the ROI
roi: roi
cuts created by the routine
hname: name
of pre-defined beta-gamma histogram.
bg_chan_ene:
channel information pointer
(bg_chan_ene[0]=#
of gamma channels, bg_chan_ene[1]=# of beta channels,
bg_chan_ene[2]=endpoint
gamma energy [keV], bg_chan_ene[1]=endpoint beta energy [keV]))
shift:
tweak parameters (previously read from file).
(shift[0] = gamma offset, shift[1]=gamma tweak,
shift[2]=beta
offset, shift[3]=beta tweak). Can be read using GetTweak.
calplot:
calibration plot option (0= plotted in new canvas, 1= plotted in new canvas)
returns
number of ROIs read from the file.
=============================================================================================================
int get_own_roi_counts(char* file, int*
roi_counts, TCutG *roi[30], char *hname,
int* bg_chan_ene, int calplot)
=============================================================================================================
Extracts
the number of counts in a ROI. ROI definitions are read from the file
"param.txt". Calibration is
performed as a
part of the
routine. The 2D histogram is has to be defined and filled in advance.
file: name
of IMS file
roi_counts:
counts in the ROI
roi: roi
cuts created by the routine
hname: name
of pre-defined beta-gamma histogram.
bg_chan_ene:
channel information pointer
(bg_chan_ene[0]=#
of gamma channels, bg_chan_ene[1]=# of beta channels,
bg_chan_ene[2]=endpoint
gamma energy [keV], bg_chan_ene[1]=endpoint beta energy [keV]))
calplot:
calibration plot option (0= plotted in new canvas, 1= plotted in new canvas)
returns
number of ROIs read from the file.
=================================================================================================
double calc_F(double lambda, int tao, double s_live, double s_real,
double g_live, double g_real)
=================================================================================================
returns the
gas background subtraction factor
lambda:
decay constant
tao: time
between start of sample and start of gas background
s_live:
sample live time
s_real:
sample real time
g_live: gas
background live time
g_real: gas
background real time
=============================================================================================================
double get_xe_counts(int *roi, int *roib, double *R, double
sf, double *k, double *Vk, double *LK, int *xrf)
=============================================================================================================
Calculates
detector background corrected counts in each ROI for a sample or gas background
measurement
roi[1..10] raw counts in ROI 1..10 for sample or gas
background
roib[1..10] raw counts in ROI 1..10 for detector
background
R interference factors
sf detector background subtraction
factor
k[1..10]: net counts in ROI 1..10
Vk[1..10]: variance for ROI 1..10
LK[1..10]: critical level for ROI 1..10
xrf radon and xe133 flag (xrf[0]=1 radon
present, xrf[1]=1 xe133 present)
=======================================================================================================================
double get_net_counts(double *ks, double *kg, double *Vks,
double *Vkg, double *nc, double *Vn, double *LCn, double *F)
=======================================================================================================================
Calculates
final net counts in measurement (sample - gas background)
ks: net counts in sample
kg: net counts in gas background
Vks:
variance of net counts in sample
Vkg: variance of net counts in gas background
nc: net counts in measurement
Vnc: variance of net counts in measurement
LCn: critical limit for net counts
F gas backgorund subtraction factor
====================================================================================================================
int get_conc_roi(double
*nc, double *Vn, double *eff, int tc, int tp, int ta, double *Vxe, double *croi, double *cerr_roi, double *kroi)
Calculates
concentration for each roi
nc: net counts in measurement
Vnc: variance of net counts in measurement
eff: efficiencies for each ROI
tc: collection time [s]
tp: process time [s]
ta: sample live time [s]
Vxe: stable xenon volume
croi: concentration for each ROI [mBq/m3]
cerr_roi: uncertainty for concentration for each ROI
[mBq/m3]
kroi: counts/mBq for earch ROI
returns
flag depending on which isotopes are present:
1: xe131m and xe133m detected
2: Xe131m only detected
3: Xe133m only detected
4: no metastables detected
=====================================================================
double calc_conc(double lambda, int tc, int tp, int ta, double
*Vxe)
=====================================================================
A part of
the concentration equation. Gets concentration in mBq/m3 if return value
is
multiplied with net counts.
lambda: the decay constant
tc: collection time
tp: process time
ta: acquisition time
Vxe: stable xenon volume [m3]
==================================================================
double xi(double lambda1, double lambda2, int tc, int tp, int ta)
==================================================================
returns
correction factor for isotope 1 decaying into isotope 2
lambda1: decay constant for isotope 1
lambda2: decay constant for isotope 2
tc: collection time
tp: process time
ta: acisition time
===================================================================================
void get_conc(int cas,
double *croi, double *cerr_roi, double *conc, int tc, int tp, int ta)
===================================================================================
Returns
isotopic xenon concentrations with errors. Combines results for different ROIs
in relevant cases:
cas: flag depending on which isotopes are present:
1: xe131m and xe133m detected
2: Xe131m only detected
3: Xe133m only detected
4: no metastables detected
croi:
concentration for each ROI
cerr_roi:
uncertainty concentration for each ROI
conc[0]:
133 conc
conc[1]:
133 error
conc[2]:
131m conc
conc[3]:
131m error
conc[4]:
133m conc
conc[5]:
133m error
conc[6]:
135 conc
conc[7]:
135 error
tc:
collection time [s]
tp: process
time [s]
ta:
acquisition time
==================================================================================================
void get_LC_n(double
*nc, double *Vn, double *kroi, int cas, double *lc, int tc, int tp, int ta)
==================================================================================================
Calculates
LC (mBq/m3)
nc: net counts
Vn: net count variance
kroi: norm
counts/mBq/m3
cas: flag depending on which isotopes are present:
1:
xe131m and xe133m detected
2:
Xe131m only detected
3:
Xe133m only detected
4: no
metastables detected
lc: LC
lc[0] : 133Xe
lc[1] : 131mXe
lc[2] : 133mXe
lc[3] : 135Xe
tc:
collection time [s]
tp: process
time [s]
ta: acquisition
time
==================================================================================================
void get_LCA_n(double
*nc, double *Vn, double *karoi, int cas, double *lca)
==================================================================================================
Calculates
LC for the activity (mBq)
nc: net counts
Vn: net count variance
karoi: norm
counts/mBq
cas: flag depending on which isotopes are present:
1:
xe131m and xe133m detected
2:
Xe131m only detected
3:
Xe133m only detected
4: no
metastables detected
lca: LC (for activity)
lca[0] : 133Xe
lca[1] : 131mXe
lca[2] : 133mXe
lca[3] : 135Xe
==================================================================================================
void get_MDC(double
*LCn, double *lc, double *kroi, int cas, double *mdc)
==================================================================================================
Calculates
MDC (mBq/m3)
LCn: critical limit for net counts as calculated
by get_net_counts
lc: lc as calculated by get_LC_n
kroi: norm
counts/mBq/m3
cas: flag depending on which isotopes are present:
1:
xe131m and xe133m detected
2:
Xe131m only detected
3:
Xe133m only detected
4: no
metastables detected
mdc: MDC for each isotope:
mdc[0] : 133Xe
mdc[1] : 131mXe
mdc[2] : 133mXe
mdc[3] : 135Xe
==================================================================================================
void get_MDA(double *LCn, double *lca, double *karoi, int cas,
double *mda){
==================================================================================================
Calculates
MDA (mBq)
LCn: critical limit for net counts as calculated
by get_net_counts
lca: lca as calculated by get_LCA_n
karoi: norm
counts/mBq
cas: flag depending on which isotopes are present:
1:
xe131m and xe133m detected
2:
Xe131m only detected
3:
Xe133m only detected
4: no
metastables detected
mda: MDA for each isotope:
mda[0] : 133Xe
mda[1] : 131mXe
mda[2] : 133mXe
mda[3] : 135Xe
mda[4] : 222Rn in equilibrium
=====================
double LD(double x)
====================
Returns LD
x: net
counts
============================================================================================================
void get_act_roi(double *nc, double *Vn, double *eff, int ta,
double *aroi, double *aerr_roi, double *karoi)
============================================================================================================
Calculates
the activity for each ROI
nc: net counts in measurement
Vn : variance of net counts in measurement
eff: efficiencies for each ROI
ta: sample live time [s]
aroi: activity for each ROI [mBq/m3]
aerr_roi: uncertainty of activity for each ROI [mBq/m3]
karoi: counts/mBq for earch ROI
=======================================
double calc_act(double lambda, int ta)
=======================================
returns
part of activity formula
lambda: decay constant
ta: sample live time (s)
=======================================================================================================
void fitpeak(char histname[80], double x1, double x2, double scale,
double mean, double sigma,int lin)
=======================================================================================================
Fits a
gaussian peak + background (linear,quadratic or step function) in a region of a
histogram.
The fit is
displayed and the parameters are written to the standard output
histname:
name of histogram
x1: lower limit of fit
x2: higher limit of fit
scale: start value for peak area
mean: peak centroid start value
sigma: peak width start value
lin: background flag: (1= linear; 2=
quadratic; 3= step function)
============================================================
void add_write_bg(char *file1, char *file2, char *sumfile)
============================================================
Reads 2D
beta-gamma spectra from IMS 2.0 files and adds data.
The result
is written to an output file in the form of a
#Histogram
block on IMS 2.0 format
file1: name of file1
file2: name of file 2
sumfile:
name of result file containing fil1+file2 beta-gamma data