Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef FileReaderDCC_h
0002 #define FileReaderDCC_h
0003 
0004 #include <stdexcept>  // std::runtime_error
0005 #include <unistd.h>   // size_t
0006 
0007 class FileReaderDCC {
0008 private:
0009   unsigned short *raw_event;  //[200000*40];

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, DCCoversize = 4, FFFF = 8, Unknown = 16, EndOfStream = 32 };
0018   enum {
0019     Type1 = Header | Trailer,
0020     Type2 = Header,
0021     Type3 = Header | DCCoversize,
0022     Type4 = Trailer,
0023     Type5 = Unknown,
0024     Type6 = Unknown | DCCoversize,
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);  // Same as ``read'', but returns only events pass certain criteria

0036   void select(unsigned int criteria) throw() { selectCriteria = criteria; }  // return events satisfying all criteria

0037   void accept(unsigned int criteria) throw() {
0038     acceptCriteria = criteria;
0039   }  // return all events satisfying any of criteria

0040   void reject(unsigned int criteria) throw() {
0041     rejectCriteria = criteria;
0042   }  // return events not satisfying any of criteria

0043 
0044   unsigned int status(void) const throw() { return eventStatus; }
0045 
0046   FileReaderDCC(void);
0047   virtual ~FileReaderDCC(void);
0048 };
0049 
0050 #endif