ROOT logo
// @(#)root/spectrum:$Id: TSpectrum.h 20882 2007-11-19 11:31:26Z rdm $
// Author: Miroslav Morhac   27/05/99

/*************************************************************************
 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/
#ifndef ROOT_TSpectrum
#define ROOT_TSpectrum

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif

class TH1;

class TSpectrum : public TNamed {
private:

   TSpectrum(const TSpectrum&); // Not implemented
   TSpectrum& operator=(const TSpectrum&); // Not implemented

protected:
   Int_t         fMaxPeaks;       //Maximum number of peaks to be found
   Int_t         fNPeaks;         //number of peaks found
   Float_t      *fPosition;       //[fNPeaks] array of current peak positions
   Float_t      *fPositionX;      //[fNPeaks] X position of peaks
   Float_t      *fPositionY;      //[fNPeaks] Y position of peaks
   Float_t       fResolution;     //resolution of the neighboring peaks
   TH1          *fHistogram;      //resulting histogram
static Int_t     fgAverageWindow; //Average window of searched peaks
static Int_t     fgIterations;    //Maximum number of decon iterations (default=3)

public:
   enum {
       kBackOrder2 =0,
       kBackOrder4 =1,
       kBackOrder6 =2,
       kBackOrder8 =3,
       kBackIncreasingWindow =0,
       kBackDecreasingWindow =1,
       kBackSmoothing3 =3,
       kBackSmoothing5 =5,
       kBackSmoothing7 =7,
       kBackSmoothing9 =9,
       kBackSmoothing11 =11,
       kBackSmoothing13 =13,
       kBackSmoothing15 =15
   };

   TSpectrum();
   TSpectrum(Int_t maxpositions, Float_t resolution=1);
   virtual ~TSpectrum();
   virtual TH1        *Background(const TH1 *hist,Int_t niter=20, Option_t *option="");
   TH1                *GetHistogram() const {return fHistogram;}
   Int_t               GetNPeaks() const {return fNPeaks;}
   Float_t            *GetPositionX() const {return fPositionX;}
   Float_t            *GetPositionY() const {return fPositionY;}
   virtual void        Print(Option_t *option="") const;
   virtual Int_t       Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05);
   static void         SetAverageWindow(Int_t w=3);   //set average window
   static void         SetDeconIterations(Int_t n=3); //set max number of decon iterations
   void                SetResolution(Float_t resolution=1);

   //new functions January 2006
   const char         *Background(float *spectrum, Int_t ssize,Int_t numberIterations,Int_t direction, Int_t filterOrder,bool smoothing,Int_t smoothWindow,bool compton);
   const char         *SmoothMarkov(float *source, Int_t ssize, Int_t averWindow);   
   const char         *Deconvolution(float *source, const float *response,Int_t ssize, Int_t numberIterations,Int_t numberRepetitions, Double_t boost );    
   const char         *DeconvolutionRL(float *source, const float *response,Int_t ssize, Int_t numberIterations,Int_t numberRepetitions, Double_t boost );    
   const char         *Unfolding(float *source,const float **respMatrix,Int_t ssizex, Int_t ssizey,Int_t numberIterations,Int_t numberRepetitions, Double_t boost);    
   Int_t               SearchHighRes(float *source,float *destVector, Int_t ssize,float sigma, Double_t threshold,bool backgroundRemove,Int_t deconIterations,bool markov, Int_t averWindow);   
   Int_t               Search1HighRes(float *source,float *destVector, Int_t ssize,float sigma, Double_t threshold,bool backgroundRemove,Int_t deconIterations,bool markov, Int_t averWindow);   

   static Int_t        StaticSearch(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05);
   static TH1         *StaticBackground(const TH1 *hist,Int_t niter=20, Option_t *option="");

   ClassDef(TSpectrum,3)  //Peak Finder, background estimator, Deconvolution
};

#endif

 TSpectrum.h:1
 TSpectrum.h:2
 TSpectrum.h:3
 TSpectrum.h:4
 TSpectrum.h:5
 TSpectrum.h:6
 TSpectrum.h:7
 TSpectrum.h:8
 TSpectrum.h:9
 TSpectrum.h:10
 TSpectrum.h:11
 TSpectrum.h:12
 TSpectrum.h:13
 TSpectrum.h:14
 TSpectrum.h:15
 TSpectrum.h:16
 TSpectrum.h:17
 TSpectrum.h:18
 TSpectrum.h:19
 TSpectrum.h:20
 TSpectrum.h:21
 TSpectrum.h:22
 TSpectrum.h:23
 TSpectrum.h:24
 TSpectrum.h:25
 TSpectrum.h:26
 TSpectrum.h:27
 TSpectrum.h:28
 TSpectrum.h:29
 TSpectrum.h:30
 TSpectrum.h:31
 TSpectrum.h:32
 TSpectrum.h:33
 TSpectrum.h:34
 TSpectrum.h:35
 TSpectrum.h:36
 TSpectrum.h:37
 TSpectrum.h:38
 TSpectrum.h:39
 TSpectrum.h:40
 TSpectrum.h:41
 TSpectrum.h:42
 TSpectrum.h:43
 TSpectrum.h:44
 TSpectrum.h:45
 TSpectrum.h:46
 TSpectrum.h:47
 TSpectrum.h:48
 TSpectrum.h:49
 TSpectrum.h:50
 TSpectrum.h:51
 TSpectrum.h:52
 TSpectrum.h:53
 TSpectrum.h:54
 TSpectrum.h:55
 TSpectrum.h:56
 TSpectrum.h:57
 TSpectrum.h:58
 TSpectrum.h:59
 TSpectrum.h:60
 TSpectrum.h:61
 TSpectrum.h:62
 TSpectrum.h:63
 TSpectrum.h:64
 TSpectrum.h:65
 TSpectrum.h:66
 TSpectrum.h:67
 TSpectrum.h:68
 TSpectrum.h:69
 TSpectrum.h:70
 TSpectrum.h:71
 TSpectrum.h:72
 TSpectrum.h:73
 TSpectrum.h:74
 TSpectrum.h:75
 TSpectrum.h:76
 TSpectrum.h:77
 TSpectrum.h:78
 TSpectrum.h:79
 TSpectrum.h:80
 TSpectrum.h:81
 TSpectrum.h:82
 TSpectrum.h:83
 TSpectrum.h:84