00001 00002 #ifndef _QGS_DISPLAY_MANAGER_HH_ 00003 #define _QGS_DISPLAY_MANAGER_HH_ 00004 00005 #include <map> 00006 #include <list> 00007 #include <string> 00008 00009 #include <Rtypes.h> 00010 00011 class QScopeChannelInfo; 00012 class QSmartScopeChannel; 00013 class TCanvas; 00014 class TH1F; 00015 class TPaveLabel; 00016 00022 class QGSDisplayManager 00023 { 00024 public: 00026 QGSDisplayManager(); 00027 00029 virtual ~QGSDisplayManager(); 00030 00032 void SetCanvas(TCanvas *canvas) { fCanvas = canvas; } 00033 00043 Bool_t AddChannel(QScopeChannelInfo* chInfo); 00044 00046 void UpdateDisplay(); 00047 00049 void SetUpdatePeriodMs(UInt_t updatePeriodMs) 00050 { fUpdatePeriodMs = updatePeriodMs; } 00051 00056 Bool_t SetWindowLengthMs(UInt_t winLengthMs); 00057 00059 void ForceResync() { fUpdateLastIndex = true; } 00060 00062 void Print(const std::string& fileName); 00063 00064 private: 00065 00070 class QScopeMeasures 00071 { 00072 public: 00073 Double_t fMaxMin; 00074 Double_t fAverage; 00075 Double_t fRMS; 00076 }; 00077 00078 00079 00081 TCanvas *fCanvas; 00083 std::map<Int_t, QScopeChannelInfo*> fConfigs; 00085 std::map<Int_t, QSmartScopeChannel*> fScopeChannels; 00087 std::map<Int_t, TH1F*> fHistograms; 00089 std::map<Int_t, QScopeMeasures> fMeasures; 00090 00092 std::list<TPaveLabel*> fMeasLabels; 00094 std::list<TPaveLabel*> fConfigLabels; 00095 00097 TH1F *fAxisHisto; 00098 00100 UInt_t fUpdatePeriodMs; 00102 UInt_t fWindowLengthMs; 00104 ULong64_t fLastIndex; 00106 Bool_t fUpdateLastIndex; 00108 const Double_t kMaxDelaySec; 00110 const Double_t kYmin; 00112 const Double_t kYmax; 00114 const Double_t kAdc2mV; 00115 00116 ULong_t fXLabelColor; 00124 Bool_t Update(Int_t chId, bool reSync); 00125 00127 void MakeUp(Int_t chId); 00128 00133 void SetGlobalParams(); 00134 00141 Float_t EvalMvPerDiv(const TH1F* histo) const; 00142 00150 Int_t EvalOffset(const TH1F* histo, Float_t mVperDiv) const; 00151 00152 00153 00155 void HandleMeasures(Int_t chId); 00156 00158 void DrawMeasures(); 00159 00161 void DrawConfig(); 00162 00169 void AddLabel(const char* text, ULong_t color, Bool_t isMeas); 00170 00172 void ClearLabels(); 00173 }; 00174 #endif