#include <RawData.h>
Inheritance diagram for DayaBay::FeePeakData:
Public Member Functions | |
FeePeakData (unsigned int *buffer=0, unsigned int majorVersion=0, unsigned int minorVersion=0, unsigned int feeDataVersion=0, bool isOwner=false) | |
~FeePeakData () | |
virtual unsigned int | size () const |
virtual unsigned int | dataType () const |
unsigned int | feeDataVersion () const |
unsigned int | channel () const |
unsigned int | tdcChannel () const |
unsigned int | adcChannel () const |
unsigned int | tdc () const |
unsigned int | tdcHitCount () const |
unsigned int | adc () const |
unsigned int | peakCycle () const |
unsigned int | adcRange () const |
bool | hasAdcPedestal () const |
unsigned int | adcPedestal () const |
virtual std::ostream & | dump (std::ostream &str) |
bool | isLocalTriggerData () const |
bool | isFeePeakData () 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_feeDataVersion |
unsigned int | m_majorVersion |
unsigned int | m_minorVersion |
Definition at line 192 of file RawData.h.
DayaBay::FeePeakData::FeePeakData | ( | unsigned int * | buffer = 0 , |
|
unsigned int | majorVersion = 0 , |
|||
unsigned int | minorVersion = 0 , |
|||
unsigned int | feeDataVersion = 0 , |
|||
bool | isOwner = false | |||
) |
Definition at line 1453 of file RawData.cc.
01458 : DataFragment(buffer,majorVersion,minorVersion,isOwner), 01459 m_feeDataVersion(feeDataVersion) 01460 { 01461 // Default constructor 01462 }
DayaBay::FeePeakData::~FeePeakData | ( | ) |
unsigned int DayaBay::FeePeakData::size | ( | ) | const [virtual] |
Reimplemented from DayaBay::DataFragment.
Definition at line 1474 of file RawData.cc.
01475 { 01476 return DataFormat::FeePeakData::size; 01477 }
unsigned int DayaBay::FeePeakData::dataType | ( | ) | const [virtual] |
Reimplemented from DayaBay::DataFragment.
Definition at line 1479 of file RawData.cc.
01480 { 01481 return DataFormat::FeePeakData::dataType; 01482 }
unsigned int DayaBay::FeePeakData::feeDataVersion | ( | ) | const |
unsigned int DayaBay::FeePeakData::channel | ( | ) | const |
unsigned int DayaBay::FeePeakData::tdcChannel | ( | ) | const |
Definition at line 1499 of file RawData.cc.
01500 { 01501 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01502 return this->getValue(DataFormat::FeePeakData_v1::tdcChannelLine, 01503 DataFormat::FeePeakData_v1::tdcChannelBitOffset, 01504 DataFormat::FeePeakData_v1::tdcChannelBitLength); 01505 return this->getValue(DataFormat::FeePeakData::tdcChannelLine, 01506 DataFormat::FeePeakData::tdcChannelBitOffset, 01507 DataFormat::FeePeakData::tdcChannelBitLength); 01508 }
unsigned int DayaBay::FeePeakData::adcChannel | ( | ) | const |
Definition at line 1488 of file RawData.cc.
01489 { 01490 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01491 return this->getValue(DataFormat::FeePeakData_v1::adcChannelLine, 01492 DataFormat::FeePeakData_v1::adcChannelBitOffset, 01493 DataFormat::FeePeakData_v1::adcChannelBitLength); 01494 return this->getValue(DataFormat::FeePeakData::adcChannelLine, 01495 DataFormat::FeePeakData::adcChannelBitOffset, 01496 DataFormat::FeePeakData::adcChannelBitLength); 01497 }
unsigned int DayaBay::FeePeakData::tdc | ( | ) | const |
Definition at line 1510 of file RawData.cc.
01511 { 01512 return this->getValue(DataFormat::FeePeakData::tdcLine, 01513 DataFormat::FeePeakData::tdcBitOffset, 01514 DataFormat::FeePeakData::tdcBitLength); 01515 }
unsigned int DayaBay::FeePeakData::tdcHitCount | ( | ) | const |
Definition at line 1517 of file RawData.cc.
01518 { 01519 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01520 return this->getValue(DataFormat::FeePeakData_v1::tdcHitCountLine, 01521 DataFormat::FeePeakData_v1::tdcHitCountBitOffset, 01522 DataFormat::FeePeakData_v1::tdcHitCountBitLength); 01523 return this->getValue(DataFormat::FeePeakData::tdcHitCountLine, 01524 DataFormat::FeePeakData::tdcHitCountBitOffset, 01525 DataFormat::FeePeakData::tdcHitCountBitLength); 01526 }
unsigned int DayaBay::FeePeakData::adc | ( | ) | const |
Definition at line 1550 of file RawData.cc.
01551 { 01552 return this->getValue(DataFormat::FeePeakData::adcLine, 01553 DataFormat::FeePeakData::adcBitOffset, 01554 DataFormat::FeePeakData::adcBitLength); 01555 }
unsigned int DayaBay::FeePeakData::peakCycle | ( | ) | const |
Definition at line 1528 of file RawData.cc.
01529 { 01530 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01531 return this->getValue(DataFormat::FeePeakData_v1::peakCycleLine, 01532 DataFormat::FeePeakData_v1::peakCycleBitOffset, 01533 DataFormat::FeePeakData_v1::peakCycleBitLength); 01534 return this->getValue(DataFormat::FeePeakData::peakCycleLine, 01535 DataFormat::FeePeakData::peakCycleBitOffset, 01536 DataFormat::FeePeakData::peakCycleBitLength); 01537 }
unsigned int DayaBay::FeePeakData::adcRange | ( | ) | const |
Definition at line 1539 of file RawData.cc.
01540 { 01541 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01542 return this->getValue(DataFormat::FeePeakData_v1::adcRangeLine, 01543 DataFormat::FeePeakData_v1::adcRangeBitOffset, 01544 DataFormat::FeePeakData_v1::adcRangeBitLength); 01545 return this->getValue(DataFormat::FeePeakData::adcRangeLine, 01546 DataFormat::FeePeakData::adcRangeBitOffset, 01547 DataFormat::FeePeakData::adcRangeBitLength); 01548 }
bool DayaBay::FeePeakData::hasAdcPedestal | ( | ) | const |
Definition at line 1566 of file RawData.cc.
01567 { 01568 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01569 return true; 01570 return false; 01571 };
unsigned int DayaBay::FeePeakData::adcPedestal | ( | ) | const |
Definition at line 1557 of file RawData.cc.
01558 { 01559 if( this->feeDataVersion() >= DataFormat::FeePeakData_v1::version ) 01560 return this->getValue(DataFormat::FeePeakData_v1::adcPedestalLine, 01561 DataFormat::FeePeakData_v1::adcPedestalBitOffset, 01562 DataFormat::FeePeakData_v1::adcPedestalBitLength); 01563 return 0; 01564 }
std::ostream & DayaBay::FeePeakData::dump | ( | std::ostream & | str | ) | [virtual] |
Reimplemented from DayaBay::DataFragment.
Definition at line 1573 of file RawData.cc.
01573 { 01574 // Print the module information 01575 str << "FeePeakData {" << std::endl << " "; 01576 this->DataFragment::dump(str); 01577 str << " channel: " << this->channel() << ", " 01578 << " tdc: " << this->tdc() << ", " 01579 << " adc: " << this->adc() << ", "; 01580 if( this->hasAdcPedestal() ) 01581 str << " adcPedestal: " << this->adcPedestal() << ", "; 01582 str << " peakCycle: " << this->peakCycle() << ", " 01583 << " adcRange: " << this->adcRange() << std::endl 01584 << "}" << std::endl; 01585 return str; 01586 }
bool DayaBay::DataFragment::isLocalTriggerData | ( | ) | const [inherited] |
Definition at line 975 of file RawData.cc.
00976 { 00977 // Is this a Local Trigger data fragment? 00978 return (this->dataType()==DataFormat::LocalTriggerData::dataType); 00979 }
bool DayaBay::DataFragment::isFeePeakData | ( | ) | const [inherited] |
Definition at line 981 of file RawData.cc.
00982 { 00983 // Is this a FEE Peak-finding data fragment? 00984 return (this->dataType()==DataFormat::FeePeakData::dataType); 00985 }
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::FeePeakData::m_feeDataVersion [protected] |
unsigned int DayaBay::RawData::m_majorVersion [protected, inherited] |
unsigned int DayaBay::RawData::m_minorVersion [protected, inherited] |