Go to the documentation of this file.00001 #ifndef FileReaderDDU_h
00002 #define FileReaderDDU_h
00003
00004 #include <stdexcept>
00005 #include <unistd.h>
00006
00007 class FileReaderDDU {
00008 private:
00009 unsigned short raw_event[200000];
00010
00011 unsigned long long word_0, word_1, word_2;
00012 unsigned long long file_buffer[4000];
00013
00014 unsigned long long *end, *file_buffer_end;
00015
00016 public:
00017 enum {Header=1,Trailer=2,DDUoversize=4,FFFF=8,Unknown=16,EndOfStream=32};
00018 enum {Type1=Header|Trailer, Type2=Header, Type3=Header|DDUoversize, Type4=Trailer, Type5=Unknown, Type6=Unknown|DDUoversize, Type7=FFFF};
00019 private:
00020 unsigned int eventStatus, selectCriteria, acceptCriteria, rejectCriteria;
00021
00022 int fd;
00023
00024 public:
00025 int open(const char *filename) throw (std::runtime_error);
00026 size_t read(const unsigned short* &buf) throw (std::runtime_error);
00027 size_t next(const unsigned short* &buf, int prescaling=1) throw (std::runtime_error);
00028 void select(unsigned int criteria) throw() { selectCriteria = criteria; }
00029 void accept(unsigned int criteria) throw() { acceptCriteria = criteria; }
00030 void reject(unsigned int criteria) throw() { rejectCriteria = criteria; }
00031
00032 unsigned int status(void) const throw() { return eventStatus; }
00033
00034 FileReaderDDU(void);
00035 virtual ~FileReaderDDU(void);
00036 };
00037
00038 #endif