00001 00002 #ifndef _Q_MONITOR_HISTOGRAM_READER_HH_ 00003 #define _Q_MONITOR_HISTOGRAM_READER_HH_ 00004 00005 #include "QCuore.hh" 00006 #include "QError.hh" 00007 #include "QApolloMonitorDefs.hh" 00008 00009 #include <string> 00010 00011 #include <Rtypes.h> 00012 #include <TH1D.h> 00013 00014 class TFile; 00015 00025 class QMonitorHistogramReader 00026 { 00027 public: 00029 QMonitorHistogramReader(); 00030 00032 virtual ~QMonitorHistogramReader(); 00033 00035 bool Read(const std::string& fileName); 00036 00037 void Close(); 00038 00040 const QError& GetError() const { return fError; } 00041 00043 bool GetTimeSec(Double_t& timeSec); 00044 00046 bool GetTimeUnix(time_t& timeUnix); 00047 00049 bool GetSamplingRate(UInt_t& rate); 00050 00052 bool GetLgChannel(Int_t& channel); 00053 00055 bool GetEventType(QApolloMonitorDefs::QMonitorEventType_t& type); 00056 00058 bool GetPulse(TH1F& pulse); 00059 00061 bool GetRateHistogram(TH1F& rateHisto, 00062 QApolloMonitorDefs::QMonitorEventType_t type); 00063 00065 bool GetSpectrum(TH1F& spectrum, 00066 QApolloMonitorDefs::QMonitorEventType_t type); 00067 00068 private: 00070 QError fError; 00071 00073 TFile *fFile; 00074 00081 TH1D fVariablesHisto; 00082 00087 bool CheckOpen(); 00088 00090 void ResetError() 00091 { if(fError != QERR_SUCCESS) fError.Set(QERR_SUCCESS, ""); } 00092 00094 bool GetVariable(QApolloMonitorDefs::QMonitorVariable_t var, Double_t& val); 00095 00100 const TH1* GetHistogram(const std::string& hName); 00101 00102 }; 00103 #endif