CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
FileReaderDCC.h
Go to the documentation of this file.
1 #ifndef FileReaderDCC_h
2 #define FileReaderDCC_h
3 
4 #include <stdexcept> // std::runtime_error
5 #include <unistd.h> // size_t
6 
7 class FileReaderDCC {
8 private:
9  unsigned short *raw_event; //[200000*40];
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, DCCoversize = 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); // Same as ``read'', but returns only events pass certain criteria
36  void select(unsigned int criteria) throw() { selectCriteria = criteria; } // return events satisfying all criteria
37  void accept(unsigned int criteria) throw() {
38  acceptCriteria = criteria;
39  } // return all events satisfying any of criteria
40  void reject(unsigned int criteria) throw() {
41  rejectCriteria = criteria;
42  } // return events not satisfying any of criteria
43 
44  unsigned int status(void) const throw() { return eventStatus; }
45 
46  FileReaderDCC(void);
47  virtual ~FileReaderDCC(void);
48 };
49 
50 #endif
size_t read(const unsigned short *&buf)
int open(const char *filename)
virtual ~FileReaderDCC(void)
unsigned long long word_0
Definition: FileReaderDCC.h:11
unsigned int acceptCriteria
Definition: FileReaderDCC.h:28
unsigned int rejectCriteria
Definition: FileReaderDCC.h:28
unsigned int status(void) const
Definition: FileReaderDCC.h:44
unsigned long long * file_buffer_end
Definition: FileReaderDCC.h:14
unsigned long long word_1
Definition: FileReaderDCC.h:11
unsigned long long file_buffer[4000]
Definition: FileReaderDCC.h:12
void select(unsigned int criteria)
Definition: FileReaderDCC.h:36
size_t next(const unsigned short *&buf)
unsigned long long word_2
Definition: FileReaderDCC.h:11
unsigned long long * end
Definition: FileReaderDCC.h:14
unsigned int eventStatus
Definition: FileReaderDCC.h:28
void accept(unsigned int criteria)
Definition: FileReaderDCC.h:37
unsigned int selectCriteria
Definition: FileReaderDCC.h:28
void reject(unsigned int criteria)
Definition: FileReaderDCC.h:40
unsigned short * raw_event
Definition: FileReaderDCC.h:9