// @(#)root/spectrum:$Id$
// Author: Miroslav Morhac   25/09/2006

/*************************************************************************
 * 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_TSpectrum3
#define ROOT_TSpectrum3

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

class TH1;

class TSpectrum3 : public TNamed {
protected:
   Int_t         fMaxPeaks;       //Maximum number of peaks to be found
   Int_t         fNPeaks;         //number of peaks found
   Double_t      *fPosition;       //[fNPeaks] array of current peak positions
   Double_t      *fPositionX;      //[fNPeaks] X positions of peaks
   Double_t      *fPositionY;      //[fNPeaks] Y positions of peaks
   Double_t      *fPositionZ;      //[fNPeaks] Z positions of peaks
   Double_t       fResolution;     //resolution of the neighboring peaks
   TH1          *fHistogram;      //resulting histogram

public:
   enum {
       kBackIncreasingWindow =0,
       kBackDecreasingWindow =1,
       kBackSuccessiveFiltering =0,
       kBackOneStepFiltering =1
   };

   TSpectrum3();
   TSpectrum3(Int_t maxpositions, Double_t resolution=1);
   virtual ~TSpectrum3();
   virtual const char *Background(const TH1 *hist, Int_t niter, Option_t *option="goff");
   const char         *Background(Double_t ***spectrum, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t numberIterationsX,Int_t numberIterationsY, Int_t numberIterationsZ, Int_t direction,Int_t filterType);
   const char         *Deconvolution(Double_t ***source, const Double_t ***resp, Int_t ssizex, Int_t ssizey, Int_t ssizez,Int_t numberIterations, Int_t numberRepetitions, Double_t boost);
   TH1                *GetHistogram() const {return fHistogram;}
   Int_t               GetNPeaks() const {return fNPeaks;}
   Double_t            *GetPositionX() const {return fPositionX;}
   Double_t            *GetPositionY() const {return fPositionY;}
   Double_t            *GetPositionZ() const {return fPositionZ;}
   virtual void        Print(Option_t *option="") const;
   virtual Int_t       Search(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05);
   Int_t               SearchFast(const Double_t ***source, Double_t ***dest, Int_t ssizex, Int_t ssizey, Int_t ssizez, Double_t sigma, Double_t threshold, Bool_t markov, Int_t averWindow);
   Int_t               SearchHighRes(const Double_t ***source,Double_t ***dest, Int_t ssizex, Int_t ssizey, Int_t ssizez, Double_t sigma, Double_t threshold, Bool_t backgroundRemove,Int_t deconIterations, Bool_t markov, Int_t averWindow);
   void                SetResolution(Double_t resolution=1);
   const char         *SmoothMarkov(Double_t ***source, Int_t ssizex, Int_t ssizey, Int_t ssizez, Int_t averWindow);

   ClassDef(TSpectrum3,1)  //Peak Finder, Background estimator, Markov smoothing and Deconvolution for 3-D histograms
};

#endif


 TSpectrum3.h:1
 TSpectrum3.h:2
 TSpectrum3.h:3
 TSpectrum3.h:4
 TSpectrum3.h:5
 TSpectrum3.h:6
 TSpectrum3.h:7
 TSpectrum3.h:8
 TSpectrum3.h:9
 TSpectrum3.h:10
 TSpectrum3.h:11
 TSpectrum3.h:12
 TSpectrum3.h:13
 TSpectrum3.h:14
 TSpectrum3.h:15
 TSpectrum3.h:16
 TSpectrum3.h:17
 TSpectrum3.h:18
 TSpectrum3.h:19
 TSpectrum3.h:20
 TSpectrum3.h:21
 TSpectrum3.h:22
 TSpectrum3.h:23
 TSpectrum3.h:24
 TSpectrum3.h:25
 TSpectrum3.h:26
 TSpectrum3.h:27
 TSpectrum3.h:28
 TSpectrum3.h:29
 TSpectrum3.h:30
 TSpectrum3.h:31
 TSpectrum3.h:32
 TSpectrum3.h:33
 TSpectrum3.h:34
 TSpectrum3.h:35
 TSpectrum3.h:36
 TSpectrum3.h:37
 TSpectrum3.h:38
 TSpectrum3.h:39
 TSpectrum3.h:40
 TSpectrum3.h:41
 TSpectrum3.h:42
 TSpectrum3.h:43
 TSpectrum3.h:44
 TSpectrum3.h:45
 TSpectrum3.h:46
 TSpectrum3.h:47
 TSpectrum3.h:48
 TSpectrum3.h:49
 TSpectrum3.h:50
 TSpectrum3.h:51
 TSpectrum3.h:52
 TSpectrum3.h:53
 TSpectrum3.h:54
 TSpectrum3.h:55
 TSpectrum3.h:56
 TSpectrum3.h:57
 TSpectrum3.h:58
 TSpectrum3.h:59
 TSpectrum3.h:60
 TSpectrum3.h:61
 TSpectrum3.h:62