GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
GGaus.h
Go to the documentation of this file.
1#ifndef GGAUS_H
2#define GGAUS_H
3
4#include <TF1.h>
5
6class GGaus : public TF1 {
7public:
8 GGaus();
9 GGaus(Double_t xlow, Double_t xhigh, Option_t* opt = "gsc");
10 GGaus(Double_t xlow, Double_t xhigh, TF1* bg, Option_t* opt = "gsc");
11 GGaus(const GGaus&);
12 GGaus(GGaus&&) noexcept = default;
13 GGaus& operator=(const GGaus&) = default;
14 GGaus& operator=(GGaus&&) noexcept = default;
15 ~GGaus() = default;
16
17 void Copy(TObject&) const override;
18 void Print(Option_t* opt = "") const override;
19 void Clear(Option_t* opt = "") override;
20
21 void InitNames();
22 bool InitParams(TH1* fithist = nullptr);
23 bool Fit(TH1*, Option_t* opt = "");
24 void DrawResiduals(TH1*) const;
25 // void DrawResiduals(); // *MENU*
26
27 TF1* Background(Option_t* = "TF1") { return &fBGFit; }
28 // void DrawBackground(Option_t* opt = "SAME") const; // *MENU*
29
30 Double_t GetCentroid() const { return GetParameter("centroid"); }
31 Double_t GetCentroidErr() const { return GetParError(GetParNumber("centroid")); }
32 Double_t GetArea() const { return fArea; }
33 Double_t GetAreaErr() const { return fDArea; }
34 Double_t GetSum() const { return fSum; }
35 Double_t GetSumErr() const { return fDSum; }
36 Double_t GetFWHM() const { return GetParameter("sigma") * 2.3548; }
37 Double_t GetFWHMErr() const { return GetParError(GetParNumber("sigma")) * 2.3548; }
38 // Double_t GetIntegralArea();
39 // Double_t GetIntegralArea(Double_t int_low, Double_t int_high);
40 // Double_t GetIntegralAreaErr();
41 // Double_t GetIntegralAreaErr(Double_t int_low, Double_t int_high);
42
43 static Bool_t CompareEnergy(const GGaus& lhs, const GGaus& rhs) { return lhs.GetCentroid() < rhs.GetCentroid(); }
44 static Bool_t CompareArea(const GGaus& lhs, const GGaus& rhs) { return lhs.GetArea() < rhs.GetArea(); }
45
46protected:
47 void SetArea(Double_t a) { fArea = a; }
48 void SetAreaErr(Double_t d_a) { fDArea = d_a; }
49 void SetSum(Double_t a) { fSum = a; }
50 void SetSumErr(Double_t d_a) { fDSum = d_a; }
51 void SetArea(Double_t a, Double_t dA)
52 {
53 SetArea(a);
54 SetAreaErr(dA);
55 }
56 void SetChi2(Double_t chi2) { fChi2 = chi2; }
57 void SetNdf(Double_t Ndf) { fNdf = Ndf; }
58
59private:
60 double fArea{0.};
61 double fDArea{0.};
62 double fChi2{0.};
63 double fNdf{0.};
64
65 double fSum{0.};
66 double fDSum{0.};
67
68 Bool_t IsInitialized() const { return fInitFlag; }
69 void SetInitialized(Bool_t flag = true) { fInitFlag = flag; }
70 bool fInitFlag{false};
71
72 TF1 fBGFit;
74
75 /// /cond CLASSIMP
76 ClassDefOverride(GGaus, 2) // NOLINT(readability-else-after-return)
77 /// /endcond
78};
79
80#endif
Definition GGaus.h:6
void SetArea(Double_t a)
Definition GGaus.h:47
Double_t GetCentroidErr() const
Definition GGaus.h:31
TF1 * Background(Option_t *="TF1")
Definition GGaus.h:27
TF1 fBGFit
Definition GGaus.h:72
double fArea
Definition GGaus.h:60
static Bool_t CompareArea(const GGaus &lhs, const GGaus &rhs)
Definition GGaus.h:44
bool fInitFlag
Definition GGaus.h:70
double fDSum
Definition GGaus.h:66
Double_t GetSumErr() const
Definition GGaus.h:35
TF1 fBGHist
Definition GGaus.h:73
double fNdf
Definition GGaus.h:63
bool InitParams(TH1 *fithist=nullptr)
Definition GGaus.cxx:90
Double_t GetArea() const
Definition GGaus.h:32
void DrawResiduals(TH1 *) const
Definition GGaus.cxx:257
Double_t GetSum() const
Definition GGaus.h:34
void SetNdf(Double_t Ndf)
Definition GGaus.h:57
Bool_t IsInitialized() const
Definition GGaus.h:68
void Copy(TObject &) const override
Definition GGaus.cxx:76
Double_t GetAreaErr() const
Definition GGaus.h:33
void SetInitialized(Bool_t flag=true)
Definition GGaus.h:69
double fChi2
Definition GGaus.h:62
GGaus()
Definition GGaus.cxx:53
Double_t GetCentroid() const
Definition GGaus.h:30
void Clear(Option_t *opt="") override
Definition GGaus.cxx:224
Double_t GetFWHM() const
Definition GGaus.h:36
Double_t GetFWHMErr() const
Definition GGaus.h:37
GGaus(GGaus &&) noexcept=default
double fDArea
Definition GGaus.h:61
void SetSumErr(Double_t d_a)
Definition GGaus.h:50
bool Fit(TH1 *, Option_t *opt="")
Definition GGaus.cxx:151
void InitNames()
Definition GGaus.cxx:67
double fSum
Definition GGaus.h:65
static Bool_t CompareEnergy(const GGaus &lhs, const GGaus &rhs)
Definition GGaus.h:43
void SetChi2(Double_t chi2)
Definition GGaus.h:56
void Print(Option_t *opt="") const override
Definition GGaus.cxx:240
void SetAreaErr(Double_t d_a)
Definition GGaus.h:48
void SetArea(Double_t a, Double_t dA)
Definition GGaus.h:51
void SetSum(Double_t a)
Definition GGaus.h:49