00001 #ifndef EVENTREADOUTFORMAT_EVENTHEADER_H 00002 #define EVENTREADOUTFORMAT_EVENTHEADER_H 00003 00004 /* 00005 * EventHeader.h 00006 * EventReadoutFormat 00007 * 00008 * Created by Simon Patton on 7/19/10. 00009 * Copyright 2010 DayaBay Collaboration. All rights reserved. 00010 * 00011 */ 00012 #include "EventReadoutFormat/EventBuffer.h" 00013 00014 namespace DybDaq { 00015 00016 class EventHeader : public EventBuffer { 00017 00018 public: 00019 00023 EventHeader(const unsigned int site, 00024 const unsigned int detector, 00025 const unsigned int run, 00026 const unsigned int event, 00027 const unsigned int dataType, 00028 const bool cbltWrapping, 00029 const bool rawCblt, 00030 const bool triggerMismatch, 00031 const bool invalidData, 00032 const EventTraits& traits) ; 00033 00037 EventHeader(const ByteBuffer& byteBuffer); 00038 00042 virtual ~EventHeader(); 00043 00047 virtual const DaqTraits& daqTraits() const; 00048 00052 unsigned int majorVersion() const; 00053 00057 unsigned int minorVersion() const; 00058 00062 unsigned int headerSize() const; 00063 00067 unsigned int totalSize() const; 00068 00072 unsigned int site() const; 00073 00077 unsigned int detector() const; 00078 00082 unsigned int run() const; 00083 00087 unsigned int event() const; 00088 00092 unsigned int dataType() const; 00093 00097 bool cbltWrapping() const; 00098 00102 bool rawCblt() const; 00103 00107 bool triggerMismatch() const; 00108 00112 bool invalidData() const; 00113 00117 virtual unsigned int bufferSize() const; 00118 00122 void setTotalSize(const unsigned int totalLength); 00123 00124 protected: 00125 00129 virtual unsigned int formatComponent() const; 00130 00131 private: 00132 00136 EventHeader(); 00137 00141 EventHeader(EventHeader& rhs); 00142 00146 EventHeader& operator=(EventHeader& rhs); 00147 00151 void setMajorVersion(const unsigned int majorVersion); 00152 00156 void setMinorVersion(const unsigned int minorVersion); 00157 00161 void setHeaderSize(const unsigned int headerLength); 00162 00166 void setSite(const unsigned int site); 00167 00171 void setDetector(const unsigned int detector); 00172 00176 void setRun(const unsigned int run); 00177 00181 void setEvent(const unsigned int event); 00182 00186 void setDataType(const unsigned int dataType); 00187 00191 void setCbltWrapping(const bool cbltWrapping); 00192 00196 void setRawCblt(const bool rawCblt); 00197 00201 void setTriggerMismatch(const bool triggerMismatch); 00202 00206 void setInvalidData(const bool invalidData); 00207 00213 const EventTraits* m_traits; 00214 }; 00215 00216 } 00217 00218 #endif // EVENTREADOUTFORMAT_EVENTHEADER_H