00001 00011 #ifndef _QGUI_HISTOGRAM_HANDLER_HH_ 00012 #define _QGUI_HISTOGRAM_HANDLER_HH_ 00013 00014 #include <string> 00015 00016 #include "TH1F.h" 00017 00018 class QGUIHistogramHandler 00019 { 00020 public: 00021 00023 QGUIHistogramHandler(); 00024 00026 virtual ~QGUIHistogramHandler(); 00027 00035 void SetChannel(unsigned int channel); 00036 00038 unsigned int GetChannel() const { return fChannel; } 00039 00040 00041 // void SetConfigFile(const std::string& fileName); 00042 00047 TH1F& GetRateHistogram() { return fRateHisto; } 00048 00053 TH1F& GetPulseHistogram() { return fPulseHisto; } 00054 00059 TH1F& GetSpectrumHistogram() { return fSpectrumHisto; } 00060 00069 bool CheckUpdate(); 00070 00075 void ForceUpdate() const; 00076 00081 void Inhibit() const; 00082 00084 void UpdateSpectrumRange() { fUpdateSpectrumRange = true; } 00085 00086 private: 00087 unsigned int fChannel; 00088 std::string fFilesPath; 00089 std::string fLockFile; 00090 std::string fConfigFile; 00091 std::string fRootFile; 00092 00093 TH1F fRateHisto; 00094 TH1F fPulseHisto; 00095 TH1F fSpectrumHisto; 00096 00097 bool fUpdateSpectrumRange; 00098 int fLastSpectrumBin; 00099 00100 time_t fTimeFromStart; 00101 time_t fEventTime; 00102 unsigned int fSamplingRate; 00103 00114 bool UpdateConfigFile(bool force = false) const; 00115 00122 bool UpdateHistograms(); 00123 00125 void ResetHistograms(); 00126 00128 void DressHistograms(); 00129 00131 void EvalSpectrumRange(); 00132 00138 bool DumpLockFile() const; 00139 00146 std::string GetTimeString(const time_t& time, const std::string& format); 00147 00148 ClassDef(QGUIHistogramHandler,0) 00149 }; 00150 00151 #endif