CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/IORawData/CSCCommissioning/src/FileReaderDDU.h

Go to the documentation of this file.
00001 #ifndef FileReaderDDU_h
00002 #define FileReaderDDU_h
00003 
00004 #include <stdexcept>   // std::runtime_error
00005 #include <unistd.h>    // size_t
00006 
00007 class FileReaderDDU {
00008 private:
00009         unsigned short raw_event[200000];
00010 
00011         unsigned long long word_0, word_1, word_2; // To remember some history
00012         unsigned long long file_buffer[4000];      // Read data block for efficiency
00013 
00014         unsigned long long *end, *file_buffer_end; // where stoped last time and where is 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}; // Andrey Korytov's notations
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); // Just plain read function
00027         size_t next(const unsigned short* &buf, int prescaling=1) throw (std::runtime_error); // Same as ``read'', but returns only events pass certain criteria
00028         void select(unsigned int criteria) throw() { selectCriteria = criteria; } // return events satisfying all criteria
00029         void accept(unsigned int criteria) throw() { acceptCriteria = criteria; } // return all events satisfying any of criteria
00030         void reject(unsigned int criteria) throw() { rejectCriteria = criteria; } // return events not satisfying any of criteria
00031 
00032         unsigned int status(void) const throw() { return eventStatus; }
00033 
00034         FileReaderDDU(void);
00035         virtual ~FileReaderDDU(void);
00036 };
00037 
00038 #endif