GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitPeakFinder.h
Go to the documentation of this file.
1 // $Id: TGo4FitPeakFinder.h 478 2009-10-29 12:26:09Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 #ifndef TGO4FITPEAKFINDER_H
15 #define TGO4FITPEAKFINDER_H
16 
17 #include "TGo4FitterAction.h"
18 
19 #include "TArrayD.h"
20 
21 class TGo4Fitter;
22 class TGo4FitData;
23 
31  public:
32 
37 
42  TGo4FitPeakFinder(const char* Name, const char* DataName = 0, Bool_t ClearModels = kFALSE, Int_t PolOrder = -1);
43 
47  virtual ~TGo4FitPeakFinder();
48 
49  void SetDataName(const char* name) { fxDataName = name; }
50  const char* GetDataName() { return fxDataName.Data(); }
51  void SetClearModels(Bool_t clear) { fbClearModels = clear; }
52  Bool_t GetClearModels() { return fbClearModels; }
53 
54 
55  void SetupPolynomialBackground(Int_t PolynomOrder);
56 
57  void SetupForFirst(Double_t MaxAmplFactor, Double_t MinWidth, Double_t MaxWidth);
58 
59  void SetupForSecond(Double_t LineWidth);
60 
61  void SetupForThird(Double_t NoiseFactor, Double_t NoiseMinimum, Int_t ChannelSum);
62 
63  virtual void DoAction(TGo4FitterAbstract* Fitter);
64 
65  virtual Bool_t CanChangeFitter() const { return kTRUE; }
66 
67  // Following functions directly changes single parameters of peakfinders.
68  // Normally you should not use them, because some or all of them can be changed later on
69  // You should use Setup... routines to configure specific peakfinder
70 
71  void SetUsePolynom(Bool_t use) { fbUsePolynom = use; }
72  Bool_t GetUsePolynom() { return fbUsePolynom; }
73  void SetPolynomOrder(Int_t order) { fiPolynomOrder = order; }
74  Int_t GetPolynomOrder() { return fiPolynomOrder; }
75 
76  void SetPeakFinderType(Int_t typ) { fiPeakFinderType = typ; }
77  Int_t GetPeakFinderType() { return fiPeakFinderType; }
78 
79  void Set0MaxAmplFactor(Double_t factor) { fd0MaxAmplFactor = factor; }
80  Double_t Get0MaxAmplFactor() { return fd0MaxAmplFactor; }
81  void Set0MinWidth(Double_t min) { fd0MinWidth = min; }
82  Double_t Get0MinWidth() { return fd0MinWidth; }
83  void Set0MaxWidth(Double_t max) { fd0MaxWidth = max; }
84  Double_t Get0MaxWidth() { return fd0MaxWidth; }
85 
86  void Set1LineWidth(Double_t width) { fd1LineWidth = width; }
87  Double_t Get1LineWidth() { return fd1LineWidth; }
88 
89  void Set2NoiseFactor(Double_t factor) { fd2NoiseFactor = factor; }
90  Double_t Get2NoiseFactor() { return fd2NoiseFactor; }
91  void Set2NoiseMinimum(Double_t min) { fd2NoiseMinimum = min; }
92  Double_t Get2NoiseMinimum() { return fd2NoiseMinimum; }
93  void Set2ChannelSum(Int_t sum) { fi2ChannelSum = sum; }
94  Int_t Get2ChannelSum() { return fi2ChannelSum; }
95 
96 
97 
101  virtual void Print(Option_t* option) const;
102 
103  private:
104 
105  void ROOTPeakFinder(TGo4Fitter* fitter,
106  TGo4FitData* data,
107  Int_t PolynomOrder,
108  Double_t Sigma);
109 
110 
118  void SergeyLinevPeakFinder(TGo4Fitter* fitter,
119  TGo4FitData* data,
120  Int_t PolOrder,
121  Double_t AmplThreshold,
122  Double_t MinWidth,
123  Double_t MaxWidth);
124 
129  void HansEsselPeakFinder(TGo4Fitter* fitter,
130  TGo4FitData* data,
131  Int_t MaxNumPeaks = 50,
132  Int_t ChannelSum = 1,
133  Double_t NoiseFactor = 2.,
134  Double_t NoiseMinimum = 10.,
135  Int_t MinimasOrder = -1);
136 
137  static void DefinePolynom(Int_t size, // number of experim points
138  Double_t* bins, // arrray of bins
139  Double_t* scales, // array of scale values
140  TArrayD& Coef, // array of polynomial coefficients
141  Double_t* weight = 0, // statistical weight of each bin
142  Double_t* backgr = 0, // background values
143  Char_t* use = 0); // usage of each points
144 
145  static void DefinePolynomEx(Int_t size, Double_t* bins, Double_t* scales, Double_t* weight, Double_t* backgr,
146  Int_t lbound, Int_t rbound, TArrayD& Coef);
147 
148 
149  static Double_t CalcPolynom(const TArrayD& Coef, Double_t x);
150 
151 
152  Int_t fiPeakFinderType; // 0 - by S.Linev, 1 - ROOT TSpectrum , 2 - by H.Essel
153 
154  TString fxDataName;
155 
157 
158  Bool_t fbUsePolynom;
160 
161  Double_t fd0MinWidth;
162  Double_t fd0MaxWidth;
164 
165  Double_t fd1LineWidth;
166 
167  Double_t fd2NoiseFactor;
168  Double_t fd2NoiseMinimum;
170 
171  ClassDef(TGo4FitPeakFinder,1)
172 };
173 
174 #endif // TGO4FITPEAKFINDER_H
Double_t Get1LineWidth()
static void DefinePolynom(Int_t size, Double_t *bins, Double_t *scales, TArrayD &Coef, Double_t *weight=0, Double_t *backgr=0, Char_t *use=0)
void SetupForSecond(Double_t LineWidth)
virtual Bool_t CanChangeFitter() const
void Set2NoiseFactor(Double_t factor)
void SetDataName(const char *name)
static void DefinePolynomEx(Int_t size, Double_t *bins, Double_t *scales, Double_t *weight, Double_t *backgr, Int_t lbound, Int_t rbound, TArrayD &Coef)
void SergeyLinevPeakFinder(TGo4Fitter *fitter, TGo4FitData *data, Int_t PolOrder, Double_t AmplThreshold, Double_t MinWidth, Double_t MaxWidth)
void Set2NoiseMinimum(Double_t min)
Double_t Get2NoiseFactor()
void SetPeakFinderType(Int_t typ)
const char * GetDataName()
Double_t Get0MaxAmplFactor()
virtual void Print(Option_t *option) const
void Set0MaxWidth(Double_t max)
void Set0MaxAmplFactor(Double_t factor)
void SetupForFirst(Double_t MaxAmplFactor, Double_t MinWidth, Double_t MaxWidth)
void Set2ChannelSum(Int_t sum)
Double_t Get2NoiseMinimum()
virtual void DoAction(TGo4FitterAbstract *Fitter)
void SetupPolynomialBackground(Int_t PolynomOrder)
void SetUsePolynom(Bool_t use)
void SetupForThird(Double_t NoiseFactor, Double_t NoiseMinimum, Int_t ChannelSum)
void Set1LineWidth(Double_t width)
void SetClearModels(Bool_t clear)
static Double_t CalcPolynom(const TArrayD &Coef, Double_t x)
void ROOTPeakFinder(TGo4Fitter *fitter, TGo4FitData *data, Int_t PolynomOrder, Double_t Sigma)
void SetPolynomOrder(Int_t order)
void HansEsselPeakFinder(TGo4Fitter *fitter, TGo4FitData *data, Int_t MaxNumPeaks=50, Int_t ChannelSum=1, Double_t NoiseFactor=2., Double_t NoiseMinimum=10., Int_t MinimasOrder=-1)
void Set0MinWidth(Double_t min)