New versions of GDC and CDH raw data headers. Some CDH getters are added
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorClient.h
1 #ifndef ALIMONITORCLIENT_H
2 #define ALIMONITORCLIENT_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 #include <TGFrame.h>
9 #include <RQ_OBJECT.h>
10 #include "AliMonitorDialog.h"
11
12 class TGListTreeItem;
13 class TGLayoutHints;
14 class TGPopupMenu;
15 class TGMenuBar;
16 class TGHorizontal3DLine;
17 class TGToolBar;
18 class TGNumberEntry;
19 class TGPicture;
20 class TGButton;
21 class TGCanvas;
22 class TGListTree;
23 class TGVSplitter;
24 class TGHSplitter;
25 class TRootEmbeddedCanvas;
26 class TGTextView;
27 class TGLabel;
28 class TGTextEntry;
29 class TSocket;
30 class TFileHandler;
31 class TFolder;
32 class TTimer;
33 class AliMonitorHisto;
34
35
36 class AliMonitorClient : public TGMainFrame {
37
38 RQ_OBJECT("AliMonitorClient")
39
40 public:
41   AliMonitorClient();
42   virtual ~AliMonitorClient();
43
44   void               CloseWindow();
45
46   void               OnNewData();
47
48   void               OnMenuActivated(Int_t id);
49
50   void               OnEventNumberChanged();
51   void               OnEventButtonPressed();
52   void               OnSumButtonPressed();
53   void               OnRunButtonPressed();
54   void               OnLoopButtonClicked();
55   void               OnPreviousButtonClicked();
56   void               OnNextButtonClicked();
57   void               OnCopyButtonClicked();
58   void               OnSaveButtonClicked();
59   void               OnPrintButtonClicked();
60
61   void               OnTreeClicked(TGListTreeItem* item, Int_t btn);
62   void               OnTreeReturnPressed(TGListTreeItem* item);
63
64   void               OnLoopTimer();
65
66 private:
67   AliMonitorClient(const AliMonitorClient& client);   // Not implemented
68   AliMonitorClient& operator = (const AliMonitorClient& client); // Not implemented
69
70   TFolder*           CreateTopFolder() const;
71   AliMonitorHisto*   GetHisto(const char* folderName, const char* histoName);
72   TGListTreeItem*    GetItem(TGListTreeItem* base, const char* folderName, 
73                              const char* histoName, Bool_t create);
74
75   Bool_t             ConnectToServer();
76   void               DisconnectFromServer();
77   Bool_t             OpenFile();
78
79   void               ViewToolBar(Bool_t visible);
80   void               ViewTree(Bool_t visible);
81   void               ViewDescription(Bool_t visible);
82   void               ViewReference(Bool_t visible);
83   void               ViewStatistics(Bool_t visible);
84
85   Bool_t             AddFavorite();
86   Bool_t             DeleteFavorite();
87   Bool_t             LoadFavorites(Bool_t dialog = kTRUE);
88   Bool_t             SaveFavorites();
89   Bool_t             SaveFavoritesAs();
90
91   Bool_t             LoadReference(Bool_t dialog = kTRUE);
92   void               SetReference();
93   Bool_t             TakeCurrentReference();
94   void               TakeReferenceHisto(const char* folderName,
95                                         AliMonitorHisto* histo);
96   void               TakeReferenceFolder(TGListTreeItem* item);
97   Bool_t             SaveReference();
98   Bool_t             SaveReferenceAs();
99
100   void               LoadSettings();
101   void               SaveSettings();
102
103   void               StopLoop();
104   Bool_t             GetBaseItem();
105   Bool_t             GoToNextItem();
106   Bool_t             GoToPreviousItem();
107   void               UpdateItem(Bool_t highlight);
108
109   Bool_t             CheckForNewData();
110   void               ClearItems(TGListTreeItem* base) const;
111   void               CleanUpTree(TGListTreeItem* base);
112   void               UpdateTree();
113   void               UpdateFavoritesTree();
114   void               UpdateComparisonTree();
115   void               UpdateDescription();
116   void               UpdateHisto();
117   void               UpdateAll();
118
119   TGLayoutHints*     fMenuBarLayout;           // layout of the menu bar
120   TGLayoutHints*     fMenuBarItemLayout;       // layout of the menu items
121   TGLayoutHints*     fMenuBarHelpLayout;       // layout of the help menu
122   TGPopupMenu*       fMenuFile;                // the file menu
123   TGPopupMenu*       fMenuView;                // the view menu
124   TGPopupMenu*       fMenuFavorites;           // the favorites menu
125   TGPopupMenu*       fMenuReference;           // the reference menu
126   TGPopupMenu*       fMenuOptions;             // the options menu
127   TGPopupMenu*       fMenuHelp;                // the help menu
128   TGMenuBar*         fMenuBar;                 // the menu bar
129
130   TGLayoutHints*     fToolBarLayout;           // layout of the tool bar
131   TGHorizontal3DLine* fToolBarSep;             // separation of the tool bar
132   TGToolBar*         fToolBar;                 // the tool bar
133   TGLayoutHints*     fEventNumberLayout;       // layout of the event number
134   TGNumberEntry*     fEventNumber;             // the event number
135   TGButton*          fEventButton;             // the button for one event
136   TGButton*          fSumButton;               // the button for the sum of events
137   TGButton*          fRunButton;               // the button for a run
138   TGButton*          fLoopButton;              // the botton for the loop
139   const TGPicture*   fLoopOnPicture;           // the picture for running loop
140   const TGPicture*   fLoopOffPicture;          // the picture for stoped loop
141   TGButton*          fPreviousButton;          // the button for previous histo
142   TGButton*          fNextButton;              // the button for next histo
143   TGButton*          fCopyButton;              // the button for copy histo
144   TGButton*          fSaveButton;              // the button for save histo
145   TGButton*          fPrintButton;             // the button for print histo
146
147   TGLayoutHints*     fBottomLayout;            // layout at bottom
148   TGLayoutHints*     fLeftLayout;              // layout at left
149   TGLayoutHints*     fExpandLayout;            // expanded layout
150
151   TGVerticalFrame*   fVerticalFrame;           // frame for tree/histo and description
152   TGHorizontalFrame* fHorizontalFrame;         // frame for tree and histo
153
154   TGCompositeFrame*  fTreeFrame;               // frame for tree
155   TGCanvas*          fTreeCanvas;              // canvas for tree
156   TGListTree*        fTree;                    // tree with histos
157   const TGPicture*   fHistoPicture;            // picture for histo item
158   TGListTreeItem*    fAllItem;                 // top item for all histos
159   TGListTreeItem*    fFavoritesItem;           // top item for favorites
160   TGListTreeItem*    fComparisonItem;          // top item for comparison
161
162   TGVSplitter*       fTreeSplitter;            // splitter for tree and histo
163
164   TGCompositeFrame*  fDrawFrame;               // frame for histo
165   TRootEmbeddedCanvas* fDrawCanvas;            // canvas for histo
166
167   TGHSplitter*       fDescriptionSplitter;     // splitter tree/histo and description
168
169   TGCompositeFrame*  fDescriptionFrame;        // frame for description
170   TGTextView*        fDescription;             // description text
171
172   TString            fServerName;              // name of the monitor server
173   TSocket*           fSocket;                  // socket to the monitor server
174   TFileHandler*      fSocketHandler;           // handler for fSocket
175
176   TFolder*           fFolder;                  // folder with histos
177
178   TGListTreeItem*    fCurrentItem;             // current tree item
179   TGListTreeItem*    fBaseItem;                // base item of current item
180   TTimer*            fLoopTimer;               // timer for loop over histos
181   Int_t              fLoopInterval;            // loop interval
182
183   TString            fFavoritesFileName;       // file name of favorites
184
185   TString            fReferenceFileName;       // file name with reference histos
186   TFolder*           fReference;               // folder with reference histos
187
188   TString            fPrintCommand;            // print command
189
190   static const char* fgSettingsFileName;       // file name of settings
191
192
193   class AliMonitorStringDlg : public AliMonitorDialog {
194
195   public:
196     AliMonitorStringDlg(TString& string, TGFrame* main, const char* title,
197                         const char* label);
198     AliMonitorStringDlg(const AliMonitorStringDlg& dlg) : 
199       AliMonitorDialog(dlg), fString(dlg.fString) {
200       Fatal("AliMonitorStringDlg", "copy constructor not implemented");
201     }
202     AliMonitorStringDlg& operator = (const AliMonitorStringDlg& /*dlg*/) {
203       Fatal("operator =", "assignment operator not implemented");
204       return *this;
205     }
206     virtual ~AliMonitorStringDlg();
207
208     virtual void       OnOkClicked();
209
210   private:
211     TGLayoutHints*     fStringLayout;    // layout of the text entry
212     TGLabel*           fStringLabel;     // label for the text entry
213     TGTextEntry*       fStringEntry;     // the text enty
214
215     TString&           fString;          // result
216   };
217
218
219   class AliMonitorNumberDlg : public AliMonitorDialog {
220
221   public:
222     AliMonitorNumberDlg(Float_t& value, TGFrame* main, const char* title,
223                         const char* label, Float_t min);
224     AliMonitorNumberDlg(const AliMonitorNumberDlg& dlg) : 
225       AliMonitorDialog(dlg), fNumber(dlg.fNumber) {
226       Fatal("AliMonitorNumberDlg", "copy constructor not implemented");
227     }
228     AliMonitorNumberDlg& operator = (const AliMonitorNumberDlg& /*dlg*/) {
229       Fatal("operator =", "assignment operator not implemented");
230       return *this;
231     }
232     virtual ~AliMonitorNumberDlg();
233
234     virtual void       OnOkClicked();
235
236   private:
237     TGLayoutHints*     fNumberLayout;    // layout of the number entry
238     TGLabel*           fNumberLabel;     // label for the number entry
239     TGNumberEntry*     fNumberEntry;     // the number entry
240
241     Float_t&           fNumber;          // result
242   };
243
244
245   ClassDef(AliMonitorClient, 0)   // class for receiving and displaying monitor histograms
246 };
247  
248
249 #endif
250
251
252
253
254
255
256
257
258