GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
GH2Base.h
Go to the documentation of this file.
1#ifndef GH2BASE__H
2#define GH2BASE__H
3
4#include <cstdio>
5#include <cstdint>
6
7#include "TNamed.h"
8#include "TH2.h"
9#include "TList.h"
10
11class GH1D;
12
18
19enum class EDirection : std::uint8_t { kXDirection,
21
22class GH2Base {
23
24public:
25 GH2Base() { Init(); }
26 GH2Base(const GH2Base&) = default;
27 GH2Base(GH2Base&&) noexcept = default;
28 GH2Base& operator=(const GH2Base&) = default;
29 GH2Base& operator=(GH2Base&&) noexcept = default;
30
31 virtual ~GH2Base();
32
33 virtual void GH2Clear(Option_t* opt = "");
34
35 virtual TH2* GetTH2() = 0;
36
37 GH1D* Projection_Background(int axis = 0, int firstbin = 0, int lastbin = -1, int first_bg_bin = 0,
39
40 // GH1D* SummaryProject(int binnum);
41
42 GH1D* ProjectionX_Background(int firstbin = 0, int lastbin = -1, int first_bg_bin = 0, int last_bg_bin = -1,
44
45 GH1D* GH2ProjectionX(const char* name = "_px", int firstbin = 0, int lastbin = -1, Option_t* option = "",
46 bool KeepEmpty = false); // *MENU*
47
48 GH1D* GH2ProjectionY(const char* name = "_py", int firstbin = 0, int lastbin = -1, Option_t* option = "",
49 bool KeepEmpty = false); // *MENU*
50
51 GH1D* ProjectionY_Background(int firstbin = 0, int lastbin = -1, int first_bg_bin = 0, int last_bg_bin = -1,
53
54 GH1D* GetPrevious(const GH1D* curr, bool DrawEmpty = true);
55 GH1D* GetPrevSummary(const GH1D* curr, bool DrawEmpty = false);
56 GH1D* GetNext(const GH1D* curr, bool DrawEmpty = true);
57 GH1D* GetNextSummary(const GH1D* curr, bool DrawEmpty = false);
58
59 TList* GetProjections() { return fProjections; }
61
62 void SetSummary(bool is_summary = true) { fIsSummary = is_summary; }
63 bool GetSummary() const { return fIsSummary; }
64
67
68 class iterator { // NOLINT(readability-identifier-naming)
69 public:
70 explicit iterator(GH2Base* mat)
71 : fMat(mat), fFirst(mat->GetNext(nullptr)), fCurr(fFirst)
72 {
73 }
74
75 iterator(GH2Base* mat, bool at_end)
76 : fMat(mat), fFirst(mat->GetNext(nullptr)), fCurr(at_end ? nullptr : fFirst)
77 {
78 }
79
80 GH1D& operator*() const { return *fCurr; }
81 GH1D* operator->() const { return fCurr; }
82
83 // prefix increment
85 {
87 if(fCurr == fFirst) {
88 fCurr = nullptr;
89 }
90 return *this;
91 }
92
93 // postfix increment
95 {
96 iterator current = *this;
97 ++(*this);
98 return current;
99 }
100
101 bool operator==(const iterator& rhs) const { return (fMat == rhs.fMat && fFirst == rhs.fFirst && fCurr == rhs.fCurr); }
102 bool operator!=(const iterator& rhs) const { return !(*this == rhs); }
103
104 private:
108 };
109
110 iterator begin() { return {this, false}; }
111 iterator end() { return {this, true}; }
112
113private:
114 void Init();
115 TList* fProjections{nullptr};
116
117 TList* fSummaryProjections{nullptr}; //!
118 bool fIsSummary{false};
120
121 /// /cond CLASSIMP
122 ClassDef(GH2Base, 1) // NOLINT(readability-else-after-return)
123 /// /endcond
124};
125
126#endif
EDirection
Definition GH2Base.h:19
EBackgroundSubtraction
Definition GH2Base.h:13
TH2D * mat
Definition UserFillObj.h:12
Definition GH1D.h:19
bool operator!=(const iterator &rhs) const
Definition GH2Base.h:102
GH2Base * fMat
Definition GH2Base.h:105
iterator & operator++()
Definition GH2Base.h:84
iterator(GH2Base *mat, bool at_end)
Definition GH2Base.h:75
GH1D * operator->() const
Definition GH2Base.h:81
iterator operator++(int)
Definition GH2Base.h:94
GH1D & operator*() const
Definition GH2Base.h:80
bool operator==(const iterator &rhs) const
Definition GH2Base.h:101
iterator(GH2Base *mat)
Definition GH2Base.h:70
bool fIsSummary
Definition GH2Base.h:118
iterator begin()
Definition GH2Base.h:110
GH1D * GetPrevious(const GH1D *curr, bool DrawEmpty=true)
Definition GH2Base.cxx:198
EDirection fSummaryDirection
Definition GH2Base.h:119
TList * GetSummaryProjections()
Definition GH2Base.h:60
virtual void GH2Clear(Option_t *opt="")
Definition GH2Base.cxx:24
void Init()
Definition GH2Base.cxx:16
TList * fSummaryProjections
Definition GH2Base.h:117
bool GetSummary() const
Definition GH2Base.h:63
GH1D * GH2ProjectionY(const char *name="_py", int firstbin=0, int lastbin=-1, Option_t *option="", bool KeepEmpty=false)
Definition GH2Base.cxx:144
GH1D * ProjectionY_Background(int firstbin=0, int lastbin=-1, int first_bg_bin=0, int last_bg_bin=-1, EBackgroundSubtraction mode=EBackgroundSubtraction::kRegionBackground)
Definition GH2Base.cxx:192
GH1D * GetNextSummary(const GH1D *curr, bool DrawEmpty=false)
Definition GH2Base.cxx:244
TList * GetProjections()
Definition GH2Base.h:59
GH1D * GH2ProjectionX(const char *name="_px", int firstbin=0, int lastbin=-1, Option_t *option="", bool KeepEmpty=false)
Definition GH2Base.cxx:90
GH2Base(GH2Base &&) noexcept=default
virtual TH2 * GetTH2()=0
GH2Base()
Definition GH2Base.h:25
GH1D * GetNext(const GH1D *curr, bool DrawEmpty=true)
Definition GH2Base.cxx:221
void SetSummary(bool is_summary=true)
Definition GH2Base.h:62
GH1D * ProjectionX_Background(int firstbin=0, int lastbin=-1, int first_bg_bin=0, int last_bg_bin=-1, EBackgroundSubtraction mode=EBackgroundSubtraction::kRegionBackground)
Definition GH2Base.cxx:138
void SetSummaryDirection(EDirection dir)
Definition GH2Base.h:65
GH1D * Projection_Background(int axis=0, int firstbin=0, int lastbin=-1, int first_bg_bin=0, int last_bg_bin=-1, EBackgroundSubtraction mode=EBackgroundSubtraction::kRegionBackground)
Definition GH2Base.cxx:31
GH1D * GetPrevSummary(const GH1D *curr, bool DrawEmpty=false)
Definition GH2Base.cxx:294
TList * fProjections
Definition GH2Base.h:115
iterator end()
Definition GH2Base.h:111
EDirection GetSummaryDirection() const
Definition GH2Base.h:66
GH2Base(const GH2Base &)=default