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/

    • Constructor Summary

      Constructors 
      Constructor Description
      TSpectrum()
      The TSpectrum() default constructor
      TSpectrum​(int maxpositions, double resolution)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void finalize()
      TSpectrum desctructor
      int getNPeaks()  
      double[] getPeakX()  
      double[] getPeakY()  
      static void main​(java.lang.String[] argv)  
      int Search​(double[] hinX, double[] hinY, double[] houtX, double[] houtY, double sigma, java.lang.String option, double threshold)
      ONE-DIMENSIONAL PEAK SEARCH FUNCTION This function searches for peaks in source spectrum in hin The number of found peaks and their positions are written into the members fNpeaks and fPositionX.
      int SearchHighRes​(double[] source, double[] destVector, int ssize, 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.
      void SetAverageWindow​(int w)  
      void SetResolution​(double resolution)  
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • fgAverageWindow

        protected static int fgAverageWindow
      • fgIterations

        protected static int fgIterations
      • fMaxPeaks

        protected int fMaxPeaks
      • fNPeaks

        protected int fNPeaks
      • fPosition

        protected double[] fPosition
      • fPositionX

        protected double[] fPositionX
      • fPositionY

        protected double[] fPositionY
      • fResolution

        protected double fResolution
    • Constructor Detail

      • TSpectrum

        public TSpectrum()
        The TSpectrum() default constructor
      • TSpectrum

        public TSpectrum​(int maxpositions,
                         double resolution)
        Parameters:
        maxpositions - maximum number of peaks
        resolution - determines resolution of the neighboring peaks default value is 1 correspond to 3 sigma distance between peaks. Higher values allow higher resolution (smaller distance between peaks. May be set later through SetResolution.)
    • Method Detail

      • finalize

        public void finalize()
        TSpectrum desctructor
        Overrides:
        finalize in class java.lang.Object
      • getNPeaks

        public int getNPeaks()
        Returns:
        number of peaks found
      • getPeakX

        public double[] getPeakX()
        Returns:
        X coordinates of found peaks
      • getPeakY

        public double[] getPeakY()
        Returns:
        Y coordinates of found peaks
      • Search

        public int Search​(double[] hinX,
                          double[] hinY,
                          double[] houtX,
                          double[] houtY,
                          double sigma,
                          java.lang.String option,
                          double threshold)
        ONE-DIMENSIONAL PEAK SEARCH FUNCTION This function searches for peaks in source spectrum in hin The number of found peaks and their positions are written into the members fNpeaks and fPositionX. The search is performed in the current histogram range. Function parameters:
        Parameters:
        hinX - histogram x of source spectrum
        hinY - histogram Y of source spectrum
        houtX - out histogram of source spectrum
        houtY - out histogram of source spectrum
        sigma - sigma of searched peaks, for details we refer to manual
        option - string options passed to the algorithms
        threshold - (default=0.05) peaks with amplitude less than threshold*highest_peak are discarded. 0 < threshold <1 By default, the background is removed before deconvolution. Specify the option "nobackground" to not remove the background. By default the "Markov" chain algorithm is used. Specify the option "noMarkov" to disable this algorithm Note that by default the source spectrum is replaced by a new spectrum
        Returns:
        number of found peaks
      • SearchHighRes

        public int SearchHighRes​(double[] source,
                                 double[] destVector,
                                 int ssize,
                                 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:
        source - vector of source spectrum
        destVector - vector of resulting deconvolved spectrum
        ssize - length of source spectrum
        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:
        number of found peaks
      • SetResolution

        public void SetResolution​(double resolution)
        Parameters:
        resolution - determines resolution of the neighboring peaks default value is 1 correspond to 3 sigma distance between peaks. Higher values allow higher resolution (smaller distance between peaks. May be set later through SetResolution.
      • main

        public static void main​(java.lang.String[] argv)