CMS 3D CMS Logo

FileReaderDDU.h
Go to the documentation of this file.
1 #ifndef FileReaderDDU_h
2 #define FileReaderDDU_h
3 
4 #include <stdexcept> // std::runtime_error
5 #include <unistd.h> // size_t
6 
7 class FileReaderDDU {
8 private:
9  unsigned short raw_event[200000];
10 
11  unsigned long long word_0, word_1, word_2; // To remember some history
12  unsigned long long file_buffer[4000]; // Read data block for efficiency
13 
14  unsigned long long *end, *file_buffer_end; // where stoped last time and where is end
15 
16 public:
17  enum { Header = 1, Trailer = 2, DDUoversize = 4, FFFF = 8, Unknown = 16, EndOfStream = 32 };
18  enum {
26  }; // Andrey Korytov's notations
27 private:
29 
30  int fd;
31 
32 public:
33  int open(const char *filename);
34  size_t read(const unsigned short *&buf); // Just plain read function
35  size_t next(const unsigned short *&buf,
36  int prescaling = 1); // Same as ``read'', but returns only events pass certain criteria
37  void select(unsigned int criteria) throw() { selectCriteria = criteria; } // return events satisfying all criteria
38  void accept(unsigned int criteria) throw() {
39  acceptCriteria = criteria;
40  } // return all events satisfying any of criteria
41  void reject(unsigned int criteria) throw() {
42  rejectCriteria = criteria;
43  } // return events not satisfying any of criteria
44 
45  unsigned int status(void) const throw() { return eventStatus; }
46 
47  FileReaderDDU(void);
48  virtual ~FileReaderDDU(void);
49 };
50 
51 #endif
unsigned int rejectCriteria
Definition: FileReaderDDU.h:28
void accept(unsigned int criteria)
Definition: FileReaderDDU.h:38
unsigned long long word_2
Definition: FileReaderDDU.h:11
size_t read(const unsigned short *&buf)
virtual ~FileReaderDDU(void)
unsigned short raw_event[200000]
Definition: FileReaderDDU.h:9
unsigned int acceptCriteria
Definition: FileReaderDDU.h:28
unsigned long long word_0
Definition: FileReaderDDU.h:11
unsigned long long * file_buffer_end
Definition: FileReaderDDU.h:14
void select(unsigned int criteria)
Definition: FileReaderDDU.h:37
unsigned int eventStatus
Definition: FileReaderDDU.h:28
unsigned long long file_buffer[4000]
Definition: FileReaderDDU.h:12
void reject(unsigned int criteria)
Definition: FileReaderDDU.h:41
size_t next(const unsigned short *&buf, int prescaling=1)
unsigned int selectCriteria
Definition: FileReaderDDU.h:28
unsigned int status(void) const
Definition: FileReaderDDU.h:45
int open(const char *filename)
unsigned long long word_1
Definition: FileReaderDDU.h:11
unsigned long long * end
Definition: FileReaderDDU.h:14