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 <iostream>
6#include <map>
7
8#include <TNamed.h>
9#include <TH2.h>
10#include <TList.h>
11
12class GH1D;
13
19
22
23class GH2Base {
24
25public:
26 GH2Base() { Init(); }
27 GH2Base(const GH2Base&) = default;
28 GH2Base(GH2Base&&) noexcept = default;
29 GH2Base& operator=(const GH2Base&) = default;
30 GH2Base& operator=(GH2Base&&) noexcept = default;
31
32 virtual ~GH2Base();
33
34 virtual void GH2Clear(Option_t* opt = "");
35
36 virtual TH2* GetTH2() = 0;
37
38 GH1D* Projection_Background(int axis = 0, int firstbin = 0, int lastbin = -1, int first_bg_bin = 0,
40
41 // GH1D* SummaryProject(int binnum);
42
43 GH1D* ProjectionX_Background(int firstbin = 0, int lastbin = -1, int first_bg_bin = 0, int last_bg_bin = -1,
45
46 GH1D* GH2ProjectionX(const char* name = "_px", int firstbin = 0, int lastbin = -1, Option_t* option = "",
47 bool KeepEmpty = false); // *MENU*
48
49 GH1D* GH2ProjectionY(const char* name = "_py", int firstbin = 0, int lastbin = -1, Option_t* option = "",
50 bool KeepEmpty = false); // *MENU*
51
52 GH1D* ProjectionY_Background(int firstbin = 0, int lastbin = -1, int first_bg_bin = 0, int last_bg_bin = -1,
54
55 GH1D* GetPrevious(const GH1D* curr, bool DrawEmpty = true);
56 GH1D* GetPrevSummary(const GH1D* curr, bool DrawEmpty = false);
57 GH1D* GetNext(const GH1D* curr, bool DrawEmpty = true);
58 GH1D* GetNextSummary(const GH1D* curr, bool DrawEmpty = false);
59
60 TList* GetProjections() { return fProjections; }
62
63 void SetSummary(bool is_summary = true) { fIsSummary = is_summary; }
64 bool GetSummary() const { return fIsSummary; }
65
68
69 class iterator { // NOLINT(readability-identifier-naming)
70 public:
71 explicit iterator(GH2Base* mat)
72 : fMat(mat), fFirst(mat->GetNext(nullptr)), fCurr(fFirst)
73 {
74 }
75
76 iterator(GH2Base* mat, bool at_end)
77 : fMat(mat), fFirst(mat->GetNext(nullptr)), fCurr(at_end ? nullptr : fFirst)
78 {
79 }
80
81 GH1D& operator*() const { return *fCurr; }
82 GH1D* operator->() const { return fCurr; }
83
84 // prefix increment
86 {
88 if(fCurr == fFirst) {
89 fCurr = nullptr;
90 }
91 return *this;
92 }
93
94 // postfix increment
96 {
97 iterator current = *this;
98 ++(*this);
99 return current;
100 }
101
102 bool operator==(const iterator& rhs) const { return (fMat == rhs.fMat && fFirst == rhs.fFirst && fCurr == rhs.fCurr); }
103 bool operator!=(const iterator& rhs) const { return !(*this == rhs); }
104
105 private:
109 };
110
111 iterator begin() { return {this, false}; }
112 iterator end() { return {this, true}; }
113
114private:
115 void Init();
116 TList* fProjections{nullptr};
117
118 TList* fSummaryProjections{nullptr}; //!
119 bool fIsSummary{false};
121
122 /// /cond CLASSIMP
123 ClassDef(GH2Base, 1) // NOLINT(readability-else-after-return)
124 /// /endcond
125};
126
127#endif
EBackgroundSubtraction
Definition GH2Base.h:14
EDirection
Definition GH2Base.h:20
TH2D * mat
Definition UserFillObj.h:12
Definition GH1D.h:17
bool operator!=(const iterator &rhs) const
Definition GH2Base.h:103
GH2Base * fMat
Definition GH2Base.h:106
iterator & operator++()
Definition GH2Base.h:85
iterator(GH2Base *mat, bool at_end)
Definition GH2Base.h:76
GH1D * operator->() const
Definition GH2Base.h:82
iterator operator++(int)
Definition GH2Base.h:95
GH1D & operator*() const
Definition GH2Base.h:81
bool operator==(const iterator &rhs) const
Definition GH2Base.h:102
iterator(GH2Base *mat)
Definition GH2Base.h:71
bool fIsSummary
Definition GH2Base.h:119
iterator begin()
Definition GH2Base.h:111
GH1D * GetPrevious(const GH1D *curr, bool DrawEmpty=true)
Definition GH2Base.cxx:198
EDirection fSummaryDirection
Definition GH2Base.h:120
TList * GetSummaryProjections()
Definition GH2Base.h:61
virtual void GH2Clear(Option_t *opt="")
Definition GH2Base.cxx:24
void Init()
Definition GH2Base.cxx:16
TList * fSummaryProjections
Definition GH2Base.h:118
bool GetSummary() const
Definition GH2Base.h:64
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:60
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:26
GH1D * GetNext(const GH1D *curr, bool DrawEmpty=true)
Definition GH2Base.cxx:221
void SetSummary(bool is_summary=true)
Definition GH2Base.h:63
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:66
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:116
iterator end()
Definition GH2Base.h:112
EDirection GetSummaryDirection() const
Definition GH2Base.h:67
GH2Base(const GH2Base &)=default