Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

HistoDisplay.h

Go to the documentation of this file.
00001 
00002 // HistoDisplay.hh
00003 // Version 1.9
00004 // Tetsuo Arisawa, 2001 03/26
00005 //
00006 
00007 
00008 #ifndef _HistoDisplay_H_
00009 #define _HistoDisplay_H_
00010 
00011 // HistoDisplay.H
00012 //  Tetsuo Arisawa (Waseda Univ.)
00013 //  1999 0716
00014 
00015 #ifndef ROOT_TGMainFrame
00016 #include <TGFrame.h>
00017 #endif
00018 
00019 #ifndef ROOT_TTimer
00020 #include "TTimer.h"
00021 #endif
00022 
00023 class ConsumerList; // Hartmut Stadie
00024 class TConsumerInfo;
00025 
00026 class TGMenuBar;
00027 class TGPopupMenu;
00028 class TGHorizontal3DLine;
00029 
00030 // Title --
00031 class TGPictureButton;
00032 class TGLabel;
00033 class TGTextEntry; //GContext_t
00034 class TGTextBuffer;
00035 class TGTextButton;
00036 class TGLayout; //TGLayoutHints
00037 //--
00038 
00039 class TGGroupFrame;
00040 class TGCheckButton;
00041 class TGRadioButton;
00042 
00043 class TGListTree;
00044 class TGListTreeItem;
00045 
00046 class TRootEmbeddedCanvas;
00047 class TGCanvas;
00048 
00049 
00050 class TH1;
00051 class TH1F;
00052 class TPad;
00053 class TCanvas;
00054 class TVirtualPad;
00055 
00056 
00057 class TSting;
00058 
00059 class TFile;
00060 class TMapFile;
00061 class TSocket;
00062 
00063 class TGStatusBar;
00064 class TList;
00065 
00066 class TCollection;
00067 //class CList;
00068 
00069 class CObject;
00070 
00071 class TTimer;
00072 class HistoDisplayUpdateTimer;
00073 class HistoDisplaySlideTimer;
00074 
00075 
00076 class HistoDisplay : public TGMainFrame {
00077 
00078 
00079   friend class HistoDisplayUpdateTimer;
00080   friend class HistoDisplaySlideTimer;
00081 
00082 
00083 private:
00084 
00085   const char *fsocketserver;
00086   Int_t fport;
00087 
00088 
00089   // MenuBar --
00090   void MakeMenuBar();
00091   void CloseMenuBar();
00092   TGMenuBar *fMenuBar;
00093   TGLayoutHints *fMenuBarLayout;
00094   TGLayoutHints *fMenuBarItemLayout;
00095   TGLayoutHints *fMenuBarHelpLayout;
00096   TGPopupMenu *fFileMenu;
00097   TGPopupMenu *fNewCascadeMenu;
00098   TGPopupMenu *fListTreeMenu;
00099   TGPopupMenu *fSortCascadeMenu;
00100   TGPopupMenu *fConnectMenu;
00101   TGPopupMenu *fHelpMenu;
00102 
00103   TGHorizontal3DLine *fMenuBarSeparator;
00104   TGLayoutHints *fMenuBarSeparatorLayout;
00105 
00106   //--
00107 
00108 
00109   // Main Frames --
00110   TGCompositeFrame *fMainFrame;
00111   TGLayoutHints *fMainFrameLayout;
00112   //--
00113 
00114 
00115   // Color --
00116   //  ULong_t LightBlue;
00117   ULong_t LightYellow;
00118   ULong_t Red;
00119   ULong_t Green;
00120 
00121   //--
00122 
00123 
00124   // Title Frame --
00125   void MakeTitleFrame( const char* );
00126   void CloseTitleFrame();
00127   TGCompositeFrame   *fTitleFrame;
00128   TGLayoutHints      *fTitleFrameLayout;
00129   TGLabel            *fTitleLabel;
00130   TGLayoutHints      *fTitleLabelLayout;
00131   GContext_t          fTextGC;
00132   TGPictureButton    *fPicBut;
00133   TGLayoutHints      *fPictLayout;
00134   //--
00135 
00136 
00137 
00138   // Input Streem --
00139   void MakeInputFrame();
00140   void CloseInputFrame();
00141   //TGCompositeFrame *fFileNameFrame;
00142   TGGroupFrame  *fFileNameFrame;
00143   TGLayoutHints *fFileNameFrameLayout;
00144 
00145   TGRadioButton *fRaButMFile;
00146   TGRadioButton *fRaButRFile;
00147   TGRadioButton *fRaButSocket;
00148   TGLayoutHints *fRaButLayout;
00149 
00150   /*
00151   Bool_t RaButMFileOn;
00152   Bool_t RaButRFileOn;
00153   Bool_t RaButSocketOn;
00154   */
00155 
00156   TGLayoutHints *fFileNameLayout;
00157   TGLabel *fFileNameLabel;
00158 
00159   TGCompositeFrame *fFileOpenFrame;
00160   TGLayoutHints *fFileOpenFrameLayout;
00161 
00162   TGTextEntry *fFileNameTextEntry;
00163   TGTextBuffer *fFileNameBuffer;
00164 
00165   TGTextButton *fReadFileButton;
00166 
00167   TGCompositeFrame *fFileNameButtonFrame;
00168   TGLayoutHints *fFileNameButtonFrameLayout;
00169   TGLayoutHints *fFileNameButtonLayout;
00170   TGTextButton *fChooseFileButton;
00171   TGTextButton *fClearFileNameButton;
00172   //--
00173 
00174 
00175   // ListTree --
00176   void MakeTGListTreeFrame();
00177   void CloseTGListTreeFrame();
00178 
00179   TGCompositeFrame *fListTreeMainFrame;
00180   TGLayoutHints *fListTreeMainFrameLayout;
00181 
00182   TGLayoutHints *fMonitorNameLayout;
00183   TGLabel *fMonitorNameLabel;
00184   TGTextEntry *fMonitorNameTextEntry;
00185   TGTextBuffer *fMonitorNameBuffer;
00186 
00187 
00188   TGCompositeFrame *fHistoListFrame;
00189   TGLayoutHints *fHistoListFrameLayout;
00190 
00191   TGCanvas *fTGCanvas;
00192   TGLayoutHints *fTGCanvasLayout;
00193   TGListTree *fHistoListTree;
00194 
00195   TGCompositeFrame *fListButtonFrame;
00196   TGLayoutHints *fListButtonFrameLayout;
00197 
00198   TGCheckButton *fChButtonAutoUpdate;
00199   TGLayoutHints *fChButtonAutoUpdateLayout;
00200   Bool_t AutoUpdate;
00201 
00202 
00203   TGCompositeFrame *fFrequencyFrame;
00204   TGLayoutHints *fFrequencyFrameLayout;
00205 
00206   TGLabel *fFrequencyLabel;
00207   TGTextEntry *fFrequencyTextEntry;
00208   TGTextBuffer *fFrequencyTextBuffer;
00209 
00210 
00211   TGCompositeFrame *fControlButtonFrame;
00212   TGLayoutHints *fControlButtonFrameLayout;
00213 
00214 
00215   TGCompositeFrame *fButtonFrame;
00216   TGLayoutHints *fButtonFrameLayout;
00217   TGLayoutHints *fButtonLayout;
00218 
00219   TGTextButton *fStartHistoButton;
00220   TGTextButton *fPauseHistoButton;
00221   TGTextButton *fRestartHistoButton;
00222   TGTextButton *fClearHistoButton;
00223   TGTextButton *fStopHistoButton;
00224   TGTextButton *fNewCanvasButton;
00225   //TGTextButton *fExitButton;
00226 
00227 
00228   TGGroupFrame *fHistoButtonGFrame;
00229   TGLayoutHints *fHistoButtonGFrameLayout;
00230   TGCompositeFrame *fHistoButtonFrame;
00231   TGLayoutHints *fHistoButtonFrameLayout;
00232   TGLayoutHints *fHistoButtonLayout;
00233 
00234   TGTextButton *fZeroHistoButton;
00235   TGTextButton *fUnZeroHistoButton;
00236   TGTextButton *fContentHistoButton;
00237   //--
00238 
00239   // Status Bar --
00240   void MakeStatusBar();
00241   void CloseStatusBar();
00242   TGStatusBar *fStatusBar;
00243   //--
00244 
00245   // File --
00246   //TObject* OpenFile(const char *filename);
00247 
00248   enum EInputTypes {
00249     kTMapFile,
00250     kTFile,
00251     kTSocket
00252   };
00253 
00254   TObject* OpenFile( const char *filename,
00255                      EInputTypes inputtype = kTFile,
00256                      Option_t *option = "READ" );
00257 
00258   TObject* CloseFile( const char *filename,
00259           EInputTypes inputtype = kTFile );
00260 
00261   TObject* CloseFile( TObject *inputobj );
00262 
00263   void CloseConnection();
00264 
00265 
00266 
00267   //TObject *InputObj;
00268   //Bool_t InputOpen;
00269 
00270 
00271   TString MonitorName;
00272   TString FileName;
00273   //--
00274 
00275   ConsumerList *consumerlist;
00276 
00277 
00278   // Local File Name Buttons --
00279   const char* FileDialogWindow();
00280   void FileNameClear();
00281 
00282   void MessageBox(const char *msg);
00283   //--
00284 
00285 
00286 
00287   // Main --
00288   //void HistoDisplayMain();
00289   void HistoDisplayMain( Int_t autoOpen = 0 );
00290   //void HistoDisplayMain( TObject *inputobj );
00291 
00292 
00293   // Histo List --
00294   TList *fHistoList;
00295 
00296   void MakeHistoList( TObject *inpuobj );
00297   void MakeHistoListM( TMapFile *MFile );
00298   void MakeHistoListR( TFile *RFile );
00299   void MakeHistoListS( TSocket *sock );
00300   //--
00301 
00302 
00303   // Make TConsumerInfo --
00304   TConsumerInfo* MakeConsumerInfo( TObject *inputobj );
00305   TConsumerInfo* MakeConsumerInfo( const char *consumername, 
00306                                    const char *filename );
00307 
00308   // Displayed List --
00309   TList *fDisplayedList;
00310   void AddToDisplayedList( const TObject *inputobj);
00311  //--
00312 
00313 
00314   // Histo TGListTree --
00315   void AddToTree( TObject *inputobj );
00316   //char* GetDirPath( const TString &);
00317   TString GetDirPath( const TString &);
00318   //void MakeTGListTree( const TString &, TObject* );
00319   void MakeTGListTree( const TString &, TObject*, const char* tip = 0 );
00320   void RemoveTGListTree();
00321   void SortTGListTree();
00322   void DelTreeItemsOfInput( TObject *inputobj );
00323   void AddTreeItemsOfInput( TObject *inputobj ); 
00324 
00325   void RefreshTreeItem( TGListTreeItem *item );
00326 
00327 
00328 
00329 
00330   TGListTreeItem *fSelectedItem;
00331   //--
00332 
00333 
00334   // Draw Histo --
00335   //void DrawHisto();
00336   //void DrawHisto( TGListTreeItem* );
00337   void DrawHisto( TObject *obj );
00338   void DrawHisto( TList *list );
00339   //void DrawHisto( const char* name );
00340   Bool_t Running;
00341   //--
00342 
00343 
00344 
00345   //Update HistoList;
00346   CObject* UpdateHistoList(const char *objName, const TObject *inputobj);
00347   TObject* GetNewObj(const char *objName, const TObject *inputobj );
00348 
00349   CObject* GetCObjFromListItem( TGListTreeItem *item );
00350 
00351   //--    
00352 
00353   //Update Pad --
00354   void UpdateTimerOn();
00355   //void UpdateCanvas();
00356   void UpdateCanvas( TVirtualPad *currentpad = 0 );
00357   void UpdatePad( TVirtualPad *pad );
00358 
00359   void DrawUpdatedPad(TVirtualPad *currentPad);
00360   void ReplacePad( TVirtualPad *newpad, TVirtualPad *oldpad );
00361   void AddPadHistosToHistoList( TPad *pad );
00362   //--
00363 
00364 
00365 
00366 
00367 
00368   // To clear (Zero-out) histograms --
00369   // List of histograms to be subtracted.
00370   void AddSubtractHisto(TVirtualPad *currentPad, int option);
00371   //--
00372 
00373   // Clear Current Pad
00374   void ClearCurrentPad();
00375   //--
00376 
00377   // 
00378   void RecursivePadClear( TVirtualPad *pad, Option_t *option = "" );
00379   //--
00380 
00381   // inside DrawHisto
00382   void DrawTH1(TH1 *histo, Option_t* option, TVirtualPad *backpad);
00383   void DrawTPad(TPad *pad1, TVirtualPad *pad2);
00384   //--
00385 
00386   
00387   // Slide Show --
00388   TList *fSlideCanvasList;
00389   TGCheckButton *fChButtonSlideUpdate;
00390   Bool_t SlideShowUpdate;
00391 
00392   //void UpdateSlide();
00393   //--
00394 
00395   // Canvas name, title, number --
00396   TString CanvasName;
00397   TString CanvasTitle;
00398   Int_t CanvasNumber;
00399   //--
00400 
00401 
00402   // Update Canvas Timer -- 
00403   //TTimer *fUpdateTimer;
00404   HistoDisplayUpdateTimer *fUpdateTimer;
00405   //Bool_t HandleTimer( TTimer *timer );
00406   //--
00407 
00408 
00409   // Cycle Slide --
00410   //void CycleSlides( const TGListTreeItem *item );
00411   void CycleSlides( const TGListTreeItem *item,
00412                     TVirtualPad *currentpad );
00413   //void SlideTimerOn();
00414   //void SlideTimerOn( const TGListTreeItem *item );
00415   //void StartSlides( const TGListTreeItem *item );
00416   void SlideTimerOn( TGListTreeItem *item );
00417   void StartSlides( TGListTreeItem *item );
00418 
00419   // Cycle Slide Timer --
00420   HistoDisplaySlideTimer *fSlideTimer;
00421   //-- 
00422 
00423 
00424   // Warning/Error folder slide show --   
00425   void PopUpSlides( TGListTreeItem *item,
00426                     const char* canvasname, const char *canvastitle );
00427   void SearchWarningErrorFolder( TGListTreeItem *item, 
00428                                  TObject *socket  );
00429   //--
00430 
00431 
00432 
00433   // Histo Content --
00434   TH1F* ContentHisto( TH1* histo);
00435   void DrawOnTheCanvas(
00436         const char* canvasname, const char* canvastitle, int padx, int pady, 
00437         TObject *obj );
00438   void DrawContentHisto(TH1* histo );
00439 
00440   TH1* HistoInPad( TVirtualPad *pad, Int_t &counthisto );
00441   //--
00442 
00443   // Print --
00444   char *fPrinter;
00445   char *fPrinterCommand;
00446   //void PrintCanvas( TCanvas *canvas );
00447   void PrintCanvas( TPad *canvas );
00448   TGTextButton *fPrintHistoButton;
00449   //--
00450 
00451   // Change canvas name and title, size --
00452   void ChangeCanvasNameTitle( TCanvas *canvas );
00453   void DuplicateCanvasSize( TCanvas *guicanvas, TCanvas *consumercanvas );
00454 
00455   //--
00456 
00457 
00458   // Close --
00459   void CloseWindow();
00460   void ResetObjects();
00461   //--
00462 
00463   void MenuConnectStatus();
00464   void MenuHelp(const char *s, const char *helpText);
00465   //void PopupWindow();
00466 
00467 
00468 public:
00469 
00470   HistoDisplay( const TGWindow *p, UInt_t w, UInt_t h, 
00471                 const char *socketserver, Int_t port );
00472   virtual ~HistoDisplay();
00473   virtual Bool_t ProcessMessage( Long_t msg, Long_t parm1, Long_t parm2 );
00474   //Bool_t HandleUpdateTimer( TTimer *timer );
00475 
00476 
00477   ClassDef( HistoDisplay, 0 )
00478 
00479 };
00480 
00481 
00482 class HistoDisplayUpdateTimer : public TTimer {
00483 private:
00484   HistoDisplay *fHistoDisplay;
00485   TVirtualPad *fCurrentPad;
00486 public:
00487   HistoDisplayUpdateTimer( HistoDisplay *histodisplay, Long_t msec = 100,
00488                            Bool_t mode = kTRUE )
00489     : TTimer( msec, mode ) { fHistoDisplay = histodisplay; }
00490 
00491   Bool_t Notify();
00492 
00493   void SetCurrentPad( TVirtualPad *pad )
00494   { fCurrentPad = pad; } 
00495 
00496   TVirtualPad* GetCurrentPad() const
00497   { return fCurrentPad; } 
00498 
00499   //ClassDef( HistoDisplayUpdateTimer, 0 )
00500 };
00501 
00502 
00503 class HistoDisplaySlideTimer : public TTimer {
00504 private:
00505   HistoDisplay *fHistoDisplay;
00506   TGListTreeItem *fCurrentItem;
00507   TVirtualPad *fCurrentPad;
00508 public:
00509   HistoDisplaySlideTimer( HistoDisplay *histodisplay, Long_t msec = 2000,
00510                            Bool_t mode = kTRUE )
00511     : TTimer( msec, mode ) { fHistoDisplay = histodisplay; }
00512 
00513   Bool_t Notify();
00514 
00515   void SetCurrentItem( TGListTreeItem *item )
00516   { fCurrentItem = item; }
00517 
00518   TGListTreeItem* GetCurrentItem() const
00519   { return fCurrentItem; }
00520 
00521   void SetCurrentPad( TVirtualPad *pad )
00522   { fCurrentPad = pad; } 
00523 
00524   TVirtualPad* GetCurrentPad() const
00525   { return fCurrentPad; } 
00526 
00527   //ClassDef( HistoDisplayUpdateTimer, 0 )
00528 };
00529 
00530 
00531 
00532 
00533 char *getword( char *str, const char commentchar = '#' );
00534 char *strdelete( char *str, const char *del );
00535 
00536 char *strstrn( const char *s, const char *k);
00537 
00538 #endif
00539 
00540 
00541 

Generated on Mon Feb 15 11:06:47 2010 for loon by  doxygen 1.3.9.1