#include <RawData.h>
Inheritance diagram for DayaBay::LtbHeadFragment:
Public Member Functions | |
LtbHeadFragment (unsigned int *buffer=0, unsigned int majorVersion=0, unsigned int minorVersion=0, bool isOwner=false) | |
~LtbHeadFragment () | |
virtual unsigned int | headType () const |
unsigned int | clockError () const |
unsigned int | ltbDataVersion () const |
unsigned int | numberInternalLocalTrigger () const |
unsigned int | numberSavedInternalLocalTrigger () const |
virtual std::ostream & | dump (std::ostream &str) |
virtual unsigned int | size () const |
unsigned int | status () const |
unsigned int | triggerNumber () const |
unsigned int | type () const |
unsigned int | majorVersion () const |
unsigned int | minorVersion () const |
bool | isEventType () const |
bool | isModuleType () const |
unsigned int * | buffer () const |
unsigned int | bufferSize () const |
bool | isOwner () const |
void | setOwner (bool isOwner=true) |
virtual bool | isValid () const |
unsigned int * | getPointer (const unsigned int &line) const |
unsigned int | getValue (const unsigned int &line, const unsigned int &firstBit=0, const unsigned int &bitLength=32) const |
char * | getString (const unsigned int &line, const unsigned int &byteOffset=0) const |
Static Public Member Functions | |
static DayaBay::RawData * | makeNewData (unsigned int *buffer=0, unsigned int majorVersion=0, unsigned int minorVersion=0, bool isOwner=false) |
Protected Attributes | |
unsigned int | m_majorVersion |
unsigned int | m_minorVersion |
Definition at line 74 of file RawData.h.
DayaBay::LtbHeadFragment::LtbHeadFragment | ( | unsigned int * | buffer = 0 , |
|
unsigned int | majorVersion = 0 , |
|||
unsigned int | minorVersion = 0 , |
|||
bool | isOwner = false | |||
) |
Definition at line 789 of file RawData.cc.
00793 : HeadFragment(buffer,majorVersion,minorVersion,isOwner) 00794 { 00795 // Default constructor 00796 }
DayaBay::LtbHeadFragment::~LtbHeadFragment | ( | ) |
unsigned int DayaBay::LtbHeadFragment::headType | ( | ) | const [virtual] |
Reimplemented from DayaBay::HeadFragment.
Definition at line 803 of file RawData.cc.
00804 { 00805 return DataFormat::LtbHeadFragment::headType; 00806 }
unsigned int DayaBay::LtbHeadFragment::clockError | ( | ) | const |
Definition at line 808 of file RawData.cc.
00809 { 00810 return this->getValue(DataFormat::LtbHeadFragment::clockErrorLine, 00811 DataFormat::LtbHeadFragment::clockErrorBitOffset, 00812 DataFormat::LtbHeadFragment::clockErrorBitLength); 00813 }
unsigned int DayaBay::LtbHeadFragment::ltbDataVersion | ( | ) | const |
Definition at line 815 of file RawData.cc.
00816 { 00817 return this->getValue(DataFormat::LtbHeadFragment::ltbDataVersionLine, 00818 DataFormat::LtbHeadFragment::ltbDataVersionBitOffset, 00819 DataFormat::LtbHeadFragment::ltbDataVersionBitLength); 00820 }
unsigned int DayaBay::LtbHeadFragment::numberInternalLocalTrigger | ( | ) | const |
Definition at line 822 of file RawData.cc.
00823 { 00824 return this->getValue(DataFormat::LtbHeadFragment::numIltLine, 00825 DataFormat::LtbHeadFragment::numIltBitOffset, 00826 DataFormat::LtbHeadFragment::numIltBitLength); 00827 }
unsigned int DayaBay::LtbHeadFragment::numberSavedInternalLocalTrigger | ( | ) | const |
Definition at line 829 of file RawData.cc.
00830 { 00831 return this->getValue(DataFormat::LtbHeadFragment::numSavedIltLine, 00832 DataFormat::LtbHeadFragment::numSavedIltBitOffset, 00833 DataFormat::LtbHeadFragment::numSavedIltBitLength); 00834 }
std::ostream & DayaBay::LtbHeadFragment::dump | ( | std::ostream & | str | ) | [virtual] |
Reimplemented from DayaBay::HeadFragment.
Definition at line 836 of file RawData.cc.
00836 { 00837 // Print the module information 00838 str << "LtbHeadFragment {" 00839 << " ltbDataVersion: " 00840 << this->ltbDataVersion() << ", " 00841 << " clockError: " 00842 << this->clockError() << ", " 00843 << " numberInternalLocalTrigger: " 00844 << this->numberInternalLocalTrigger() << ", " 00845 << " numberSavedInternalLocalTrigger: " 00846 << this->numberSavedInternalLocalTrigger() << std::endl; 00847 this->HeadFragment::dump(str); 00848 return str << "}" << std::endl; 00849 }
unsigned int DayaBay::HeadFragment::size | ( | ) | const [virtual, inherited] |
Reimplemented from DayaBay::RawFragment.
Definition at line 713 of file RawData.cc.
00714 { 00715 return DataFormat::HeadFragment::size; 00716 }
unsigned int DayaBay::HeadFragment::status | ( | ) | const [inherited] |
Definition at line 723 of file RawData.cc.
00724 { 00725 return this->getValue(DataFormat::HeadFragment::statusLine, 00726 DataFormat::HeadFragment::statusBitOffset, 00727 DataFormat::HeadFragment::statusBitLength); 00728 }
unsigned int DayaBay::HeadFragment::triggerNumber | ( | ) | const [inherited] |
Definition at line 730 of file RawData.cc.
00731 { 00732 return this->getValue(DataFormat::HeadFragment::triggerNumberLine, 00733 DataFormat::HeadFragment::triggerNumberBitOffset, 00734 DataFormat::HeadFragment::triggerNumberBitLength); 00735 }
unsigned int DayaBay::RawFragment::type | ( | ) | const [inherited] |
Reimplemented from DayaBay::RawData.
Definition at line 681 of file RawData.cc.
00682 { 00683 return this->getValue(DataFormat::RawFragment::typeLine, 00684 DataFormat::RawFragment::typeBitOffset, 00685 DataFormat::RawFragment::typeBitLength); 00686 }
unsigned int DayaBay::RawData::majorVersion | ( | ) | const [inherited] |
Definition at line 58 of file RawData.cc.
00059 { 00060 // Return the major version of this data 00061 return m_majorVersion; 00062 }
unsigned int DayaBay::RawData::minorVersion | ( | ) | const [inherited] |
Definition at line 64 of file RawData.cc.
00065 { 00066 // Return the minor version of this data 00067 return m_minorVersion; 00068 }
bool DayaBay::RawData::isEventType | ( | ) | const [inherited] |
Definition at line 46 of file RawData.cc.
00047 { 00048 // Is this event data? 00049 return (this->type()==DataFormat::Event::type); 00050 }
bool DayaBay::RawData::isModuleType | ( | ) | const [inherited] |
Definition at line 52 of file RawData.cc.
00053 { 00054 // Is this module data? 00055 return (this->type()==DataFormat::Module::type); 00056 }
DayaBay::RawData * DayaBay::RawData::makeNewData | ( | unsigned int * | buffer = 0 , |
|
unsigned int | majorVersion = 0 , |
|||
unsigned int | minorVersion = 0 , |
|||
bool | isOwner = false | |||
) | [static, inherited] |
Definition at line 101 of file RawData.cc.
00104 { 00105 // Make a new raw data object. Automatically set the correct class 00106 // type using the type() defined in the raw data. 00107 // 00108 // The caller is responsible for deleting the returned data object. 00109 00110 DayaBay::RawData* newData = 0; 00111 // Convert to the proper record type 00112 DayaBay::RawData rawData(buffer,majorVersion,minorVersion); 00113 if( rawData.isEventType() ){ 00114 newData = new DayaBay::RawEvent(buffer, majorVersion, minorVersion, 00115 isOwner); 00116 }else if( rawData.isModuleType() ){ 00117 newData = new DayaBay::RawModule(buffer, majorVersion, minorVersion, 00118 isOwner); 00119 }else{ 00120 newData = new DayaBay::RawData(buffer, majorVersion, minorVersion, 00121 isOwner); 00122 } 00123 return newData; 00124 }
unsigned int * DayaBay::RawBuffer::buffer | ( | ) | const [inherited] |
Definition at line 52 of file RawBuffer.cc.
00053 { 00054 // Return the pointer to the internal memory buffer 00055 return m_buffer; 00056 }
unsigned int DayaBay::RawBuffer::bufferSize | ( | ) | const [inherited] |
Definition at line 58 of file RawBuffer.cc.
00059 { 00060 // Return the allocated size of the internal memory buffer, if known 00061 return m_bufferSize; 00062 }
bool DayaBay::RawBuffer::isOwner | ( | ) | const [inherited] |
Definition at line 64 of file RawBuffer.cc.
00065 { 00066 // Does this RawBuffer own this memory buffer? 00067 return m_isOwner; 00068 }
void DayaBay::RawBuffer::setOwner | ( | bool | isOwner = true |
) | [inherited] |
bool DayaBay::RawBuffer::isValid | ( | ) | const [virtual, inherited] |
Definition at line 74 of file RawBuffer.cc.
00075 { 00076 // Does this RawBuffer contain data? 00077 return (m_buffer != 0); 00078 }
unsigned int * DayaBay::RawBuffer::getPointer | ( | const unsigned int & | line | ) | const [inherited] |
Definition at line 80 of file RawBuffer.cc.
00081 { 00082 // Return a pointer to a specific line in the data block 00083 if(m_bufferSize>0 && line>=m_bufferSize) return 0; 00084 return (m_buffer + line); 00085 }
unsigned int DayaBay::RawBuffer::getValue | ( | const unsigned int & | line, | |
const unsigned int & | firstBit = 0 , |
|||
const unsigned int & | bitLength = 32 | |||
) | const [inherited] |
Definition at line 87 of file RawBuffer.cc.
00090 { 00091 // Read a value from the memory buffer 00092 // line = line number in the memory block (line = integer length) 00093 // firstBit = first bit to read (max=31) 00094 // bitLength = length of bits to read (max=32) 00095 if(bitLength>32 || firstBit>31) return 0; 00096 unsigned int* pointer = this->getPointer(line); 00097 if(!pointer) return 0; 00098 // Catch request for full line 00099 if(firstBit==0 && bitLength==32) return *pointer; 00100 // Prepare bit mask 00101 unsigned int oneBit = 0x1; 00102 unsigned int mask = 0; 00103 for(unsigned int shift=0; shift<bitLength; shift++) 00104 mask += (oneBit << shift); 00105 // Shift value, mask, and return 00106 return (*pointer >> firstBit) & mask; 00107 }
char * DayaBay::RawBuffer::getString | ( | const unsigned int & | line, | |
const unsigned int & | byteOffset = 0 | |||
) | const [inherited] |
Definition at line 109 of file RawBuffer.cc.
00111 { 00112 // Return a char pointer to a specific byte in the data block 00113 // line = line number in the memory block (line = integer length) 00114 // byteOffset = offset if string starts at an uneven byte position (max=3) 00115 if(byteOffset>3) return 0; 00116 unsigned int* pointer = this->getPointer(line); 00117 if(!pointer) return 0; 00118 return (char*)(pointer + byteOffset); 00119 }
unsigned int DayaBay::RawData::m_majorVersion [protected, inherited] |
unsigned int DayaBay::RawData::m_minorVersion [protected, inherited] |