Class TSpectrum


  • public class TSpectrum
    extends java.lang.Object
    Original 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.doc

    ftp://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/

    • 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 void filterBackgroundOrder2​(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)  
      protected static void filterBackgroundOrder4​(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)  
      protected static void filterBackgroundOrder6​(double[] workingSpace, int length, int numberIterations, TSpectrum.Direction direction, TSpectrum.SmoothWindow smoothing)  
      protected static void filterBackgroundOrder8​(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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 spectrum
        destination - where to copy the filtered background
        length - length of the spectrum vector
        numberIterations - maximal width of clipping window,
        direction - direction of change of clipping window - possible values=kBackIncreasingWindow kBackDecreasingWindow
        filterOrder - order of clipping filter, -possible values=kBackOrder2 kBackOrder4 kBackOrder6 kBackOrder8
        smoothing - logical variable whether the smoothing operation in the estimation of background will be included resp. smoothing window
        compton - 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 spectrum
        response - vector of response spectrum
        destination - vector to store result (if null or too small, new vector is allocated and returned)
        length - length of source and response spectra
        numberIterations - for details we refer to the reference given below
        numberRepetitions - 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 spectrum
        response - vector of response spectrum
        destination - vector to store result (if null or too small, new vector is allocated and returned)
        length - length of source and response spectra
        numberIterations - for details we refer to the reference given above
        numberRepetitions - for repeated boosted deconvolution
        boost - 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.
      • 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 spectrum
        sourceY - vector of source spectrum
        destVector - vector of resulting deconvolved spectrum
        length - length of source spectrum
        nMaxPeaks - maximum number of peaks to search for (upper bound)
        sigma - sigma of searched peaks, for details we refer to manual
        threshold - threshold value in % for selected peaks, peaks with amplitude less than threshold*highest_peak/100 are ignored, see manual
        backgroundRemove - logical variable, set if the removal of background before deconvolution is desired
        deconIterations - number of iterations in deconvolution operation
        markov - 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 spectrum
        destination - array where to store the filtered background
        length - length of source array
        averWindow - 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 spectrum
        respMatrix - matrix of response spectra
        destination - vector of unfolded source spectrum
        lengthx - length of source spectrum and # of columns of response matrix
        lengthy - length of destination spectrum and # of rows of response matrix
        numberIterations - Note!!! lengthx must be >= lengthy
        numberRepetitions - repetition count
        boost - 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.