Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TSpectrum2.h
Go to the documentation of this file.
1 // @(#)root/spectrum:$Id$
2 // Author: Miroslav Morhac 17/01/2006
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 #ifndef ROOT_TSpectrum2
12 #define ROOT_TSpectrum2
13 
14 #include "TNamed.h"
15 
16 class TH1;
17 
18 class TSpectrum2 : public TNamed {
19 protected:
20  Int_t fMaxPeaks; ///< Maximum number of peaks to be found
21  Int_t fNPeaks; ///< number of peaks found
22  Double_t *fPosition; ///< [fNPeaks] array of current peak positions
23  Double_t *fPositionX; ///< [fNPeaks] X position of peaks
24  Double_t *fPositionY; ///< [fNPeaks] Y position of peaks
25  Double_t fResolution; ///< *NOT USED* resolution of the neighboring peaks
26  TH1 *fHistogram; ///< resulting histogram
27 static Int_t fgAverageWindow; ///< Average window of searched peaks
28 static Int_t fgIterations; ///< Maximum number of decon iterations (default=3)
29 
30 public:
31  enum {
32  kBackIncreasingWindow =0,
33  kBackDecreasingWindow =1,
34  kBackSuccessiveFiltering =0,
35  kBackOneStepFiltering =1
36  };
37 
38  TSpectrum2();
39  TSpectrum2(Int_t maxpositions, Double_t resolution=1); // resolution is *NOT USED*
40  virtual ~TSpectrum2();
41  virtual TH1 *Background(const TH1 *hist, Int_t niter=20, Option_t *option="");
42  TH1 *GetHistogram() const {return fHistogram;}
43  Int_t GetNPeaks() const {return fNPeaks;}
44  Double_t *GetPositionX() const {return fPositionX;}
45  Double_t *GetPositionY() const {return fPositionY;}
46  virtual void Print(Option_t *option="") const;
47  virtual Int_t Search(const TH1 *hist, Double_t sigma=2, Option_t *option="", Double_t threshold=0.05);
48  static void SetAverageWindow(Int_t w=3); //set average window
49  static void SetDeconIterations(Int_t n=3); //set max number of decon iterations
50  void SetResolution(Double_t resolution=1); // *NOT USED*
51 
52  //new functions January 2006
53  const char *Background(Double_t **spectrum,Int_t ssizex, Int_t ssizey,Int_t numberIterationsX,Int_t numberIterationsY,Int_t direction,Int_t filterType);
54  const char *SmoothMarkov(Double_t **source, Int_t ssizex, Int_t ssizey, Int_t averWindow);
55  const char *Deconvolution(Double_t **source, Double_t **resp, Int_t ssizex, Int_t ssizey,Int_t numberIterations, Int_t numberRepetitions, Double_t boost);
56  Int_t SearchHighRes(Double_t **source,Double_t **dest, Int_t ssizex, Int_t ssizey, Double_t sigma, Double_t threshold, Bool_t backgroundRemove,Int_t deconIterations, Bool_t markov, Int_t averWindow);
57 
58  static Int_t StaticSearch(const TH1 *hist, Double_t sigma=2, Option_t *option="goff", Double_t threshold=0.05);
59  static TH1 *StaticBackground(const TH1 *hist,Int_t niter=20, Option_t *option="");
60 
61  ClassDef(TSpectrum2,1) //Peak Finder, background estimator, Deconvolution for 2-D histograms
62 };
63 
64 #endif
65