Go to the documentation of this file.00001
00005
00006
00007 #ifndef NXYTER_QUICKDAQ_H
00008 #define NXYTER_QUICKDAQ_H
00009
00010 #include "base/Board.h"
00011 #include "roc/Message.h"
00012 #include "roc/Iterator.h"
00013 #include "nxyter/FebBase.h"
00014 #include "nxyter/QuickDaqStats.h"
00015 #include "nxyter/RocNx.h"
00016
00017 namespace nxyter {
00018
00019 class QuickDaq {
00020 protected:
00021 base::Board* fBoard;
00022 nxyter::FebBase* fFebs[2];
00023 nxyter::RocNx fRocNx;
00024 int fState;
00025 int fStopCode;
00026 int fDaqLowWater;
00027 int fDaqHighWater;
00028 uint32_t fDaqFlushTimer;
00029 double fDaqStaStoTimeout;
00030 QuickDaqStats fStats;
00031 bool fNextNxMaskActive;
00032 int fNextNxMask;
00033 double fStartTime;
00034 double fStopTime;
00035 double fStartMsgTime;
00036 double fStopMsgTime;
00037 double fMaxMsg;
00038 double fMaxTime;
00039 roc::Iterator fIter;
00040 double fMsgTime;
00041 double fNowTime;
00042
00043 public:
00044
00046 enum daqState {
00047 kDaqStopped = 0,
00048 kDaqStarting,
00049 kDaqRunning,
00050 kDaqStopping
00051 };
00053 enum daqStopCode {
00054 kDaqStopPending = 0,
00055 kDaqStopByCount,
00056 kDaqStopByTime,
00057 kDaqStopByInterrupt,
00058 kDaqStopByStop,
00059 kDaqStopByTimeout
00060 };
00061
00062 explicit QuickDaq(base::Board* board);
00063 explicit QuickDaq(nxyter::FebBase* feb0=0,
00064 nxyter::FebBase* feb1=0);
00065 virtual ~QuickDaq();
00066
00067 int setNxTestModes(bool testpuls, bool testtrig, int calselect);
00068 int setNxRegisterAll(uint8_t reg, uint8_t val, bool veri=true);
00069
00070 void nextRunNxMask(int nxmask);
00071
00072 int startRun(int maxmsg=0, double maxtime=0., bool noinit=false);
00073 int stopRun(bool hardstop=false);
00074 void interruptRun();
00075
00076 bool testRun(double timeout=0.);
00077
00079 roc::Message& msg()
00080 { return fIter.msg(); }
00081
00083 uint32_t getMsgEpoch() const
00084 { return fIter.getMsgEpoch(); }
00085
00087 double getMsgTime()
00088 { return fMsgTime; }
00089
00091 double getRunTime()
00092 { return fNowTime - fStartTime; }
00093
00095 double getStartTime()
00096 { return fStartTime; }
00097
00099 double getStopTime()
00100 { return fStopTime; }
00101
00103 const QuickDaqStats& stats()
00104 { return fStats; }
00105
00107 int getState()
00108 { return fState; }
00109
00111 int getStopCode()
00112 { return fStopCode; }
00113
00114 static double now();
00115
00116 };
00117
00118 }
00119
00120 #endif