#include <EventHeader.h>
Inheritance diagram for DybDaq::EventHeader:
Public Types | |
typedef std::pair< const char *, unsigned int > | OutputBuffer |
typedef std::vector< OutputBuffer > | OutputBufferList |
typedef std::vector< ByteInspector * > | Bytes |
typedef std::vector< BitsInspector * > | Bits |
Public Member Functions | |
EventHeader (const unsigned int site, const unsigned int detector, const unsigned int run, const unsigned int event, const unsigned int dataType, const bool cbltWrapping, const bool rawCblt, const bool triggerMismatch, const bool invalidData, const EventTraits &traits) | |
Create an instance of this class. | |
EventHeader (const ByteBuffer &byteBuffer) | |
Create an instance of this class. | |
virtual | ~EventHeader () |
Destroy this instance of the class. | |
virtual const DaqTraits & | daqTraits () const |
Returns the DaqTraits instance used to parse this object's buffer. | |
unsigned int | majorVersion () const |
Returns the majorVersion of the event format. | |
unsigned int | minorVersion () const |
Returns the minorVersion of the event format. | |
unsigned int | headerSize () const |
Returns the length of this head in the buffer in 4-byte words. | |
unsigned int | totalSize () const |
Returns the total size of the event in the buffer in 4-byte words. | |
unsigned int | site () const |
Returns the site of the event in the buffer. | |
unsigned int | detector () const |
Returns the detector of the event in the buffer. | |
unsigned int | run () const |
Returns the run number of the event in the buffer. | |
unsigned int | event () const |
Returns the event number of the event in the buffer. | |
unsigned int | dataType () const |
Returns the data type of the event in the buffer. | |
bool | cbltWrapping () const |
True if 2 extra 4-byte words are resevered for CBLT header and footer. | |
bool | rawCblt () const |
True if the event is raw DBLT readout data, no ROM Fragment. | |
bool | triggerMismatch () const |
True if the event contains a mis-matched trigger. | |
bool | invalidData () const |
True if the event contains invalid data. | |
virtual unsigned int | bufferSize () const |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer. | |
void | setTotalSize (const unsigned int totalLength) |
Sets the total size of the event in the buffer in 4-byte words. | |
const EventTraits & | eventTraits () const |
Returns the EventTraits instance used to parse this object's buffer. | |
bool | hasDaqTraits () const |
virtual unsigned int | gather (OutputBufferList &outputBuffers) const |
virtual unsigned int | inspect (DaqBuffer::Bytes &inspectors) const |
Static Public Attributes | |
static const unsigned int | kBytesInInt |
static const unsigned int | kUndefinedFormatComponent |
Protected Member Functions | |
virtual unsigned int | formatComponent () const |
Returns the component with the format of this buffer. | |
const char * | buffer () const |
char * | buffer () |
bool | hasByteBuffer () const |
const ByteBuffer & | byteBuffer () const |
unsigned int | fillInspectors (DaqBuffer::Bytes &inspectors, unsigned int component, unsigned int cursor) const |
virtual bool | readBool (const unsigned int field) const |
virtual int | readInt (const unsigned int field) const |
virtual unsigned char | readUnsignedChar (const unsigned int field) const |
virtual unsigned int | readUnsignedInt (const unsigned int field) const |
virtual void | writeField (const bool value, const unsigned int field) |
virtual void | writeField (const int value, const unsigned int field) |
virtual void | writeField (const unsigned int value, const unsigned int field) |
Private Member Functions | |
EventHeader () | |
Suppress default. | |
EventHeader (EventHeader &rhs) | |
Suppress default. | |
EventHeader & | operator= (EventHeader &rhs) |
Suppress default. | |
void | setMajorVersion (const unsigned int majorVersion) |
Sets the majorVersion of the event format. | |
void | setMinorVersion (const unsigned int minorVersion) |
Sets the minorVersion of the event format. | |
void | setHeaderSize (const unsigned int headerLength) |
Sets the length of this head in the buffer in 4-byte words. | |
void | setSite (const unsigned int site) |
Sets the site of the event in the buffer. | |
void | setDetector (const unsigned int detector) |
Sets the detector of the event in the buffer. | |
void | setRun (const unsigned int run) |
Sets the run number of the event in the buffer. | |
void | setEvent (const unsigned int event) |
Sets the event number of the event in the buffer. | |
void | setDataType (const unsigned int dataType) |
Sets the data type of the event in the buffer. | |
void | setCbltWrapping (const bool cbltWrapping) |
Sets whether 2 extra 4-byte words are resevered for CBLT header and footer or not. | |
void | setRawCblt (const bool rawCblt) |
Sets whether the event is raw DBLT readout data, no ROM Fragmentor not. | |
void | setTriggerMismatch (const bool triggerMismatch) |
Sets whether the event contains a mis-matched trigger or not. | |
void | setInvalidData (const bool invalidData) |
Sets whether the event contains invalid data or not. | |
Private Attributes | |
const EventTraits * | m_traits |
The EventTraits instance used to parse this object's buffer. |
Definition at line 16 of file EventHeader.h.
EventHeader::EventHeader | ( | const unsigned int | site, | |
const unsigned int | detector, | |||
const unsigned int | run, | |||
const unsigned int | event, | |||
const unsigned int | dataType, | |||
const bool | cbltWrapping, | |||
const bool | rawCblt, | |||
const bool | triggerMismatch, | |||
const bool | invalidData, | |||
const EventTraits & | traits | |||
) |
Create an instance of this class.
Definition at line 19 of file EventHeader.cc.
00028 : 00029 EventBuffer(new char[traits.headerSize(EventTraits::kEventHeader) * kBytesInInt], 00030 traits) { 00031 m_traits = &traits; 00032 traits.initializeHeader(EventTraits::kEventHeader, 00033 buffer()); 00034 setMajorVersion(traits.majorVersion()); 00035 setMinorVersion(traits.minorVersion()); 00036 setHeaderSize(traits.headerSize(EventTraits::kEventHeader)), 00037 setTotalSize(headerSize()); 00038 setSite(site); 00039 setDetector(detector); 00040 setRun(run); 00041 setEvent(event); 00042 setDataType(dataType); 00043 setCbltWrapping(cbltWrapping); 00044 setRawCblt(rawCblt); 00045 setTriggerMismatch(triggerMismatch); 00046 setInvalidData(invalidData); 00047 }
EventHeader::EventHeader | ( | const ByteBuffer & | byteBuffer | ) |
Create an instance of this class.
Definition at line 49 of file EventHeader.cc.
00049 : 00050 EventBuffer(byteBuffer, 00051 *((EventTraits*)0)) { 00052 const char* buffer = byteBuffer.cursor(); 00053 m_traits = EventTraits::readTraits(buffer); 00054 byteBuffer.position(byteBuffer.position() + (headerSize() * kBytesInInt)); 00055 }
EventHeader::~EventHeader | ( | ) | [virtual] |
DybDaq::EventHeader::EventHeader | ( | ) | [private] |
Suppress default.
DybDaq::EventHeader::EventHeader | ( | EventHeader & | rhs | ) | [private] |
Suppress default.
const DaqTraits & EventHeader::daqTraits | ( | ) | const [virtual] |
Returns the DaqTraits instance used to parse this object's buffer.
Reimplemented from DybDaq::DaqBuffer.
Definition at line 60 of file EventHeader.cc.
00060 { 00061 return *m_traits; 00062 }
unsigned int EventHeader::majorVersion | ( | ) | const |
Returns the majorVersion of the event format.
Definition at line 68 of file EventHeader.cc.
00068 { 00069 return readUnsignedInt(EventTraits::kMajorVersion); 00070 }
unsigned int EventHeader::minorVersion | ( | ) | const |
Returns the minorVersion of the event format.
Definition at line 72 of file EventHeader.cc.
00072 { 00073 return readUnsignedInt(EventTraits::kMinorVersion); 00074 }
unsigned int EventHeader::headerSize | ( | ) | const |
Returns the length of this head in the buffer in 4-byte words.
Definition at line 76 of file EventHeader.cc.
00076 { 00077 return readUnsignedInt(EventTraits::kEventHeaderSize); 00078 }
unsigned int EventHeader::totalSize | ( | ) | const |
Returns the total size of the event in the buffer in 4-byte words.
Definition at line 80 of file EventHeader.cc.
00080 { 00081 return readUnsignedInt(EventTraits::kEventTotalSize); 00082 }
unsigned int EventHeader::site | ( | ) | const |
Returns the site of the event in the buffer.
Definition at line 84 of file EventHeader.cc.
00084 { 00085 return readUnsignedInt(EventTraits::kEventSite); 00086 }
unsigned int EventHeader::detector | ( | ) | const |
Returns the detector of the event in the buffer.
Definition at line 88 of file EventHeader.cc.
00088 { 00089 return readUnsignedInt(EventTraits::kEventDetector); 00090 }
unsigned int EventHeader::run | ( | ) | const |
Returns the run number of the event in the buffer.
Definition at line 92 of file EventHeader.cc.
00092 { 00093 return readUnsignedInt(EventTraits::kEventRun); 00094 }
unsigned int EventHeader::event | ( | ) | const |
Returns the event number of the event in the buffer.
Definition at line 96 of file EventHeader.cc.
00096 { 00097 return readUnsignedInt(EventTraits::kEventNumber); 00098 }
unsigned int EventHeader::dataType | ( | ) | const |
Returns the data type of the event in the buffer.
Definition at line 100 of file EventHeader.cc.
00100 { 00101 return readUnsignedInt(EventTraits::kEventDataType); 00102 }
bool EventHeader::cbltWrapping | ( | ) | const |
True if 2 extra 4-byte words are resevered for CBLT header and footer.
Definition at line 104 of file EventHeader.cc.
00104 { 00105 return readBool(EventTraits::kCbltWrapping); 00106 }
bool EventHeader::rawCblt | ( | ) | const |
True if the event is raw DBLT readout data, no ROM Fragment.
Definition at line 108 of file EventHeader.cc.
00108 { 00109 return readBool(EventTraits::kRawCblt); 00110 }
bool EventHeader::triggerMismatch | ( | ) | const |
True if the event contains a mis-matched trigger.
Definition at line 112 of file EventHeader.cc.
00112 { 00113 return readBool(EventTraits::kLtbMismatch); 00114 }
bool EventHeader::invalidData | ( | ) | const |
True if the event contains invalid data.
Definition at line 116 of file EventHeader.cc.
00116 { 00117 return readBool(EventTraits::kInvalidData); 00118 }
unsigned int EventHeader::bufferSize | ( | ) | const [virtual] |
Returns the size, in 4-bytes, of this ojbect's contents in the buffer.
Implements DybDaq::DaqBuffer.
Definition at line 120 of file EventHeader.cc.
00120 { 00121 return headerSize(); 00122 }
void EventHeader::setTotalSize | ( | const unsigned int | totalLength | ) |
Sets the total size of the event in the buffer in 4-byte words.
Definition at line 139 of file EventHeader.cc.
00139 { 00140 writeField(totalLength, 00141 EventTraits::kEventTotalSize); 00142 }
unsigned int EventHeader::formatComponent | ( | ) | const [protected, virtual] |
Returns the component with the format of this buffer.
Reimplemented from DybDaq::DaqBuffer.
Definition at line 64 of file EventHeader.cc.
00064 { 00065 return EventTraits::kEventHeader; 00066 }
EventHeader& DybDaq::EventHeader::operator= | ( | EventHeader & | rhs | ) | [private] |
Suppress default.
void EventHeader::setMajorVersion | ( | const unsigned int | majorVersion | ) | [private] |
Sets the majorVersion of the event format.
Definition at line 124 of file EventHeader.cc.
00124 { 00125 writeField(majorVersion, 00126 EventTraits::kMajorVersion); 00127 }
void EventHeader::setMinorVersion | ( | const unsigned int | minorVersion | ) | [private] |
Sets the minorVersion of the event format.
Definition at line 129 of file EventHeader.cc.
00129 { 00130 writeField(minorVersion, 00131 EventTraits::kMinorVersion); 00132 }
void EventHeader::setHeaderSize | ( | const unsigned int | headerLength | ) | [private] |
Sets the length of this head in the buffer in 4-byte words.
Definition at line 134 of file EventHeader.cc.
00134 { 00135 writeField(headerLength, 00136 EventTraits::kEventHeaderSize); 00137 }
void EventHeader::setSite | ( | const unsigned int | site | ) | [private] |
Sets the site of the event in the buffer.
Definition at line 144 of file EventHeader.cc.
00144 { 00145 writeField(site, 00146 EventTraits::kEventSite); 00147 }
void EventHeader::setDetector | ( | const unsigned int | detector | ) | [private] |
Sets the detector of the event in the buffer.
Definition at line 149 of file EventHeader.cc.
00149 { 00150 writeField(detector, 00151 EventTraits::kEventDetector); 00152 }
void EventHeader::setRun | ( | const unsigned int | run | ) | [private] |
Sets the run number of the event in the buffer.
Definition at line 154 of file EventHeader.cc.
00154 { 00155 writeField(run, 00156 EventTraits::kEventRun); 00157 }
void EventHeader::setEvent | ( | const unsigned int | event | ) | [private] |
Sets the event number of the event in the buffer.
Definition at line 159 of file EventHeader.cc.
00159 { 00160 writeField(event, 00161 EventTraits::kEventNumber); 00162 }
void EventHeader::setDataType | ( | const unsigned int | dataType | ) | [private] |
Sets the data type of the event in the buffer.
Definition at line 164 of file EventHeader.cc.
00164 { 00165 writeField(dataType, 00166 EventTraits::kEventDataType); 00167 }
void EventHeader::setCbltWrapping | ( | const bool | cbltWrapping | ) | [private] |
Sets whether 2 extra 4-byte words are resevered for CBLT header and footer or not.
Definition at line 169 of file EventHeader.cc.
00169 { 00170 writeField(cbltWrapping, 00171 EventTraits::kCbltWrapping); 00172 }
void EventHeader::setRawCblt | ( | const bool | rawCblt | ) | [private] |
Sets whether the event is raw DBLT readout data, no ROM Fragmentor not.
Definition at line 174 of file EventHeader.cc.
00174 { 00175 writeField(rawCblt, 00176 EventTraits::kRawCblt); 00177 }
void EventHeader::setTriggerMismatch | ( | const bool | triggerMismatch | ) | [private] |
Sets whether the event contains a mis-matched trigger or not.
Definition at line 179 of file EventHeader.cc.
00179 { 00180 writeField(triggerMismatch, 00181 EventTraits::kLtbMismatch); 00182 }
void EventHeader::setInvalidData | ( | const bool | invalidData | ) | [private] |
Sets whether the event contains invalid data or not.
Definition at line 184 of file EventHeader.cc.
00184 { 00185 writeField(invalidData, 00186 EventTraits::kInvalidData); 00187 }
const EventTraits & EventBuffer::eventTraits | ( | ) | const [inherited] |
Returns the EventTraits instance used to parse this object's buffer.
Definition at line 35 of file EventBuffer.cc.
00035 { 00036 return dynamic_cast<const EventTraits&>(daqTraits()); 00037 }
const EventTraits* DybDaq::EventHeader::m_traits [private] |
The EventTraits instance used to parse this object's buffer.
This is set after construction, so can not use base class's.
Reimplemented from DybDaq::DaqBuffer.
Definition at line 213 of file EventHeader.h.