00001 #ifndef SPADIC_SUSIBOINPUT_H 00002 #define SPADIC_SUSIBOINPUT_H 00003 00004 #ifndef DABC_DataIO 00005 #include "dabc/DataIO.h" 00006 #endif 00007 00008 #include <string> 00009 00010 #include <stdint.h> 00011 00012 #include "dabc/timing.h" 00013 00014 namespace SuS { 00015 class SpadicLib; 00016 } 00017 00018 namespace spadic { 00019 00020 class SusiboInput : public dabc::DataInput { 00021 public: 00022 SusiboInput(const char* name = 0, uint32_t bufsize = 0x10000); 00023 virtual ~SusiboInput(); 00024 00025 virtual bool Read_Init(const dabc::WorkerRef& wrk, const dabc::Command& cmd); 00026 00027 virtual unsigned Read_Size(); 00028 virtual unsigned Read_Complete(dabc::Buffer& buf); 00029 00030 virtual double GetTimeout() { return fTimeout; } 00031 00032 protected: 00033 00034 /* internal device id of susibo board, used for usb connection*/ 00035 int fBoardID; 00036 00037 /* size of preallocated memory buffer from pool*/ 00038 uint32_t fBufferSize; 00039 00040 /* number of mbs events filled into one dabc buffer before returning*/ 00041 int fMaxBufferEvents; 00042 00043 /* hit delay for susibo sample window*/ 00044 int fHitDelay; 00045 00046 /* if true (default), put susibo data into mbs event structure. 00047 * mbs event number matches vulom trigger id; 00048 * susibo id number is put into subevent subcrate number*/ 00049 bool fFormatMbs; 00050 00051 /* enable triggering susibo test trigger*/ 00052 bool fTestTrigger; 00053 00054 /* trigger frequency for test trigger*/ 00055 double fTriggerPerSecond; 00056 00057 /* timeout (in seconds) for readout polling. */ 00058 double fTimeout; 00059 00060 dabc::TimeStamp fLastTriggerTime; 00061 00062 SuS::SpadicLib* fLib; 00063 00064 00065 bool Init(); 00066 bool Close(); 00067 }; 00068 00069 } 00070 00071 #endif