/* * VetrocWord.cpp * * Created on: Nov 7, 2017 * Author: Hovanes Egiyan */ #include "VetrocWord.hh" //#define DATA_TYPE(type) using namespace std; map VetrocWordBase::lspForWordTypeMap = VetrocWordBase::assignLspMap(); const uint32_t VetrocWord::blockNumberMask = 0x3FF00; const uint32_t VetrocWord::blockSizeMask = 0xFF; const uint32_t VetrocWord::triggerNumberMask = 0x3FFFFF; const uint32_t VetrocWord::scalerValueMask = 0x7FFFF; const uint32_t VetrocWord::binIdMask = 0x3F80000; const uint32_t VetrocWord::accidentalMask = 0x4000000; const uint32_t VetrocWord::scalerValueMask = 0x7FFFF; const uint32_t VetrocWord::binXMask = 0x1F80000; const uint32_t VetrocWord::binYMask = 0x7E000000; const uint32_t VetrocWord::triggerTimeMask = 0xFFFFFF; const uint32_t VetrocWord::triggerTimeMask = 0xFFFFFF; map VetrocWordBase::assignLspMap() { map tmpMap; // Define an array of all type that may need LSP uint32_t arrayOfMasks[] = { VETROC_DATA_TYPE_DEFINE, VETROC_DATA_TYPE_MASK, VETROC_DATA_SLOT_MASK, VETROC_BLOCK_LEVEL_MASK, VETROC_DATA_BLOCK_HEADER, VETROC_DATA_BLOCK_TRAILER, VETROC_DATA_EVENT_HEADER, VETROC_DATA_TRIGGER_TIME, VETROC_DATA_INVALID, VETROC_DATA_FILLER, VETROC_DUMMY_DATA, VETROC_DATA_TDCEVT, VETROC_DATA_BLKNUM_MASK, VETROC_DATA_WRDCNT_MASK, VetrocWord::getBlockNumberMask(), VetrocWord::getBlockSizeMask(), VetrocWord::getTriggerNumberMask(), VetrocWord::getScalerValueMask(), VetrocWord::getBinIdMask(), VetrocWord::getAccidentalMask(), VetrocWord::getScalerValueMask(), VetrocWord::getBinXMask(), VetrocWord::getBinYMask(), VetrocWord::getTriggerTimeMask(), VetrocWord::getTriggerTimeMask() }; for ( unsigned iMask = 0; iMask < (sizeof(arrayOfMasks) / sizeof(uint32_t)); iMask++ ) { tmpMap[arrayOfMasks[iMask]] = leastBitPosition( arrayOfMasks[iMask] ); } return tmpMap; }