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