Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Poms.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Poms.h
1 /****************************************************************************\
2  * Poms.h, header for:
3  *
4  * PomsClient.C -- A program to graphically launch and control all online
5  * monitoring for PHENIX subsystems.
6  * This program requires the ROOT runtime environment and each subsystems
7  * individual online monitoring client macros.
8  *
9  * Program developed at Brookhaven National Laboratory for the PHENIX
10  * collaboration to be used by offline shifters.
11  *
12  *
13  *
14  * Copyright 2003 Phenix Collaboration
15  *
16  *
17  * M. McCain (mcm99c@acu.edu) January 2003
18  *
19  * Credit to Ryan Roth (LANL) for coding style and example of ROOT GUI
20  * in his implementation of HVDP (High Voltage Display Program)
21  ****************************************************************************
22  */
23 
24 /* ROOT headers */
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
27 #include <TGFrame.h>
28 #include <TGShutter.h>
29 #pragma GCC diagnostic pop
30 
31 /* Standard C++ headers */
32 
33 #include <list>
34 #include <map>
35 #include <string>
36 
37 /* forward declarations to speed up compilation */
38 class TList;
39 class TGMenuBar;
40 class TGButton;
41 class TGPopupMenu;
42 class TGHotString;
43 class TGWindow;
44 
45 #define POMS_VER "POMS Ver 1.0: "
46 
48 {
54 };
55 
56 // Declare all classes to preven compiler errors
57 class SubSystem;
59 
60 // Declare list types
61 typedef std::list<SubSystem*> SubSystemList;
62 typedef std::list<SubSystemAction*> SubSystemActionList;
63 typedef std::less<int> lessp;
64 typedef std::map<int, SubSystemAction*, lessp> SubSystemActionMap;
65 
67 // Class that defines the main Window //
68 // //
69 // (actual main window obtained from gClient->GetRoot() since we //
70 // are running in CINT environment) //
71 // //
72 // Implements Singleton Pattern //
74 
75 class PomsMainFrame : public TGMainFrame
76 {
77  private:
79 
80  //Paths
82 
83  int looping;
84  //Root Screen Properties
85  /*** See constructor to change default values ***/
86  UInt_t _rootWidth;
87  UInt_t _rootHeight;
88  UInt_t _rootHorizPad;
89  UInt_t _rootVertPad;
90  UInt_t _windowPad;
91 
92  //GUI OBJECTS -- Main Window
93  TGButton* _closeButton;
94  TGMenuBar* _menuBar;
95  TGPopupMenu* _menuFile;
96  TGPopupMenu* _menuWindow;
97  TGShutter* _shutter;
98 
99  TGButton* startloop;
100  TGButton* stoploop;
101  //Collections
103 
104  //MEMBER FUNCTIONS
105  TGShutter* BuildShutter();
106  int HandleButtonPoms(Long_t parm1);
107  void LoopDiLoop();
108 
109  // Singleton, private constructure
110  PomsMainFrame(const TGWindow* p, UInt_t w, UInt_t h);
111 
112  public:
113  static PomsMainFrame* Instance();
114  virtual ~PomsMainFrame();
115  void StopLoop();
116 
117  void SetMacroPath(const char* path);
118  virtual void CloseWindow();
119  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t /* parm2 */);
120 #pragma GCC diagnostic push
121 #pragma GCC diagnostic ignored "-Woverloaded-virtual"
122  void Draw();
123 #pragma GCC diagnostic pop
124  void AlignRight();
125  void TileCanvases(TList* canvasList);
126  void CascadeCanvases(TList* canvasList);
127  void TileAllCanvases();
128 
129  //Accessors
130  UInt_t GetRootWidth() { return _rootWidth; };
131  UInt_t GetRootHeight() { return _rootHeight; };
132  const std::string& GetMacroPath() { return _macroPath; };
133 
134  //CONFIGURATION FUNCTIONS
135  SubSystem* RegisterSubSystem(const char* name, const char* prefix,
136  int addDefaultActions = 1, int loadLibrary = 1);
138 };
139 
141 // Class to store information on each subsystem that is registered //
143 
145 {
146  private:
149  TList* _canvasList;
152 
153  public:
154  SubSystem(const char* name, const char* prefix, int loadLibrary = 1);
155  virtual ~SubSystem();
156 
157  // Public Functions
158  TList* GetCanvases(int forceReQuery = 0);
159  void PrintCanvasList();
160  void ShowCanvases();
161 
162  SubSystemAction* AddAction(const char* cmd, const char* description);
165  void AddDefaultActions();
166 
167  void TileCanvases();
168  void CascadeCanvases();
169 
170  // Accessor Methods
171  const std::string& GetName() { return _name; };
172  const std::string& GetPrefix() { return _prefix; };
174  int isInitialized() { return _initialized; }
175  void setInitialized(const int i) { _initialized = i; }
176 };
177 
179 // Class to store subsystem actions, commands to be added to shutter //
181 
183 {
184  protected:
185  bool _running;
186  int _id;
187  static int _nextId;
189 
190  // Member Functions
191  int NextId() { return _nextId++; };
192 
196 
197  public:
198  SubSystemAction(SubSystem* parent);
199  SubSystemAction(SubSystem* parent, const char* description);
200  SubSystemAction(SubSystem* parent, const char* cmd, const char* description);
201  virtual ~SubSystemAction();
202 
203  virtual int Execute();
204 
205  // Accessor Methods
206  const std::string& GetCmd() { return _cmd; };
208  int GetId() const { return _id; };
209  static SubSystemAction* FindById(int id) { return _map[id]; };
210 };
211 
213 {
214  public:
216  virtual ~SubSystemActionDraw(){};
217  int Execute();
218 };
219 
221 {
222  public:
225  int Execute();
226 };
227 
229 {
230  public:
233  int Execute();
234 };
235 
237 {
238  public:
241  int Execute();
242 };
243 
245 {
246  public:
249  int Execute();
250 };
251 
253 {
254  public:
257  int Execute();
258 };
259 
260 class ColorShutterItem : public TGShutterItem
261 {
262  public:
263  ColorShutterItem(const ULong_t bgColor, const TGWindow* p, TGHotString* s,
264  Int_t id = -1, UInt_t options = 0);
265  virtual ~ColorShutterItem(){};
266 };