Package de.gsi.math.spectra
Class TSpectrum
- java.lang.Object
-
- de.gsi.math.spectra.TSpectrum
-
public class TSpectrum extends java.lang.ObjectOriginal Author: Miroslav Morhac 27/05/99 clean up/java port: Ralph Steinhagen 18/04/18 THIS CLASS CONTAINS ADVANCED SPECTRA PROCESSING FUNCTIONS. ONE-DIMENSIONAL BACKGROUND ESTIMATION FUNCTIONS ONE-DIMENSIONAL SMOOTHING FUNCTIONS ONE-DIMENSIONAL DECONVOLUTION FUNCTIONS ONE-DIMENSIONAL PEAK SEARCH FUNCTIONS These functions were written by: Miroslav Morhac Institute of Physics Slovak Academy of Sciences Dubravska cesta 9, 842 28 BRATISLAVA SLOVAKIA email:fyzimiro@savba.sk, fax:+421 7 54772479 The original code in C has been repackaged as a C++ class by R.Brun The algorithms in this class have been published in the following references: [1] M.Morhac et al.: Background elimination methods for multidimensional coincidence gamma-ray spectra. Nuclear Instruments and Methods in Physics Research A 401 (1997) 113-132. [2] M.Morhac et al.: Efficient one- and two-dimensional Gold deconvolution and its application to gamma-ray spectra decomposition. Nuclear Instruments and Methods in Physics Research A 401 (1997) 385-408. [3] M.Morhac et al.: Identification of peaks in multidimensional coincidence gamma-ray spectra. Nuclear Instruments and Methods in Research Physics A 443(2000), 108-125. These NIM papers are also available as doc or ps files from: ftp://root.cern.ch/root/Spectrum.docftp://root.cern.ch/root/SpectrumDec.ps.gz ftp://root.cern.ch/root/SpectrumSrc.ps.gz ftp://root.cern.ch/root/SpectrumBck.ps.gz The original source documentation as well as examples can be found at http://root.cern.ch/
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTSpectrum.Directionstatic classTSpectrum.FilterOrderstatic classTSpectrum.SmoothWindow
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]background(double[] source, double[] destination, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.FilterOrder filterOrder, TSpectrum.SmoothWindow smoothing, boolean compton)ONE-DIMENSIONAL BACKGROUND ESTIMATION FUNCTION - GENERAL FUNCTION This function calculates background spectrum from source spectrum.static double[]deconvolution(double[] source, double[] response, double[] destination, int length, int numberIterations, int numberRepetitions, double boost)ONE-DIMENSIONAL DECONVOLUTION FUNCTION This function calculates deconvolution from source spectrum according to response spectrum using Gold algorithm The result is placed in the vector pointed by destination pointer.static double[]deconvolutionRL(double[] source, double[] response, double[] destination, int length, int numberIterations, int numberRepetitions, double boost)ONE-DIMENSIONAL DECONVOLUTION FUNCTION This function calculates deconvolution from source spectrum according to response spectrum using Richardson-Lucy algorithm The result is placed in the vector pointed by destination pointer.protected static voidfilterBackgroundOrder2(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)protected static voidfilterBackgroundOrder4(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)protected static voidfilterBackgroundOrder6(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)protected static voidfilterBackgroundOrder8(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)static java.util.List<de.gsi.dataset.spi.utils.DoublePoint>search(double[] sourceX, double[] sourceY, double[] destVector, int length, int nMaxPeaks, double sigma, double threshold, boolean backgroundRemove, int deconIterations, boolean markov, int averWindow)ONE-DIMENSIONAL HIGH-RESOLUTION PEAK SEARCH FUNCTION This function searches for peaks in source spectrum It is based on deconvolution method.static double[]smoothMarkov(double[] source, double[] destination, int length, int averWindow)ONE-DIMENSIONAL MARKOV SPECTRUM SMOOTHING FUNCTION This function calculates smoothed spectrum from source spectrum based on Markov chain method.static double[]unfolding(double[] source, double[][] respMatrix, double[] destination, int lengthx, int lengthy, int numberIterations, int numberRepetitions, double boost)ONE-DIMENSIONAL UNFOLDING FUNCTION This function unfolds source spectrum according to response matrix columns.
-
-
-
Method Detail
-
background
public static double[] background(double[] source, double[] destination, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.FilterOrder filterOrder, TSpectrum.SmoothWindow smoothing, boolean compton)ONE-DIMENSIONAL BACKGROUND ESTIMATION FUNCTION - GENERAL FUNCTION This function calculates background spectrum from source spectrum. The result is placed in the vector pointed by spectrum pointer.- Parameters:
source- vector of source spectrumdestination- where to copy the filtered backgroundlength- length of the spectrum vectornumberIterations- maximal width of clipping window,direction- direction of change of clipping window - possible values=kBackIncreasingWindow kBackDecreasingWindowfilterOrder- order of clipping filter, -possible values=kBackOrder2 kBackOrder4 kBackOrder6 kBackOrder8smoothing- logical variable whether the smoothing operation in the estimation of background will be included resp. smoothing windowcompton- logical variable whether the estimation of Compton edge will be included - possible values=kFALSE kTRUE- Returns:
- filtered array, N.B. if destination is null or has insufficient length a new array is being allocated, otherwise calculations are done in-place.
-
deconvolution
public static double[] deconvolution(double[] source, double[] response, double[] destination, int length, int numberIterations, int numberRepetitions, double boost)ONE-DIMENSIONAL DECONVOLUTION FUNCTION This function calculates deconvolution from source spectrum according to response spectrum using Gold algorithm The result is placed in the vector pointed by destination pointer.- Parameters:
source- vector of source spectrumresponse- vector of response spectrumdestination- vector to store result (if null or too small, new vector is allocated and returned)length- length of source and response spectranumberIterations- for details we refer to the reference given belownumberRepetitions- for repeated boosted deconvolution @boost, boosting coefficient M. Morhac, J. Kliman, V. Matousek, M. Veselsk, I. Turzo.: Efficient one- and two-dimensional Gold deconvolution and its application to gamma-ray spectra decomposition. NIM, A401 (1997) 385-408.boost- ???- Returns:
- filtered array, N.B. if destination is null or has insufficient length a new array is being allocated, otherwise calculations are done in-place.
-
deconvolutionRL
public static double[] deconvolutionRL(double[] source, double[] response, double[] destination, int length, int numberIterations, int numberRepetitions, double boost)ONE-DIMENSIONAL DECONVOLUTION FUNCTION This function calculates deconvolution from source spectrum according to response spectrum using Richardson-Lucy algorithm The result is placed in the vector pointed by destination pointer.- Parameters:
source- vector of source spectrumresponse- vector of response spectrumdestination- vector to store result (if null or too small, new vector is allocated and returned)length- length of source and response spectranumberIterations- for details we refer to the reference given abovenumberRepetitions- for repeated boosted deconvolutionboost- boosting coefficient- Returns:
- filtered array, N.B. if destination is null or has insufficient length a new array is being allocated, otherwise calculations are done in-place.
-
filterBackgroundOrder2
protected static void filterBackgroundOrder2(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)
-
filterBackgroundOrder4
protected static void filterBackgroundOrder4(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)
-
filterBackgroundOrder6
protected static void filterBackgroundOrder6(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)
-
filterBackgroundOrder8
protected static void filterBackgroundOrder8(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)
-
search
public static java.util.List<de.gsi.dataset.spi.utils.DoublePoint> search(double[] sourceX, double[] sourceY, double[] destVector, int length, int nMaxPeaks, double sigma, double threshold, boolean backgroundRemove, int deconIterations, boolean markov, int averWindow)ONE-DIMENSIONAL HIGH-RESOLUTION PEAK SEARCH FUNCTION This function searches for peaks in source spectrum It is based on deconvolution method. First the background is removed (if desired), then Markov spectrum is calculated (if desired), then the response function is generated according to given sigma and deconvolution is carried out.- Parameters:
sourceX- vector of source spectrumsourceY- vector of source spectrumdestVector- vector of resulting deconvolved spectrumlength- length of source spectrumnMaxPeaks- maximum number of peaks to search for (upper bound)sigma- sigma of searched peaks, for details we refer to manualthreshold- threshold value in % for selected peaks, peaks with amplitude less than threshold*highest_peak/100 are ignored, see manualbackgroundRemove- logical variable, set if the removal of background before deconvolution is desireddeconIterations- number of iterations in deconvolution operationmarkov- logical variable, if it is true, first the source spectrum is replaced by new spectrum calculated using Markov chains method.averWindow- averaging window of searched peaks, for details we refer to manual (applies only for Markov method)- Returns:
- list with identified peaks
-
smoothMarkov
public static double[] smoothMarkov(double[] source, double[] destination, int length, int averWindow)ONE-DIMENSIONAL MARKOV SPECTRUM SMOOTHING FUNCTION This function calculates smoothed spectrum from source spectrum based on Markov chain method. The result is placed in the array pointed by source pointer.- Parameters:
source- array of source spectrumdestination- array where to store the filtered backgroundlength- length of source arrayaverWindow- width of averaging smoothing window- Returns:
- filtered array, N.B. if destination is null or has insufficient length a new array is being allocated, otherwise calculations are done in-place.
-
unfolding
public static double[] unfolding(double[] source, double[][] respMatrix, double[] destination, int lengthx, int lengthy, int numberIterations, int numberRepetitions, double boost)ONE-DIMENSIONAL UNFOLDING FUNCTION This function unfolds source spectrum according to response matrix columns. The result is placed in the vector pointed by source pointer.- Parameters:
source- vector of source spectrumrespMatrix- matrix of response spectradestination- vector of unfolded source spectrumlengthx- length of source spectrum and # of columns of response matrixlengthy- length of destination spectrum and # of rows of response matrixnumberIterations- Note!!! lengthx must be >= lengthynumberRepetitions- repetition countboost- boosting coefficient- Returns:
- filtered array, N.B. if destination is null or has insufficient length a new array is being allocated, otherwise calculations are done in-place.
-
-