From 362f583688f857c443114d0f228cab9aa501a9e5 Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Mon, 1 May 2023 16:20:16 -0400 Subject: [PATCH] Remove Regitser namespace, update Global and TRGOUT Mask, all channels settings UI --- ClassDigitizer.cpp | 142 +++--- ClassDigitizer.h | 80 ++-- DigiSettingsPanel.cpp | 575 +++++++++++++---------- DigiSettingsPanel.h | 56 ++- RegisterAddress.h | 1043 +++++++++++++++++++++-------------------- Scope.cpp | 132 +++--- Scope.h | 8 +- 7 files changed, 1092 insertions(+), 944 deletions(-) diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index 491b47f..5f73092 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -48,7 +48,7 @@ void Digitizer::Reset(){ ret = CAEN_DGTZ_Reset(handle); if( ret != 0 ) ErrorMsg(__func__); - ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::SoftwareClear_W, 1); + ret |= CAEN_DGTZ_WriteRegister(handle, DPP::SoftwareClear_W, 1); if( ret != 0 ) ErrorMsg("Reset-SoftwareClear_W"); } @@ -129,7 +129,7 @@ int Digitizer::OpenDigitizer(int boardID, int portID, bool program, bool verbose default : data->DPPTypeStr = "STD"; break; // stardard } /// change address 0xEF08 (5 bits), this will reflected in the 2nd word of the Board Agg. header. - ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardID, (DPPType & 0xF)); + ret = CAEN_DGTZ_WriteRegister(handle, DPP::BoardID, (DPPType & 0xF)); if ( verbose ){ PrintBoard(); if (DPPType < 0x80 ) { @@ -216,8 +216,8 @@ void Digitizer::SetChannelMask(uint32_t mask){ if( !isConnected ) return; channelMask = mask; ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask); - SaveSettingToFile(Register::DPP::ChannelEnableMask, mask); - SetSettingToMemory(Register::DPP::ChannelEnableMask, mask); + SaveSettingToFile(DPP::ChannelEnableMask, mask); + SetSettingToMemory(DPP::ChannelEnableMask, mask); ErrorMsg(__func__); } @@ -241,7 +241,7 @@ int Digitizer::ProgramBoard(){ /// | | +- (1) trigger overlap not allowed /// | +- (3) test pattern disable /// + (6) Self-trigger polarity, 1 = negative, 0 = Positive - ret = CAEN_DGTZ_WriteRegister(handle, (uint32_t) Register::BoardConfiguration , 0x000E0114); /// Channel Control Reg (indiv trg, seq readout) ?? + ret = CAEN_DGTZ_WriteRegister(handle, (uint32_t) BoardConfiguration , 0x000E0114); /// Channel Control Reg (indiv trg, seq readout) ?? /// Set the I/O level (CAEN_DGTZ_IOLevel_NIM or CAEN_DGTZ_IOLevel_TTL) ret |= CAEN_DGTZ_SetIOLevel(handle, IOlev); @@ -253,7 +253,7 @@ int Digitizer::ProgramBoard(){ ret |= CAEN_DGTZ_SetRecordLength(handle, 2000); /// Set Extras 2 to enable, this override Accusition mode, focring list mode - ret |= CAEN_DGTZ_WriteRegister(handle, Register::BoardConfiguration , 0x00E8114 ); + ret |= CAEN_DGTZ_WriteRegister(handle, BoardConfiguration , 0x00E8114 ); /// Set the digitizer acquisition mode (CAEN_DGTZ_SW_CONTROLLED or CAEN_DGTZ_S_IN_CONTROLLED) ret |= CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command @@ -273,9 +273,9 @@ int Digitizer::ProgramBoard(){ ret |= CAEN_DGTZ_SetRunSynchronizationMode(handle, CAEN_DGTZ_RUN_SYNC_Disabled); /// Set how many events to accumulate in the board memory before being available for readout - ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::NumberEventsPerAggregate_G + 0x7000, 100); - ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::AggregateOrganization, 0); - ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::MaxAggregatePerBlockTransfer, 50); + ret |= CAEN_DGTZ_WriteRegister(handle, DPP::NumberEventsPerAggregate_G + 0x7000, 100); + ret |= CAEN_DGTZ_WriteRegister(handle, DPP::AggregateOrganization, 0); + ret |= CAEN_DGTZ_WriteRegister(handle, DPP::MaxAggregatePerBlockTransfer, 50); ErrorMsg(__func__); return ret; @@ -287,9 +287,9 @@ int Digitizer::ProgramPHABoard(){ ret = CAEN_DGTZ_Reset(handle); printf("======== program board PHA\n"); - ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 62); - ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x0F8915); /// has Extra2, dual trace, input and trap-baseline - ///ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::BoardConfiguration, 0x0D8115); /// diable Extra2 + ret = CAEN_DGTZ_WriteRegister(handle, DPP::RecordLength_G + 0x7000, 62); + ret = CAEN_DGTZ_WriteRegister(handle, DPP::BoardConfiguration, 0x0F8915); /// has Extra2, dual trace, input and trap-baseline + ///ret = CAEN_DGTZ_WriteRegister(handle, DPP::BoardConfiguration, 0x0D8115); /// diable Extra2 //TODO change to write register ret = CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command @@ -307,26 +307,26 @@ int Digitizer::ProgramPHABoard(){ uint32_t address; - address = Register::DPP::PHA::DecayTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 5000 ); - address = Register::DPP::PHA::TrapezoidFlatTop; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x1A ); - address = Register::DPP::PHA::TrapezoidRiseTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 6 ); - address = Register::DPP::PHA::PeakingTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 6 ); - address = Register::DPP::PHA::RCCR2SmoothingFactor; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 4 ); - address = Register::DPP::PHA::InputRiseTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 6 ); - address = Register::DPP::PHA::TriggerThreshold; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 1000 ); - address = Register::DPP::PHA::PeakHoldOff; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x3E ); - address = Register::DPP::PHA::TriggerHoldOffWidth; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x3E ); - address = Register::DPP::PHA::RiseTimeValidationWindow;ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x0 ); + address = DPP::PHA::DecayTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 5000 ); + address = DPP::PHA::TrapezoidFlatTop; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x1A ); + address = DPP::PHA::TrapezoidRiseTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 6 ); + address = DPP::PHA::PeakingTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 6 ); + address = DPP::PHA::RCCR2SmoothingFactor; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 4 ); + address = DPP::PHA::InputRiseTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 6 ); + address = DPP::PHA::TriggerThreshold; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 1000 ); + address = DPP::PHA::PeakHoldOff; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x3E ); + address = DPP::PHA::TriggerHoldOffWidth; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x3E ); + address = DPP::PHA::RiseTimeValidationWindow;ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x0 ); - ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::ChannelDCOffset) + 0x7000 , 0xEEEE ); - ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::PreTrigger) + 0x7000 , 32 ); - ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::InputDynamicRange) + 0x7000 , 0x0 ); + ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::ChannelDCOffset) + 0x7000 , 0xEEEE ); + ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::PreTrigger) + 0x7000 , 32 ); + ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::InputDynamicRange) + 0x7000 , 0x0 ); - ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::NumberEventsPerAggregate_G) + 0x7000, 511); - ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::AggregateOrganization), 2); - ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::MaxAggregatePerBlockTransfer), 4); - ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::DPPAlgorithmControl) + 0x7000, 0xC30200f); + ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::NumberEventsPerAggregate_G) + 0x7000, 511); + ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::AggregateOrganization), 2); + ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::MaxAggregatePerBlockTransfer), 4); + ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::DPPAlgorithmControl) + 0x7000, 0xC30200f); if( ret != 0 ) { printf("==== set channels error.\n"); return 0;} @@ -381,23 +381,23 @@ unsigned int Digitizer::CalByteForBuffer(){ unsigned int aggOrgan; if( isConnected ){ - numAggBLT = ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer, 0, false); - chMask = ReadRegister(Register::DPP::ChannelEnableMask, 0, false); - boardCfg = ReadRegister(Register::DPP::BoardConfiguration, 0, false); - aggOrgan = ReadRegister(Register::DPP::AggregateOrganization, 0, false); + numAggBLT = ReadRegister(DPP::MaxAggregatePerBlockTransfer, 0, false); + chMask = ReadRegister(DPP::ChannelEnableMask, 0, false); + boardCfg = ReadRegister(DPP::BoardConfiguration, 0, false); + aggOrgan = ReadRegister(DPP::AggregateOrganization, 0, false); for( int pCh = 0; pCh < NChannel/2; pCh++){ - eventAgg[pCh] = ReadRegister(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 , false); - recordLength[pCh] = ReadRegister(Register::DPP::RecordLength_G, pCh * 2 , false); + eventAgg[pCh] = ReadRegister(DPP::NumberEventsPerAggregate_G, pCh * 2 , false); + recordLength[pCh] = ReadRegister(DPP::RecordLength_G, pCh * 2 , false); } }else{ - numAggBLT = GetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer); - chMask = GetSettingFromMemory(Register::DPP::ChannelEnableMask); - boardCfg = GetSettingFromMemory(Register::DPP::BoardConfiguration); - aggOrgan = GetSettingFromMemory(Register::DPP::AggregateOrganization); + numAggBLT = GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer); + chMask = GetSettingFromMemory(DPP::ChannelEnableMask); + boardCfg = GetSettingFromMemory(DPP::BoardConfiguration); + aggOrgan = GetSettingFromMemory(DPP::AggregateOrganization); for( int pCh = 0; pCh < NChannel/2; pCh++){ - eventAgg[pCh] = GetSettingFromMemory(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 ); - recordLength[pCh] = GetSettingFromMemory(Register::DPP::RecordLength_G, pCh * 2); + eventAgg[pCh] = GetSettingFromMemory(DPP::NumberEventsPerAggregate_G, pCh * 2 ); + recordLength[pCh] = GetSettingFromMemory(DPP::RecordLength_G, pCh * 2); } } @@ -432,7 +432,7 @@ int Digitizer::ReadData(){ } ret = CAEN_DGTZ_ReadData(handle, CAEN_DGTZ_SLAVE_TERMINATED_READOUT_MBLT, data->buffer, &(data->nByte)); - //uint32_t EventSize = ReadRegister(Register::DPP::EventSize); // Is it as same as data->nByte? + //uint32_t EventSize = ReadRegister(DPP::EventSize); // Is it as same as data->nByte? //printf("Read Buffer size %d byte, Event Size : %d byte \n", data->nByte, EventSize); if (ret || data->nByte == 0) { @@ -444,7 +444,7 @@ int Digitizer::ReadData(){ void Digitizer::PrintACQStatue(){ if( !isConnected ) return; - unsigned int status = ReadRegister(Register::DPP::AcquisitionStatus_R); + unsigned int status = ReadRegister(DPP::AcquisitionStatus_R); printf("=================== Print ACQ status \n"); printf(" 32 28 24 20 16 12 8 4 0\n"); @@ -463,7 +463,7 @@ void Digitizer::PrintACQStatue(){ //=========================================================== //=========================================================== //=========================================================== -void Digitizer::WriteRegister (Register::Reg registerAddress, uint32_t value, int ch, bool isSave2MemAndFile){ +void Digitizer::WriteRegister (Reg registerAddress, uint32_t value, int ch, bool isSave2MemAndFile){ printf("%30s[0x%04X](ch-%02d) [0x%04X]: 0x%08X \n", registerAddress.GetNameChar(), registerAddress.GetAddress(),ch, registerAddress.ActualAddress(ch), value); @@ -473,10 +473,10 @@ void Digitizer::WriteRegister (Register::Reg registerAddress, uint32_t value, in return; } - if( registerAddress.GetType() == Register::RW::ReadONLY ) return; + if( registerAddress.GetType() == RW::ReadONLY ) return; ret = CAEN_DGTZ_WriteRegister(handle, registerAddress.ActualAddress(ch), value); - if( ret == 0 && isSave2MemAndFile && registerAddress.GetType() == Register::RW::ReadWrite) { + if( ret == 0 && isSave2MemAndFile && registerAddress.GetType() == RW::ReadWrite) { SetSettingToMemory(registerAddress, value, ch); SaveSettingToFile(registerAddress, value, ch); } @@ -484,9 +484,9 @@ void Digitizer::WriteRegister (Register::Reg registerAddress, uint32_t value, in ErrorMsg("WriteRegister:" + std::to_string(registerAddress)); } -uint32_t Digitizer::ReadRegister(Register::Reg registerAddress, unsigned short ch, bool isSave2MemAndFile, std::string str ){ +uint32_t Digitizer::ReadRegister(Reg registerAddress, unsigned short ch, bool isSave2MemAndFile, std::string str ){ if( !isConnected ) return 0; - if( registerAddress.GetType() == Register::RW::WriteONLY ) return 0; + if( registerAddress.GetType() == RW::WriteONLY ) return 0; ret = CAEN_DGTZ_ReadRegister(handle, registerAddress.ActualAddress(ch), &returnData); @@ -518,9 +518,9 @@ uint32_t Digitizer::PrintRegister(uint32_t address, std::string msg){ } //========================================== setting file IO -Register::Reg Digitizer::FindRegister(uint32_t address){ +Reg Digitizer::FindRegister(uint32_t address){ - Register::Reg tempReg; + Reg tempReg; ///========= Find Match Register for( int p = 0; p < (int) RegisterDPPList[p]; p++){ if( address == RegisterDPPList[p].GetAddress() ) { @@ -559,23 +559,23 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){ /// board setting for( int p = 0; p < (int) RegisterDPPList.size(); p++){ - if( RegisterDPPList[p].GetType() == Register::RW::WriteONLY) continue; + if( RegisterDPPList[p].GetType() == RW::WriteONLY) continue; ReadRegister(RegisterDPPList[p]); } - channelMask = GetSettingFromMemory(Register::DPP::ChannelEnableMask); + channelMask = GetSettingFromMemory(DPP::ChannelEnableMask); /// Channels Setting for( int ch = 0; ch < NChannel; ch ++){ if( DPPType == V1730_DPP_PHA_CODE ){ for( int p = 0; p < (int) RegisterPHAList.size(); p++){ - if( RegisterPHAList[p].GetType() == Register::RW::WriteONLY) continue; + if( RegisterPHAList[p].GetType() == RW::WriteONLY) continue; ReadRegister(RegisterPHAList[p], ch); } } if( DPPType == V1730_DPP_PSD_CODE ){ for( int p = 0; p < (int) RegisterPSDList.size(); p++){ - if( RegisterPSDList[p].GetType() == Register::RW::WriteONLY) continue; + if( RegisterPSDList[p].GetType() == RW::WriteONLY) continue; ReadRegister(RegisterPSDList[p], ch); } } @@ -587,11 +587,11 @@ void Digitizer::ProgramSettingsToBoard(){ if( !isConnected ) return; if( isDummy ) return; - Register::Reg haha; + Reg haha; /// board setting for( int p = 0; p < (int) RegisterDPPList[p]; p++){ - if( RegisterDPPList[p].GetType() == Register::RW::ReadONLY) continue; + if( RegisterDPPList[p].GetType() == RW::ReadONLY) continue; haha = RegisterDPPList[p]; WriteRegister(haha, GetSettingFromMemory(haha), -1, false); usleep(100 * 1000); @@ -600,7 +600,7 @@ void Digitizer::ProgramSettingsToBoard(){ for( int ch = 0; ch < NChannel; ch ++){ if( DPPType == V1730_DPP_PHA_CODE ){ for( int p = 0; p < (int) RegisterPHAList[p]; p++){ - if( RegisterPHAList[p].GetType() == Register::RW::ReadONLY) continue; + if( RegisterPHAList[p].GetType() == RW::ReadONLY) continue; haha = RegisterPHAList[p]; WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); usleep(100 * 1000); @@ -608,7 +608,7 @@ void Digitizer::ProgramSettingsToBoard(){ } if( DPPType == V1730_DPP_PSD_CODE ){ for( int p = 0; p < (int) RegisterPSDList[p]; p++){ - if( RegisterPSDList[p].GetType() == Register::RW::ReadONLY) continue; + if( RegisterPSDList[p].GetType() == RW::ReadONLY) continue; haha = RegisterPHAList[p]; WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); usleep(100 * 1000); @@ -617,13 +617,13 @@ void Digitizer::ProgramSettingsToBoard(){ } } -void Digitizer::SetSettingToMemory(Register::Reg registerAddress, unsigned int value, unsigned short ch ){ +void Digitizer::SetSettingToMemory(Reg registerAddress, unsigned int value, unsigned short ch ){ unsigned short index = registerAddress.Index(ch); if( index > SETTINGSIZE ) return; setting[index] = value; } -unsigned int Digitizer::GetSettingFromMemory(Register::Reg registerAddress, unsigned short ch ){ +unsigned int Digitizer::GetSettingFromMemory(Reg registerAddress, unsigned short ch ){ unsigned short index = registerAddress.Index(ch); if( index > SETTINGSIZE ) return 0xFFFF; return setting[index] ; @@ -668,7 +668,7 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){ settingFileName = fileName; fclose (settingFile); - uint32_t fileDPP = ((ReadSettingFromFile(Register::DPP::AMCFirmwareRevision_R, 0) >> 8) & 0xFF); + uint32_t fileDPP = ((ReadSettingFromFile(DPP::AMCFirmwareRevision_R, 0) >> 8) & 0xFF); /// compare seeting DPP version; if( isConnected && DPPType != (int) fileDPP ){ @@ -685,7 +685,7 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){ if( dummy == 0 ) printf("reach the end of file\n"); - uint32_t boardInfo = GetSettingFromMemory(Register::DPP::BoardInfo_R); + uint32_t boardInfo = GetSettingFromMemory(DPP::BoardInfo_R); if( (boardInfo & 0xFF) == 0x0E ) ch2ns = 4.0; if( (boardInfo & 0xFF) == 0x0B ) ch2ns = 2.0; @@ -697,7 +697,7 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){ } } -unsigned int Digitizer::ReadSettingFromFile(Register::Reg registerAddress, unsigned short ch){ +unsigned int Digitizer::ReadSettingFromFile(Reg registerAddress, unsigned short ch){ if ( !settingFileExist ) return -1; unsigned short index = registerAddress.Index(ch); @@ -717,7 +717,7 @@ unsigned int Digitizer::ReadSettingFromFile(Register::Reg registerAddress, unsig } -void Digitizer::SaveSettingToFile(Register::Reg registerAddress, unsigned int value, unsigned short ch){ +void Digitizer::SaveSettingToFile(Reg registerAddress, unsigned int value, unsigned short ch){ if ( !settingFileExist ) return ; unsigned short index = registerAddress.Index(ch); @@ -757,7 +757,7 @@ void Digitizer::SaveAllSettingsAsText(std::string fileName){ return; } - Register::Reg haha; + Reg haha; for( unsigned int i = 0; i < SETTINGSIZE ; i++){ haha.SetName(""); @@ -779,9 +779,9 @@ void Digitizer::SaveAllSettingsAsText(std::string fileName){ } if( haha.GetName() != "" ) { std::string typeStr ; - if( haha.GetType() == Register::RW::ReadWrite ) typeStr = "R/W"; - if( haha.GetType() == Register::RW::ReadONLY ) typeStr = "R "; - if( haha.GetType() == Register::RW::WriteONLY ) typeStr = " W"; + if( haha.GetType() == RW::ReadWrite ) typeStr = "R/W"; + if( haha.GetType() == RW::ReadONLY ) typeStr = "R "; + if( haha.GetType() == RW::WriteONLY ) typeStr = " W"; fprintf( txtFile, "0x%04X %30s 0x%08X %s %u\n", actualAddress, haha.GetNameChar(), setting[i], @@ -853,11 +853,11 @@ void Digitizer::ErrorMsg(std::string header){ //============================== DPP-Alpgorthm Control void Digitizer::SetDPPAlgorithmControl(uint32_t bit, int ch){ - WriteRegister( Register::DPP::DPPAlgorithmControl, bit, ch); + WriteRegister( DPP::DPPAlgorithmControl, bit, ch); if( ret != 0 ) ErrorMsg(__func__); } -unsigned int Digitizer::ReadBits(Register::Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ){ +unsigned int Digitizer::ReadBits(Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ){ int tempCh = ch; if (ch < 0 && address < 0x8000 ) tempCh = 0; /// take ch-0 uint32_t bit = ReadRegister(address, tempCh); @@ -865,7 +865,7 @@ unsigned int Digitizer::ReadBits(Register::Reg address, unsigned int bitLength, return bit; } -void Digitizer::SetBits(Register::Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch){ +void Digitizer::SetBits(Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch){ ///printf("address : 0x%X, value : 0x%X, len : %d, pos : %d, ch : %d \n", address, bitValue, bitLength, bitSmallestPos, ch); uint32_t bit ; uint32_t bitmask = (uint(pow(2, bitLength)-1) << bitSmallestPos); diff --git a/ClassDigitizer.h b/ClassDigitizer.h index b84638c..53163d7 100644 --- a/ClassDigitizer.h +++ b/ClassDigitizer.h @@ -92,10 +92,10 @@ class Digitizer{ /// write value to digitizer, memory, and settingFile (if exist) /// ONLY WriteRegister can have ch = -1, for writting all channels /// for board setting, ignore ch - void WriteRegister (Register::Reg registerAddress, uint32_t value, int ch = -1, bool isSave2MemAndFile = true); + void WriteRegister (Reg registerAddress, uint32_t value, int ch = -1, bool isSave2MemAndFile = true); /// read value from digitizer and memory, and save to memory, and settingFile(if exist), /// for board setting, ignore ch - uint32_t ReadRegister (Register::Reg registerAddress, unsigned short ch = 0, bool isSave2MemAndFile = true, std::string str = "" ); + uint32_t ReadRegister (Reg registerAddress, unsigned short ch = 0, bool isSave2MemAndFile = true, std::string str = "" ); uint32_t PrintRegister(uint32_t address, std::string msg); //^================ Get Board info @@ -116,14 +116,14 @@ class Digitizer{ int GetErrorCode() const {return ret;} //^================ Setting - Register::Reg FindRegister(uint32_t address); + Reg FindRegister(uint32_t address); /// board <--> memory functions void ReadAllSettingsFromBoard (bool force = false); void ProgramSettingsToBoard (); /// simply read settings from memory - void SetSettingToMemory (Register::Reg registerAddress, unsigned int value, unsigned short ch = 0); - unsigned int GetSettingFromMemory (Register::Reg registerAddress, unsigned short ch = 0); + void SetSettingToMemory (Reg registerAddress, unsigned int value, unsigned short ch = 0); + unsigned int GetSettingFromMemory (Reg registerAddress, unsigned short ch = 0); void PrintSettingFromMemory (); unsigned int * GetSettings() {return setting;}; @@ -137,51 +137,51 @@ class Digitizer{ /// load setting file to memory /// if problem, return -1; load without problem, return 0; int LoadSettingBinaryToMemory (std::string fileName); - void SaveSettingToFile (Register::Reg registerAddress, unsigned int value, unsigned short ch = 0); /// also save to memory - unsigned int ReadSettingFromFile (Register::Reg registerAddress, unsigned short ch = 0); /// read from setting binary + void SaveSettingToFile (Reg registerAddress, unsigned int value, unsigned short ch = 0); /// also save to memory + unsigned int ReadSettingFromFile (Reg registerAddress, unsigned short ch = 0); /// read from setting binary //============ old methods, that only manipulate digitizer register, not setting in memory void SetDPPAlgorithmControl(uint32_t bit, int ch); - unsigned int ReadBits(Register::Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ); - void SetBits(Register::Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch); - void SetBits(Register::Reg address, std::pair bit, unsigned int bitValue, int ch){ SetBits(address, bitValue, bit.first, bit.second, ch);} + unsigned int ReadBits(Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ); + void SetBits(Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch); + void SetBits(Reg address, std::pair bit, unsigned int bitValue, int ch){ SetBits(address, bitValue, bit.first, bit.second, ch);} static unsigned int ExtractBits(uint32_t value, std::pair bit){ return ((value >> bit.second) & uint(pow(2, bit.first)-1) ); } //====== Board Config breakDown - bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(Register::DPP::BoardConfiguration) & 0x1 );} - bool IsDecimateTrace() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 1) & 0x1 );} - bool IsTriggerPropagate() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 2) & 0x1 );} - bool IsDualTrace() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 11) & 0x1 );} - unsigned short AnaProbe1Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 12) & 0x3 );} - unsigned short AnaProbe2Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 14) & 0x3 );} - bool IsRecordTrace() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 16) & 0x1 );} - bool IsEnabledExtra2() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 17) & 0x1 );} - bool IsRecordTimeStamp() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 18) & 0x1 );} - bool IsRecordEnergy() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 19) & 0x1 );} - unsigned short DigiProbe1Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 20) & 0xF );} - unsigned short DigiProbe2Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 26) & 0x7 );} + bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(DPP::BoardConfiguration) & 0x1 );} + bool IsDecimateTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 1) & 0x1 );} + bool IsTriggerPropagate() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 2) & 0x1 );} + bool IsDualTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 11) & 0x1 );} + unsigned short AnaProbe1Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 12) & 0x3 );} + unsigned short AnaProbe2Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 14) & 0x3 );} + bool IsRecordTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 16) & 0x1 );} + bool IsEnabledExtra2() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 17) & 0x1 );} + bool IsRecordTimeStamp() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 18) & 0x1 );} + bool IsRecordEnergy() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 19) & 0x1 );} + unsigned short DigiProbe1Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 20) & 0xF );} + unsigned short DigiProbe2Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 26) & 0x7 );} //====== DPP Algorithm Contol breakdown - unsigned short TrapReScaling(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 0) & 0x1F );} - unsigned short TraceDecimation(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 8) & 0x3 );} - unsigned short TraceDecimationGain(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 10) & 0x3 );} - unsigned short PeakMean(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 12) & 0x3 );} - unsigned short Polarity(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 16) & 0x1 );} - unsigned short TriggerMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 18) & 0x3 );} - unsigned short BaseLineAvg(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 18) & 0x7 );} - unsigned short DisableSelfTrigger(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 24) & 0x1 );} - unsigned short EnableRollOverFlag(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 26) & 0x1 );} - unsigned short EnablePileUpFlag(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 27) & 0x1 );} + unsigned short TrapReScaling(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 0) & 0x1F );} + unsigned short TraceDecimation(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 8) & 0x3 );} + unsigned short TraceDecimationGain(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 10) & 0x3 );} + unsigned short PeakMean(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 12) & 0x3 );} + unsigned short Polarity(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 16) & 0x1 );} + unsigned short TriggerMode(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 18) & 0x3 );} + unsigned short BaseLineAvg(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 18) & 0x7 );} + unsigned short DisableSelfTrigger(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 24) & 0x1 );} + unsigned short EnableRollOverFlag(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 26) & 0x1 );} + unsigned short EnablePileUpFlag(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 27) & 0x1 );} //====== DPP Algorithm Contol 2 breakdown - unsigned short LocalShapeMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 0) & 0x7 );} - unsigned short LocalTrigValidMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 4) & 0x7 );} - unsigned short Extra2Option(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 8) & 0x3 );} - unsigned short VetoSource(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 14) & 0x3 );} - unsigned short TrigCounter(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 16) & 0x3 );} - unsigned short ActiveBaseLineCal(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 18) & 0x1 );} - unsigned short TagCorrelatedEvents(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 19) & 0x1 );} - unsigned short OptimizeBaseLineRestorer(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 29) & 0x1 );} + unsigned short LocalShapeMode(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 0) & 0x7 );} + unsigned short LocalTrigValidMode(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 4) & 0x7 );} + unsigned short Extra2Option(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 8) & 0x3 );} + unsigned short VetoSource(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 14) & 0x3 );} + unsigned short TrigCounter(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 16) & 0x3 );} + unsigned short ActiveBaseLineCal(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 18) & 0x1 );} + unsigned short TagCorrelatedEvents(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 19) & 0x1 );} + unsigned short OptimizeBaseLineRestorer(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 29) & 0x1 );} //====== Acquistion Control vreakdown diff --git a/DigiSettingsPanel.cpp b/DigiSettingsPanel.cpp index 76815a0..0fd230a 100644 --- a/DigiSettingsPanel.cpp +++ b/DigiSettingsPanel.cpp @@ -32,7 +32,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai enableSignalSlot = false; setWindowTitle("Digitizer Settings"); - setGeometry(0, 0, 1300, 800); + setGeometry(0, 0, 1400, 800); tabWidget = new QTabWidget(this); setCentralWidget(tabWidget); @@ -75,7 +75,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai SetUpInfo("ROC version ", digi[ID]->GetROCVersion(), infoLayout[ID], 2, 2); SetUpInfo("AMC version ", digi[ID]->GetAMCVersion(), infoLayout[ID], 2, 4); - uint32_t boardInfo = digi[ID]->GetSettingFromMemory(Register::DPP::BoardInfo_R); + uint32_t boardInfo = digi[ID]->GetSettingFromMemory(DPP::BoardInfo_R); SetUpInfo("Family Code ", (boardInfo & 0xFF) == 0x0E ? "725 Family" : "730 Family", infoLayout[ID], 3, 0); SetUpInfo("Ch. Mem. Size ", ((boardInfo >> 8 ) & 0xFF) == 0x01 ? "640 kSample" : "5.12 MSample", infoLayout[ID], 3, 2); SetUpInfo("Board Type ", ((boardInfo >> 16) & 0xFF) == 0x10 ? "16-ch VME" : "DT, NIM, or 8-ch VME", infoLayout[ID], 3, 4); @@ -153,23 +153,23 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai buttonLayout->addWidget(bnRefreshSetting, rowID, 0); connect(bnRefreshSetting, &QPushButton::clicked, this, &DigiSettingsPanel::ReadSettingsFromBoard); - bnProgramPreDefined = new QPushButton("Clear Buffer/FIFO", this); + bnProgramPreDefined = new QPushButton("Program Default", this); buttonLayout->addWidget(bnProgramPreDefined, rowID, 1); connect(bnProgramPreDefined, &QPushButton::clicked, this, [=](){ digi[ID]->ProgramPHABoard();}); //TODO for PSD bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this); buttonLayout->addWidget(bnClearBuffer, rowID, 2); - connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(Register::DPP::SoftwareClear_W, 1);}); + connect(bnClearBuffer, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClear_W, 1);}); rowID ++; //--------------------------- bnSendSoftwareTriggerSignal = new QPushButton("Send SW Trigger Signal", this); buttonLayout->addWidget(bnSendSoftwareTriggerSignal, rowID, 0); - connect(bnSendSoftwareTriggerSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(Register::DPP::SoftwareTrigger_W, 1);}); + connect(bnSendSoftwareTriggerSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareTrigger_W, 1);}); bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this); buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1); - connect(bnSendSoftwareClockSyncSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(Register::DPP::SoftwareClockSync_W, 1);}); + connect(bnSendSoftwareClockSyncSignal, &QPushButton::clicked, this, [=](){ digi[ID]->WriteRegister(DPP::SoftwareClockSync_W, 1);}); bnSaveSettings = new QPushButton("Save Settings", this); buttonLayout->addWidget(bnSaveSettings, rowID, 2); @@ -187,95 +187,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard(); - //--------------- trigger - QWidget * triggerBox = new QWidget(this); - int row = settingLayout[iDigi]->rowCount(); - settingLayout[iDigi]->addWidget(triggerBox, row +1, 0, 3, 4); - triggerLayout[iDigi] = new QGridLayout(triggerBox); - triggerLayout[iDigi]->setAlignment(Qt::AlignLeft); - triggerLayout[iDigi]->setSpacing(2); - - for( int i = 0; i < MaxNChannels/2; i++){ - - if( i % 2 == 0 ){ - QLabel * chIDLabel = new QLabel(QString::number(2*i) + "-" + QString::number(2*i + 1), this); - chIDLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom); - triggerLayout[iDigi]->addWidget(chIDLabel, 0, 1 + i, 1, 2); - } - - bnGlobalTriggerMask[ID][i] = new QPushButton(this); - bnGlobalTriggerMask[ID][i]->setFixedSize(QSize(20,20)); - //bnGlobalTriggerMask[ID][i]->setToolTip("Ch-" + QString::number(2*i) + "," + QString::number(2*i+1)); - bnGlobalTriggerMask[ID][i]->setToolTipDuration(-1); - triggerLayout[iDigi]->addWidget(bnGlobalTriggerMask[ID][i], 1, 1 + i ); - - bnTRGOUTMask[ID][i] = new QPushButton(this); - bnTRGOUTMask[ID][i]->setFixedSize(QSize(20,20)); - bnTRGOUTMask[ID][i]->setToolTipDuration(-1); - triggerLayout[iDigi]->addWidget(bnTRGOUTMask[ID][i], 2, 1 + i ); - - } - - QLabel * lbGlobalTrg = new QLabel("Global Trigger Mask : ", this); - lbGlobalTrg->setAlignment(Qt::AlignRight | Qt::AlignCenter); - triggerLayout[iDigi]->addWidget(lbGlobalTrg, 1, 0); - - QLabel * lbMajorCoinWin = new QLabel("Coin. Win [ns] : ", this); - triggerLayout[iDigi]->addWidget(lbMajorCoinWin, 1, 9); - - sbGlbMajCoinWin[iDigi] = new RSpinBox(this); - sbGlbMajCoinWin[iDigi]->setMinimum(0); - sbGlbMajCoinWin[iDigi]->setMaximum(0xF * 4 * digi[iDigi]->GetCh2ns() ); - sbGlbMajCoinWin[iDigi]->setSingleStep(1); - triggerLayout[iDigi]->addWidget(sbGlbMajCoinWin[iDigi], 1, 10); - - QLabel * lbMajorLvl = new QLabel("Maj. Level", this); - lbMajorLvl->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); - triggerLayout[iDigi]->addWidget(lbMajorLvl, 0, 11); - - sbGlbMajLvl[iDigi] = new RSpinBox(this); - sbGlbMajLvl[iDigi]->setMinimum(0); - sbGlbMajLvl[iDigi]->setMaximum(16); - sbGlbMajLvl[iDigi]->setSingleStep(1); - - QLabel * lbOtherTrigger = new QLabel("OR trigger", this); - lbOtherTrigger->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); - triggerLayout[iDigi]->addWidget(lbOtherTrigger, 0, 12); - - cbGlbUseOtherTriggers[iDigi] = new RComboBox(this); - cbGlbUseOtherTriggers[iDigi]->addItem("None", 0); - cbGlbUseOtherTriggers[iDigi]->addItem("TRG-IN", 1); - cbGlbUseOtherTriggers[iDigi]->addItem("SW", 2); - cbGlbUseOtherTriggers[iDigi]->addItem("TRG-IN OR SW", 3); - triggerLayout[iDigi]->addWidget(cbGlbUseOtherTriggers[iDigi], 1, 12); - - QLabel * lbTrgOut = new QLabel("TRG-OUT Mask : ", this); - lbTrgOut->setAlignment(Qt::AlignRight | Qt::AlignCenter); - triggerLayout[iDigi]->addWidget(lbTrgOut, 2, 0); - - QLabel * lbTrgOutLogic = new QLabel("Logic : ", this); - lbTrgOutLogic->setAlignment(Qt::AlignRight | Qt::AlignCenter); - triggerLayout[iDigi]->addWidget(lbTrgOutLogic, 2, 9); - - cbTRGOUTLogic[iDigi] = new RComboBox(this); - cbTRGOUTLogic[iDigi]->addItem("OR", 0); - cbTRGOUTLogic[iDigi]->addItem("AND", 1); - cbTRGOUTLogic[iDigi]->addItem("Maj.", 3); - triggerLayout[iDigi]->addWidget(cbTRGOUTLogic[iDigi], 2, 10); - triggerLayout[iDigi]->addWidget(sbGlbMajLvl[iDigi], 1, 11); - - sbTRGOUTMajLvl[iDigi] = new RSpinBox(this); - sbTRGOUTMajLvl[iDigi]->setMinimum(0); - sbTRGOUTMajLvl[iDigi]->setMaximum(16); - sbTRGOUTMajLvl[iDigi]->setSingleStep(1); - triggerLayout[iDigi]->addWidget(sbTRGOUTMajLvl[iDigi], 2, 11); - - cbTRGOUTUseOtherTriggers[iDigi] = new RComboBox(this); - cbTRGOUTUseOtherTriggers[iDigi]->addItem("None", 0); - cbTRGOUTUseOtherTriggers[iDigi]->addItem("TRG-IN", 1); - cbTRGOUTUseOtherTriggers[iDigi]->addItem("SW", 2); - cbTRGOUTUseOtherTriggers[iDigi]->addItem("TRG-IN OR SW", 3); - triggerLayout[iDigi]->addWidget(cbTRGOUTUseOtherTriggers[iDigi], 2, 12); + SetUpGlobalTriggerMaskAndFrontPanelMask(); } @@ -350,7 +262,7 @@ void DigiSettingsPanel::SetUpInfo(QString label, std::string value, QGridLayout gLayout->addWidget(leInfo, row, col + 1); } -void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para, std::pair bit){ +void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Reg para, std::pair bit){ chkBox = new QCheckBox(label, this); gLayout->addWidget(chkBox, row, col); @@ -362,13 +274,13 @@ void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridL } -void DigiSettingsPanel::SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector> items, Register::Reg para, std::pair bit){ +void DigiSettingsPanel::SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector> items, Reg para, std::pair bit, int colspan){ QLabel * lab = new QLabel(label, this); lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); gLayout->addWidget(lab, row, col); cb = new RComboBox(this); - gLayout->addWidget(cb, row, col + 1); + gLayout->addWidget(cb, row, col + 1, 1, colspan); for(int i = 0; i < (int) items.size(); i++){ cb->addItem(QString::fromStdString(items[i].first), items[i].second); @@ -380,7 +292,7 @@ void DigiSettingsPanel::SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLa }); } -void DigiSettingsPanel::SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para){ +void DigiSettingsPanel::SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, Reg para){ QLabel * lab = new QLabel(label, this); lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); @@ -401,7 +313,7 @@ void DigiSettingsPanel::SetUpComboBox(RComboBox * &cb, QString label, QGridLayou } -void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para){ +void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout *gLayout, int row, int col, Reg para){ QLabel * lab = new QLabel(label, this); lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); gLayout->addWidget(lab, row, col); @@ -460,6 +372,186 @@ void DigiSettingsPanel::CleanUpGroupBox(QGroupBox * & gBox){ } +void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(){ + + QWidget * triggerBox = new QWidget(this); + int row = settingLayout[ID]->rowCount(); + settingLayout[ID]->addWidget(triggerBox, row +1, 0, 3, 4); + triggerLayout[ID] = new QGridLayout(triggerBox); + triggerLayout[ID]->setAlignment(Qt::AlignLeft); + triggerLayout[ID]->setSpacing(2); + + for( int i = 0; i < MaxNChannels/2; i++){ + + if( i % 2 == 0 ){ + QLabel * chIDLabel = new QLabel(QString::number(2*i) + "-" + QString::number(2*i + 1), this); + chIDLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom); + triggerLayout[ID]->addWidget(chIDLabel, 0, 1 + i, 1, 2); + } + + bnGlobalTriggerMask[ID][i] = new QPushButton(this); + bnGlobalTriggerMask[ID][i]->setFixedSize(QSize(20,20)); + bnGlobalTriggerMask[ID][i]->setToolTipDuration(-1); + triggerLayout[ID]->addWidget(bnGlobalTriggerMask[ID][i], 1, 1 + i ); + connect(bnGlobalTriggerMask[ID][i], &QPushButton::clicked, this, [=](){ + if( !enableSignalSlot) return; + + if( bnGlobalTriggerMask[ID][i]->styleSheet() == "" ){ + bnGlobalTriggerMask[ID][i]->setStyleSheet("background-color : green;"); + digi[ID]->SetBits(DPP::GlobalTriggerMask, {1, i}, 1, i); + }else{ + bnGlobalTriggerMask[ID][i]->setStyleSheet(""); + digi[ID]->SetBits(DPP::GlobalTriggerMask, {1, i}, 0, i); + } + }); + + bnTRGOUTMask[ID][i] = new QPushButton(this); + bnTRGOUTMask[ID][i]->setFixedSize(QSize(20,20)); + bnTRGOUTMask[ID][i]->setToolTipDuration(-1); + triggerLayout[ID]->addWidget(bnTRGOUTMask[ID][i], 2, 1 + i ); + connect(bnTRGOUTMask[ID][i], &QPushButton::clicked, this, [=](){ + if( !enableSignalSlot) return; + + if( bnTRGOUTMask[ID][i]->styleSheet() == "" ){ + bnTRGOUTMask[ID][i]->setStyleSheet("background-color : green;"); + digi[ID]->SetBits(DPP::FrontPanelTRGOUTEnableMask, {1, i}, 1, i); + }else{ + bnTRGOUTMask[ID][i]->setStyleSheet(""); + digi[ID]->SetBits(DPP::FrontPanelTRGOUTEnableMask, {1, i}, 0, i); + } + }); + } + + QLabel * lbGlobalTrg = new QLabel("Global Trigger Mask : ", this); + lbGlobalTrg->setAlignment(Qt::AlignRight | Qt::AlignCenter); + triggerLayout[ID]->addWidget(lbGlobalTrg, 1, 0); + + //*============================================ + QLabel * lbMajorCoinWin = new QLabel("Coin. Win [ns] : ", this); + triggerLayout[ID]->addWidget(lbMajorCoinWin, 1, 9); + + sbGlbMajCoinWin[ID] = new RSpinBox(this); + sbGlbMajCoinWin[ID]->setMinimum(0); + sbGlbMajCoinWin[ID]->setMaximum(0xF * 4 * digi[ID]->GetCh2ns() ); + sbGlbMajCoinWin[ID]->setSingleStep(4 * digi[ID]->GetCh2ns()); + triggerLayout[ID]->addWidget(sbGlbMajCoinWin[ID], 1, 10); + connect(sbGlbMajCoinWin[ID], &RSpinBox::valueChanged, this, [=](){ + if( !enableSignalSlot ) return; + sbGlbMajCoinWin[ID]->setStyleSheet("color : blue;"); + }); + + connect(sbGlbMajCoinWin[ID], &RSpinBox::returnPressed, this, [=](){ + if( !enableSignalSlot ) return; + + if( sbGlbMajCoinWin[ID]->decimals() == 0 && sbGlbMajCoinWin[ID]->singleStep() != 1) { + double step = sbGlbMajCoinWin[ID]->singleStep(); + double value = sbGlbMajCoinWin[ID]->value(); + sbGlbMajCoinWin[ID]->setValue( (std::round(value/step)*step)); + } + + sbGlbMajCoinWin[ID]->setStyleSheet(""); + digi[ID]->SetBits(DPP::GlobalTriggerMask, DPP::Bit_GlobalTriggerMask::MajorCoinWin, sbGlbMajCoinWin[ID]->value() / 4 / digi[ID]->GetCh2ns(), -1); + }); + + //*============================================ + QLabel * lbMajorLvl = new QLabel("Maj. Level", this); + lbMajorLvl->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); + triggerLayout[ID]->addWidget(lbMajorLvl, 0, 11); + + sbGlbMajLvl[ID] = new RSpinBox(this); + sbGlbMajLvl[ID]->setMinimum(0); + sbGlbMajLvl[ID]->setMaximum(7); + sbGlbMajLvl[ID]->setSingleStep(1); + connect(sbGlbMajLvl[ID], &RSpinBox::valueChanged, this, [=](){ + if( !enableSignalSlot ) return; + sbGlbMajLvl[ID]->setStyleSheet("color : blue;"); + }); + + connect(sbGlbMajLvl[ID], &RSpinBox::returnPressed, this, [=](){ + if( !enableSignalSlot ) return; + sbGlbMajLvl[ID]->setStyleSheet(""); + digi[ID]->SetBits(DPP::GlobalTriggerMask, DPP::Bit_GlobalTriggerMask::MajorLevel, sbGlbMajLvl[ID]->value(), -1); + + if( sbGlbMajLvl[ID]->value() > 0 ) { + sbGlbMajCoinWin[ID]->setEnabled(true); + }else{ + sbGlbMajCoinWin[ID]->setEnabled(false); + } + + }); + + + QLabel * lbOtherTrigger = new QLabel("OR trigger", this); + lbOtherTrigger->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); + triggerLayout[ID]->addWidget(lbOtherTrigger, 0, 12); + + //*============================================ + cbGlbUseOtherTriggers[ID] = new RComboBox(this); + cbGlbUseOtherTriggers[ID]->addItem("None", 0); + cbGlbUseOtherTriggers[ID]->addItem("TRG-IN", 1); + cbGlbUseOtherTriggers[ID]->addItem("SW", 2); + cbGlbUseOtherTriggers[ID]->addItem("TRG-IN OR SW", 3); + triggerLayout[ID]->addWidget(cbGlbUseOtherTriggers[ID], 1, 12); + connect(cbGlbUseOtherTriggers[ID], &RComboBox::currentIndexChanged, this, [=](int index){ + if( !enableSignalSlot ) return; + digi[ID]->SetBits(DPP::GlobalTriggerMask, {2, 30}, index, -1); + }); + + + QLabel * lbTrgOut = new QLabel("TRG-OUT Mask : ", this); + lbTrgOut->setAlignment(Qt::AlignRight | Qt::AlignCenter); + triggerLayout[ID]->addWidget(lbTrgOut, 2, 0); + + QLabel * lbTrgOutLogic = new QLabel("Logic : ", this); + lbTrgOutLogic->setAlignment(Qt::AlignRight | Qt::AlignCenter); + triggerLayout[ID]->addWidget(lbTrgOutLogic, 2, 9); + + //*============================================ + cbTRGOUTLogic[ID] = new RComboBox(this); + cbTRGOUTLogic[ID]->addItem("OR", 0); + cbTRGOUTLogic[ID]->addItem("AND", 1); + cbTRGOUTLogic[ID]->addItem("Maj.", 2); + triggerLayout[ID]->addWidget(cbTRGOUTLogic[ID], 2, 10); + triggerLayout[ID]->addWidget(sbGlbMajLvl[ID], 1, 11); + + connect(cbTRGOUTLogic[ID], &RComboBox::currentIndexChanged, this, [=](int index){ + if( !enableSignalSlot ) return; + digi[ID]->SetBits(DPP::FrontPanelTRGOUTEnableMask, DPP::Bit_TRGOUTMask::TRGOUTLogic, index, -1); + }); + + //*============================================ + sbTRGOUTMajLvl[ID] = new RSpinBox(this); + sbTRGOUTMajLvl[ID]->setMinimum(0); + sbTRGOUTMajLvl[ID]->setMaximum(7); + sbTRGOUTMajLvl[ID]->setSingleStep(1); + triggerLayout[ID]->addWidget(sbTRGOUTMajLvl[ID], 2, 11); + + connect(sbTRGOUTMajLvl[ID], &RSpinBox::valueChanged, this, [=](){ + if( !enableSignalSlot ) return; + sbTRGOUTMajLvl[ID]->setStyleSheet("color : blue;"); + }); + + connect(sbTRGOUTMajLvl[ID], &RSpinBox::returnPressed, this, [=](){ + if( !enableSignalSlot ) return; + sbTRGOUTMajLvl[ID]->setStyleSheet(""); + digi[ID]->SetBits(DPP::FrontPanelTRGOUTEnableMask, DPP::Bit_TRGOUTMask::MajorLevel, sbTRGOUTMajLvl[ID]->value(), -1); + }); + + //*============================================ + cbTRGOUTUseOtherTriggers[ID] = new RComboBox(this); + cbTRGOUTUseOtherTriggers[ID]->addItem("None", 0); + cbTRGOUTUseOtherTriggers[ID]->addItem("TRG-IN", 1); + cbTRGOUTUseOtherTriggers[ID]->addItem("SW", 2); + cbTRGOUTUseOtherTriggers[ID]->addItem("TRG-IN OR SW", 3); + triggerLayout[ID]->addWidget(cbTRGOUTUseOtherTriggers[ID], 2, 12); + + connect(cbTRGOUTUseOtherTriggers[ID], &RComboBox::currentIndexChanged, this, [=](int index){ + if( !enableSignalSlot ) return; + digi[ID]->SetBits(DPP::FrontPanelTRGOUTEnableMask, {2, 30}, index, -1); + }); + +} + void DigiSettingsPanel::SetUpPHABoard(){ printf("============== %s \n", __func__); @@ -489,53 +581,59 @@ void DigiSettingsPanel::SetUpPHABoard(){ if( bnChEnableMask[ID][i]->styleSheet() == "" ){ bnChEnableMask[ID][i]->setStyleSheet("background-color : green;"); - digi[ID]->SetBits(Register::DPP::ChannelEnableMask, {1, i}, 1, i); + digi[ID]->SetBits(DPP::ChannelEnableMask, {1, i}, 1, i); }else{ bnChEnableMask[ID][i]->setStyleSheet(""); - digi[ID]->SetBits(Register::DPP::ChannelEnableMask, {1, i}, 0, i); + digi[ID]->SetBits(DPP::ChannelEnableMask, {1, i}, 0, i); } }); } - SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", settingLayout[ID], 1, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::EnableAutoDataFlush); - SetUpCheckBox(chkDecimateTrace[ID], "Decimate Trace", settingLayout[ID], 2, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DecimateTrace); - SetUpCheckBox(chkTrigPropagation[ID], "Trig. Propagate", settingLayout[ID], 3, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::TrigPropagation); - SetUpCheckBox(chkEnableExternalTrigger[ID], "Enable TRG-IN ", settingLayout[ID], 4, 0, Register::DPP::DisableExternalTrigger, {1, 0}); + SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", settingLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableAutoDataFlush); + SetUpCheckBox(chkDecimateTrace[ID], "Decimate Trace", settingLayout[ID], 2, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::DecimateTrace); + SetUpCheckBox(chkTrigPropagation[ID], "Trig. Propagate", settingLayout[ID], 3, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::TrigPropagation); + SetUpCheckBox(chkEnableExternalTrigger[ID], "Enable TRG-IN ", settingLayout[ID], 4, 0, DPP::DisableExternalTrigger, {1, 0}); - SetUpCheckBox(chkDualTrace[ID], "Dual Trace", settingLayout[ID], 1, 1, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DualTrace); - SetUpCheckBox(chkTraceRecording[ID], "Record Trace", settingLayout[ID], 2, 1, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::RecordTrace); - SetUpCheckBox(chkEnableExtra2[ID], "Enable Extra2", settingLayout[ID], 3, 1, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::EnableExtra2); + SetUpCheckBox(chkDualTrace[ID], "Dual Trace", settingLayout[ID], 1, 1, DPP::BoardConfiguration, DPP::Bit_BoardConfig::DualTrace); + + connect(chkDualTrace[ID], &QCheckBox::stateChanged, this, [=](int state){ + if( !enableSignalSlot) return; + cbAnaProbe2[ID]->setEnabled(state); + cbDigiProbe2[ID]->setEnabled(state); + }); - SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe 1 ", settingLayout[ID], 1, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe1_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe1); - SetUpComboBoxBit(cbAnaProbe2[ID], "Ana. Probe 2 ", settingLayout[ID], 2, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe2_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe2); - SetUpComboBoxBit(cbDigiProbe1[ID], "Digi. Probe 1 ", settingLayout[ID], 3, 2, Register::DPP::Bit_BoardConfig::ListDigiProbe1_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel1); - SetUpComboBoxBit(cbDigiProbe2[ID], "Digi. Probe 2 ", settingLayout[ID], 4, 2, {{"trigger", 0}}, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel2); - cbDigiProbe2[ID]->setEnabled(false); + SetUpCheckBox(chkTraceRecording[ID], "Record Trace", settingLayout[ID], 2, 1, DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace); + SetUpCheckBox(chkEnableExtra2[ID], "Enable Extra2", settingLayout[ID], 3, 1, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableExtra2); - SetUpSpinBox(sbAggNum[ID], "Agg. Num. / read", settingLayout[ID], 5, 0, Register::DPP::MaxAggregatePerBlockTransfer); - SetUpComboBox(cbAggOrg[ID], "Aggregate Organization ", settingLayout[ID], 6, 0, Register::DPP::AggregateOrganization); + SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe 1 ", settingLayout[ID], 1, 2, DPP::Bit_BoardConfig::ListAnaProbe1_PHA, DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe1); + SetUpComboBoxBit(cbAnaProbe2[ID], "Ana. Probe 2 ", settingLayout[ID], 2, 2, DPP::Bit_BoardConfig::ListAnaProbe2_PHA, DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe2); + SetUpComboBoxBit(cbDigiProbe1[ID], "Digi. Probe 1 ", settingLayout[ID], 3, 2, DPP::Bit_BoardConfig::ListDigiProbe1_PHA, DPP::BoardConfiguration, DPP::Bit_BoardConfig::DigiProbel1); + SetUpComboBoxBit(cbDigiProbe2[ID], "Digi. Probe 2 ", settingLayout[ID], 4, 2, {{"trigger", 0}}, DPP::BoardConfiguration, DPP::Bit_BoardConfig::DigiProbel2); + + SetUpSpinBox(sbAggNum[ID], "Agg. Num. / read", settingLayout[ID], 5, 0, DPP::MaxAggregatePerBlockTransfer); + SetUpComboBox(cbAggOrg[ID], "Aggregate Organization ", settingLayout[ID], 6, 0, DPP::AggregateOrganization); SetUpComboBoxBit(cbStartStopMode[ID], "Start/Stop Mode ", settingLayout[ID], 7, 0, {{"SW controlled", 0}, {"S-IN/GPI controlled", 1}, {"1st Trigger", 2}, {"LVDS controlled", 3}}, - Register::DPP::AcquisitionControl, Register::DPP::Bit_AcquistionControl::StartStopMode); + DPP::AcquisitionControl, DPP::Bit_AcquistionControl::StartStopMode); SetUpComboBoxBit(cbAcqStartArm[ID], "Acq Start/Arm ", settingLayout[ID], 8, 0, {{"ACQ STOP", 0}, - {"ACQ RUN", 1}},Register::DPP::AcquisitionControl, Register::DPP::Bit_AcquistionControl::ACQStartArm); + {"ACQ RUN", 1}},DPP::AcquisitionControl, DPP::Bit_AcquistionControl::ACQStartArm); - SetUpComboBoxBit(cbPLLRefClock[ID], "PLL Ref. Clock ", settingLayout[ID], 5, 2, {{"Internal 50 MHz", 0},{"Ext. CLK-IN", 1}}, Register::DPP::AcquisitionControl, Register::DPP::Bit_AcquistionControl::ACQStartArm); + SetUpComboBoxBit(cbPLLRefClock[ID], "PLL Ref. Clock ", settingLayout[ID], 5, 2, {{"Internal 50 MHz", 0},{"Ext. CLK-IN", 1}}, DPP::AcquisitionControl, DPP::Bit_AcquistionControl::ACQStartArm); - SetUpSpinBox(sbRunDelay[ID], "Run Delay [ns] ", settingLayout[ID], 6, 2, Register::DPP::RunStartStopDelay); + SetUpSpinBox(sbRunDelay[ID], "Run Delay [ns] ", settingLayout[ID], 6, 2, DPP::RunStartStopDelay); - SetUpComboBox(cbAnalogMonitorMode[ID], "Analog Monitor Mode ", settingLayout[ID], 7, 2, Register::DPP::AnalogMonitorMode); + SetUpComboBox(cbAnalogMonitorMode[ID], "Analog Monitor Mode ", settingLayout[ID], 7, 2, DPP::AnalogMonitorMode); - SetUpSpinBox(sbBufferGain[ID], "Buffer Occup. Gain ", settingLayout[ID], 8, 2, Register::DPP::BufferOccupancyGain); + SetUpSpinBox(sbBufferGain[ID], "Buffer Occup. Gain ", settingLayout[ID], 8, 2, DPP::BufferOccupancyGain); - SetUpComboBoxBit(cbLEMOMode[ID], "LEMO Mode ", settingLayout[ID], 9, 0, Register::DPP::Bit_FrontPanelIOControl::ListLEMOLevel, Register::DPP::FrontPanelIOControl, Register::DPP::Bit_FrontPanelIOControl::LEMOLevel); + SetUpComboBoxBit(cbLEMOMode[ID], "LEMO Mode ", settingLayout[ID], 9, 0, DPP::Bit_FrontPanelIOControl::ListLEMOLevel, DPP::FrontPanelIOControl, DPP::Bit_FrontPanelIOControl::LEMOLevel); ///============================ Trig out mode @@ -545,7 +643,7 @@ void DigiSettingsPanel::SetUpPHABoard(){ cbTRGOUTMode[ID] = new RComboBox(this); settingLayout[ID]->addWidget(cbTRGOUTMode[ID], 9, 3); - std::vector> items = Register::DPP::Bit_FrontPanelIOControl::ListTRGOUTConfig; + std::vector> items = DPP::Bit_FrontPanelIOControl::ListTRGOUTConfig; for(int i = 0; i < (int) items.size(); i++){ cbTRGOUTMode[ID]->addItem(QString::fromStdString(items[i].first), items[i].second); @@ -555,13 +653,13 @@ void DigiSettingsPanel::SetUpPHABoard(){ if( !enableSignalSlot ) return; if( index == 0 ) { - digi[ID]->SetBits(Register::DPP::FrontPanelIOControl, Register::DPP::Bit_FrontPanelIOControl::DisableTrgOut, 1, -1); + digi[ID]->SetBits(DPP::FrontPanelIOControl, DPP::Bit_FrontPanelIOControl::DisableTrgOut, 1, -1); }else{ - digi[ID]->SetBits(Register::DPP::FrontPanelIOControl, Register::DPP::Bit_FrontPanelIOControl::DisableTrgOut, 0, -1); + digi[ID]->SetBits(DPP::FrontPanelIOControl, DPP::Bit_FrontPanelIOControl::DisableTrgOut, 0, -1); unsigned short bit = (cbTRGOUTMode[ID]->currentData().toUInt() >> 14) & 0x3F ; - digi[ID]->SetBits(Register::DPP::FrontPanelIOControl, {6, 14}, bit, -1); + digi[ID]->SetBits(DPP::FrontPanelIOControl, {6, 14}, bit, -1); } @@ -580,38 +678,17 @@ void DigiSettingsPanel::SetUpPHAChannel(){ QGridLayout * inputLayout = new QGridLayout(inputBox); - RSpinBox * sbRecordLength; - SetUpSpinBox(sbRecordLength, "Record Length [G][ns] : ", inputLayout, 0, 0, Register::DPP::RecordLength_G); - - RComboBox * cbDynamicRange; - SetUpComboBox(cbDynamicRange, "Dynamic Range : ", inputLayout, 0, 2, Register::DPP::InputDynamicRange); - - RSpinBox * sbPreTrigger; - SetUpSpinBox(sbPreTrigger, "Pre-Trigger [ns] : ", inputLayout, 1, 0, Register::DPP::PreTrigger); - - RComboBox * cbRCCR2Smoothing; - SetUpComboBox(cbRCCR2Smoothing, "Smoothing factor : ", inputLayout, 1, 2, Register::DPP::PHA::RCCR2SmoothingFactor); - - RSpinBox * sbInputRiseTime; - SetUpSpinBox(sbInputRiseTime, "Rise Time [ns] : ", inputLayout, 2, 0, Register::DPP::PHA::InputRiseTime); - - RSpinBox * sbThreshold; - SetUpSpinBox(sbThreshold, "Threshold [LSB] : ", inputLayout, 2, 2, Register::DPP::PHA::TriggerThreshold); - - RSpinBox * sbRiseTimeValidWin; - SetUpSpinBox(sbRiseTimeValidWin, "Rise Time Valid. Win. [ns] : ", inputLayout, 3, 0, Register::DPP::PHA::RiseTimeValidationWindow); - - RSpinBox * sbTriggerHoldOff; - SetUpSpinBox(sbTriggerHoldOff, "Tigger Hold-off [ns] : ", inputLayout, 3, 2, Register::DPP::PHA::TriggerHoldOffWidth); - - RSpinBox * sbShapedTrigWidth; - SetUpSpinBox(sbShapedTrigWidth, "Shaped Trig. Width [ns] : ", inputLayout, 4, 0, Register::DPP::PHA::ShapedTriggerWidth); - - RSpinBox * sbDCOffset; - SetUpSpinBox(sbDCOffset, "DC Offset [%] : ", inputLayout, 4, 2, Register::DPP::ChannelDCOffset); - - RComboBox * cbPolarity; - SetUpComboBoxBit(cbPolarity, "Polarity : ", inputLayout, 5, 0, Register::DPP::Bit_DPPAlgorithmControl::ListPolarity, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::Polarity); + SetUpSpinBox(sbRecordLength[MaxNChannels], "Record Length [G][ns] : ", inputLayout, 0, 0, DPP::RecordLength_G); + SetUpComboBox(cbDynamicRange[MaxNChannels], "Dynamic Range : ", inputLayout, 0, 2, DPP::InputDynamicRange); + SetUpSpinBox(sbPreTrigger[MaxNChannels], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::PreTrigger); + SetUpComboBox(cbRCCR2Smoothing[MaxNChannels], "Smoothing factor : ", inputLayout, 1, 2, DPP::PHA::RCCR2SmoothingFactor); + SetUpSpinBox(sbInputRiseTime[MaxNChannels], "Rise Time [ns] : ", inputLayout, 2, 0, DPP::PHA::InputRiseTime); + SetUpSpinBox(sbThreshold[MaxNChannels], "Threshold [LSB] : ", inputLayout, 2, 2, DPP::PHA::TriggerThreshold); + SetUpSpinBox(sbRiseTimeValidWin[MaxNChannels], "Rise Time Valid. Win. [ns] : ", inputLayout, 3, 0, DPP::PHA::RiseTimeValidationWindow); + SetUpSpinBox(sbTriggerHoldOff[MaxNChannels], "Tigger Hold-off [ns] : ", inputLayout, 3, 2, DPP::PHA::TriggerHoldOffWidth); + SetUpSpinBox(sbShapedTrigWidth[MaxNChannels], "Shaped Trig. Width [ns] : ", inputLayout, 4, 0, DPP::PHA::ShapedTriggerWidth); + SetUpSpinBox(sbDCOffset[MaxNChannels], "DC Offset [%] : ", inputLayout, 4, 2, DPP::ChannelDCOffset); + SetUpComboBoxBit(cbPolarity[MaxNChannels], "Polarity : ", inputLayout, 5, 0, DPP::Bit_DPPAlgorithmControl::ListPolarity, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::Polarity); } @@ -621,39 +698,17 @@ void DigiSettingsPanel::SetUpPHAChannel(){ QGridLayout * trapLayout = new QGridLayout(trapBox); - RSpinBox * sbTrapRiseTime; - SetUpSpinBox(sbTrapRiseTime, "Rise Time [ns] : ", trapLayout, 0, 0, Register::DPP::PHA::TrapezoidRiseTime); - - RSpinBox * sbTrapFlatTop; - SetUpSpinBox(sbTrapFlatTop, "Flat Top [ns] : ", trapLayout, 0, 2, Register::DPP::PHA::TrapezoidFlatTop); - - RSpinBox * sbDecay; - SetUpSpinBox(sbDecay, "Decay [ns] : ", trapLayout, 1, 0, Register::DPP::PHA::DecayTime); - - RSpinBox * sbTrapScaling; - SetUpSpinBox(sbTrapScaling, "Rescaling : ", trapLayout, 1, 2, Register::DPP::PHA::DPPAlgorithmControl2_G); - - RSpinBox * sbPeaking; - SetUpSpinBox(sbPeaking, "Peaking [ns] : ", trapLayout, 2, 0, Register::DPP::PHA::PeakingTime); - - RSpinBox * sbPeakingHoldOff; - SetUpSpinBox(sbPeakingHoldOff, "Peaking Hold-off [ns] : ", trapLayout, 2, 2, Register::DPP::PHA::PeakHoldOff); - - RComboBox * cbPeakAvg; - SetUpComboBoxBit(cbPeakAvg, "Peak Avg. : ", trapLayout, 3, 0, Register::DPP::Bit_DPPAlgorithmControl::ListPeakMean, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::PeakMean); - - RComboBox * cBaseLineAvg; - SetUpComboBoxBit(cBaseLineAvg, "Baseline Avg. : ", trapLayout, 3, 2, Register::DPP::Bit_DPPAlgorithmControl::ListBaselineAvg, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::BaselineAvg); - - QCheckBox * chkActiveBaseline; - SetUpCheckBox(chkActiveBaseline, "Active basline [G]", trapLayout, 4, 0, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ActivebaselineCalulation); - - QCheckBox * chkBaselineRestore; - SetUpCheckBox(chkBaselineRestore, "Baseline Restorer [G]", trapLayout, 4, 1, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::EnableActiveBaselineRestoration); - - RSpinBox * sbFineGain; - SetUpSpinBox(sbFineGain, "Fine Gain : ", trapLayout, 4, 2, Register::DPP::PHA::FineGain); - + SetUpSpinBox(sbTrapRiseTime[MaxNChannels], "Rise Time [ns] : ", trapLayout, 0, 0, DPP::PHA::TrapezoidRiseTime); + SetUpSpinBox(sbTrapFlatTop[MaxNChannels], "Flat Top [ns] : ", trapLayout, 0, 2, DPP::PHA::TrapezoidFlatTop); + SetUpSpinBox(sbDecay[MaxNChannels], "Decay [ns] : ", trapLayout, 1, 0, DPP::PHA::DecayTime); + SetUpSpinBox(sbTrapScaling[MaxNChannels], "Rescaling : ", trapLayout, 1, 2, DPP::PHA::DPPAlgorithmControl2_G); + SetUpSpinBox(sbPeaking[MaxNChannels], "Peaking [ns] : ", trapLayout, 2, 0, DPP::PHA::PeakingTime); + SetUpSpinBox(sbPeakingHoldOff[MaxNChannels], "Peak Hold-off [ns] : ", trapLayout, 2, 2, DPP::PHA::PeakHoldOff); + SetUpComboBoxBit(cbPeakAvg[MaxNChannels], "Peak Avg. : ", trapLayout, 3, 0, DPP::Bit_DPPAlgorithmControl::ListPeakMean, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::PeakMean); + SetUpComboBoxBit(cBaseLineAvg[MaxNChannels], "Baseline Avg. : ", trapLayout, 3, 2, DPP::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::BaselineAvg); + SetUpCheckBox(chkActiveBaseline[MaxNChannels], "Active basline [G]", trapLayout, 4, 0, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ActivebaselineCalulation); + SetUpCheckBox(chkBaselineRestore[MaxNChannels], "Baseline Restorer [G]", trapLayout, 4, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::EnableActiveBaselineRestoration); + SetUpSpinBox(sbFineGain[MaxNChannels], "Fine Gain : ", trapLayout, 4, 2, DPP::PHA::FineGain); } @@ -663,46 +718,21 @@ void DigiSettingsPanel::SetUpPHAChannel(){ QGridLayout * otherLayout = new QGridLayout(otherBox); - RComboBox * cbDecimateTrace; - SetUpComboBoxBit(cbDecimateTrace, "Decimate Trace : ", otherLayout, 0, 0, Register::DPP::Bit_DPPAlgorithmControl::ListTraceDecimation, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TraceDecimation); - - RComboBox * cbDecimateGain; - SetUpComboBoxBit(cbDecimateGain, "Decimate Gain : ", otherLayout, 0, 2, Register::DPP::Bit_DPPAlgorithmControl::ListDecimationGain, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TraceDeciGain); - - RComboBox * cbTrigMode; - SetUpComboBoxBit(cbTrigMode, "Trig Mode : ", otherLayout, 1, 0, Register::DPP::Bit_DPPAlgorithmControl::ListTrigMode, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TriggerMode); - - QCheckBox * chkDisableSelfTrigger; - SetUpCheckBox(chkDisableSelfTrigger, "Disable Self Trigger ", otherLayout, 1, 2, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::DisableSelfTrigger); - - QCheckBox * chkEnableRollOver; - SetUpCheckBox(chkEnableRollOver, "Enable Roll-Over Event", otherLayout, 2, 0, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::EnableRollOverFlag); - - QCheckBox * chkEnablePileUp; - SetUpCheckBox(chkEnablePileUp, "Allow Pile-up Event", otherLayout, 2, 2, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::EnablePileUpFlag); - - RComboBox * cbShapedTrigger; - SetUpComboBoxBit(cbShapedTrigger, "Local Shaped Trig. [G] : ", otherLayout, 3, 0, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode); - - RComboBox * cbTriggerValid; - SetUpComboBoxBit(cbTriggerValid, "Local Trig. Valid. [G] : ", otherLayout, 3, 2, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode); - - RComboBox * cbExtra2Option; - SetUpComboBoxBit(cbExtra2Option, "Extra2 Option [G] : ", otherLayout, 4, 0, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option); - - RComboBox * cbVetoSource; - SetUpComboBoxBit(cbVetoSource, "Veto Source [G] : ", otherLayout, 4, 2, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListVetoSource, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource); - - RComboBox * cbTrigCount; - SetUpComboBoxBit(cbTrigCount, "Trig. Counter Flag [G] : ", otherLayout, 5, 0, Register::DPP::PHA::Bit_DPPAlgorithmControl2::ListTrigCounter, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag); - - RSpinBox * sbNumEventAgg; - SetUpSpinBox(sbNumEventAgg, "Events per Agg. [G] : ", otherLayout, 5, 2, Register::DPP::NumberEventsPerAggregate_G); - - QCheckBox * chkTagCorrelation; - SetUpCheckBox(chkTagCorrelation, "Tag Correlated events [G]", otherLayout, 6, 0, Register::DPP::PHA::DPPAlgorithmControl2_G, Register::DPP::PHA::Bit_DPPAlgorithmControl2::TagCorrelatedEvents); - - //TODO VETO width + SetUpCheckBox(chkDisableSelfTrigger[MaxNChannels], "Disable Self Trigger ", otherLayout, 0, 0, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::DisableSelfTrigger); + SetUpCheckBox(chkEnableRollOver[MaxNChannels], "Enable Roll-Over Event", otherLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::EnableRollOverFlag); + SetUpCheckBox(chkEnablePileUp[MaxNChannels], "Allow Pile-up Event", otherLayout, 1, 0, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::EnablePileUpFlag); + SetUpCheckBox(chkTagCorrelation[MaxNChannels], "Tag Correlated events [G]", otherLayout, 1, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TagCorrelatedEvents); + SetUpComboBoxBit(cbDecimateTrace[MaxNChannels], "Decimate Trace : ", otherLayout, 0, 2, DPP::Bit_DPPAlgorithmControl::ListTraceDecimation, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::TraceDecimation); + SetUpComboBoxBit(cbDecimateGain[MaxNChannels], "Decimate Gain : ", otherLayout, 1, 2, DPP::Bit_DPPAlgorithmControl::ListDecimationGain, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::TraceDeciGain); + SetUpSpinBox(sbNumEventAgg[MaxNChannels], "Events per Agg. [G] : ", otherLayout, 2, 0, DPP::NumberEventsPerAggregate_G); + SetUpComboBoxBit(cbTriggerValid[MaxNChannels], "Local Trig. Valid. [G] : ", otherLayout, 2, 2, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode); + SetUpComboBoxBit(cbTrigCount[MaxNChannels], "Trig. Counter Flag [G] : ", otherLayout, 3, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag); + SetUpComboBoxBit(cbTrigMode[MaxNChannels], "Trig Mode : ", otherLayout, 4, 0, DPP::Bit_DPPAlgorithmControl::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::TriggerMode, 3); + SetUpComboBoxBit(cbShapedTrigger[MaxNChannels], "Local Shaped Trig. [G] : ", otherLayout, 5, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 3); + SetUpComboBoxBit(cbExtra2Option[MaxNChannels], "Extra2 Option [G] : ", otherLayout, 6, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 3); + SetUpComboBoxBit(cbVetoSource[MaxNChannels], "Veto Source [G] : ", otherLayout, 7, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListVetoSource, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource); + SetUpSpinBox(sbVetoWidth[MaxNChannels], "Veto Width : ", otherLayout, 7, 2, DPP::VetoWidth); + SetUpComboBoxBit(cbVetoStep[MaxNChannels], "Veto Step : ", otherLayout, 9, 0, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 3); } @@ -718,7 +748,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ enableSignalSlot = false; - uint32_t AcqStatus = digi[ID]->GetSettingFromMemory(Register::DPP::AcquisitionStatus_R); + uint32_t AcqStatus = digi[ID]->GetSettingFromMemory(DPP::AcquisitionStatus_R); for( int i = 0; i < 9; i++){ if( Digitizer::ExtractBits(AcqStatus, {1, ACQToolTip[i].second}) == 0 ){ bnACQStatus[ID][i]->setStyleSheet(""); @@ -731,7 +761,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - uint32_t BdFailStatus = digi[ID]->GetSettingFromMemory(Register::DPP::BoardFailureStatus_R); + uint32_t BdFailStatus = digi[ID]->GetSettingFromMemory(DPP::BoardFailureStatus_R); for( int i = 0; i < 3; i++){ if( Digitizer::ExtractBits(BdFailStatus, {1, BdFailToolTip[i].second}) == 0 ){ bnBdFailStatus[ID][i]->setStyleSheet("background-color: green;"); @@ -742,7 +772,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - uint32_t ReadoutStatus = digi[ID]->GetSettingFromMemory(Register::DPP::ReadoutStatus_R); + uint32_t ReadoutStatus = digi[ID]->GetSettingFromMemory(DPP::ReadoutStatus_R); for( int i = 0; i < 3; i++){ if( Digitizer::ExtractBits(ReadoutStatus, {1, ReadoutToolTip[i].second}) == 0 ){ if( ReadoutToolTip[i].second != 2 ) { @@ -761,16 +791,16 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - uint32_t BdCfg = digi[ID]->GetSettingFromMemory(Register::DPP::BoardConfiguration); + uint32_t BdCfg = digi[ID]->GetSettingFromMemory(DPP::BoardConfiguration); - chkAutoDataFlush[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::EnableAutoDataFlush) ); - chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DecimateTrace) ); - chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::TrigPropagation) ); - chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DualTrace) ); - chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::TrigPropagation) ); - chkEnableExtra2[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::EnableExtra2) ); + chkAutoDataFlush[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableAutoDataFlush) ); + chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DecimateTrace) ); + chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::TrigPropagation) ); + chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DualTrace) ); + chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::TrigPropagation) ); + chkEnableExtra2[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableExtra2) ); - int temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe1); + int temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::AnalogProbe1); for( int i = 0; i < cbAnaProbe1[ID]->count(); i++){ if( cbAnaProbe1[ID]->itemData(i).toInt() == temp) { cbAnaProbe1[ID]->setCurrentIndex(i); @@ -778,14 +808,14 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe2); + temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::AnalogProbe2); for(int i = 0; i < cbAnaProbe2[ID]->count(); i++){ if( cbAnaProbe2[ID]->itemData(i).toInt() == temp) { cbAnaProbe2[ID]->setCurrentIndex(i); break; } } - temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DigiProbel1); + temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DigiProbel1); for(int i = 0; i < cbDigiProbe1[ID]->count(); i++){ if( cbDigiProbe1[ID]->itemData(i).toInt() == temp) { cbDigiProbe1[ID]->setCurrentIndex(i); @@ -793,7 +823,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - uint32_t chMask = digi[ID]->GetSettingFromMemory(Register::DPP::ChannelEnableMask); + uint32_t chMask = digi[ID]->GetSettingFromMemory(DPP::ChannelEnableMask); for( int i = 0; i < MaxNChannels; i++){ if( (chMask >> i ) & 0x1 ) { bnChEnableMask[ID][i]->setStyleSheet("background-color: green;"); @@ -802,7 +832,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - uint32_t aggOrg = digi[ID]->GetSettingFromMemory(Register::DPP::AggregateOrganization); + uint32_t aggOrg = digi[ID]->GetSettingFromMemory(DPP::AggregateOrganization); for( int i = 0; i < cbAggOrg[ID]->count(); i++){ if( cbAggOrg[ID]->itemData(i).toUInt() == aggOrg ){ cbAggOrg[ID]->setCurrentIndex(i); @@ -810,13 +840,13 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - sbAggNum[ID]->setValue(digi[ID]->GetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer)); + sbAggNum[ID]->setValue(digi[ID]->GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer)); - chkEnableExternalTrigger[ID]->setChecked( ! ( digi[ID]->GetSettingFromMemory(Register::DPP::DisableExternalTrigger) & 0x1) ); + chkEnableExternalTrigger[ID]->setChecked( ! ( digi[ID]->GetSettingFromMemory(DPP::DisableExternalTrigger) & 0x1) ); - sbRunDelay[ID]->setValue(digi[ID]->GetSettingFromMemory(Register::DPP::RunStartStopDelay)); + sbRunDelay[ID]->setValue(digi[ID]->GetSettingFromMemory(DPP::RunStartStopDelay)); - uint32_t anaMonitor = digi[ID]->GetSettingFromMemory(Register::DPP::AnalogMonitorMode); + uint32_t anaMonitor = digi[ID]->GetSettingFromMemory(DPP::AnalogMonitorMode); for( int i = 0 ; i < cbAnalogMonitorMode[ID]->count(); i++){ if( cbAnalogMonitorMode[ID]->itemData(i).toUInt() == anaMonitor ){ cbAnalogMonitorMode[ID]->setCurrentIndex(i); @@ -824,10 +854,10 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } - sbBufferGain[ID]->setValue(digi[ID]->GetSettingFromMemory(Register::DPP::BufferOccupancyGain)); + sbBufferGain[ID]->setValue(digi[ID]->GetSettingFromMemory(DPP::BufferOccupancyGain)); - uint32_t frontPanel = digi[ID]->GetSettingFromMemory(Register::DPP::FrontPanelIOControl); + uint32_t frontPanel = digi[ID]->GetSettingFromMemory(DPP::FrontPanelIOControl); cbLEMOMode[ID]->setCurrentIndex( ( frontPanel & 0x1 )); if( (frontPanel >> 1 ) & 0x1 ) { // bit-1, TRIG-OUT high impedance, i.e. disable @@ -843,10 +873,45 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){ } } + uint32_t glbTrgMask = digi[ID]->GetSettingFromMemory(DPP::GlobalTriggerMask); + + for( int i = 0; i < MaxNChannels/2; i++){ + if( (glbTrgMask >> i ) & 0x1 ){ + bnGlobalTriggerMask[ID][i]->setStyleSheet("background-color: green;"); + }else{ + bnGlobalTriggerMask[ID][i]->setStyleSheet(""); + } + } + + sbGlbMajCoinWin[ID]->setValue( Digitizer::ExtractBits(glbTrgMask, DPP::Bit_GlobalTriggerMask::MajorCoinWin) ); + sbGlbMajLvl[ID]->setValue( Digitizer::ExtractBits(glbTrgMask, DPP::Bit_GlobalTriggerMask::MajorLevel) ); + cbGlbUseOtherTriggers[ID]->setCurrentIndex(Digitizer::ExtractBits(glbTrgMask, {2, 30})); + + uint32_t TRGOUTMask = digi[ID]->GetSettingFromMemory(DPP::FrontPanelTRGOUTEnableMask); + for( int i = 0; i < MaxNChannels/2; i++){ + if( (TRGOUTMask >> i ) & 0x1 ){ + bnTRGOUTMask[ID][i]->setStyleSheet("background-color: green;"); + }else{ + bnTRGOUTMask[ID][i]->setStyleSheet(""); + } + } + + cbTRGOUTLogic[ID]->setCurrentIndex(Digitizer::ExtractBits(TRGOUTMask, DPP::Bit_TRGOUTMask::TRGOUTLogic)); + sbTRGOUTMajLvl[ID]->setValue( Digitizer::ExtractBits(TRGOUTMask, DPP::Bit_TRGOUTMask::MajorLevel)); + cbTRGOUTUseOtherTriggers[ID]->setCurrentIndex(Digitizer::ExtractBits(TRGOUTMask, {2, 30})); + enableSignalSlot = true; } +void DigiSettingsPanel::UpdatePHASetting(){ + + +} + +//*================================================================ +//*================================================================ + void DigiSettingsPanel::ReadSettingsFromBoard(){ digi[ID]->ReadAllSettingsFromBoard(); @@ -856,7 +921,3 @@ void DigiSettingsPanel::ReadSettingsFromBoard(){ } -//*================================================================ -//*================================================================ - - diff --git a/DigiSettingsPanel.h b/DigiSettingsPanel.h index 2f99646..2b7c469 100644 --- a/DigiSettingsPanel.h +++ b/DigiSettingsPanel.h @@ -31,18 +31,24 @@ signals: private: void SetUpInfo(QString label, std::string value, QGridLayout *gLayout, int row, int col); - void SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para, std::pair bit); - void SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector> items, Register::Reg para, std::pair bit); - void SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para); - void SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para); + void SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Reg para, std::pair bit); + void SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector> items, Reg para, std::pair bit, int colspan = 1); + void SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, Reg para); + void SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout *gLayout, int row, int col, Reg para); void CleanUpGroupBox(QGroupBox * & gBox); + void SetUpGlobalTriggerMaskAndFrontPanelMask(); + void SetUpPHABoard(); void SetUpPHAChannel(); void SetUpPSDBoard(); + + void UpdatePHASetting(); + + Digitizer ** digi; unsigned int nDigi; unsigned short ID; @@ -117,6 +123,48 @@ private: /// ============================ Channel QWidget * chAllSetting; + //---------- PHA + RSpinBox * sbRecordLength[MaxNChannels + 1]; + RComboBox * cbDynamicRange[MaxNChannels + 1]; + RSpinBox * sbPreTrigger[MaxNChannels + 1]; + RComboBox * cbRCCR2Smoothing[MaxNChannels + 1]; + RSpinBox * sbInputRiseTime[MaxNChannels + 1]; + RSpinBox * sbThreshold[MaxNChannels + 1]; + RSpinBox * sbRiseTimeValidWin[MaxNChannels + 1]; + RSpinBox * sbTriggerHoldOff[MaxNChannels + 1]; + RSpinBox * sbShapedTrigWidth[MaxNChannels + 1]; + RSpinBox * sbDCOffset[MaxNChannels + 1]; + RComboBox * cbPolarity[MaxNChannels + 1]; + + RSpinBox * sbTrapRiseTime[MaxNChannels + 1]; + RSpinBox * sbTrapFlatTop[MaxNChannels + 1]; + RSpinBox * sbDecay[MaxNChannels + 1]; + RSpinBox * sbTrapScaling[MaxNChannels + 1]; + RSpinBox * sbPeaking[MaxNChannels + 1]; + RSpinBox * sbPeakingHoldOff[MaxNChannels + 1]; + RComboBox * cbPeakAvg[MaxNChannels + 1]; + RComboBox * cBaseLineAvg[MaxNChannels + 1]; + QCheckBox * chkActiveBaseline[MaxNChannels + 1]; + QCheckBox * chkBaselineRestore[MaxNChannels + 1]; + RSpinBox * sbFineGain[MaxNChannels + 1]; + + QCheckBox * chkDisableSelfTrigger[MaxNChannels + 1]; + QCheckBox * chkEnableRollOver[MaxNChannels + 1]; + QCheckBox * chkEnablePileUp[MaxNChannels + 1]; + QCheckBox * chkTagCorrelation[MaxNChannels + 1]; + RComboBox * cbDecimateTrace[MaxNChannels + 1]; + RComboBox * cbDecimateGain[MaxNChannels + 1]; + RSpinBox * sbNumEventAgg[MaxNChannels + 1]; + RComboBox * cbTriggerValid[MaxNChannels + 1]; + RComboBox * cbTrigCount[MaxNChannels + 1]; + RComboBox * cbTrigMode[MaxNChannels + 1]; + RComboBox * cbShapedTrigger[MaxNChannels + 1]; + RComboBox * cbExtra2Option[MaxNChannels + 1]; + RComboBox * cbVetoSource[MaxNChannels + 1]; + RSpinBox * sbVetoWidth[MaxNChannels + 1]; + RComboBox * cbVetoStep[MaxNChannels + 1]; + + //QPushButton * bnTriggerValidMask[MaxNDigitizer][MaxNChannels/2]; }; diff --git a/RegisterAddress.h b/RegisterAddress.h index 174415a..3662588 100644 --- a/RegisterAddress.h +++ b/RegisterAddress.h @@ -19,8 +19,6 @@ /// Reg haha("haha", 0x1234); /// uint32_t papa = haha; /// papa = 0x1234 -namespace Register { - enum RW { ReadWrite, ReadONLY, WriteONLY}; class Reg{ @@ -140,525 +138,566 @@ inline uint32_t Reg::CalAddress(unsigned int index){ } - const Reg EventReadOutBuffer("EventReadOutBuffer", 0x0000, RW::ReadONLY, false, {}); /// R +const Reg EventReadOutBuffer("EventReadOutBuffer", 0x0000, RW::ReadONLY, false, {}); /// R + +///========== Channel or Group +const Reg ChannelDummy32 ("ChannelDummy32" , 0x1024, RW::ReadWrite, false, {}); /// R/W +const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {}); /// R/W +const Reg ChannelPulseWidth ("ChannelPulseWidth" , 0x1070, RW::ReadWrite, false, {}); /// R/W +const Reg ChannelTriggerThreshold ("ChannelTriggerThreshold" , 0x1080, RW::ReadWrite, false, {}); /// R/W +const Reg CoupleSelfTriggerLogic_G ("CoupleSelfTriggerLogic_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W +const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY, false, {}); /// R +const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY, false, {}); /// R +const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, false, {}); /// R/W +const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY, false, {}); /// R +const Reg ChannelSelfTriggerRateMeter_R ("ChannelSelfTriggerRateMeter_R", 0x10EC, RW::ReadONLY, false, {}); /// R - ///========== Channel or Group - const Reg ChannelDummy32 ("ChannelDummy32" , 0x1024, RW::ReadWrite, false, {}); /// R/W - const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelPulseWidth ("ChannelPulseWidth" , 0x1070, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelTriggerThreshold ("ChannelTriggerThreshold" , 0x1080, RW::ReadWrite, false, {}); /// R/W - const Reg CoupleSelfTriggerLogic_G ("CoupleSelfTriggerLogic_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W - const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY, false, {}); /// R - const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY, false, {}); /// R - const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY, false, {}); /// R - const Reg ChannelSelfTriggerRateMeter_R ("ChannelSelfTriggerRateMeter_R", 0x10EC, RW::ReadONLY, false, {}); /// R - - ///========== Board - const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite, false, {}); /// R/W - const Reg BufferOrganization ("BufferOrganization" , 0x800C, RW::ReadWrite, false, {}); /// R/W - const Reg CustomSize ("CustomSize" , 0x8020, RW::ReadWrite, false, {}); /// R/W - const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY, false, {}); /// W - const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite, false, {}); /// R/W - const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY , false, {}); /// R - const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY, false, {}); /// W - const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite, false, {}); /// R/W - const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W - const Reg PostTrigger ("PostTrigger" , 0x8114, RW::ReadWrite, false, {}); /// R/W - const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W - const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W - const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R - const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R - const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W - const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY, false, {}); /// W - const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY , false, {}); /// R - const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite, false, {}); /// R/W - const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY , false, {}); /// R - const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite, false, {}); /// R/W - const Reg MemoryBufferAlmostFullLevel ("MemoryBufferAlmostFullLevel" , 0x816C, RW::ReadWrite, false, {}); /// R/W - const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite, false, {}); /// R/W - const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY , false, {}); /// R - const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite, false, {}); /// R/W - const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelsShutdown_W ("ChannelsShutdown_W" , 0x81C0, RW::WriteONLY, false, {}); /// W - const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite, false, {}); /// R/W - const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite, false, {}); /// R/W - const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY , false, {}); /// R - const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite, false, {}); /// R/W - const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite, false, {}); /// R/W - const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite, false, {}); /// R/W - const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite, false, {}); /// R/W - const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite, false, {}); /// R/W - const Reg MaxAggregatePerBlockTransfer ("MaxAggregatePerBlockTransfer" , 0xEF1C, RW::ReadWrite, false, {}); /// R/W - const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite, false, {}); /// R/W - const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W - const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W +///========== Board +const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite, false, {}); /// R/W +const Reg BufferOrganization ("BufferOrganization" , 0x800C, RW::ReadWrite, false, {}); /// R/W +const Reg CustomSize ("CustomSize" , 0x8020, RW::ReadWrite, false, {}); /// R/W +const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY, false, {}); /// W +const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite, false, {}); /// R/W +const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY , false, {}); /// R +const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY, false, {}); /// W +const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite, false, {}); /// R/W +const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W +const Reg PostTrigger ("PostTrigger" , 0x8114, RW::ReadWrite, false, {}); /// R/W +const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W +const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W +const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W +const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R +const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R +const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W +const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY, false, {}); /// W +const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY , false, {}); /// R +const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite, false, {}); /// R/W +const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY , false, {}); /// R +const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite, false, {}); /// R/W +const Reg MemoryBufferAlmostFullLevel ("MemoryBufferAlmostFullLevel" , 0x816C, RW::ReadWrite, false, {}); /// R/W +const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite, false, {}); /// R/W +const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY , false, {}); /// R +const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite, false, {}); /// R/W +const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite, false, {}); /// R/W +const Reg ChannelsShutdown_W ("ChannelsShutdown_W" , 0x81C0, RW::WriteONLY, false, {}); /// W +const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite, false, {}); /// R/W +const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite, false, {}); /// R/W +const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY , false, {}); /// R +const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite, false, {}); /// R/W +const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite, false, {}); /// R/W +const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite, false, {}); /// R/W +const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite, false, {}); /// R/W +const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite, false, {}); /// R/W +const Reg MaxAggregatePerBlockTransfer ("MaxAggregatePerBlockTransfer" , 0xEF1C, RW::ReadWrite, false, {}); /// R/W +const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite, false, {}); /// R/W +const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W +const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W - - ///====== Common for PHA and PSD - namespace DPP { - namespace Bit_BoardConfig{ - const std::pair EnableAutoDataFlush = {1, 0} ; /// length, smallest pos - const std::pair DecimateTrace = {1, 1} ; - const std::pair TrigPropagation = {1, 2} ; - const std::pair DualTrace = {1, 11} ; - const std::pair AnalogProbe1 = {2, 12} ; - const std::pair AnalogProbe2 = {2, 14} ; - const std::pair RecordTrace = {1, 16} ; - const std::pair EnableExtra2 = {1, 17} ; - const std::pair DigiProbel1 = {4, 20} ; - const std::pair DigiProbel2 = {3, 26} ; +///====== Common for PHA and PSD +namespace DPP { - const std::vector> ListAnaProbe1_PHA = {{"Input", 0}, - {"RC-CR", 1}, - {"RC-CR2", 2}, - {"Trapezoid", 3}}; - const std::vector> ListAnaProbe2_PHA = {{"Input", 0}, - {"Threshold", 1}, - {"Trap. - Baseline", 2}, - {"Trap. Baseline", 3}}; + namespace Bit_BoardConfig{ + const std::pair EnableAutoDataFlush = {1, 0} ; /// length, smallest pos + const std::pair DecimateTrace = {1, 1} ; + const std::pair TrigPropagation = {1, 2} ; + const std::pair DualTrace = {1, 11} ; + const std::pair AnalogProbe1 = {2, 12} ; + const std::pair AnalogProbe2 = {2, 14} ; + const std::pair RecordTrace = {1, 16} ; + const std::pair EnableExtra2 = {1, 17} ; + const std::pair DigiProbel1 = {4, 20} ; + const std::pair DigiProbel2 = {3, 26} ; - const std::vector> ListDigiProbe1_PHA = {{"Peaking", 0}, - {"Armed", 1}, - {"Peak Run", 2}, - {"Pile Up", 3}, - {"peaking", 4}, - {"TRG Valid. Win", 5}, - {"Baseline Freeze", 6}, - {"TRG Holdoff", 7}, - {"TRG Valid.", 8}, - {"ACQ Busy", 9}, - {"Zero Cross", 10}, - {"Ext. TRG", 11}, - {"Budy", 12}}; + const std::vector> ListAnaProbe1_PHA = {{"Input", 0}, + {"RC-CR", 1}, + {"RC-CR2", 2}, + {"Trapezoid", 3}}; + const std::vector> ListAnaProbe2_PHA = {{"Input", 0}, + {"Threshold", 1}, + {"Trap. - Baseline", 2}, + {"Trap. Baseline", 3}}; - } - - namespace Bit_DPPAlgorithmControl { - const std::pair TrapRescaling = {6, 0} ; /// length, smallest pos - const std::pair TraceDecimation = {2, 8}; - const std::pair TraceDeciGain = {2, 10,}; - const std::pair PeakMean = {2, 12}; - const std::pair Polarity = {1, 16}; - const std::pair TriggerMode = {2, 18}; - const std::pair BaselineAvg = {3, 20}; - const std::pair DisableSelfTrigger = {1, 24}; - const std::pair EnableRollOverFlag = {1, 26}; - const std::pair EnablePileUpFlag = {1, 27}; + const std::vector> ListDigiProbe1_PHA = {{"Peaking", 0}, + {"Armed", 1}, + {"Peak Run", 2}, + {"Pile Up", 3}, + {"peaking", 4}, + {"TRG Valid. Win", 5}, + {"Baseline Freeze", 6}, + {"TRG Holdoff", 7}, + {"TRG Valid.", 8}, + {"ACQ Busy", 9}, + {"Zero Cross", 10}, + {"Ext. TRG", 11}, + {"Budy", 12}}; - const std::vector> ListTraceDecimation = {{"Disabled", 0}, - {"2 samples", 1}, - {"4 samples", 2}, - {"8 samples", 3}}; - - const std::vector> ListDecimationGain = {{"x1", 0}, - {"x2", 1}, - {"x4", 2}, - {"x8", 3}}; - - const std::vector> ListPeakMean = {{"1 sample", 0}, - {"4 sample", 1}, - {"16 sample", 2}, - {"64 sample", 3}}; - - const std::vector> ListPolarity = {{"Positive", 0}, - {"Negative", 1}}; - - const std::vector> ListTrigMode = {{"Independent", 0}, - {"Coincident (Shape Trig.)", 1}, - {"Anti-Coincident (Shape Trig.)", 3}}; - - const std::vector> ListBaselineAvg = {{"Not Used", 0}, - {"16 samples", 1}, - {"64 samples", 2}, - {"256 samples", 3}, - {"1024 samples", 4}, - {"4096 samples", 5}, - {"16384 samples", 6}}; - - } - - namespace Bit_AcquistionControl { - const std::pair StartStopMode = {2, 0} ; - const std::pair ACQStartArm = {1, 2} ; - const std::pair PLLRef = {1, 6} ; - const std::pair LVDSBusyEnable = {1, 8} ; - const std::pair LVDSVetoEnable = {1, 9} ; - const std::pair VetoTRGOut = {1, 12} ; - } - - namespace Bit_AcqStatus { - const std::pair AcqStatus = {1, 2} ; - const std::pair EventReady = {1, 3} ; - const std::pair EventFull = {1, 4} ; - const std::pair ClockSource = {1, 5} ; - const std::pair PLLLock = {1, 7} ; - const std::pair BoardReady = {1, 8} ; - const std::pair SINStatus = {1, 15} ; - const std::pair TRGINStatus = {1, 16} ; - const std::pair ChannelsDown = {1, 19} ; - } - - namespace Bit_ReadoutControl { - const std::pair VMEInterruptLevel = {3, 0} ; - const std::pair EnableOpticalLinkInpt = {1, 3} ; - const std::pair EnableEventAligned = {1, 4} ; - const std::pair VMEAlign64Mode = {1, 5} ; - const std::pair VMEBaseAddressReclocated = {1, 6} ; - const std::pair InterrupReleaseMode = {1, 7} ; - const std::pair EnableExtendedBlockTransfer = {1, 8} ; - } - - namespace Bit_FrontPanelIOControl { - const std::pair LEMOLevel = {1, 0} ; - const std::pair DisableTrgOut = {1, 1} ; - const std::pair LVDSDirection1 = {1, 2} ; // [3:0] - const std::pair LVDSDirection2 = {1, 3} ; // [7:4] - const std::pair LVDSDirection3 = {1, 4} ; // [11:8] - const std::pair LVDSDirection4 = {1, 5} ; // [15:12] - const std::pair LVDSConfiguration = {2, 6}; - const std::pair LVDSNewFeature = {1, 8}; - const std::pair LVDSLatchMode = {1, 9}; - const std::pair TRGINMode = {1, 10}; - const std::pair TRGINMezzanine = {1, 11}; - const std::pair TRGOUTConfig = {6, 14}; - const std::pair PatternConfig = {2, 21}; - - const std::vector> ListLEMOLevel = {{"NIM I/O", 0}, - {"TTL I/O", 1}}; - const std::vector> ListTRGIMode = {{"Edge of TRG-IN", 0}, - {"Whole duration of TR-IN", 1}}; - const std::vector> ListTRGIMezzanine = {{"Pocessed by Motherboard", 0}, - {"Skip Motherboard", 1}}; - - const std::vector> ListTRGOUTConfig = {{"Disable", 0x00002}, /// this is TRG_OUT high imped. 0x811C bit[1] - {"force TRG-OUT is 0", 0x08000}, - {"force TRG-OUT is 1", 0x0C000}, - {"Trigger (Mask)", 0x00000}, - {"Channel Probe", 0x20000}, - {"S-IN", 0x30000}, - {"RUN", 0x10000}, - {"Sync Clock", 0x50000}, - {"Clock Phase", 0x90000}, - {"BUSY/UNLOCK", 0xD0000}}; - - } - - const Reg RecordLength_G ("RecordLength_G" , 0x1020, RW::ReadWrite, true, 0x3FFF, 8); /// R/W - const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {{"2 Vpp", 0},{"0.5 Vpp", 1}}); /// R/W - const Reg NumberEventsPerAggregate_G ("NumberEventsPerAggregate_G" , 0x1034, RW::ReadWrite, true, 0x3FF, -1); /// R/W - const Reg PreTrigger ("PreTrigger" , 0x1038, RW::ReadWrite, false, 0xFF, 4); /// R/W - const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, false, 0x3FFF, -1); /// R/W - const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, 0x3FF, 4); /// R/W - const Reg DPPAlgorithmControl ("DPPAlgorithmControl" , 0x1080, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY , false, {}); /// R - const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY , false, {}); /// R - const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, false, 0xFFFF, -1); /// R/W - const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY , false, {}); /// R - const Reg IndividualSoftwareTrigger_W ("IndividualSoftwareTrigger_W" , 0x10C0, RW::WriteONLY, false, {}); /// W - const Reg VetoWidth ("VetoWidth" , 0x10D4, RW::ReadWrite, false, {}); /// R/W - - /// I know there are many duplication, it is the design. - const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite, false, {}); /// R/W - const Reg AggregateOrganization ("AggregateOrganization" , 0x800C, RW::ReadWrite, false, {{"Not use", 0x0}, - {"Not use", 0x1}, - { "4", 0x2}, - { "8", 0x3}, - { "16", 0x4}, - { "32", 0x5}, - { "64", 0x6}, - { "128", 0x7}, - { "256", 0x8}, - { "512", 0x9}, - {"1024", 0xA}}); /// R/W - const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY, false, {}); /// W - const Reg ChannelShutdown_W ("ChannelShutdown_W" , 0x80BC, RW::WriteONLY, false, {{"no shutdown", 0},{"shutdown", 1}}); /// W - const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite, false, {}); /// R/W - const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY , false, {}); /// R - const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY, false, {}); /// W - const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite, false, {}); /// R/W - const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W - const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W - const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W - const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W - const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R - const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R - const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W - const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY, false, {}); /// W - const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY , false, {}); /// R - const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite, false, {{"Trig. Maj. Mode", 0}, - {"Test mode", 1}, - {"Buffer occp. Mode", 3}, - {"Voltage Lvl Mode", 4}}); /// R/W - const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY , false, {}); /// R - const Reg TimeBombDowncounter_R ("TimeBombDowncounter_R" , 0x8158, RW::ReadONLY , false, {}); /// R - const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite, false, {}); /// R/W - const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite, false, 0xFF, 8); /// R/W - const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY , false, {}); /// R - const Reg DisableExternalTrigger ("DisableExternalTrigger" , 0x817C, RW::ReadWrite, false, {}); /// R/W - const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite, false, {}); /// R/W - const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite, false, 0xF, -1); /// R/W - const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite, false, 0xFFFF, 4); /// R/W - const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite, false, {}); /// R/W - const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY , false, {}); /// R - const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite, false, {}); /// R/W - const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite, false, {}); /// R/W - const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite, false, {}); /// R/W - const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite, false, {}); /// R/W - const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite, false, {}); /// R/W - const Reg MaxAggregatePerBlockTransfer("MaxAggregatePerBlockTransfer", 0xEF1C, RW::ReadWrite, false, 0x3FF, -1); /// R/W - const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite, false, {}); /// R/W - const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W - const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W - const Reg ConfigurationReload_W ("ConfigurationReload_W" , 0xEF34, RW::WriteONLY, false, {}); /// W - const Reg ROMChecksum_R ("ROMChecksum_R" , 0xF000, RW::ReadONLY , false, {}); /// R - const Reg ROMChecksumByte2_R ("ROMChecksumByte2_R" , 0xF004, RW::ReadONLY , false, {}); /// R - const Reg ROMChecksumByte1_R ("ROMChecksumByte1_R" , 0xF008, RW::ReadONLY , false, {}); /// R - const Reg ROMChecksumByte0_R ("ROMChecksumByte0_R" , 0xF00C, RW::ReadONLY , false, {}); /// R - const Reg ROMConstantByte2_R ("ROMConstantByte2_R" , 0xF010, RW::ReadONLY , false, {}); /// R - const Reg ROMConstantByte1_R ("ROMConstantByte1_R" , 0xF014, RW::ReadONLY , false, {}); /// R - const Reg ROMConstantByte0_R ("ROMConstantByte0_R" , 0xF018, RW::ReadONLY , false, {}); /// R - const Reg ROM_C_Code_R ("ROM_C_Code_R" , 0xF01C, RW::ReadONLY , false, {}); /// R - const Reg ROM_R_Code_R ("ROM_R_Code_R" , 0xF020, RW::ReadONLY , false, {}); /// R - const Reg ROM_IEEE_OUI_Byte2_R ("ROM_IEEE_OUI_Byte2_R" , 0xF024, RW::ReadONLY , false, {}); /// R - const Reg ROM_IEEE_OUI_Byte1_R ("ROM_IEEE_OUI_Byte1_R" , 0xF028, RW::ReadONLY , false, {}); /// R - const Reg ROM_IEEE_OUI_Byte0_R ("ROM_IEEE_OUI_Byte0_R" , 0xF02C, RW::ReadONLY , false, {}); /// R - const Reg ROM_BoardVersion_R ("ROM_BoardVersion_R" , 0xF030, RW::ReadONLY , false, {}); /// R - const Reg ROM_BoardFromFactor_R ("ROM_BoardFromFactor_R" , 0xF034, RW::ReadONLY , false, {}); /// R - const Reg ROM_BoardIDByte1_R ("ROM_BoardIDByte1_R" , 0xF038, RW::ReadONLY , false, {}); /// R - const Reg ROM_BoardIDByte0_R ("ROM_BoardIDByte0_R" , 0xF03C, RW::ReadONLY , false, {}); /// R - const Reg ROM_PCB_rev_Byte3_R ("ROM_PCB_rev_Byte3_R" , 0xF040, RW::ReadONLY , false, {}); /// R - const Reg ROM_PCB_rev_Byte2_R ("ROM_PCB_rev_Byte2_R" , 0xF044, RW::ReadONLY , false, {}); /// R - const Reg ROM_PCB_rev_Byte1_R ("ROM_PCB_rev_Byte1_R" , 0xF048, RW::ReadONLY , false, {}); /// R - const Reg ROM_PCB_rev_Byte0_R ("ROM_PCB_rev_Byte0_R" , 0xF04C, RW::ReadONLY , false, {}); /// R - const Reg ROM_FlashType_R ("ROM_FlashType_R" , 0xF050, RW::ReadONLY , false, {}); /// R - const Reg ROM_BoardSerialNumByte1_R ("ROM_BoardSerialNumByte1_R" , 0xF080, RW::ReadONLY , false, {}); /// R - const Reg ROM_BoardSerialNumByte0_R ("ROM_BoardSerialNumByte0_R" , 0xF084, RW::ReadONLY , false, {}); /// R - const Reg ROM_VCXO_Type_R ("ROM_VCXO_Type_R" , 0xF088, RW::ReadONLY , false, {}); /// R - - const Reg TriggerValidationMask_G ("TriggerValidationMask_G" , 0x8180, RW::ReadWrite, true, {}); /// R/W, - - namespace PHA { - const Reg DataFlush_W ("DataFlush_W" , 0x103C, RW::WriteONLY, false, {}); /// W not sure - const Reg ChannelStopAcquisition ("ChannelStopAcquisition" , 0x1040, RW::ReadWrite, false, {{"Run", 0}, {"Stop", 1}}); /// R/W not sure - const Reg RCCR2SmoothingFactor ("RCCR2SmoothingFactor" , 0x1054, RW::ReadWrite, false, {{ "Disabled", 0x0}, - { "2 sample", 0x1}, - { "4 sample", 0x2}, - { "8 sample", 0x4}, - { "16 sample", 0x8}, - { "32 sample", 0x10}, - { "64 sample", 0x20}, - {"128 sample", 0x3F} - }); /// R/W Trigger Filter smoothing, triggerSmoothingFactor - const Reg InputRiseTime ("InputRiseTime" , 0x1058, RW::ReadWrite, false, 0xFF, 4); /// R/W OK - const Reg TrapezoidRiseTime ("TrapezoidRiseTime" , 0x105C, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK - const Reg TrapezoidFlatTop ("TrapezoidFlatTop" , 0x1060, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK - const Reg PeakingTime ("PeakingTime" , 0x1064, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK - const Reg DecayTime ("DecayTime" , 0x1068, RW::ReadWrite, false, 0xFFFF, 4); /// R/W OK - const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, false, 0x3FFF, -1); /// R/W OK - const Reg RiseTimeValidationWindow ("RiseTimeValidationWindow" , 0x1070, RW::ReadWrite, false, 0x3FF, 1); /// R/W OK - const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, 0x3FF, 4); /// R/W OK - const Reg PeakHoldOff ("PeakHoldOff" , 0x1078, RW::ReadWrite, false, 0x3FF, 4); /// R/W OK - const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1084, RW::ReadWrite, false, 0x3FF, 4); /// R/W not sure - const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x10A0, RW::ReadWrite, true, {}); /// R/W OK - const Reg FineGain ("FineGain" , 0x10C4, RW::ReadWrite, false, {}); /// R/W OK - - namespace Bit_DPPAlgorithmControl2 { - const std::pair LocalShapeTriggerMode = {3, 0} ; - const std::pair LocalTrigValidMode = {3, 4} ; - const std::pair Extra2Option = {3, 8} ; - const std::pair VetoSource = {2, 14} ; - const std::pair TriggerCounterFlag = {2, 16} ; - const std::pair ActivebaselineCalulation = {1, 18} ; - const std::pair TagCorrelatedEvents = {1, 19} ; - const std::pair EnableActiveBaselineRestoration = {1, 29} ; - - const std::vector> ListLocalShapeTrigMode = {{"Disabled", 0}, - {"AND", 4}, - {"The even Channel", 5}, - {"The odd Channel", 6}, - {"OR", 7}}; - - const std::vector> ListLocalTrigValidMode = {{"Disabled", 0}, - {"Crossed", 4}, - {"Equal", 5}, - {"AND", 6}, - {"OR", 7}}; - - const std::vector> ListExtra2 = {{"Extended timeStamp + baseline * 4", 0}, - {"Extended timeStamp + Fine timestamp", 2}, - {"Lost Trig. Count + Total Trig. Count", 4}, - {"Event Before 0-xing + After 0-xing", 5}}; - - const std::vector> ListVetoSource = {{"Disabled", 0}, - {"Common (Global Trig. Mask)", 1}, - {"Difference (Trig. Mask)", 2}, - {"Negative Saturation", 3}}; - - const std::vector> ListTrigCounter = {{"1024", 0}, - {"128", 1}, - {"8192", 2}}; - - } - - } - - namespace PSD { - const Reg CFDSetting ("CFDSetting" , 0x103C, RW::ReadWrite, false, {}); /// R/W - const Reg ForcedDataFlush_W ("ForcedDataFlush_W" , 0x1040, RW::WriteONLY, false, {}); /// W - const Reg ChargeZeroSuppressionThreshold ("ChargeZeroSuppressionThreshold" , 0x1044, RW::ReadWrite, false, {}); /// R/W - const Reg ShortGateWidth ("ShortGateWidth" , 0x1054, RW::ReadWrite, false, {}); /// R/W - const Reg LongGateWidth ("LongGateWidth" , 0x1058, RW::ReadWrite, false, {}); /// R/W - const Reg GateOffset ("GateOffset" , 0x105C, RW::ReadWrite, false, {}); /// R/W - const Reg TriggerThreshold ("TriggerThreshold" , 0x1060, RW::ReadWrite, false, {}); /// R/W - const Reg FixedBaseline ("FixedBaseline" , 0x1064, RW::ReadWrite, false, {}); /// R/W - const Reg TriggerLatency ("TriggerLatency" , 0x106C, RW::ReadWrite, false, {}); /// R/W - const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1070, RW::ReadWrite, false, {}); /// R/W - const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, {}); /// R/W - const Reg ThresholdForPSDCut ("ThresholdForPSDCut" , 0x1078, RW::ReadWrite, false, {}); /// R/W - const Reg PurGapThreshold ("PurGapThreshold" , 0x107C, RW::ReadWrite, false, {}); /// R/W - const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W - const Reg EarlyBaselineFreeze ("EarlyBaselineFreeze" , 0x10D8, RW::ReadWrite, true, {}); /// R/W - } } -}; // end of namepace Register + + namespace Bit_DPPAlgorithmControl { + const std::pair TrapRescaling = {6, 0} ; /// length, smallest pos + const std::pair TraceDecimation = {2, 8}; + const std::pair TraceDeciGain = {2, 10,}; + const std::pair PeakMean = {2, 12}; + const std::pair Polarity = {1, 16}; + const std::pair TriggerMode = {2, 18}; + const std::pair BaselineAvg = {3, 20}; + const std::pair DisableSelfTrigger = {1, 24}; + const std::pair EnableRollOverFlag = {1, 26}; + const std::pair EnablePileUpFlag = {1, 27}; -const std::vector RegisterPHAList = { - Register::DPP::PHA::DataFlush_W , - Register::DPP::PHA::ChannelStopAcquisition , - Register::DPP::PHA::RCCR2SmoothingFactor , - Register::DPP::PHA::InputRiseTime , - Register::DPP::PHA::TrapezoidRiseTime , - Register::DPP::PHA::TrapezoidFlatTop , - Register::DPP::PHA::PeakingTime , - Register::DPP::PHA::DecayTime , - Register::DPP::PHA::TriggerThreshold , - Register::DPP::PHA::RiseTimeValidationWindow , - Register::DPP::PHA::TriggerHoldOffWidth , - Register::DPP::PHA::PeakHoldOff , - Register::DPP::PHA::ShapedTriggerWidth , - Register::DPP::PHA::DPPAlgorithmControl2_G , - Register::DPP::PHA::FineGain , + const std::vector> ListTraceDecimation = {{"Disabled", 0}, + {"2 samples", 1}, + {"4 samples", 2}, + {"8 samples", 3}}; + + const std::vector> ListDecimationGain = {{"x1", 0}, + {"x2", 1}, + {"x4", 2}, + {"x8", 3}}; + + const std::vector> ListPeakMean = {{"1 sample", 0}, + {"4 sample", 1}, + {"16 sample", 2}, + {"64 sample", 3}}; + + const std::vector> ListPolarity = {{"Positive", 0}, + {"Negative", 1}}; + + const std::vector> ListTrigMode = {{"Independent", 0}, + {"Coincident (Shape Trig.)", 1}, + {"Anti-Coincident (Shape Trig.)", 3}}; + + const std::vector> ListBaselineAvg = {{"Not Used", 0}, + {"16 samples", 1}, + {"64 samples", 2}, + {"256 samples", 3}, + {"1024 samples", 4}, + {"4096 samples", 5}, + {"16384 samples", 6}}; + + } + + namespace Bit_AcquistionControl { + const std::pair StartStopMode = {2, 0} ; + const std::pair ACQStartArm = {1, 2} ; + const std::pair PLLRef = {1, 6} ; + const std::pair LVDSBusyEnable = {1, 8} ; + const std::pair LVDSVetoEnable = {1, 9} ; + const std::pair VetoTRGOut = {1, 12} ; + } + + namespace Bit_AcqStatus { + const std::pair AcqStatus = {1, 2} ; + const std::pair EventReady = {1, 3} ; + const std::pair EventFull = {1, 4} ; + const std::pair ClockSource = {1, 5} ; + const std::pair PLLLock = {1, 7} ; + const std::pair BoardReady = {1, 8} ; + const std::pair SINStatus = {1, 15} ; + const std::pair TRGINStatus = {1, 16} ; + const std::pair ChannelsDown = {1, 19} ; + } + + namespace Bit_ReadoutControl { + const std::pair VMEInterruptLevel = {3, 0} ; + const std::pair EnableOpticalLinkInpt = {1, 3} ; + const std::pair EnableEventAligned = {1, 4} ; + const std::pair VMEAlign64Mode = {1, 5} ; + const std::pair VMEBaseAddressReclocated = {1, 6} ; + const std::pair InterrupReleaseMode = {1, 7} ; + const std::pair EnableExtendedBlockTransfer = {1, 8} ; + } + + namespace Bit_GlobalTriggerMask { + const std::pair GroupedChMask = {8, 0} ; + const std::pair MajorCoinWin = {4, 20} ; + const std::pair MajorLevel = {2, 24} ; + const std::pair LVDSTrigger = {1, 29} ; + const std::pair ExtTrigger = {1, 30} ; + const std::pair SWTrigger = {1, 31} ; + } + + namespace Bit_TRGOUTMask{ + const std::pair GroupedChMask = {8, 0} ; + const std::pair TRGOUTLogic = {2, 8} ; + const std::pair MajorLevel = {3, 10} ; + const std::pair LVDSTrigger = {1, 29} ; + const std::pair ExtTrigger = {1, 30} ; + const std::pair SWTrigger = {1, 31} ; + } + + namespace Bit_FrontPanelIOControl { + const std::pair LEMOLevel = {1, 0} ; + const std::pair DisableTrgOut = {1, 1} ; + const std::pair LVDSDirection1 = {1, 2} ; // [3:0] + const std::pair LVDSDirection2 = {1, 3} ; // [7:4] + const std::pair LVDSDirection3 = {1, 4} ; // [11:8] + const std::pair LVDSDirection4 = {1, 5} ; // [15:12] + const std::pair LVDSConfiguration = {2, 6}; + const std::pair LVDSNewFeature = {1, 8}; + const std::pair LVDSLatchMode = {1, 9}; + const std::pair TRGINMode = {1, 10}; + const std::pair TRGINMezzanine = {1, 11}; + const std::pair TRGOUTConfig = {6, 14}; + const std::pair PatternConfig = {2, 21}; + + const std::vector> ListLEMOLevel = {{"NIM I/O", 0}, + {"TTL I/O", 1}}; + const std::vector> ListTRGIMode = {{"Edge of TRG-IN", 0}, + {"Whole duration of TR-IN", 1}}; + const std::vector> ListTRGIMezzanine = {{"Pocessed by Motherboard", 0}, + {"Skip Motherboard", 1}}; + + const std::vector> ListTRGOUTConfig = {{"Disable", 0x00002}, /// this is TRG_OUT high imped. 0x811C bit[1] + {"force TRG-OUT is 0", 0x08000}, + {"force TRG-OUT is 1", 0x0C000}, + {"Trigger (Mask)", 0x00000}, + {"Channel Probe", 0x20000}, + {"S-IN", 0x30000}, + {"RUN", 0x10000}, + {"Sync Clock", 0x50000}, + {"Clock Phase", 0x90000}, + {"BUSY/UNLOCK", 0xD0000}}; + } + + namespace Bit_VetoWidth { + const std::pair VetoWidth = {16, 0} ; + const std::pair VetoStep = {2, 16} ; + + const std::vector> ListVetoStep = {{" 16 ns (725), 8 ns (730)", 0}, + {" 4 ns (725), 2 ns (730)", 1}, + {"1048 ns (725), 524 ns (730)", 2}, + {" 264 ns (725), 134 ns (730)", 3}}; + + } + + const Reg RecordLength_G ("RecordLength_G" , 0x1020, RW::ReadWrite, true, 0x3FFF, 8); /// R/W + const Reg InputDynamicRange ("InputDynamicRange" , 0x1028, RW::ReadWrite, false, {{"2 Vpp", 0},{"0.5 Vpp", 1}}); /// R/W + const Reg NumberEventsPerAggregate_G ("NumberEventsPerAggregate_G" , 0x1034, RW::ReadWrite, true, 0x3FF, -1); /// R/W + const Reg PreTrigger ("PreTrigger" , 0x1038, RW::ReadWrite, false, 0xFF, 4); /// R/W + const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, false, 0x3FFF, -1); /// R/W + const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, 0x3FF, 4); /// R/W + const Reg DPPAlgorithmControl ("DPPAlgorithmControl" , 0x1080, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelStatus_R ("ChannelStatus_R" , 0x1088, RW::ReadONLY , false, {}); /// R + const Reg AMCFirmwareRevision_R ("AMCFirmwareRevision_R" , 0x108C, RW::ReadONLY , false, {}); /// R + const Reg ChannelDCOffset ("ChannelDCOffset" , 0x1098, RW::ReadWrite, false, 0xFFFF, -1); /// R/W + const Reg ChannelADCTemperature_R ("ChannelADCTemperature_R" , 0x10A8, RW::ReadONLY , false, {}); /// R + const Reg IndividualSoftwareTrigger_W ("IndividualSoftwareTrigger_W" , 0x10C0, RW::WriteONLY, false, {}); /// W + const Reg VetoWidth ("VetoWidth" , 0x10D4, RW::ReadWrite, false, {}); /// R/W - Register::DPP::RecordLength_G , - Register::DPP::InputDynamicRange , - Register::DPP::NumberEventsPerAggregate_G , - Register::DPP::PreTrigger , - Register::DPP::TriggerThreshold , - Register::DPP::TriggerHoldOffWidth , - Register::DPP::DPPAlgorithmControl , - Register::DPP::ChannelStatus_R , - Register::DPP::AMCFirmwareRevision_R , - Register::DPP::ChannelDCOffset , - Register::DPP::ChannelADCTemperature_R , - Register::DPP::IndividualSoftwareTrigger_W, - Register::DPP::VetoWidth , + /// I know there are many duplication, it is the design. + const Reg BoardConfiguration ("BoardConfiguration" , 0x8000, RW::ReadWrite, false, {}); /// R/W + const Reg AggregateOrganization ("AggregateOrganization" , 0x800C, RW::ReadWrite, false, {{"Not use", 0x0}, + {"Not use", 0x1}, + { "4", 0x2}, + { "8", 0x3}, + { "16", 0x4}, + { "32", 0x5}, + { "64", 0x6}, + { "128", 0x7}, + { "256", 0x8}, + { "512", 0x9}, + {"1024", 0xA}}); /// R/W + const Reg ADCCalibration_W ("ADCCalibration_W" , 0x809C, RW::WriteONLY, false, {}); /// W + const Reg ChannelShutdown_W ("ChannelShutdown_W" , 0x80BC, RW::WriteONLY, false, {{"no shutdown", 0},{"shutdown", 1}}); /// W + const Reg AcquisitionControl ("AcquisitionControl" , 0x8100, RW::ReadWrite, false, {}); /// R/W + const Reg AcquisitionStatus_R ("AcquisitionStatus_R" , 0x8104, RW::ReadONLY , false, {}); /// R + const Reg SoftwareTrigger_W ("SoftwareTrigger_W" , 0x8108, RW::WriteONLY, false, {}); /// W + const Reg GlobalTriggerMask ("GlobalTriggerMask" , 0x810C, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110, RW::ReadWrite, false, {}); /// R/W + const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W + const Reg ChannelEnableMask ("ChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W + const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R + const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R + const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W + const Reg SoftwareClockSync_W ("SoftwareClockSync_W" , 0x813C, RW::WriteONLY, false, {}); /// W + const Reg BoardInfo_R ("BoardInfo_R" , 0x8140, RW::ReadONLY , false, {}); /// R + const Reg AnalogMonitorMode ("AnalogMonitorMode" , 0x8144, RW::ReadWrite, false, {{"Trig. Maj. Mode", 0}, + {"Test mode", 1}, + {"Buffer occp. Mode", 3}, + {"Voltage Lvl Mode", 4}}); /// R/W + const Reg EventSize_R ("EventSize_R" , 0x814C, RW::ReadONLY , false, {}); /// R + const Reg TimeBombDowncounter_R ("TimeBombDowncounter_R" , 0x8158, RW::ReadONLY , false, {}); /// R + const Reg FanSpeedControl ("FanSpeedControl" , 0x8168, RW::ReadWrite, false, {}); /// R/W + const Reg RunStartStopDelay ("RunStartStopDelay" , 0x8170, RW::ReadWrite, false, 0xFF, 8); /// R/W + const Reg BoardFailureStatus_R ("BoardFailureStatus_R" , 0x8178, RW::ReadONLY , false, {}); /// R + const Reg DisableExternalTrigger ("DisableExternalTrigger" , 0x817C, RW::ReadWrite, false, {}); /// R/W + const Reg FrontPanelLVDSIONewFeatures ("FrontPanelLVDSIONewFeatures" , 0x81A0, RW::ReadWrite, false, {}); /// R/W + const Reg BufferOccupancyGain ("BufferOccupancyGain" , 0x81B4, RW::ReadWrite, false, 0xF, -1); /// R/W + const Reg ExtendedVetoDelay ("ExtendedVetoDelay" , 0x81C4, RW::ReadWrite, false, 0xFFFF, 4); /// R/W + const Reg ReadoutControl ("ReadoutControl" , 0xEF00, RW::ReadWrite, false, {}); /// R/W + const Reg ReadoutStatus_R ("ReadoutStatus_R" , 0xEF04, RW::ReadONLY , false, {}); /// R + const Reg BoardID ("BoardID" , 0xEF08, RW::ReadWrite, false, {}); /// R/W + const Reg MCSTBaseAddressAndControl ("MCSTBaseAddressAndControl" , 0xEF0C, RW::ReadWrite, false, {}); /// R/W + const Reg RelocationAddress ("RelocationAddress" , 0xEF10, RW::ReadWrite, false, {}); /// R/W + const Reg InterruptStatusID ("InterruptStatusID" , 0xEF14, RW::ReadWrite, false, {}); /// R/W + const Reg InterruptEventNumber ("InterruptEventNumber" , 0xEF18, RW::ReadWrite, false, {}); /// R/W + const Reg MaxAggregatePerBlockTransfer("MaxAggregatePerBlockTransfer", 0xEF1C, RW::ReadWrite, false, 0x3FF, -1); /// R/W + const Reg Scratch ("Scratch" , 0xEF20, RW::ReadWrite, false, {}); /// R/W + const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W + const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W + const Reg ConfigurationReload_W ("ConfigurationReload_W" , 0xEF34, RW::WriteONLY, false, {}); /// W + const Reg ROMChecksum_R ("ROMChecksum_R" , 0xF000, RW::ReadONLY , false, {}); /// R + const Reg ROMChecksumByte2_R ("ROMChecksumByte2_R" , 0xF004, RW::ReadONLY , false, {}); /// R + const Reg ROMChecksumByte1_R ("ROMChecksumByte1_R" , 0xF008, RW::ReadONLY , false, {}); /// R + const Reg ROMChecksumByte0_R ("ROMChecksumByte0_R" , 0xF00C, RW::ReadONLY , false, {}); /// R + const Reg ROMConstantByte2_R ("ROMConstantByte2_R" , 0xF010, RW::ReadONLY , false, {}); /// R + const Reg ROMConstantByte1_R ("ROMConstantByte1_R" , 0xF014, RW::ReadONLY , false, {}); /// R + const Reg ROMConstantByte0_R ("ROMConstantByte0_R" , 0xF018, RW::ReadONLY , false, {}); /// R + const Reg ROM_C_Code_R ("ROM_C_Code_R" , 0xF01C, RW::ReadONLY , false, {}); /// R + const Reg ROM_R_Code_R ("ROM_R_Code_R" , 0xF020, RW::ReadONLY , false, {}); /// R + const Reg ROM_IEEE_OUI_Byte2_R ("ROM_IEEE_OUI_Byte2_R" , 0xF024, RW::ReadONLY , false, {}); /// R + const Reg ROM_IEEE_OUI_Byte1_R ("ROM_IEEE_OUI_Byte1_R" , 0xF028, RW::ReadONLY , false, {}); /// R + const Reg ROM_IEEE_OUI_Byte0_R ("ROM_IEEE_OUI_Byte0_R" , 0xF02C, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardVersion_R ("ROM_BoardVersion_R" , 0xF030, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardFromFactor_R ("ROM_BoardFromFactor_R" , 0xF034, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardIDByte1_R ("ROM_BoardIDByte1_R" , 0xF038, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardIDByte0_R ("ROM_BoardIDByte0_R" , 0xF03C, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte3_R ("ROM_PCB_rev_Byte3_R" , 0xF040, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte2_R ("ROM_PCB_rev_Byte2_R" , 0xF044, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte1_R ("ROM_PCB_rev_Byte1_R" , 0xF048, RW::ReadONLY , false, {}); /// R + const Reg ROM_PCB_rev_Byte0_R ("ROM_PCB_rev_Byte0_R" , 0xF04C, RW::ReadONLY , false, {}); /// R + const Reg ROM_FlashType_R ("ROM_FlashType_R" , 0xF050, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardSerialNumByte1_R ("ROM_BoardSerialNumByte1_R" , 0xF080, RW::ReadONLY , false, {}); /// R + const Reg ROM_BoardSerialNumByte0_R ("ROM_BoardSerialNumByte0_R" , 0xF084, RW::ReadONLY , false, {}); /// R + const Reg ROM_VCXO_Type_R ("ROM_VCXO_Type_R" , 0xF088, RW::ReadONLY , false, {}); /// R + + const Reg TriggerValidationMask_G ("TriggerValidationMask_G" , 0x8180, RW::ReadWrite, true, {}); /// R/W, - Register::DPP::TriggerValidationMask_G + namespace PHA { + const Reg DataFlush_W ("DataFlush_W" , 0x103C, RW::WriteONLY, false, {}); /// W not sure + const Reg ChannelStopAcquisition ("ChannelStopAcquisition" , 0x1040, RW::ReadWrite, false, {{"Run", 0}, {"Stop", 1}}); /// R/W not sure + const Reg RCCR2SmoothingFactor ("RCCR2SmoothingFactor" , 0x1054, RW::ReadWrite, false, {{ "Disabled", 0x0}, + { "2 sample", 0x1}, + { "4 sample", 0x2}, + { "8 sample", 0x4}, + { "16 sample", 0x8}, + { "32 sample", 0x10}, + { "64 sample", 0x20}, + {"128 sample", 0x3F} + }); /// R/W Trigger Filter smoothing, triggerSmoothingFactor + const Reg InputRiseTime ("InputRiseTime" , 0x1058, RW::ReadWrite, false, 0xFF, 4); /// R/W OK + const Reg TrapezoidRiseTime ("TrapezoidRiseTime" , 0x105C, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK + const Reg TrapezoidFlatTop ("TrapezoidFlatTop" , 0x1060, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK + const Reg PeakingTime ("PeakingTime" , 0x1064, RW::ReadWrite, false, 0xFFF, 4); /// R/W OK + const Reg DecayTime ("DecayTime" , 0x1068, RW::ReadWrite, false, 0xFFFF, 4); /// R/W OK + const Reg TriggerThreshold ("TriggerThreshold" , 0x106C, RW::ReadWrite, false, 0x3FFF, -1); /// R/W OK + const Reg RiseTimeValidationWindow ("RiseTimeValidationWindow" , 0x1070, RW::ReadWrite, false, 0x3FF, 1); /// R/W OK + const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, 0x3FF, 4); /// R/W OK + const Reg PeakHoldOff ("PeakHoldOff" , 0x1078, RW::ReadWrite, false, 0x3FF, 4); /// R/W OK + const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1084, RW::ReadWrite, false, 0x3FF, 4); /// R/W not sure + const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x10A0, RW::ReadWrite, true, {}); /// R/W OK + const Reg FineGain ("FineGain" , 0x10C4, RW::ReadWrite, false, {}); /// R/W OK + + namespace Bit_DPPAlgorithmControl2 { + const std::pair LocalShapeTriggerMode = {3, 0} ; + const std::pair LocalTrigValidMode = {3, 4} ; + const std::pair Extra2Option = {3, 8} ; + const std::pair VetoSource = {2, 14} ; + const std::pair TriggerCounterFlag = {2, 16} ; + const std::pair ActivebaselineCalulation = {1, 18} ; + const std::pair TagCorrelatedEvents = {1, 19} ; + const std::pair EnableActiveBaselineRestoration = {1, 29} ; + + const std::vector> ListLocalShapeTrigMode = {{"Disabled", 0}, + {"AND", 4}, + {"The even Channel", 5}, + {"The odd Channel", 6}, + {"OR", 7}}; + + const std::vector> ListLocalTrigValidMode = {{"Disabled", 0}, + {"Crossed", 4}, + {"Equal", 5}, + {"AND", 6}, + {"OR", 7}}; + + const std::vector> ListExtra2 = {{"Extended timeStamp + baseline * 4", 0}, + {"Extended timeStamp + Fine timestamp", 2}, + {"Lost Trig. Count + Total Trig. Count", 4}, + {"Event Before 0-xing + After 0-xing", 5}}; + + const std::vector> ListVetoSource = {{"Disabled", 0}, + {"Common (Global Trig. Mask)", 1}, + {"Difference (Trig. Mask)", 2}, + {"Negative Saturation", 3}}; + + const std::vector> ListTrigCounter = {{"1024", 0}, + {"128", 1}, + {"8192", 2}}; + + } + + } + + namespace PSD { + const Reg CFDSetting ("CFDSetting" , 0x103C, RW::ReadWrite, false, {}); /// R/W + const Reg ForcedDataFlush_W ("ForcedDataFlush_W" , 0x1040, RW::WriteONLY, false, {}); /// W + const Reg ChargeZeroSuppressionThreshold ("ChargeZeroSuppressionThreshold" , 0x1044, RW::ReadWrite, false, {}); /// R/W + const Reg ShortGateWidth ("ShortGateWidth" , 0x1054, RW::ReadWrite, false, {}); /// R/W + const Reg LongGateWidth ("LongGateWidth" , 0x1058, RW::ReadWrite, false, {}); /// R/W + const Reg GateOffset ("GateOffset" , 0x105C, RW::ReadWrite, false, {}); /// R/W + const Reg TriggerThreshold ("TriggerThreshold" , 0x1060, RW::ReadWrite, false, {}); /// R/W + const Reg FixedBaseline ("FixedBaseline" , 0x1064, RW::ReadWrite, false, {}); /// R/W + const Reg TriggerLatency ("TriggerLatency" , 0x106C, RW::ReadWrite, false, {}); /// R/W + const Reg ShapedTriggerWidth ("ShapedTriggerWidth" , 0x1070, RW::ReadWrite, false, {}); /// R/W + const Reg TriggerHoldOffWidth ("TriggerHoldOffWidth" , 0x1074, RW::ReadWrite, false, {}); /// R/W + const Reg ThresholdForPSDCut ("ThresholdForPSDCut" , 0x1078, RW::ReadWrite, false, {}); /// R/W + const Reg PurGapThreshold ("PurGapThreshold" , 0x107C, RW::ReadWrite, false, {}); /// R/W + const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W + const Reg EarlyBaselineFreeze ("EarlyBaselineFreeze" , 0x10D8, RW::ReadWrite, true, {}); /// R/W + } + + namespace QDC { + const Reg GateWidth ("GateWidth" , 0x1030, RW::ReadWrite, false, 0xFFF, 4); /// R/W + const Reg GateOffset ("GateOfset" , 0x1034, RW::ReadWrite, false, 0xFF, 4); /// R/W + const Reg FixedBaseline ("FixedBaseline" , 0x1038, RW::ReadWrite, false, 0xFFF, 4); /// R/W + const Reg Pretrigger ("PreTrigger" , 0x103C, RW::ReadWrite, false, 0xFF, 4); /// R/W + const Reg DPPAlgorithmControl ("DPPAlgorithmControl" , 0x1040, RW::ReadWrite, false, {}); /// R/W + } + +} // end of DPP namepace Register + +const std::vector RegisterPHAList = { + DPP::PHA::DataFlush_W , + DPP::PHA::ChannelStopAcquisition , + DPP::PHA::RCCR2SmoothingFactor , + DPP::PHA::InputRiseTime , + DPP::PHA::TrapezoidRiseTime , + DPP::PHA::TrapezoidFlatTop , + DPP::PHA::PeakingTime , + DPP::PHA::DecayTime , + DPP::PHA::TriggerThreshold , + DPP::PHA::RiseTimeValidationWindow , + DPP::PHA::TriggerHoldOffWidth , + DPP::PHA::PeakHoldOff , + DPP::PHA::ShapedTriggerWidth , + DPP::PHA::DPPAlgorithmControl2_G , + DPP::PHA::FineGain , + + DPP::RecordLength_G , + DPP::InputDynamicRange , + DPP::NumberEventsPerAggregate_G , + DPP::PreTrigger , + DPP::TriggerThreshold , + DPP::TriggerHoldOffWidth , + DPP::DPPAlgorithmControl , + DPP::ChannelStatus_R , + DPP::AMCFirmwareRevision_R , + DPP::ChannelDCOffset , + DPP::ChannelADCTemperature_R , + DPP::IndividualSoftwareTrigger_W, + DPP::VetoWidth , + + DPP::TriggerValidationMask_G }; -const std::vector RegisterPSDList = { - Register::DPP::PSD::CFDSetting , - Register::DPP::PSD::ForcedDataFlush_W , - Register::DPP::PSD::ChargeZeroSuppressionThreshold , - Register::DPP::PSD::ShortGateWidth , - Register::DPP::PSD::LongGateWidth , - Register::DPP::PSD::GateOffset , - Register::DPP::PSD::TriggerThreshold , - Register::DPP::PSD::FixedBaseline , - Register::DPP::PSD::TriggerLatency , - Register::DPP::PSD::ShapedTriggerWidth , - Register::DPP::PSD::TriggerHoldOffWidth , - Register::DPP::PSD::ThresholdForPSDCut , - Register::DPP::PSD::PurGapThreshold , - Register::DPP::PSD::DPPAlgorithmControl2_G , - Register::DPP::PSD::EarlyBaselineFreeze , +const std::vector RegisterPSDList = { + DPP::PSD::CFDSetting , + DPP::PSD::ForcedDataFlush_W , + DPP::PSD::ChargeZeroSuppressionThreshold , + DPP::PSD::ShortGateWidth , + DPP::PSD::LongGateWidth , + DPP::PSD::GateOffset , + DPP::PSD::TriggerThreshold , + DPP::PSD::FixedBaseline , + DPP::PSD::TriggerLatency , + DPP::PSD::ShapedTriggerWidth , + DPP::PSD::TriggerHoldOffWidth , + DPP::PSD::ThresholdForPSDCut , + DPP::PSD::PurGapThreshold , + DPP::PSD::DPPAlgorithmControl2_G , + DPP::PSD::EarlyBaselineFreeze , - Register::DPP::RecordLength_G , - Register::DPP::InputDynamicRange , - Register::DPP::NumberEventsPerAggregate_G , - Register::DPP::PreTrigger , - Register::DPP::TriggerThreshold , - Register::DPP::TriggerHoldOffWidth , - Register::DPP::DPPAlgorithmControl , - Register::DPP::ChannelStatus_R , - Register::DPP::AMCFirmwareRevision_R , - Register::DPP::ChannelDCOffset , - Register::DPP::ChannelADCTemperature_R , - Register::DPP::IndividualSoftwareTrigger_W, - Register::DPP::VetoWidth , + DPP::RecordLength_G , + DPP::InputDynamicRange , + DPP::NumberEventsPerAggregate_G , + DPP::PreTrigger , + DPP::TriggerThreshold , + DPP::TriggerHoldOffWidth , + DPP::DPPAlgorithmControl , + DPP::ChannelStatus_R , + DPP::AMCFirmwareRevision_R , + DPP::ChannelDCOffset , + DPP::ChannelADCTemperature_R , + DPP::IndividualSoftwareTrigger_W, + DPP::VetoWidth , - Register::DPP::TriggerValidationMask_G + DPP::TriggerValidationMask_G +}; + +const std::vector RegisterQDCList = { //TODO + + }; /// Only Board Setting -const std::vector RegisterDPPList = { +const std::vector RegisterDPPList = { - Register::DPP::BoardConfiguration , - Register::DPP::AggregateOrganization , - Register::DPP::ADCCalibration_W , - Register::DPP::ChannelShutdown_W , - Register::DPP::AcquisitionControl , - Register::DPP::AcquisitionStatus_R , - Register::DPP::SoftwareTrigger_W , - Register::DPP::GlobalTriggerMask , - Register::DPP::FrontPanelTRGOUTEnableMask , - Register::DPP::LVDSIOData , - Register::DPP::FrontPanelIOControl , - Register::DPP::ChannelEnableMask , - Register::DPP::ROCFPGAFirmwareRevision_R , - Register::DPP::EventStored_R , - Register::DPP::VoltageLevelModeConfig , - Register::DPP::SoftwareClockSync_W , - Register::DPP::BoardInfo_R , - Register::DPP::AnalogMonitorMode , - Register::DPP::EventSize_R , - Register::DPP::TimeBombDowncounter_R , - Register::DPP::FanSpeedControl , - Register::DPP::RunStartStopDelay , - Register::DPP::BoardFailureStatus_R , - Register::DPP::DisableExternalTrigger , - Register::DPP::FrontPanelLVDSIONewFeatures , - Register::DPP::BufferOccupancyGain , - Register::DPP::ExtendedVetoDelay , - Register::DPP::ReadoutControl , - Register::DPP::ReadoutStatus_R , - Register::DPP::BoardID , - Register::DPP::MCSTBaseAddressAndControl , - Register::DPP::RelocationAddress , - Register::DPP::InterruptStatusID , - Register::DPP::InterruptEventNumber , - Register::DPP::MaxAggregatePerBlockTransfer, - Register::DPP::Scratch , - Register::DPP::SoftwareReset_W , - Register::DPP::SoftwareClear_W , - Register::DPP::ConfigurationReload_W , - Register::DPP::ROMChecksum_R , - Register::DPP::ROMChecksumByte2_R , - Register::DPP::ROMChecksumByte1_R , - Register::DPP::ROMChecksumByte0_R , - Register::DPP::ROMConstantByte2_R , - Register::DPP::ROMConstantByte1_R , - Register::DPP::ROMConstantByte0_R , - Register::DPP::ROM_C_Code_R , - Register::DPP::ROM_R_Code_R , - Register::DPP::ROM_IEEE_OUI_Byte2_R , - Register::DPP::ROM_IEEE_OUI_Byte1_R , - Register::DPP::ROM_IEEE_OUI_Byte0_R , - Register::DPP::ROM_BoardVersion_R , - Register::DPP::ROM_BoardFromFactor_R , - Register::DPP::ROM_BoardIDByte1_R , - Register::DPP::ROM_BoardIDByte0_R , - Register::DPP::ROM_PCB_rev_Byte3_R , - Register::DPP::ROM_PCB_rev_Byte2_R , - Register::DPP::ROM_PCB_rev_Byte1_R , - Register::DPP::ROM_PCB_rev_Byte0_R , - Register::DPP::ROM_FlashType_R , - Register::DPP::ROM_BoardSerialNumByte1_R , - Register::DPP::ROM_BoardSerialNumByte0_R , - Register::DPP::ROM_VCXO_Type_R + DPP::BoardConfiguration , + DPP::AggregateOrganization , + DPP::ADCCalibration_W , + DPP::ChannelShutdown_W , + DPP::AcquisitionControl , + DPP::AcquisitionStatus_R , + DPP::SoftwareTrigger_W , + DPP::GlobalTriggerMask , + DPP::FrontPanelTRGOUTEnableMask , + DPP::LVDSIOData , + DPP::FrontPanelIOControl , + DPP::ChannelEnableMask , + DPP::ROCFPGAFirmwareRevision_R , + DPP::EventStored_R , + DPP::VoltageLevelModeConfig , + DPP::SoftwareClockSync_W , + DPP::BoardInfo_R , + DPP::AnalogMonitorMode , + DPP::EventSize_R , + DPP::TimeBombDowncounter_R , + DPP::FanSpeedControl , + DPP::RunStartStopDelay , + DPP::BoardFailureStatus_R , + DPP::DisableExternalTrigger , + DPP::FrontPanelLVDSIONewFeatures , + DPP::BufferOccupancyGain , + DPP::ExtendedVetoDelay , + DPP::ReadoutControl , + DPP::ReadoutStatus_R , + DPP::BoardID , + DPP::MCSTBaseAddressAndControl , + DPP::RelocationAddress , + DPP::InterruptStatusID , + DPP::InterruptEventNumber , + DPP::MaxAggregatePerBlockTransfer, + DPP::Scratch , + DPP::SoftwareReset_W , + DPP::SoftwareClear_W , + DPP::ConfigurationReload_W , + DPP::ROMChecksum_R , + DPP::ROMChecksumByte2_R , + DPP::ROMChecksumByte1_R , + DPP::ROMChecksumByte0_R , + DPP::ROMConstantByte2_R , + DPP::ROMConstantByte1_R , + DPP::ROMConstantByte0_R , + DPP::ROM_C_Code_R , + DPP::ROM_R_Code_R , + DPP::ROM_IEEE_OUI_Byte2_R , + DPP::ROM_IEEE_OUI_Byte1_R , + DPP::ROM_IEEE_OUI_Byte0_R , + DPP::ROM_BoardVersion_R , + DPP::ROM_BoardFromFactor_R , + DPP::ROM_BoardIDByte1_R , + DPP::ROM_BoardIDByte0_R , + DPP::ROM_PCB_rev_Byte3_R , + DPP::ROM_PCB_rev_Byte2_R , + DPP::ROM_PCB_rev_Byte1_R , + DPP::ROM_PCB_rev_Byte0_R , + DPP::ROM_FlashType_R , + DPP::ROM_BoardSerialNumByte1_R , + DPP::ROM_BoardSerialNumByte0_R , + DPP::ROM_VCXO_Type_R }; diff --git a/Scope.cpp b/Scope.cpp index 2942e4b..aa2edf7 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -309,7 +309,7 @@ void Scope::SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col){ } -void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Register::Reg para){ +void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Reg para){ SetUpComboBoxSimple(cb, str, row, col); @@ -342,7 +342,7 @@ void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const } -void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Register::Reg para){ +void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Reg para){ QLabel * lb = new QLabel(str, settingGroup); lb->setAlignment(Qt::AlignRight | Qt::AlignCenter); settingLayout->addWidget(lb, row, col); @@ -377,16 +377,16 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re uint32_t value = sb->value() / ch2ns / abs(para.GetPartialStep()); - if( para == Register::DPP::RecordLength_G || para == Register::DPP::PreTrigger){ + if( para == DPP::RecordLength_G || para == DPP::PreTrigger){ int factor = digi[ID]->IsDualTrace() ? 2 : 1; value = value * factor; } - if( para == Register::DPP::ChannelDCOffset ){ + if( para == DPP::ChannelDCOffset ){ value = uint16_t((1.0 - sb->value()/100.) * 0xFFFF); } - if( para == Register::DPP::PHA::TriggerThreshold ){ + if( para == DPP::PHA::TriggerThreshold ){ value = sb->value(); } @@ -425,23 +425,23 @@ void Scope::SetUpPHAPanel(){ enableSignalSlot = false; int rowID = 0; - SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, Register::DPP::RecordLength_G); - SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, Register::DPP::PreTrigger); - SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, Register::DPP::ChannelDCOffset); + SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::RecordLength_G); + SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::PreTrigger); + SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::ChannelDCOffset); sbDCOffset->setDecimals(2); - SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, Register::DPP::InputDynamicRange); + SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, DPP::InputDynamicRange); rowID ++; //============================================================= - SetUpSpinBox(sbInputRiseTime, "Input Rise Time [ns] ", rowID, 0, Register::DPP::PHA::InputRiseTime); - SetUpSpinBox(sbThreshold, "Threshold [LSB] ", rowID, 2, Register::DPP::PHA::TriggerThreshold); - SetUpSpinBox(sbTriggerHoldOff,"Trigger HoldOff [ns] ", rowID, 4, Register::DPP::PHA::TriggerHoldOffWidth); - SetUpComboBox(cbSmoothingFactor, "Smooth Factor ", rowID, 6, Register::DPP::PHA::RCCR2SmoothingFactor); + SetUpSpinBox(sbInputRiseTime, "Input Rise Time [ns] ", rowID, 0, DPP::PHA::InputRiseTime); + SetUpSpinBox(sbThreshold, "Threshold [LSB] ", rowID, 2, DPP::PHA::TriggerThreshold); + SetUpSpinBox(sbTriggerHoldOff,"Trigger HoldOff [ns] ", rowID, 4, DPP::PHA::TriggerHoldOffWidth); + SetUpComboBox(cbSmoothingFactor, "Smooth Factor ", rowID, 6, DPP::PHA::RCCR2SmoothingFactor); rowID ++; //============================================================= - SetUpSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", rowID, 0, Register::DPP::PHA::TrapezoidRiseTime); - SetUpSpinBox(sbTrapFlatTop, "Trap. FlatTop [ns] ", rowID, 2, Register::DPP::PHA::TrapezoidFlatTop); - SetUpSpinBox(sbDecayTime, "Decay Time [ns] ", rowID, 4, Register::DPP::PHA::DecayTime); - SetUpSpinBox(sbPeakingTime, "Peaking Time [ns] ", rowID, 6, Register::DPP::PHA::PeakingTime); + SetUpSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", rowID, 0, DPP::PHA::TrapezoidRiseTime); + SetUpSpinBox(sbTrapFlatTop, "Trap. FlatTop [ns] ", rowID, 2, DPP::PHA::TrapezoidFlatTop); + SetUpSpinBox(sbDecayTime, "Decay Time [ns] ", rowID, 4, DPP::PHA::DecayTime); + SetUpSpinBox(sbPeakingTime, "Peaking Time [ns] ", rowID, 6, DPP::PHA::PeakingTime); rowID ++; //============================================================= SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0); @@ -449,7 +449,7 @@ void Scope::SetUpPHAPanel(){ cbPolarity->addItem("Negative", 1); connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()); }); SetUpComboBoxSimple(cbBaselineAvg, "Baseline Avg. ", rowID, 2); @@ -462,7 +462,7 @@ void Scope::SetUpPHAPanel(){ cbBaselineAvg->addItem("16384 sample", 6); connect(cbBaselineAvg, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::BaselineAvg, cbBaselineAvg->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::BaselineAvg, cbBaselineAvg->currentData().toInt(), cbScopeCh->currentIndex()); }); SetUpComboBoxSimple(cbPeakAvg, "Peak Avg. ", rowID, 4); @@ -472,10 +472,10 @@ void Scope::SetUpPHAPanel(){ cbPeakAvg->addItem("64 sample", 3); connect(cbPeakAvg, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::PeakMean, cbPeakAvg->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::PeakMean, cbPeakAvg->currentData().toInt(), cbScopeCh->currentIndex()); }); - SetUpSpinBox(sbPeakHoldOff, "Peak HoldOff [ns] ", rowID, 6, Register::DPP::PHA::PeakHoldOff); + SetUpSpinBox(sbPeakHoldOff, "Peak HoldOff [ns] ", rowID, 6, DPP::PHA::PeakHoldOff); rowID ++; //============================================================= @@ -486,7 +486,7 @@ void Scope::SetUpPHAPanel(){ cbAnaProbe1->addItem("Trap.", 3); connect(cbAnaProbe1, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe1, cbAnaProbe1->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe1, cbAnaProbe1->currentData().toInt(), cbScopeCh->currentIndex()); dataTrace[0]->setName(cbAnaProbe1->currentText()); }); @@ -497,7 +497,7 @@ void Scope::SetUpPHAPanel(){ cbAnaProbe2->addItem("Baseline", 3); connect(cbAnaProbe2, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe2, cbAnaProbe2->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe2, cbAnaProbe2->currentData().toInt(), cbScopeCh->currentIndex()); dataTrace[1]->setName(cbAnaProbe2->currentText()); }); @@ -517,7 +517,7 @@ void Scope::SetUpPHAPanel(){ cbDigiProbe1->addItem("Budy", 12); connect(cbDigiProbe1, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DigiProbel1, cbDigiProbe1->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::DigiProbel1, cbDigiProbe1->currentData().toInt(), cbScopeCh->currentIndex()); dataTrace[2]->setName(cbDigiProbe2->currentText()); }); @@ -533,11 +533,11 @@ void Scope::SetUpPHAPanel(){ void Scope::SetUpPSDPanel(){ int rowID = 0; - SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, Register::DPP::RecordLength_G); - SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, Register::DPP::PreTrigger); - SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, Register::DPP::ChannelDCOffset); + SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::RecordLength_G); + SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::PreTrigger); + SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::ChannelDCOffset); sbDCOffset->setDecimals(2); - SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, Register::DPP::InputDynamicRange); + SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, DPP::InputDynamicRange); rowID ++; //============================================================= SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0); @@ -545,7 +545,7 @@ void Scope::SetUpPSDPanel(){ cbPolarity->addItem("Negative", 1); connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; - digi[ID]->SetBits(Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()); + digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::Polarity, cbPolarity->currentData().toInt(), cbScopeCh->currentIndex()); }); } @@ -568,7 +568,7 @@ void Scope::EnableControl(bool enable){ //*======================================================= //*======================================================= -void Scope::UpdateComobox(RComboBox * &cb, const Register::Reg para){ +void Scope::UpdateComobox(RComboBox * &cb, const Reg para){ int ch = cbScopeCh->currentIndex(); enableSignalSlot = false; @@ -585,7 +585,7 @@ void Scope::UpdateComobox(RComboBox * &cb, const Register::Reg para){ //enableSignalSlot = true; } -void Scope::UpdateSpinBox(RSpinBox * &sb, const Register::Reg para){ +void Scope::UpdateSpinBox(RSpinBox * &sb, const Reg para){ int ch = cbScopeCh->currentIndex(); enableSignalSlot = false; @@ -603,37 +603,37 @@ void Scope::UpdatePanelFromMomeory(){ int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace, - unsigned int haha = digi[ID]->GetSettingFromMemory(Register::DPP::RecordLength_G, ch); - sbReordLength->setValue(haha * Register::DPP::RecordLength_G.GetPartialStep() * ch2ns / factor); + unsigned int haha = digi[ID]->GetSettingFromMemory(DPP::RecordLength_G, ch); + sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns / factor); - haha = digi[ID]->GetSettingFromMemory(Register::DPP::PreTrigger, ch); - sbPreTrigger->setValue(haha * Register::DPP::PreTrigger.GetPartialStep() * ch2ns / factor); + haha = digi[ID]->GetSettingFromMemory(DPP::PreTrigger, ch); + sbPreTrigger->setValue(haha * DPP::PreTrigger.GetPartialStep() * ch2ns / factor); - haha = digi[ID]->GetSettingFromMemory(Register::DPP::ChannelDCOffset, ch); + haha = digi[ID]->GetSettingFromMemory(DPP::ChannelDCOffset, ch); sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 ); - UpdateComobox(cbDynamicRange, Register::DPP::InputDynamicRange); + UpdateComobox(cbDynamicRange, DPP::InputDynamicRange); - uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch); - if( Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::Polarity) ){ + uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch); + if( Digitizer::ExtractBits(DPPAlg, DPP::Bit_DPPAlgorithmControl::Polarity) ){ cbPolarity->setCurrentIndex(1); }else{ cbPolarity->setCurrentIndex(0); } if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ - UpdateSpinBox(sbInputRiseTime, Register::DPP::PHA::InputRiseTime); - UpdateSpinBox(sbThreshold, Register::DPP::PHA::TriggerThreshold); - UpdateSpinBox(sbTriggerHoldOff, Register::DPP::PHA::TriggerHoldOffWidth); + UpdateSpinBox(sbInputRiseTime, DPP::PHA::InputRiseTime); + UpdateSpinBox(sbThreshold, DPP::PHA::TriggerThreshold); + UpdateSpinBox(sbTriggerHoldOff, DPP::PHA::TriggerHoldOffWidth); - UpdateSpinBox(sbTrapRiseTime, Register::DPP::PHA::TrapezoidRiseTime); - UpdateSpinBox(sbTrapFlatTop, Register::DPP::PHA::TrapezoidFlatTop); - UpdateSpinBox(sbDecayTime, Register::DPP::PHA::DecayTime); - UpdateSpinBox(sbPeakingTime, Register::DPP::PHA::PeakingTime); + UpdateSpinBox(sbTrapRiseTime, DPP::PHA::TrapezoidRiseTime); + UpdateSpinBox(sbTrapFlatTop, DPP::PHA::TrapezoidFlatTop); + UpdateSpinBox(sbDecayTime, DPP::PHA::DecayTime); + UpdateSpinBox(sbPeakingTime, DPP::PHA::PeakingTime); - UpdateComobox(cbSmoothingFactor, Register::DPP::PHA::RCCR2SmoothingFactor); + UpdateComobox(cbSmoothingFactor, DPP::PHA::RCCR2SmoothingFactor); - int temp = Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::BaselineAvg); + int temp = Digitizer::ExtractBits(DPPAlg, DPP::Bit_DPPAlgorithmControl::BaselineAvg); for(int i = 0; i < cbBaselineAvg->count(); i++){ if( cbBaselineAvg->itemData(i).toInt() == temp) { cbBaselineAvg->setCurrentIndex(i); @@ -641,7 +641,7 @@ void Scope::UpdatePanelFromMomeory(){ } } - temp = Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::PeakMean); + temp = Digitizer::ExtractBits(DPPAlg, DPP::Bit_DPPAlgorithmControl::PeakMean); for(int i = 0; i < cbPeakAvg->count(); i++){ if( cbPeakAvg->itemData(i).toInt() == temp) { cbPeakAvg->setCurrentIndex(i); @@ -649,9 +649,9 @@ void Scope::UpdatePanelFromMomeory(){ } } - uint32_t BdCfg = digi[ID]->GetSettingFromMemory(Register::DPP::BoardConfiguration); + uint32_t BdCfg = digi[ID]->GetSettingFromMemory(DPP::BoardConfiguration); - temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe1); + temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::AnalogProbe1); for(int i = 0; i < cbAnaProbe1->count(); i++){ if( cbAnaProbe1->itemData(i).toInt() == temp) { cbAnaProbe1->setCurrentIndex(i); @@ -659,7 +659,7 @@ void Scope::UpdatePanelFromMomeory(){ break; } } - temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::AnalogProbe2); + temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::AnalogProbe2); for(int i = 0; i < cbAnaProbe2->count(); i++){ if( cbAnaProbe2->itemData(i).toInt() == temp) { cbAnaProbe2->setCurrentIndex(i); @@ -667,7 +667,7 @@ void Scope::UpdatePanelFromMomeory(){ break; } } - temp = Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DigiProbel1); + temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DigiProbel1); for(int i = 0; i < cbDigiProbe1->count(); i++){ if( cbDigiProbe1->itemData(i).toInt() == temp) { cbDigiProbe1->setCurrentIndex(i); @@ -686,22 +686,22 @@ void Scope::ReadSettingsFromBoard(){ int ch = cbScopeCh->currentIndex(); - digi[ID]->ReadRegister(Register::DPP::RecordLength_G, ch); - digi[ID]->ReadRegister(Register::DPP::PreTrigger, ch); - digi[ID]->ReadRegister(Register::DPP::ChannelDCOffset, ch); - digi[ID]->ReadRegister(Register::DPP::InputDynamicRange, ch); - digi[ID]->ReadRegister(Register::DPP::BoardConfiguration, ch); - digi[ID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch); + digi[ID]->ReadRegister(DPP::RecordLength_G, ch); + digi[ID]->ReadRegister(DPP::PreTrigger, ch); + digi[ID]->ReadRegister(DPP::ChannelDCOffset, ch); + digi[ID]->ReadRegister(DPP::InputDynamicRange, ch); + digi[ID]->ReadRegister(DPP::BoardConfiguration, ch); + digi[ID]->ReadRegister(DPP::DPPAlgorithmControl, ch); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ - digi[ID]->ReadRegister(Register::DPP::PHA::InputRiseTime, ch); - digi[ID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch); - digi[ID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch); - digi[ID]->ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, ch); - digi[ID]->ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, ch); - digi[ID]->ReadRegister(Register::DPP::PHA::DecayTime, ch); - digi[ID]->ReadRegister(Register::DPP::PHA::PeakingTime, ch); + digi[ID]->ReadRegister(DPP::PHA::InputRiseTime, ch); + digi[ID]->ReadRegister(DPP::PHA::TriggerThreshold, ch); + digi[ID]->ReadRegister(DPP::PHA::TriggerHoldOffWidth, ch); + digi[ID]->ReadRegister(DPP::PHA::TrapezoidRiseTime, ch); + digi[ID]->ReadRegister(DPP::PHA::TrapezoidFlatTop, ch); + digi[ID]->ReadRegister(DPP::PHA::DecayTime, ch); + digi[ID]->ReadRegister(DPP::PHA::PeakingTime, ch); } diff --git a/Scope.h b/Scope.h index 7ad408f..1ac800f 100644 --- a/Scope.h +++ b/Scope.h @@ -44,16 +44,16 @@ signals: private: void SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col); - void SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Register::Reg para); - void SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Register::Reg para); + void SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Reg para); + void SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Reg para); void CleanUpSettingsGroupBox(); void SetUpPHAPanel(); void SetUpPSDPanel(); void EnableControl(bool enable); - void UpdateComobox(RComboBox * &cb, const Register::Reg para); - void UpdateSpinBox(RSpinBox * &sb, const Register::Reg para); + void UpdateComobox(RComboBox * &cb, const Reg para); + void UpdateSpinBox(RSpinBox * &sb, const Reg para); void UpdatePanelFromMomeory(); Digitizer ** digi;