00001 00002 #ifndef __Q_SMART_SCOPE_CHANNEL_HH__ 00003 #define __Q_SMART_SCOPE_CHANNEL_HH__ 00004 00005 #include "QCuore.hh" 00006 00007 #include <vector> 00008 #include <deque> 00009 00010 #include <TH1F.h> 00011 00012 class QCrateReceiverBuffer; 00013 00029 class QSmartScopeChannel 00030 { 00031 public: 00032 00034 QSmartScopeChannel(); 00035 00037 virtual ~QSmartScopeChannel(); 00038 00044 bool SetChannel(unsigned int channel); 00045 00047 const unsigned int GetChannel() const {return fChannel;} 00048 00050 const std::vector<unsigned int>& GetDisplayRates() const 00051 { return fDisplayRates; } 00052 00062 bool GetHistogram(TH1F& histo,unsigned int upperEdge, double& delay); 00063 00071 unsigned int GetLatestIndex() const; 00072 00082 unsigned int SetDisplayRate(unsigned int rate); 00083 00085 void SetWindow(unsigned int winLength) 00086 {gWinLength = winLength; } 00087 00089 void SetUpdatePeriod(unsigned int period) 00090 {gUpdatePeriod = period; } 00091 00092 00093 00094 private: 00095 00097 void EvalDisplayRates(); 00098 00100 void SetSampleZero(); 00101 00111 double GetData(unsigned int nCycle); 00112 00113 unsigned int fChannel; 00114 unsigned int fStepSize; 00115 unsigned int fRealRate; 00116 unsigned int fDisplayRate; 00118 unsigned int fLastCycle; 00119 00124 unsigned long long fSampleZero; 00125 00131 static long long gTimeZero; 00132 00134 static unsigned int gUpdatePeriod; 00135 00137 static unsigned int gWinLength; 00138 00140 static unsigned int gInstances; 00141 00142 QCrateReceiverBuffer* fBuffer; 00144 std::vector<unsigned int> fDisplayRates; 00145 00147 std::deque<long> fData; 00148 }; 00149 00150 #endif