00001 #ifndef __Q_SMART_SCOPE_CHANNEL_HH__ 00002 #define __Q_SMART_SCOPE_CHANNEL_HH__ 00003 00004 #include "QCuore.hh" 00005 00006 #include <vector> 00007 #include <deque> 00008 00009 #include "TH1F.h" 00010 00011 class QCrateReceiverBuffer; 00012 00013 class QSmartScopeChannel { 00014 public: 00015 QSmartScopeChannel(); 00016 virtual ~QSmartScopeChannel(); 00017 00024 bool SetChannel(unsigned int channel); 00025 00027 const unsigned int GetChannel() const {return fChannel;} 00028 00032 const std::vector<unsigned int>& GetDisplayRates() const 00033 { return fDisplayRates; } 00034 00043 bool GetHistogram(TH1F& histo,unsigned int upperEdge, double& delay); 00044 00051 unsigned int GetLatestIndex() const; 00052 00062 unsigned int SetDisplayRate(unsigned int rate); 00063 00068 void SetWindow(unsigned int winLength) 00069 {gWinLength = winLength; } 00070 00075 void SetUpdatePeriod(unsigned int period) 00076 {gUpdatePeriod = period; } 00077 00078 private: 00079 00081 void EvalDisplayRates(); 00082 00086 void SetSampleZero(); 00087 00096 double GetData(unsigned int nCycle); 00097 00098 unsigned int fChannel; 00099 unsigned int fStepSize; 00100 unsigned int fRealRate; 00101 unsigned int fDisplayRate; 00102 unsigned long long fSampleZero; 00103 00108 static long long gTimeZero; 00109 00113 static unsigned int gUpdatePeriod; 00114 00118 static unsigned int gWinLength; 00119 00121 static unsigned int gInstances; 00122 00123 QCrateReceiverBuffer* fBuffer; 00124 std::vector<unsigned int> fDisplayRates; 00125 std::deque<long> fData; 00126 }; 00127 00128 #endif