GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BasePeak.h
Go to the documentation of this file.
1 
2 
3 #ifndef Gw_BasePeak
4 #define Gw_BasePeak
5 
6 #ifndef ROOT_TNamed
7 #include "TNamed.h"
8 #endif
9 
10 class TF1;
11 class TH1;
12 class TList;
13 
14 namespace Gw {
15 
19 class BasePeak : public TNamed
20 {
21 private:
22  struct GateColor {
23  Color_t k0;
24  Color_t k1;
25  Color_t k2;
26  Color_t k3;
27  };
28 
29 public:
30  static GateColor gGateColor;
31 
32  static Bool_t IsvalideGateColor(Color_t co);
33  static Int_t GetGateAxis(Color_t co);
34  static Color_t GetGateColor(Int_t idx);
35 
36 public:
37  BasePeak(const char* name, const char* title);
38  virtual ~BasePeak();
39  BasePeak(const BasePeak& p);
40  BasePeak& operator=(const BasePeak& p);
41 
42  virtual void Copy(TObject &o) const
43  {
44  ((BasePeak &)o) = (*this);
45  }
46 
48  virtual void SetHeight(const Double_t height)
49  { fHeight = height; }
51  virtual void SetIntensity(const Double_t intensity)
52  { fIntensity = intensity; }
54  virtual void EnableFit()
55  { fIsFitOn = true; }
57  virtual void DisableFit()
58  { fIsFitOn = false; }
59  virtual void FitOn(Bool_t fit_on = true); //*TOGGLE* *GETTER=FitFlag
60 
62  virtual void SetCombinedFlag(Bool_t flag)
63  { fIsCombined = flag; }
64 
66  virtual Double_t GetHeight() const
67  { return fHeight; }
69  virtual Double_t GetIntensity() const
70  { return fIntensity; }
72  virtual UShort_t GetDimension() const
73  { return fDimension; }
75  virtual Bool_t FitFlag() const
76  { return fIsFitOn; }
78  virtual Bool_t CombinedFlag() const
79  { return fIsCombined; }
80 
82  virtual void Print(Option_t* opt = "") const;
83 
84  /* pure virtual functions */
85 
87  virtual Short_t IsPointInBkg(Double_t x, Double_t y = 0) = 0;
88 
90  virtual TF1 *SetSignalFunction(const char* nameFunc = "gaus", TH1 *h=0x0) = 0;
91 
93  virtual TF1 *SetSignalFunction(const TF1* func) = 0;
94 
96  virtual TF1 *SignalFunction() = 0;
97 
99  virtual TF1 *SetBkgFunction(const char* nameFunc = "-") = 0;
100 
102  virtual TF1 *SetBkgFunction(const TF1* func) = 0;
103 
105  virtual TF1 *BkgFunction() = 0;
106 
108  virtual void Fit(TH1 *h, Option_t* optFit = "RN", Option_t* optBkg = "lin") = 0;
109 
111  virtual void FitCombined(TH1 *h, TList* peakList, Option_t* optFit = "RN", Option_t* optBkg = "lin") = 0;
112 
114  virtual Double_t GetPosition(Option_t* axis = "X") const = 0;
115 
117  virtual Double_t GetFWHM(Option_t* axis = "X") const = 0;
118 
120  virtual void SetPosition(const Double_t position, Option_t* axis = "X") = 0;
121 
123  virtual void SetFWHM(const Double_t FWHM, Option_t* axis = "X") = 0;
124 
126  virtual void PaintFor(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax) = 0;
127 
128 protected:
129  Double_t fHeight;
130  Double_t fIntensity;
131  UShort_t fDimension;
132  Bool_t fIsFitOn;
133  Bool_t fIsCombined;
134 
135  ClassDef(BasePeak,1); // Class definition for BasePeak
136 };
137 
138 } // end namespace
139 #endif
virtual Double_t GetPosition(Option_t *axis="X") const =0
Get position of peak.
virtual Bool_t CombinedFlag() const
Get flag for combined fit.
Definition: BasePeak.h:78
virtual TF1 * SetSignalFunction(const char *nameFunc="gaus", TH1 *h=0x0)=0
Set pre-defined function to fit the signal.
virtual void Fit(TH1 *h, Option_t *optFit="RN", Option_t *optBkg="lin")=0
Fit peak with background.
virtual void SetPosition(const Double_t position, Option_t *axis="X")=0
Set position of peak.
Bool_t fIsCombined
flag to stated peak is part of a combined fit
Definition: BasePeak.h:133
virtual TF1 * SetBkgFunction(const char *nameFunc="-")=0
Set pre-defined function for background during fit.
virtual Double_t GetIntensity() const
Get intensity of peak.
Definition: BasePeak.h:69
Double_t fIntensity
intensity of the peak
Definition: BasePeak.h:130
virtual void SetCombinedFlag(Bool_t flag)
Set flag for combined fit.
Definition: BasePeak.h:62
static GateColor gGateColor
Definition: BasePeak.h:30
virtual void PaintFor(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax)=0
Set vis attribute to be painted in the following frame.
UShort_t fDimension
dimension of the peak
Definition: BasePeak.h:131
virtual Double_t GetHeight() const
Get height of peak.
Definition: BasePeak.h:66
virtual void FitOn(Bool_t fit_on=true)
Definition: BasePeak.cpp:126
static Int_t GetGateAxis(Color_t co)
Definition: BasePeak.cpp:111
Bool_t fIsFitOn
flag for fitted peak
Definition: BasePeak.h:132
BasePeak(const char *name, const char *title)
virtual TF1 * BkgFunction()=0
Access to bkg function ... don't delete it !
virtual void EnableFit()
Set flag on to enable fit of the peak.
Definition: BasePeak.h:54
virtual Short_t IsPointInBkg(Double_t x, Double_t y=0)=0
to determine if a point is in bg. 0 likely in peak, 1 in bg, 2 outside bg
virtual void Print(Option_t *opt="") const
print current peak
Definition: BasePeak.cpp:132
virtual ~BasePeak()
Definition: BasePeak.cpp:46
virtual void FitCombined(TH1 *h, TList *peakList, Option_t *optFit="RN", Option_t *optBkg="lin")=0
Fit multi-defined peak with a common background.
virtual TF1 * SignalFunction()=0
Access to bkg function ... don't delete it !
Double_t fHeight
height of the Peak
Definition: BasePeak.h:129
virtual Bool_t FitFlag() const
Get flag for enable fit.
Definition: BasePeak.h:75
virtual void SetIntensity(const Double_t intensity)
Set intensity of peak.
Definition: BasePeak.h:51
static Bool_t IsvalideGateColor(Color_t co)
Definition: BasePeak.cpp:82
virtual Double_t GetFWHM(Option_t *axis="X") const =0
Get FWHM of peak.
virtual void SetFWHM(const Double_t FWHM, Option_t *axis="X")=0
Set FWHM of peak.
A BasePeak is defined by a height, intensity and a dimension of the peak.
Definition: BasePeak.h:19
BasePeak & operator=(const BasePeak &p)
Definition: BasePeak.cpp:65
ClassDef(BasePeak, 1)
virtual UShort_t GetDimension() const
Get dimension of peak.
Definition: BasePeak.h:72
virtual void SetHeight(const Double_t height)
Set height of peak.
Definition: BasePeak.h:48
virtual void DisableFit()
Set flag off to enable fit of the peak.
Definition: BasePeak.h:57
virtual void Copy(TObject &o) const
Definition: BasePeak.h:42
static Color_t GetGateColor(Int_t idx)
Definition: BasePeak.cpp:93