QGUISmartScope.hh

00001 /*
00002  * APOLLO: A complete DAQ and Online Data Analysis Framework for Cuore
00003  * 
00004  * A.Giachero created 16/12/06 - <Andrea.Giachero@ge.infn.it> 
00005  * 
00006  $ $Id: QGUISmartScope.hh 655 2006-12-21 22:12:07Z giacher $
00007  * $Revision: 655 $
00008  *
00009  * Class QGUISmartScope: Smart Oscilloscope for real time display
00010  *
00011  */
00012 
00013 #ifndef _QGUI_SMART_SCOPE_HH_
00014 #define _QGUI_SMART_SCOPE_HH_
00015 
00016 
00017 
00018 // Apollo Includes
00019 #include "QGUIBaseFrame.hh"
00020 #include "QGUIScopeChannel.hh"
00021 
00022 #include <map>
00023 #include <vector>
00024 
00025 // ROOT Includes
00026 #include "Rtypes.h"
00027 #include "TTimer.h"
00028 #include "TH1F.h"
00029 
00030 
00031 
00032 // Used Classes
00033 class TGObject;
00034 class TRootEmbeddedCanvas;
00035 class TGNumberEntry;
00036 class TGTextEntry;
00037 class TGTextButton;
00038 class QSmartScopeChannel;
00039 class QGUINumberSelector;
00040 
00041 class QGUISmartScope: public QGUIBaseFrame
00042 {
00043 
00044 public:
00045   
00046    // ctor
00047    QGUISmartScope(const TGWindow*          p,
00048                   unsigned int             Width,
00049                   unsigned int             Height);
00050 
00051    // dtor
00052    virtual ~QGUISmartScope();
00053 
00054    // ** SLOTS **   
00055    // histogram Y range
00056    void UpdateUpperEdge();
00057    void UpdateLowerEdge();
00058    void UpdateChannel();
00059 
00061    void Close();
00062   
00064    void DoRefresh();
00065    
00067    void UpdateTimeCtr();
00068 
00070    void StartHistoUpdate();
00071 
00073    void StopHistoUpdate();
00074 
00075    // toggle AutoRange flag
00076    void SetAutoRange(bool isTrue);
00077 
00078    // invert autorange status and update Gui buttons accordingly
00079    void FlipAutoRange();
00080 
00081    // Set RefreshTime on Timer
00082    void SetRefreshTime(long Time);
00083 
00084    // Start Refresh Timer
00085    void StartRefreshTime();
00086   
00087    // Stop Refresh Timer
00088    void StopRefreshTime();
00089 
00090 private:
00091   
00092 
00093    std::vector<unsigned int> fActiveChannels;
00094 
00095    // Timer for display update
00096    TTimer fRefreshTimer;
00097    TTimer fRealTimer;
00098 
00099    unsigned long fTimeCtr;
00100 
00101    bool   fIsHistoUpdate;  // if fIsHistoUpddate=true Histo Update is enabled 
00102    
00103    bool fAutoRangeChanged;
00104 
00105    // Online Scope Shared Memory 
00106    QSmartScopeChannel *fScope;
00107 
00108    // Histogram
00109    TH1F fh1;
00110   
00111    // histogram aspect handler
00112    QGUIScopeChannel fGraphix;
00113 
00114    QGUINumberSelector* fChSelector;
00115     
00116    // ******* Widget Pointers *******
00117    TGCompositeFrame*    fTopHFrame;       // Top Horizontal Frame 
00118    TGCompositeFrame*    fBottomHFrame;    // Bottom Horizontal Frame
00119    TGCompositeFrame*    fControlVFrame;   // Scope Control Vertical Frame 
00120    TGCompositeFrame*    fCanvasHFrame;    // Canvas Frame
00121    TRootEmbeddedCanvas* fEmbCanvas;       // Embedded Canvas
00122 
00123    TGCompositeFrame*    fStartStopVFrame; // Start Stop Vertical Frame;
00124   
00125    TGTextEntry*         fChDisplay;
00126 
00127    TGTextButton*        fAutoRangeBtn;    // Buttons for autorange ON/OFF
00128    TGNumberEntry*       fUpperEntry;      // Numeric Entry for Upper Choice
00129    TGNumberEntry*       fLowerEntry;      // Numeric Entry for Lower Choice
00130 
00131    TGTextEntry*         fMeanVal;         // Text Entry for Mean Value
00132    TGTextEntry*         fSigmaVal;        // Text Entry for Sigma Value
00133    TGTextEntry*         fMaxVal;          // Text Entry for Max Value (Y Axis)
00134    TGTextEntry*         fMinVal;          // Text Entry for Min Value (Y Axis)
00135 
00136    TGTextButton*        fStartBtn;        // Start Button
00137    TGTextButton*        fStopBtn;         // Stop Button
00138    TGTextButton*        fExitBtn;         // Exit Button
00139     
00140    // Init
00141    void _Init();
00142 
00143    // read list of active channels from db
00144    void GetActiveChannels();
00145 
00146    // Init Refresh Timer
00147    void _InitRefreshTimer(long Time);
00148 
00149    // Create Frames into main window
00150    void _CreateFrames();
00151 
00152    // Add Widget into Control Scope Frame
00153    void _AddLateralWidgets();
00154 
00155    // Add Buttons into Start/Stop Frame
00156    void _AddStartStopButtons();
00157   
00158    // Set all Widget Pointers to Zero;
00159    void _Zeros();
00160 
00161    // Set Histogram gStyle
00162    void _SetStyleOptions();
00163 
00164    // Draw Histogram and Update widgets
00165    void _DrawHistogram(TH1F& Histo);
00166 
00167    // ******* Boolean Getters *******
00168    inline const bool _IsHistoUpdate() const {return fIsHistoUpdate;}
00169 
00170    ClassDef(QGUISmartScope,0)
00171 };
00172 
00173 #endif // _QGUI_SMART_SCOPE_HH_

Generated on Tue Nov 16 10:49:55 2010 for CUORE Software by  doxygen 1.5.6