Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:14

0001 #ifndef FileReaderDDU_h
0002 #define FileReaderDDU_h
0003 
0004 #include <stdexcept>  // std::runtime_error
0005 #include <unistd.h>   // size_t
0006 
0007 class FileReaderDDU {
0008 private:
0009   unsigned short raw_event[200000];
0010 
0011   unsigned long long word_0, word_1, word_2;  // To remember some history
0012   unsigned long long file_buffer[4000];       // Read data block for efficiency
0013 
0014   unsigned long long *end, *file_buffer_end;  // where stoped last time and where is end
0015 
0016 public:
0017   enum { Header = 1, Trailer = 2, DDUoversize = 4, FFFF = 8, Unknown = 16, EndOfStream = 32 };
0018   enum {
0019     Type1 = Header | Trailer,
0020     Type2 = Header,
0021     Type3 = Header | DDUoversize,
0022     Type4 = Trailer,
0023     Type5 = Unknown,
0024     Type6 = Unknown | DDUoversize,
0025     Type7 = FFFF
0026   };  // Andrey Korytov's notations
0027 private:
0028   unsigned int eventStatus, selectCriteria, acceptCriteria, rejectCriteria;
0029 
0030   int fd;
0031 
0032 public:
0033   int open(const char *filename);
0034   size_t read(const unsigned short *&buf);  // Just plain read function
0035   size_t next(const unsigned short *&buf,
0036               int prescaling = 1);  // Same as ``read'', but returns only events pass certain criteria
0037   void select(unsigned int criteria) throw() { selectCriteria = criteria; }  // return events satisfying all criteria
0038   void accept(unsigned int criteria) throw() {
0039     acceptCriteria = criteria;
0040   }  // return all events satisfying any of criteria
0041   void reject(unsigned int criteria) throw() {
0042     rejectCriteria = criteria;
0043   }  // return events not satisfying any of criteria
0044 
0045   unsigned int status(void) const throw() { return eventStatus; }
0046 
0047   FileReaderDDU(void);
0048   virtual ~FileReaderDDU(void);
0049 };
0050 
0051 #endif