Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:57

0001 #ifndef MusEcalGUI_hh
0002 #define MusEcalGUI_hh
0003 
0004 //

0005 // MusEcal : Monitoring and Useful Survey of CMS Ecal

0006 //                  Clever Analysis of Laser

0007 //

0008 // Authors  : Gautier Hamel de Monchenault and Julie Malcles, Saclay 

0009 //           Inspired from MONECAL, by F.X. Gentit and P. Verrecchia 

0010 //

0011 
0012 #include <TApplication.h>
0013 #include <TVirtualX.h>
0014 #include <TGButton.h>
0015 #include <TGResourcePool.h>
0016 #include <TGListBox.h>
0017 #include <TGListTree.h>
0018 #include <TGFSContainer.h>
0019 #include <TGClient.h>
0020 #include <TGFrame.h>
0021 #include <TGIcon.h>
0022 #include <TGLabel.h>
0023 #include <TGButton.h>
0024 #include <TGTextEntry.h>
0025 #include <TGNumberEntry.h>
0026 #include <TGMsgBox.h>
0027 #include <TGMenu.h>
0028 #include <TGCanvas.h>
0029 #include <TGComboBox.h>
0030 #include <TGTab.h>
0031 #include <TGSlider.h>
0032 #include <TGDoubleSlider.h>
0033 #include <TGFileDialog.h>
0034 #include <TGTextEdit.h>
0035 #include <TGShutter.h>
0036 #include <TGProgressBar.h>
0037 #include <TGColorSelect.h>
0038 #include <TRootEmbeddedCanvas.h>
0039 #include <TRandom.h>
0040 #include <TSystem.h>
0041 #include <TSystemDirectory.h>
0042 #include <TEnv.h>
0043 #include <TFile.h>
0044 #include <TKey.h>
0045 #include <TGDockableFrame.h>
0046 #include <TGFontDialog.h>
0047 
0048 #include <map>
0049 
0050 // base classes

