GSI Object Oriented Online Offline (Go4)  GO4-6.1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TGo4FitPeakFinder.h
Go to the documentation of this file.
1 // $Id: TGo4FitPeakFinder.h 2692 2020-01-10 14:34:41Z 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 fuer 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() const { return fbUsePolynom; }
73  void SetPolynomOrder(Int_t order) { fiPolynomOrder = order; }
74  Int_t GetPolynomOrder() const { return fiPolynomOrder; }
75 
76  void SetPeakFinderType(Int_t typ) { fiPeakFinderType = typ; }
77  Int_t GetPeakFinderType() const { return fiPeakFinderType; }
78 
79  void Set0MaxAmplFactor(Double_t factor) { fd0MaxAmplFactor = factor; }
80  Double_t Get0MaxAmplFactor() const { return fd0MaxAmplFactor; }
81  void Set0MinWidth(Double_t min) { fd0MinWidth = min; }
82  Double_t Get0MinWidth() const { return fd0MinWidth; }
83  void Set0MaxWidth(Double_t max) { fd0MaxWidth = max; }
84  Double_t Get0MaxWidth() const { return fd0MaxWidth; }
85 
86  void Set1LineWidth(Double_t width) { fd1LineWidth = width; }
87  Double_t Get1LineWidth() const { return fd1LineWidth; }
88 
89  void Set2NoiseFactor(Double_t factor) { fd2NoiseFactor = factor; }
90  Double_t Get2NoiseFactor() const { return fd2NoiseFactor; }
91  void Set2NoiseMinimum(Double_t min) { fd2NoiseMinimum = min; }
92  Double_t Get2NoiseMinimum() const { return fd2NoiseMinimum; }
93  void Set2ChannelSum(Int_t sum) { fi2ChannelSum = sum; }
94  Int_t Get2ChannelSum() const { return fi2ChannelSum; }
95 
99  virtual void Print(Option_t* option) const;
100 
101  private:
102 
103  void ROOTPeakFinder(TGo4Fitter* fitter,
104  TGo4FitData* data,
105  Int_t PolynomOrder,
106  Double_t Sigma);
107 
108 
116  void SergeyLinevPeakFinder(TGo4Fitter* fitter,
117  TGo4FitData* data,
118  Int_t PolOrder,
119  Double_t AmplThreshold,
120  Double_t MinWidth,
121  Double_t MaxWidth);
122 
127  void HansEsselPeakFinder(TGo4Fitter* fitter,
128  TGo4FitData* data,
129  Int_t MaxNumPeaks = 50,
130  Int_t ChannelSum = 1,
131  Double_t NoiseFactor = 2.,
132  Double_t NoiseMinimum = 10.,
133  Int_t MinimasOrder = -1);
134 
135  static void DefinePolynom(Int_t size, // number of experim points
136  Double_t* bins, // arrray of bins
137  Double_t* scales, // array of scale values
138  TArrayD& Coef, // array of polynomial coefficients
139  Double_t* weight = 0, // statistical weight of each bin
140  Double_t* backgr = 0, // background values
141  Char_t* use = 0); // usage of each points
142 
143  static void DefinePolynomEx(Int_t size, Double_t* bins, Double_t* scales, Double_t* weight, Double_t* backgr,
144  Int_t lbound, Int_t rbound, TArrayD& Coef);
145 
146 
147  static Double_t CalcPolynom(const TArrayD& Coef, Double_t x);
148 
149 
150  Int_t fiPeakFinderType; // 0 - by S.Linev, 1 - ROOT TSpectrum , 2 - by H.Essel
151 
152  TString fxDataName;
153 
155 
156  Bool_t fbUsePolynom;
158 
159  Double_t fd0MinWidth;
160  Double_t fd0MaxWidth;
162 
163  Double_t fd1LineWidth;
164 
165  Double_t fd2NoiseFactor;
166  Double_t fd2NoiseMinimum;
168 
169  ClassDef(TGo4FitPeakFinder,1)
170 };
171 
172 #endif // TGO4FITPEAKFINDER_H
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
Int_t GetPeakFinderType() const
void Set2NoiseFactor(Double_t factor)
Double_t Get0MinWidth() const
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)
void SetPeakFinderType(Int_t typ)
Bool_t GetUsePolynom() const
Double_t Get2NoiseMinimum() const
Int_t Get2ChannelSum() const
const char * GetDataName()
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 Get2NoiseFactor() const
virtual void DoAction(TGo4FitterAbstract *Fitter)
void SetupPolynomialBackground(Int_t PolynomOrder)
Double_t Get1LineWidth() const
void SetUsePolynom(Bool_t use)
void SetupForThird(Double_t NoiseFactor, Double_t NoiseMinimum, Int_t ChannelSum)
Double_t Get0MaxWidth() const
void Set1LineWidth(Double_t width)
void SetClearModels(Bool_t clear)
static Double_t CalcPolynom(const TArrayD &Coef, Double_t x)
Double_t Get0MaxAmplFactor() const
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)
Int_t GetPolynomOrder() const