00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #ifndef TGO4FITPEAKFINDER_H
00017 #define TGO4FITPEAKFINDER_H
00018 
00019 #include "TGo4FitterAction.h"
00020 
00021 #include "TArrayD.h"
00022 
00023 class TGo4Fitter;
00024 class TGo4FitData;
00025 
00032 class TGo4FitPeakFinder : public TGo4FitterAction {
00033    public:
00034 
00038       TGo4FitPeakFinder();
00039 
00044       TGo4FitPeakFinder(const char* Name, const char* DataName = 0, Bool_t ClearModels = kFALSE, Int_t PolOrder = -1);
00045 
00049       virtual ~TGo4FitPeakFinder();
00050 
00051       void SetDataName(const char* name) { fxDataName = name; }
00052       const char* GetDataName() { return fxDataName.Data(); }
00053       void SetClearModels(Bool_t clear) { fbClearModels = clear; }
00054       Bool_t GetClearModels() { return fbClearModels; }
00055 
00056 
00057       void SetupPolynomialBackground(Int_t PolynomOrder);
00058 
00059       void SetupForFirst(Double_t MaxAmplFactor, Double_t MinWidth, Double_t MaxWidth);
00060 
00061       void SetupForSecond(Double_t LineWidth);
00062 
00063       void SetupForThird(Double_t NoiseFactor, Double_t NoiseMinimum, Int_t ChannelSum);
00064 
00065       virtual void DoAction(TGo4FitterAbstract* Fitter);
00066 
00067       virtual Bool_t CanChangeFitter() const { return kTRUE; }
00068 
00069       
00070       
00071       
00072 
00073       void SetUsePolynom(Bool_t use) { fbUsePolynom = use; }
00074       Bool_t GetUsePolynom() { return fbUsePolynom; }
00075       void SetPolynomOrder(Int_t order) { fiPolynomOrder = order; }
00076       Int_t GetPolynomOrder() { return fiPolynomOrder; }
00077 
00078       void SetPeakFinderType(Int_t typ) { fiPeakFinderType = typ; }
00079       Int_t GetPeakFinderType() { return fiPeakFinderType; }
00080 
00081       void Set0MaxAmplFactor(Double_t factor) { fd0MaxAmplFactor = factor; }
00082       Double_t Get0MaxAmplFactor() { return fd0MaxAmplFactor; }
00083       void Set0MinWidth(Double_t min) { fd0MinWidth = min; }
00084       Double_t Get0MinWidth() { return fd0MinWidth; }
00085       void Set0MaxWidth(Double_t max) { fd0MaxWidth = max; }
00086       Double_t Get0MaxWidth() { return fd0MaxWidth; }
00087 
00088       void Set1LineWidth(Double_t width) { fd1LineWidth = width; }
00089       Double_t Get1LineWidth() { return fd1LineWidth; }
00090 
00091       void Set2NoiseFactor(Double_t factor) { fd2NoiseFactor = factor; }
00092       Double_t Get2NoiseFactor() { return fd2NoiseFactor; }
00093       void Set2NoiseMinimum(Double_t min) { fd2NoiseMinimum = min; }
00094       Double_t Get2NoiseMinimum() { return fd2NoiseMinimum; }
00095       void Set2ChannelSum(Int_t sum) { fi2ChannelSum = sum; }
00096       Int_t Get2ChannelSum() { return fi2ChannelSum; }
00097 
00098 
00099 
00103       virtual void Print(Option_t* option) const;
00104 
00105     private:
00106 
00107       void ROOTPeakFinder(TGo4Fitter* fitter,
00108                           TGo4FitData* data,
00109                           Int_t PolynomOrder,
00110                           Double_t Sigma);
00111 
00112 
00120       void SergeyLinevPeakFinder(TGo4Fitter* fitter,
00121                                  TGo4FitData* data,
00122                                  Int_t PolOrder,
00123                                  Double_t AmplThreshold,
00124                                  Double_t MinWidth,
00125                                  Double_t MaxWidth);
00126 
00131       void HansEsselPeakFinder(TGo4Fitter* fitter,
00132                                TGo4FitData* data,
00133                                Int_t MaxNumPeaks = 50,
00134                                Int_t ChannelSum = 1,
00135                                Double_t NoiseFactor = 2.,
00136                                Double_t NoiseMinimum = 10.,
00137                                Int_t MinimasOrder = -1);
00138 
00139       static void DefinePolynom(Int_t size,              
00140                                 Double_t* bins,          
00141                                 Double_t* scales,        
00142                                 TArrayD& Coef,           
00143                                 Double_t* weight = 0,    
00144                                 Double_t* backgr = 0,    
00145                                 Char_t* use = 0);        
00146 
00147       static void DefinePolynomEx(Int_t size, Double_t* bins, Double_t* scales, Double_t* weight, Double_t* backgr,
00148                                   Int_t lbound, Int_t rbound, TArrayD& Coef);
00149 
00150 
00151       static Double_t CalcPolynom(const TArrayD& Coef, Double_t x);
00152 
00153 
00154       Int_t fiPeakFinderType;   
00155 
00156       TString fxDataName;
00157 
00158       Bool_t fbClearModels;
00159 
00160       Bool_t fbUsePolynom;
00161       Int_t  fiPolynomOrder;
00162 
00163       Double_t fd0MinWidth;
00164       Double_t fd0MaxWidth;
00165       Double_t fd0MaxAmplFactor;
00166 
00167       Double_t fd1LineWidth;
00168 
00169       Double_t fd2NoiseFactor;
00170       Double_t fd2NoiseMinimum;
00171       Int_t  fi2ChannelSum;
00172 
00173    ClassDef(TGo4FitPeakFinder,1)
00174 };
00175 
00176 #endif // TGO4FITPEAKFINDER_H
00177 
00178