ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
AtSidebarFrames.h
Go to the documentation of this file.
1 #ifndef ATSIDEBARFRAMES_H
2 #define ATSIDEBARFRAMES_H
3 // IWYU pragma: no_include <ext/alloc_traits.h>
4 
5 #include "AtDataObserver.h" // for Observer
6 #include "AtViewerManagerSubject.h" // for AtBranch (ptr only), AtPadNum
7 
8 #include <Rtypes.h> // for UInt_t, Int_t
9 #include <TGFrame.h> // for TGHorizontalFrame (ptr only)
10 #include <TString.h> // for TString
11 
12 #include <GuiTypes.h> // for Pixel_t, kChildFrame, kHorizonta...
13 
14 #include <map> // for map
15 #include <string> // for string
16 #include <vector> // for vector
17 class TGComboBox;
18 class TGLabel;
19 class TGNumberEntry;
20 class TGTextButton;
21 class TGWindow;
22 namespace DataHandling {
23 class AtSubject;
24 }
25 
30 class AtSidebarFrame : public TGCompositeFrame {
31 protected:
33  bool kUsePictureButtons{false};
34 
35  // Protected constructor because this can only be instantiated as a base class
36  AtSidebarFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1, UInt_t options = 0,
37  Pixel_t back = GetDefaultFrameBackground())
38  : TGCompositeFrame(p, w, h, options | kChildFrame, back)
39  {
40  }
41 
42 public:
47  virtual void FillFrame() = 0;
48 
50  void UsePictureButtons(bool val = true) { kUsePictureButtons = val; }
51 };
52 
54 public:
55  AtVerticalSidebarFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1, UInt_t options = 0,
56  Pixel_t back = GetDefaultFrameBackground())
57  : AtSidebarFrame(p, w, h, options | kVerticalFrame, back)
58  {
59  }
60 };
61 
63 public:
64  AtHorizontalSidebarFrame(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1, UInt_t options = 0,
65  Pixel_t back = GetDefaultFrameBackground())
66  : AtSidebarFrame(p, w, h, options | kHorizontalFrame, back)
67  {
68  }
69 };
70 
75 private:
76  TGLabel *fRunFile{nullptr};
77  TGLabel *fRunId{nullptr};
78  TGLabel *fRunLength{nullptr};
79 
80 public:
81  AtSidebarRunInfo(const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1, UInt_t options = 0,
82  Pixel_t back = GetDefaultFrameBackground())
83  : AtVerticalSidebarFrame(p, w, h, options, back)
84  {
85  }
86 
87  void FillFrame() override;
88 
89 private:
90  TString GetFileName(TString filePath);
91 };
93  DataHandling::AtPadNum &fPadNum;
94 
95  TGHorizontalFrame *fCurrentPadFrame{nullptr};
96  TGLabel *fCurrentPadLabel{nullptr};
97  TGNumberEntry *fCurrentPadEntry{nullptr};
98  TGTextButton *fRedrawPadButton{nullptr};
99 
100  TGLabel *fCurrentPadId{nullptr};
101  static constexpr char fPadRefString[] = "Pad Ref:[%d,%d,%d,%d]";
102 
103 public:
104  AtSidebarPadControl(DataHandling::AtPadNum &padNum, const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
105  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
107 
108  void Update(DataHandling::AtSubject *changedSubject) override;
109  void FillFrame() override;
110 
111  void SelectPad(); //< Pad TGNumberEntry/Button callback
112 };
113 
115 private:
116  DataHandling::AtTreeEntry &fEntryNumber;
117 
118  TGHorizontalFrame *fCurrentEventFrame{nullptr};
119  TGLabel *fCurrentEventLabel{nullptr};
120  TGNumberEntry *fCurrentEventEntry{nullptr};
121  TGTextButton *fRerunButton{nullptr};
122 
123  TGHorizontalFrame *fButtonFrame{nullptr};
124 
125 public:
126  AtSidebarEventControl(DataHandling::AtTreeEntry &entryNum, const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
127  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
129 
130  void Update(DataHandling::AtSubject *changedSubject) override;
131  void FillFrame() override;
132 
133  void SelectEvent(); //< Event TGNumberEntry callback
134  void RedrawEvent(); //< Event TGNumberEntry callback
135 };
136 
138 private:
139  TGVerticalFrame *fLabels{nullptr};
140  TGVerticalFrame *fBoxes{nullptr};
141  std::map<TString, DataHandling::AtBranch &> fBranches;
142  std::map<TString, TGComboBox *> fBranchBoxes;
143 
144 public:
146  DataHandling::AtBranch &patternEvent, const TGWindow *p = nullptr, UInt_t w = 1, UInt_t h = 1,
147  UInt_t options = 0, Pixel_t back = GetDefaultFrameBackground());
148 
150 
151  void Update(DataHandling::AtSubject *changedSubject) override;
152 
153  void SelectedAtRawEvent(Int_t);
154  void SelectedAtEvent(Int_t);
155  void SelectedAtPatternEvent(Int_t);
156 
157  void SelectEvent(Int_t ind, TString className);
158 
159  void FillFrame() override;
160 
161 private:
162  void FillBranchFrame(std::string name, std::string className);
163  int GetIndex(TString, const std::vector<TString> &vec);
164 };
165 
166 #endif
AtSidebarEventControl::FillFrame
void FillFrame() override
Definition: AtSidebarFrames.cxx:146
AtVerticalSidebarFrame::AtVerticalSidebarFrame
AtVerticalSidebarFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.h:55
AtDataObserver.h
AtHorizontalSidebarFrame
Definition: AtSidebarFrames.h:62
DataHandling::AtObserver
Definition: AtDataObserver.h:12
AtSidebarRunInfo
Definition: AtSidebarFrames.h:74
AtSidebarBranchControl::AtSidebarBranchControl
AtSidebarBranchControl(DataHandling::AtBranch &rawEvent, DataHandling::AtBranch &event, DataHandling::AtBranch &patternEvent, const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.cxx:191
DataHandling::AtBranch
Subject for the branch in the FairRoot tree.
Definition: AtViewerManagerSubject.h:38
AtSidebarEventControl::RedrawEvent
void RedrawEvent()
Definition: AtSidebarFrames.cxx:141
AtSidebarPadControl::Update
void Update(DataHandling::AtSubject *changedSubject) override
Definition: AtSidebarFrames.cxx:104
AtHorizontalSidebarFrame::AtHorizontalSidebarFrame
AtHorizontalSidebarFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.h:64
AtSidebarPadControl
Definition: AtSidebarFrames.h:92
AtSidebarFrame::AtSidebarFrame
AtSidebarFrame(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.h:36
AtSidebarFrame::FillFrame
virtual void FillFrame()=0
AtSidebarBranchControl::SelectedAtPatternEvent
void SelectedAtPatternEvent(Int_t)
Definition: AtSidebarFrames.cxx:286
AtSidebarFrame::UsePictureButtons
void UsePictureButtons(bool val=true)
Use text only buttons instead of picture buttons.
Definition: AtSidebarFrames.h:50
DataHandling::AtSimpleType
Subject for any simple type.
Definition: AtDataSubject.h:51
AtSidebarFrame
Definition: AtSidebarFrames.h:30
AtSidebarBranchControl::SelectEvent
void SelectEvent(Int_t ind, TString className)
Definition: AtSidebarFrames.cxx:267
AtSidebarBranchControl
Definition: AtSidebarFrames.h:137
AtSidebarPadControl::SelectPad
void SelectPad()
Definition: AtSidebarFrames.cxx:113
AtSidebarPadControl::AtSidebarPadControl
AtSidebarPadControl(DataHandling::AtPadNum &padNum, const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.cxx:69
AtSidebarFrame::kUsePictureButtons
bool kUsePictureButtons
Option to disable picture buttons since they break some machines.
Definition: AtSidebarFrames.h:33
AtVerticalSidebarFrame
Definition: AtSidebarFrames.h:53
AtViewerManagerSubject.h
AtSidebarBranchControl::Update
void Update(DataHandling::AtSubject *changedSubject) override
Definition: AtSidebarFrames.cxx:291
DataHandling
Definition: AtDataObserver.h:4
AtSidebarEventControl::~AtSidebarEventControl
~AtSidebarEventControl()
Definition: AtSidebarFrames.cxx:125
AtSidebarRunInfo::AtSidebarRunInfo
AtSidebarRunInfo(const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.h:81
AtSidebarEventControl::Update
void Update(DataHandling::AtSubject *changedSubject) override
Definition: AtSidebarFrames.cxx:130
AtSidebarRunInfo::FillFrame
void FillFrame() override
Definition: AtSidebarFrames.cxx:42
AtSidebarPadControl::~AtSidebarPadControl
~AtSidebarPadControl()
Definition: AtSidebarFrames.cxx:75
AtSidebarBranchControl::~AtSidebarBranchControl
~AtSidebarBranchControl()
Definition: AtSidebarFrames.cxx:252
DataHandling::AtSubject
Definition: AtDataSubject.h:24
AtSidebarBranchControl::SelectedAtRawEvent
void SelectedAtRawEvent(Int_t)
Definition: AtSidebarFrames.cxx:276
AtSidebarEventControl::SelectEvent
void SelectEvent()
Definition: AtSidebarFrames.cxx:136
AtSidebarPadControl::FillFrame
void FillFrame() override
Definition: AtSidebarFrames.cxx:80
AtSidebarBranchControl::SelectedAtEvent
void SelectedAtEvent(Int_t)
Definition: AtSidebarFrames.cxx:281
AtSidebarEventControl
Definition: AtSidebarFrames.h:114
DataHandling::AtTreeEntry
Subject for the entry number in the FairRoot tree.
Definition: AtViewerManagerSubject.h:17
AtSidebarBranchControl::FillFrame
void FillFrame() override
Definition: AtSidebarFrames.cxx:205
AtSidebarEventControl::AtSidebarEventControl
AtSidebarEventControl(DataHandling::AtTreeEntry &entryNum, const TGWindow *p=nullptr, UInt_t w=1, UInt_t h=1, UInt_t options=0, Pixel_t back=GetDefaultFrameBackground())
Definition: AtSidebarFrames.cxx:119