0051 #include "MEClickableCanvas.hh"
0052 #include "MECanvasHolder.hh"
0053 #include "MusEcal.hh"
0054 class MEPlotWindow;
0055 class MERunPanel;
0056 class MEChanPanel;
0057 class MELeafPanel;
0058 class MEMultiVarPanel;
0059 
0060 class MusEcalGUI : public TGMainFrame, public MECanvasHolder, public MusEcal
0061 {
0062   enum { iHIST, iVS_CHANNEL, iMAP };
0063 
0064 public:
0065 
0066   // contructors/destructor

0067   MusEcalGUI() {}
0068   MusEcalGUI( const TGWindow *p, UInt_t w, UInt_t h,
0069           int type=ME::iLaser, int color=ME::iBlue );
0070   virtual  ~MusEcalGUI();
0071 
0072 protected:
0073 
0074   // exit gracefuly

0075   void exitProg();
0076 
0077 private:
0078 
0079   // virtual MusEcal functions

0080   virtual void refresh();
0081   virtual void setType( int type, int color=0 );
0082   virtual void setLMRegion( int lmr );
0083   virtual void setTime( ME::Time );
0084   //  virtual void setChannel( int ig, int ieta, int iphi, bool useEtaPhi=true );

0085   virtual void setChannel( MEChannel* );
0086 
0087   void welcome();
0088 
0089   bool getTimeVector( std::vector< ME::Time >& );
0090   bool getHistoryVector( std::vector< ME::Time >&,
0091              std::vector< float >&,
0092              std::vector< bool >&,
0093              std::vector< float >&,
0094              bool& b_, float& miny, float& maxy );
0095   bool getHistoryVector( unsigned int& nrun, 
0096              float* x, float* y, float* ex, float* ey,
0097              bool* ok, float& norm, float& min, float& max );
0098   void drawHistoryGraph( unsigned int n, 
0099              float* x, float* y, float* ex, float* ey, bool* ok,
0100              int markerStyle, float markerSize, int markerColor,
0101              int lineWidth, int lineColor, const char* graphOpt="LPSame" );
0102   
0103   // Run selection panel

0104   MERunPanel* _fRunPanel;
0105   friend class MERunPanel;
0106   void createRunPanel();
0107 
0108   // Channel selection panel

0109   MEChanPanel* _fChanPanel;
0110   friend class MEChanPanel;
0111   void createChanPanel( bool ifexists=false );
0112 
0113   // leaf panel

0114   MELeafPanel* _fLeafPanel;
0115   friend class MELeafPanel;
0116   void createLeafPanel();
0117 
0118   // multiVar panel

0119   MEMultiVarPanel* _fMultiVarPanel;
0120   friend class MEMultiVarPanel;
0121   void createMultiVarPanel();
0122 
0123   // draw functions

0124   int _ihtype;
0125   int _icateg;
0126   int _ihist;
0127   TString _psdir;
0128   void drawHist(    int opt=0 );
0129   void drawAPDHist( int opt=0 );
0130   void drawPNHist(  int opt=0 );
0131   void drawMTQHist( int opt=0 );
0132 
0133   void drawAPDAnim( int opt=0 );
0134 
0135   void historyPlot(  int opt=0 );
0136   void leafPlot(     int opt=0 );
0137   void multiVarPlot( int opt=0 );
0138 
0139   // normalize history?

0140   bool _normalize;  // FIXME: was in MusEcal

0141   
0142   // current type of history plot

0143   enum { iHistoryVsTime, iHistoryProjection };
0144   int _historyType;
0145 
0146   friend class MEPlotWindow;
0147   std::map< TString, MEPlotWindow* > _window;
0148   MEPlotWindow* getWindow( TString, int opt, int w, int h );
0149 
0150   // action after a double click

0151   friend class MEClickableCanvas;
0152   virtual void setPxAndPy( int px, int py ); 
0153   void windowClicked( MEPlotWindow* canv );
0154 
0155   //

0156   // layouts and menus

0157   //

0158   void setupMainWindow();
0159   void setLMRMenu();
0160 
0161   TGLayoutHints* fMenuBarLayout; 
0162   TGLayoutHints* fMenuBarItemLayout; 
0163   TGLayoutHints* fL1;              //Layout of fEcanvas in fHFrame1

0164   TGLayoutHints* fL2;              //Layout of fHFrame1 in this

0165   TGLayoutHints* fL5;              //Layout of fHFrame2 in this

0166   TGLayoutHints* fLb;              //Layout of fVFrame in fHFrame1

0167   TGLayoutHints* fL8;              //Layout of fVFrame in fHFrame1

0168 
0169   // docks and bars

0170   TGDockableFrame* fMenuDock;
0171   TGMenuBar*       fMenuBar;
0172 
0173   // menus

0174   TGPopupMenu* f_File_Menu;
0175   TGPopupMenu* f_Hist_Menu;
0176 
0177   // if type is laser

0178   TGPopupMenu* f_Laser_Menu;
0179   TGPopupMenu* f_APD_Menu;
0180   TGPopupMenu* f_PN_Menu;
0181   TGPopupMenu* f_MTQ_Menu;
0182   TGPopupMenu* f_APD_Hist_Menu[ME::iSizeC];
0183   TGPopupMenu* f_PN_Hist_Menu[ME::iSizeC]; 
0184   TGPopupMenu* f_MTQ_Hist_Menu[ME::iSizeC];
0185 
0186   // if type is testpulse

0187   TGPopupMenu* f_TP_Menu;
0188   TGPopupMenu* f_TPAPD_Gain_Menu;
0189   TGPopupMenu* f_TPPN_Gain_Menu;
0190   TGPopupMenu* f_TPAPD_Hist_Menu;
0191   TGPopupMenu* f_TPPN_Hist_Menu;
0192 
0193   TGPopupMenu* f_Channel_Menu;
0194   std::vector<TGPopupMenu*> f_tree_menu;
0195   
0196   // History menu

0197   TGPopupMenu* f_History_Menu;
0198   TGPopupMenu* f_History_L_Menu;
0199   TGPopupMenu* f_History_TPV_Menu;
0200   TGPopupMenu* f_History_LV_Menu[ME::iSizeC]; 
0201 
0202   // Frames

0203   TGHorizontalFrame*   fHFrame1;    // Horizontal frame up

0204   TGHorizontalFrame*   fHFrame2;    // Horizontal frame down

0205   TGVerticalFrame*     fVFrame;     // Left frame in fHFrame1

0206   MEClickableCanvas*   fEcanvas;    // RootEmbeddedCanvas in fHFrame1, at right - clickable !

0207 
0208   TPad* _curPad;
0209 
0210 public:
0211 
0212   // slots

0213   void HandleFileMenu(Int_t);
0214   void HandleHistMenu(Int_t);
0215   void HandleHistoryMenu(Int_t);
0216   void HandleChannelMenu(Int_t);
0217 
0218   ClassDef( MusEcalGUI, 0 ) // MusEcalGUI -- Monitoring utility for survey of Ecal

0219 };
0220 
0221 #endif
0222