Remove Regitser namespace, update Global and TRGOUT Mask, all channels settings UI

This commit is contained in:
splitPoleDAQ 2023-05-01 16:20:16 -04:00
parent c37f132477
commit 362f583688
7 changed files with 1092 additions and 944 deletions

View File

@ -48,7 +48,7 @@ void Digitizer::Reset(){
ret = CAEN_DGTZ_Reset(handle); ret = CAEN_DGTZ_Reset(handle);
if( ret != 0 ) ErrorMsg(__func__); 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"); 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 default : data->DPPTypeStr = "STD"; break; // stardard
} }
/// change address 0xEF08 (5 bits), this will reflected in the 2nd word of the Board Agg. header. /// 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 ){ if ( verbose ){
PrintBoard(); PrintBoard();
if (DPPType < 0x80 ) { if (DPPType < 0x80 ) {
@ -216,8 +216,8 @@ void Digitizer::SetChannelMask(uint32_t mask){
if( !isConnected ) return; if( !isConnected ) return;
channelMask = mask; channelMask = mask;
ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask); ret |= CAEN_DGTZ_SetChannelEnableMask(handle, channelMask);
SaveSettingToFile(Register::DPP::ChannelEnableMask, mask); SaveSettingToFile(DPP::ChannelEnableMask, mask);
SetSettingToMemory(Register::DPP::ChannelEnableMask, mask); SetSettingToMemory(DPP::ChannelEnableMask, mask);
ErrorMsg(__func__); ErrorMsg(__func__);
} }
@ -241,7 +241,7 @@ int Digitizer::ProgramBoard(){
/// | | +- (1) trigger overlap not allowed /// | | +- (1) trigger overlap not allowed
/// | +- (3) test pattern disable /// | +- (3) test pattern disable
/// + (6) Self-trigger polarity, 1 = negative, 0 = Positive /// + (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) /// Set the I/O level (CAEN_DGTZ_IOLevel_NIM or CAEN_DGTZ_IOLevel_TTL)
ret |= CAEN_DGTZ_SetIOLevel(handle, IOlev); ret |= CAEN_DGTZ_SetIOLevel(handle, IOlev);
@ -253,7 +253,7 @@ int Digitizer::ProgramBoard(){
ret |= CAEN_DGTZ_SetRecordLength(handle, 2000); ret |= CAEN_DGTZ_SetRecordLength(handle, 2000);
/// Set Extras 2 to enable, this override Accusition mode, focring list mode /// 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) /// 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 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); 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 /// 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, DPP::NumberEventsPerAggregate_G + 0x7000, 100);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::AggregateOrganization, 0); ret |= CAEN_DGTZ_WriteRegister(handle, DPP::AggregateOrganization, 0);
ret |= CAEN_DGTZ_WriteRegister(handle, Register::DPP::MaxAggregatePerBlockTransfer, 50); ret |= CAEN_DGTZ_WriteRegister(handle, DPP::MaxAggregatePerBlockTransfer, 50);
ErrorMsg(__func__); ErrorMsg(__func__);
return ret; return ret;
@ -287,9 +287,9 @@ int Digitizer::ProgramPHABoard(){
ret = CAEN_DGTZ_Reset(handle); ret = CAEN_DGTZ_Reset(handle);
printf("======== program board PHA\n"); printf("======== program board PHA\n");
ret = CAEN_DGTZ_WriteRegister(handle, Register::DPP::RecordLength_G + 0x7000, 62); ret = CAEN_DGTZ_WriteRegister(handle, 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, 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::BoardConfiguration, 0x0D8115); /// diable Extra2
//TODO change to write register //TODO change to write register
ret = CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command ret = CAEN_DGTZ_SetAcquisitionMode(handle, CAEN_DGTZ_SW_CONTROLLED); /// software command
@ -307,26 +307,26 @@ int Digitizer::ProgramPHABoard(){
uint32_t address; uint32_t address;
address = Register::DPP::PHA::DecayTime; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 5000 ); address = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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 = 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::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)(DPP::ChannelDCOffset) + 0x7000 , 0xEEEE );
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::PreTrigger) + 0x7000 , 32 ); ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::PreTrigger) + 0x7000 , 32 );
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(Register::DPP::InputDynamicRange) + 0x7000 , 0x0 ); 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)(DPP::NumberEventsPerAggregate_G) + 0x7000, 511);
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::AggregateOrganization), 2); ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::AggregateOrganization), 2);
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::MaxAggregatePerBlockTransfer), 4); ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::MaxAggregatePerBlockTransfer), 4);
ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(Register::DPP::DPPAlgorithmControl) + 0x7000, 0xC30200f); ret |= CAEN_DGTZ_WriteRegister(handle, (int32_t)(DPP::DPPAlgorithmControl) + 0x7000, 0xC30200f);
if( ret != 0 ) { printf("==== set channels error.\n"); return 0;} if( ret != 0 ) { printf("==== set channels error.\n"); return 0;}
@ -381,23 +381,23 @@ unsigned int Digitizer::CalByteForBuffer(){
unsigned int aggOrgan; unsigned int aggOrgan;
if( isConnected ){ if( isConnected ){
numAggBLT = ReadRegister(Register::DPP::MaxAggregatePerBlockTransfer, 0, false); numAggBLT = ReadRegister(DPP::MaxAggregatePerBlockTransfer, 0, false);
chMask = ReadRegister(Register::DPP::ChannelEnableMask, 0, false); chMask = ReadRegister(DPP::ChannelEnableMask, 0, false);
boardCfg = ReadRegister(Register::DPP::BoardConfiguration, 0, false); boardCfg = ReadRegister(DPP::BoardConfiguration, 0, false);
aggOrgan = ReadRegister(Register::DPP::AggregateOrganization, 0, false); aggOrgan = ReadRegister(DPP::AggregateOrganization, 0, false);
for( int pCh = 0; pCh < NChannel/2; pCh++){ for( int pCh = 0; pCh < NChannel/2; pCh++){
eventAgg[pCh] = ReadRegister(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 , false); eventAgg[pCh] = ReadRegister(DPP::NumberEventsPerAggregate_G, pCh * 2 , false);
recordLength[pCh] = ReadRegister(Register::DPP::RecordLength_G, pCh * 2 , false); recordLength[pCh] = ReadRegister(DPP::RecordLength_G, pCh * 2 , false);
} }
}else{ }else{
numAggBLT = GetSettingFromMemory(Register::DPP::MaxAggregatePerBlockTransfer); numAggBLT = GetSettingFromMemory(DPP::MaxAggregatePerBlockTransfer);
chMask = GetSettingFromMemory(Register::DPP::ChannelEnableMask); chMask = GetSettingFromMemory(DPP::ChannelEnableMask);
boardCfg = GetSettingFromMemory(Register::DPP::BoardConfiguration); boardCfg = GetSettingFromMemory(DPP::BoardConfiguration);
aggOrgan = GetSettingFromMemory(Register::DPP::AggregateOrganization); aggOrgan = GetSettingFromMemory(DPP::AggregateOrganization);
for( int pCh = 0; pCh < NChannel/2; pCh++){ for( int pCh = 0; pCh < NChannel/2; pCh++){
eventAgg[pCh] = GetSettingFromMemory(Register::DPP::NumberEventsPerAggregate_G, pCh * 2 ); eventAgg[pCh] = GetSettingFromMemory(DPP::NumberEventsPerAggregate_G, pCh * 2 );
recordLength[pCh] = GetSettingFromMemory(Register::DPP::RecordLength_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)); 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); //printf("Read Buffer size %d byte, Event Size : %d byte \n", data->nByte, EventSize);
if (ret || data->nByte == 0) { if (ret || data->nByte == 0) {
@ -444,7 +444,7 @@ int Digitizer::ReadData(){
void Digitizer::PrintACQStatue(){ void Digitizer::PrintACQStatue(){
if( !isConnected ) return; if( !isConnected ) return;
unsigned int status = ReadRegister(Register::DPP::AcquisitionStatus_R); unsigned int status = ReadRegister(DPP::AcquisitionStatus_R);
printf("=================== Print ACQ status \n"); printf("=================== Print ACQ status \n");
printf(" 32 28 24 20 16 12 8 4 0\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); 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; return;
} }
if( registerAddress.GetType() == Register::RW::ReadONLY ) return; if( registerAddress.GetType() == RW::ReadONLY ) return;
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress.ActualAddress(ch), value); 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); SetSettingToMemory(registerAddress, value, ch);
SaveSettingToFile(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)); 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( !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); 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 //========================================== setting file IO
Register::Reg Digitizer::FindRegister(uint32_t address){ Reg Digitizer::FindRegister(uint32_t address){
Register::Reg tempReg; Reg tempReg;
///========= Find Match Register ///========= Find Match Register
for( int p = 0; p < (int) RegisterDPPList[p]; p++){ for( int p = 0; p < (int) RegisterDPPList[p]; p++){
if( address == RegisterDPPList[p].GetAddress() ) { if( address == RegisterDPPList[p].GetAddress() ) {
@ -559,23 +559,23 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){
/// board setting /// board setting
for( int p = 0; p < (int) RegisterDPPList.size(); p++){ 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]); ReadRegister(RegisterDPPList[p]);
} }
channelMask = GetSettingFromMemory(Register::DPP::ChannelEnableMask); channelMask = GetSettingFromMemory(DPP::ChannelEnableMask);
/// Channels Setting /// Channels Setting
for( int ch = 0; ch < NChannel; ch ++){ for( int ch = 0; ch < NChannel; ch ++){
if( DPPType == V1730_DPP_PHA_CODE ){ if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterPHAList.size(); p++){ 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); ReadRegister(RegisterPHAList[p], ch);
} }
} }
if( DPPType == V1730_DPP_PSD_CODE ){ if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterPSDList.size(); p++){ 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); ReadRegister(RegisterPSDList[p], ch);
} }
} }
@ -587,11 +587,11 @@ void Digitizer::ProgramSettingsToBoard(){
if( !isConnected ) return; if( !isConnected ) return;
if( isDummy ) return; if( isDummy ) return;
Register::Reg haha; Reg haha;
/// board setting /// board setting
for( int p = 0; p < (int) RegisterDPPList[p]; p++){ 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]; haha = RegisterDPPList[p];
WriteRegister(haha, GetSettingFromMemory(haha), -1, false); WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
usleep(100 * 1000); usleep(100 * 1000);
@ -600,7 +600,7 @@ void Digitizer::ProgramSettingsToBoard(){
for( int ch = 0; ch < NChannel; ch ++){ for( int ch = 0; ch < NChannel; ch ++){
if( DPPType == V1730_DPP_PHA_CODE ){ if( DPPType == V1730_DPP_PHA_CODE ){
for( int p = 0; p < (int) RegisterPHAList[p]; p++){ 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]; haha = RegisterPHAList[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(100 * 1000); usleep(100 * 1000);
@ -608,7 +608,7 @@ void Digitizer::ProgramSettingsToBoard(){
} }
if( DPPType == V1730_DPP_PSD_CODE ){ if( DPPType == V1730_DPP_PSD_CODE ){
for( int p = 0; p < (int) RegisterPSDList[p]; p++){ 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]; haha = RegisterPHAList[p];
WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false); WriteRegister(haha, GetSettingFromMemory(haha, ch), ch, false);
usleep(100 * 1000); 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); unsigned short index = registerAddress.Index(ch);
if( index > SETTINGSIZE ) return; if( index > SETTINGSIZE ) return;
setting[index] = value; 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); unsigned short index = registerAddress.Index(ch);
if( index > SETTINGSIZE ) return 0xFFFF; if( index > SETTINGSIZE ) return 0xFFFF;
return setting[index] ; return setting[index] ;
@ -668,7 +668,7 @@ int Digitizer::LoadSettingBinaryToMemory(std::string fileName){
settingFileName = fileName; settingFileName = fileName;
fclose (settingFile); 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; /// compare seeting DPP version;
if( isConnected && DPPType != (int) fileDPP ){ 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"); 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) == 0x0E ) ch2ns = 4.0;
if( (boardInfo & 0xFF) == 0x0B ) ch2ns = 2.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; if ( !settingFileExist ) return -1;
unsigned short index = registerAddress.Index(ch); 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 ; if ( !settingFileExist ) return ;
unsigned short index = registerAddress.Index(ch); unsigned short index = registerAddress.Index(ch);
@ -757,7 +757,7 @@ void Digitizer::SaveAllSettingsAsText(std::string fileName){
return; return;
} }
Register::Reg haha; Reg haha;
for( unsigned int i = 0; i < SETTINGSIZE ; i++){ for( unsigned int i = 0; i < SETTINGSIZE ; i++){
haha.SetName(""); haha.SetName("");
@ -779,9 +779,9 @@ void Digitizer::SaveAllSettingsAsText(std::string fileName){
} }
if( haha.GetName() != "" ) { if( haha.GetName() != "" ) {
std::string typeStr ; std::string typeStr ;
if( haha.GetType() == Register::RW::ReadWrite ) typeStr = "R/W"; if( haha.GetType() == RW::ReadWrite ) typeStr = "R/W";
if( haha.GetType() == Register::RW::ReadONLY ) typeStr = "R "; if( haha.GetType() == RW::ReadONLY ) typeStr = "R ";
if( haha.GetType() == Register::RW::WriteONLY ) typeStr = " W"; if( haha.GetType() == RW::WriteONLY ) typeStr = " W";
fprintf( txtFile, "0x%04X %30s 0x%08X %s %u\n", actualAddress, fprintf( txtFile, "0x%04X %30s 0x%08X %s %u\n", actualAddress,
haha.GetNameChar(), haha.GetNameChar(),
setting[i], setting[i],
@ -853,11 +853,11 @@ void Digitizer::ErrorMsg(std::string header){
//============================== DPP-Alpgorthm Control //============================== DPP-Alpgorthm Control
void Digitizer::SetDPPAlgorithmControl(uint32_t bit, int ch){ void Digitizer::SetDPPAlgorithmControl(uint32_t bit, int ch){
WriteRegister( Register::DPP::DPPAlgorithmControl, bit, ch); WriteRegister( DPP::DPPAlgorithmControl, bit, ch);
if( ret != 0 ) ErrorMsg(__func__); 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; int tempCh = ch;
if (ch < 0 && address < 0x8000 ) tempCh = 0; /// take ch-0 if (ch < 0 && address < 0x8000 ) tempCh = 0; /// take ch-0
uint32_t bit = ReadRegister(address, tempCh); uint32_t bit = ReadRegister(address, tempCh);
@ -865,7 +865,7 @@ unsigned int Digitizer::ReadBits(Register::Reg address, unsigned int bitLength,
return bit; 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); ///printf("address : 0x%X, value : 0x%X, len : %d, pos : %d, ch : %d \n", address, bitValue, bitLength, bitSmallestPos, ch);
uint32_t bit ; uint32_t bit ;
uint32_t bitmask = (uint(pow(2, bitLength)-1) << bitSmallestPos); uint32_t bitmask = (uint(pow(2, bitLength)-1) << bitSmallestPos);

View File

@ -92,10 +92,10 @@ class Digitizer{
/// write value to digitizer, memory, and settingFile (if exist) /// write value to digitizer, memory, and settingFile (if exist)
/// ONLY WriteRegister can have ch = -1, for writting all channels /// ONLY WriteRegister can have ch = -1, for writting all channels
/// for board setting, ignore ch /// 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), /// read value from digitizer and memory, and save to memory, and settingFile(if exist),
/// for board setting, ignore ch /// 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); uint32_t PrintRegister(uint32_t address, std::string msg);
//^================ Get Board info //^================ Get Board info
@ -116,14 +116,14 @@ class Digitizer{
int GetErrorCode() const {return ret;} int GetErrorCode() const {return ret;}
//^================ Setting //^================ Setting
Register::Reg FindRegister(uint32_t address); Reg FindRegister(uint32_t address);
/// board <--> memory functions /// board <--> memory functions
void ReadAllSettingsFromBoard (bool force = false); void ReadAllSettingsFromBoard (bool force = false);
void ProgramSettingsToBoard (); void ProgramSettingsToBoard ();
/// simply read settings from memory /// simply read settings from memory
void SetSettingToMemory (Register::Reg registerAddress, unsigned int value, unsigned short ch = 0); void SetSettingToMemory (Reg registerAddress, unsigned int value, unsigned short ch = 0);
unsigned int GetSettingFromMemory (Register::Reg registerAddress, unsigned short ch = 0); unsigned int GetSettingFromMemory (Reg registerAddress, unsigned short ch = 0);
void PrintSettingFromMemory (); void PrintSettingFromMemory ();
unsigned int * GetSettings() {return setting;}; unsigned int * GetSettings() {return setting;};
@ -137,51 +137,51 @@ class Digitizer{
/// load setting file to memory /// load setting file to memory
/// if problem, return -1; load without problem, return 0; /// if problem, return -1; load without problem, return 0;
int LoadSettingBinaryToMemory (std::string fileName); int LoadSettingBinaryToMemory (std::string fileName);
void SaveSettingToFile (Register::Reg registerAddress, unsigned int value, unsigned short ch = 0); /// also save to memory void SaveSettingToFile (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 unsigned int ReadSettingFromFile (Reg registerAddress, unsigned short ch = 0); /// read from setting binary
//============ old methods, that only manipulate digitizer register, not setting in memory //============ old methods, that only manipulate digitizer register, not setting in memory
void SetDPPAlgorithmControl(uint32_t bit, int ch); void SetDPPAlgorithmControl(uint32_t bit, int ch);
unsigned int ReadBits(Register::Reg address, unsigned int bitLength, unsigned int bitSmallestPos, int ch ); unsigned int ReadBits(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(Reg address, unsigned int bitValue, unsigned int bitLength, unsigned int bitSmallestPos, int ch);
void SetBits(Register::Reg address, std::pair<unsigned short, unsigned short> bit, unsigned int bitValue, int ch){ SetBits(address, bitValue, bit.first, bit.second, ch);} void SetBits(Reg address, std::pair<unsigned short, unsigned short> bit, unsigned int bitValue, int ch){ SetBits(address, bitValue, bit.first, bit.second, ch);}
static unsigned int ExtractBits(uint32_t value, std::pair<unsigned short, unsigned short> bit){ return ((value >> bit.second) & uint(pow(2, bit.first)-1) ); } static unsigned int ExtractBits(uint32_t value, std::pair<unsigned short, unsigned short> bit){ return ((value >> bit.second) & uint(pow(2, bit.first)-1) ); }
//====== Board Config breakDown //====== Board Config breakDown
bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(Register::DPP::BoardConfiguration) & 0x1 );} bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(DPP::BoardConfiguration) & 0x1 );}
bool IsDecimateTrace() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 1) & 0x1 );} bool IsDecimateTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 1) & 0x1 );}
bool IsTriggerPropagate() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 2) & 0x1 );} bool IsTriggerPropagate() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 2) & 0x1 );}
bool IsDualTrace() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 11) & 0x1 );} bool IsDualTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 11) & 0x1 );}
unsigned short AnaProbe1Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 12) & 0x3 );} unsigned short AnaProbe1Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 12) & 0x3 );}
unsigned short AnaProbe2Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 14) & 0x3 );} unsigned short AnaProbe2Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 14) & 0x3 );}
bool IsRecordTrace() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 16) & 0x1 );} bool IsRecordTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 16) & 0x1 );}
bool IsEnabledExtra2() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 17) & 0x1 );} bool IsEnabledExtra2() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 17) & 0x1 );}
bool IsRecordTimeStamp() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 18) & 0x1 );} bool IsRecordTimeStamp() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 18) & 0x1 );}
bool IsRecordEnergy() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 19) & 0x1 );} bool IsRecordEnergy() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 19) & 0x1 );}
unsigned short DigiProbe1Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 20) & 0xF );} unsigned short DigiProbe1Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 20) & 0xF );}
unsigned short DigiProbe2Type() {return ( (GetSettingFromMemory(Register::DPP::BoardConfiguration) >> 26) & 0x7 );} unsigned short DigiProbe2Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 26) & 0x7 );}
//====== DPP Algorithm Contol breakdown //====== DPP Algorithm Contol breakdown
unsigned short TrapReScaling(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 0) & 0x1F );} unsigned short TrapReScaling(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 0) & 0x1F );}
unsigned short TraceDecimation(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 8) & 0x3 );} unsigned short TraceDecimation(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 8) & 0x3 );}
unsigned short TraceDecimationGain(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 10) & 0x3 );} unsigned short TraceDecimationGain(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 10) & 0x3 );}
unsigned short PeakMean(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 12) & 0x3 );} unsigned short PeakMean(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 12) & 0x3 );}
unsigned short Polarity(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 16) & 0x1 );} unsigned short Polarity(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 16) & 0x1 );}
unsigned short TriggerMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 18) & 0x3 );} unsigned short TriggerMode(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 18) & 0x3 );}
unsigned short BaseLineAvg(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 18) & 0x7 );} unsigned short BaseLineAvg(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 18) & 0x7 );}
unsigned short DisableSelfTrigger(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 24) & 0x1 );} unsigned short DisableSelfTrigger(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 24) & 0x1 );}
unsigned short EnableRollOverFlag(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 26) & 0x1 );} unsigned short EnableRollOverFlag(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 26) & 0x1 );}
unsigned short EnablePileUpFlag(int ch) {return ( (GetSettingFromMemory(Register::DPP::DPPAlgorithmControl, ch) >> 27) & 0x1 );} unsigned short EnablePileUpFlag(int ch) {return ( (GetSettingFromMemory(DPP::DPPAlgorithmControl, ch) >> 27) & 0x1 );}
//====== DPP Algorithm Contol 2 breakdown //====== DPP Algorithm Contol 2 breakdown
unsigned short LocalShapeMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 0) & 0x7 );} unsigned short LocalShapeMode(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 0) & 0x7 );}
unsigned short LocalTrigValidMode(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 4) & 0x7 );} unsigned short LocalTrigValidMode(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 4) & 0x7 );}
unsigned short Extra2Option(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 8) & 0x3 );} unsigned short Extra2Option(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 8) & 0x3 );}
unsigned short VetoSource(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 14) & 0x3 );} unsigned short VetoSource(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 14) & 0x3 );}
unsigned short TrigCounter(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 16) & 0x3 );} unsigned short TrigCounter(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 16) & 0x3 );}
unsigned short ActiveBaseLineCal(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 18) & 0x1 );} unsigned short ActiveBaseLineCal(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 18) & 0x1 );}
unsigned short TagCorrelatedEvents(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 19) & 0x1 );} unsigned short TagCorrelatedEvents(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 19) & 0x1 );}
unsigned short OptimizeBaseLineRestorer(int ch) {return ( (GetSettingFromMemory(Register::DPP::PHA::DPPAlgorithmControl2_G, ch) >> 29) & 0x1 );} unsigned short OptimizeBaseLineRestorer(int ch) {return ( (GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch) >> 29) & 0x1 );}
//====== Acquistion Control vreakdown //====== Acquistion Control vreakdown

View File

@ -32,7 +32,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QMai
enableSignalSlot = false; enableSignalSlot = false;
setWindowTitle("Digitizer Settings"); setWindowTitle("Digitizer Settings");
setGeometry(0, 0, 1300, 800); setGeometry(0, 0, 1400, 800);
tabWidget = new QTabWidget(this); tabWidget = new QTabWidget(this);
setCentralWidget(tabWidget); 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("ROC version ", digi[ID]->GetROCVersion(), infoLayout[ID], 2, 2);
SetUpInfo("AMC version ", digi[ID]->GetAMCVersion(), infoLayout[ID], 2, 4); 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("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("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); 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); buttonLayout->addWidget(bnRefreshSetting, rowID, 0);
connect(bnRefreshSetting, &QPushButton::clicked, this, &DigiSettingsPanel::ReadSettingsFromBoard); 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); buttonLayout->addWidget(bnProgramPreDefined, rowID, 1);
connect(bnProgramPreDefined, &QPushButton::clicked, this, [=](){ digi[ID]->ProgramPHABoard();}); //TODO for PSD connect(bnProgramPreDefined, &QPushButton::clicked, this, [=](){ digi[ID]->ProgramPHABoard();}); //TODO for PSD
bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this); bnClearBuffer = new QPushButton("Clear Buffer/FIFO", this);
buttonLayout->addWidget(bnClearBuffer, rowID, 2); 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 ++; //--------------------------- rowID ++; //---------------------------
bnSendSoftwareTriggerSignal = new QPushButton("Send SW Trigger Signal", this); bnSendSoftwareTriggerSignal = new QPushButton("Send SW Trigger Signal", this);
buttonLayout->addWidget(bnSendSoftwareTriggerSignal, rowID, 0); 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); bnSendSoftwareClockSyncSignal = new QPushButton("Send SW Clock-Sync Signal", this);
buttonLayout->addWidget(bnSendSoftwareClockSyncSignal, rowID, 1); 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); bnSaveSettings = new QPushButton("Save Settings", this);
buttonLayout->addWidget(bnSaveSettings, rowID, 2); 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(); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard();
//--------------- trigger SetUpGlobalTriggerMaskAndFrontPanelMask();
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);
} }
@ -350,7 +262,7 @@ void DigiSettingsPanel::SetUpInfo(QString label, std::string value, QGridLayout
gLayout->addWidget(leInfo, row, col + 1); gLayout->addWidget(leInfo, row, col + 1);
} }
void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para, std::pair<unsigned short, unsigned short> bit){ void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Reg para, std::pair<unsigned short, unsigned short> bit){
chkBox = new QCheckBox(label, this); chkBox = new QCheckBox(label, this);
gLayout->addWidget(chkBox, row, col); 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<std::pair<std::string, unsigned int>> items, Register::Reg para, std::pair<unsigned short, unsigned short> bit){ void DigiSettingsPanel::SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector<std::pair<std::string, unsigned int>> items, Reg para, std::pair<unsigned short, unsigned short> bit, int colspan){
QLabel * lab = new QLabel(label, this); QLabel * lab = new QLabel(label, this);
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); lab->setAlignment(Qt::AlignRight | Qt::AlignCenter);
gLayout->addWidget(lab, row, col); gLayout->addWidget(lab, row, col);
cb = new RComboBox(this); 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++){ for(int i = 0; i < (int) items.size(); i++){
cb->addItem(QString::fromStdString(items[i].first), items[i].second); 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); QLabel * lab = new QLabel(label, this);
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); 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); QLabel * lab = new QLabel(label, this);
lab->setAlignment(Qt::AlignRight | Qt::AlignCenter); lab->setAlignment(Qt::AlignRight | Qt::AlignCenter);
gLayout->addWidget(lab, row, col); 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(){ void DigiSettingsPanel::SetUpPHABoard(){
printf("============== %s \n", __func__); printf("============== %s \n", __func__);
@ -489,53 +581,59 @@ void DigiSettingsPanel::SetUpPHABoard(){
if( bnChEnableMask[ID][i]->styleSheet() == "" ){ if( bnChEnableMask[ID][i]->styleSheet() == "" ){
bnChEnableMask[ID][i]->setStyleSheet("background-color : green;"); 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{ }else{
bnChEnableMask[ID][i]->setStyleSheet(""); 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(chkAutoDataFlush[ID], "Auto Data Flush", settingLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableAutoDataFlush);
SetUpCheckBox(chkDecimateTrace[ID], "Decimate Trace", settingLayout[ID], 2, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::DecimateTrace); SetUpCheckBox(chkDecimateTrace[ID], "Decimate Trace", settingLayout[ID], 2, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::DecimateTrace);
SetUpCheckBox(chkTrigPropagation[ID], "Trig. Propagate", settingLayout[ID], 3, 0, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::TrigPropagation); 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, Register::DPP::DisableExternalTrigger, {1, 0}); 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(chkDualTrace[ID], "Dual Trace", settingLayout[ID], 1, 1, DPP::BoardConfiguration, 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); 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); SetUpCheckBox(chkTraceRecording[ID], "Record Trace", settingLayout[ID], 2, 1, DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace);
SetUpComboBoxBit(cbAnaProbe2[ID], "Ana. Probe 2 ", settingLayout[ID], 2, 2, Register::DPP::Bit_BoardConfig::ListAnaProbe2_PHA, Register::DPP::BoardConfiguration, Register::DPP::Bit_BoardConfig::AnalogProbe2); SetUpCheckBox(chkEnableExtra2[ID], "Enable Extra2", settingLayout[ID], 3, 1, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableExtra2);
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);
SetUpSpinBox(sbAggNum[ID], "Agg. Num. / read", settingLayout[ID], 5, 0, Register::DPP::MaxAggregatePerBlockTransfer); SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe 1 ", settingLayout[ID], 1, 2, DPP::Bit_BoardConfig::ListAnaProbe1_PHA, DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe1);
SetUpComboBox(cbAggOrg[ID], "Aggregate Organization ", settingLayout[ID], 6, 0, Register::DPP::AggregateOrganization); 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}, SetUpComboBoxBit(cbStartStopMode[ID], "Start/Stop Mode ", settingLayout[ID], 7, 0, {{"SW controlled", 0},
{"S-IN/GPI controlled", 1}, {"S-IN/GPI controlled", 1},
{"1st Trigger", 2}, {"1st Trigger", 2},
{"LVDS controlled", 3}}, {"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}, 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 ///============================ Trig out mode
@ -545,7 +643,7 @@ void DigiSettingsPanel::SetUpPHABoard(){
cbTRGOUTMode[ID] = new RComboBox(this); cbTRGOUTMode[ID] = new RComboBox(this);
settingLayout[ID]->addWidget(cbTRGOUTMode[ID], 9, 3); settingLayout[ID]->addWidget(cbTRGOUTMode[ID], 9, 3);
std::vector<std::pair<std::string, unsigned int>> items = Register::DPP::Bit_FrontPanelIOControl::ListTRGOUTConfig; std::vector<std::pair<std::string, unsigned int>> items = DPP::Bit_FrontPanelIOControl::ListTRGOUTConfig;
for(int i = 0; i < (int) items.size(); i++){ for(int i = 0; i < (int) items.size(); i++){
cbTRGOUTMode[ID]->addItem(QString::fromStdString(items[i].first), items[i].second); cbTRGOUTMode[ID]->addItem(QString::fromStdString(items[i].first), items[i].second);
@ -555,13 +653,13 @@ void DigiSettingsPanel::SetUpPHABoard(){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
if( index == 0 ) { 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{ }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 ; 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); QGridLayout * inputLayout = new QGridLayout(inputBox);
RSpinBox * sbRecordLength; SetUpSpinBox(sbRecordLength[MaxNChannels], "Record Length [G][ns] : ", inputLayout, 0, 0, DPP::RecordLength_G);
SetUpSpinBox(sbRecordLength, "Record Length [G][ns] : ", inputLayout, 0, 0, Register::DPP::RecordLength_G); SetUpComboBox(cbDynamicRange[MaxNChannels], "Dynamic Range : ", inputLayout, 0, 2, DPP::InputDynamicRange);
SetUpSpinBox(sbPreTrigger[MaxNChannels], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::PreTrigger);
RComboBox * cbDynamicRange; SetUpComboBox(cbRCCR2Smoothing[MaxNChannels], "Smoothing factor : ", inputLayout, 1, 2, DPP::PHA::RCCR2SmoothingFactor);
SetUpComboBox(cbDynamicRange, "Dynamic Range : ", inputLayout, 0, 2, Register::DPP::InputDynamicRange); SetUpSpinBox(sbInputRiseTime[MaxNChannels], "Rise Time [ns] : ", inputLayout, 2, 0, DPP::PHA::InputRiseTime);
SetUpSpinBox(sbThreshold[MaxNChannels], "Threshold [LSB] : ", inputLayout, 2, 2, DPP::PHA::TriggerThreshold);
RSpinBox * sbPreTrigger; SetUpSpinBox(sbRiseTimeValidWin[MaxNChannels], "Rise Time Valid. Win. [ns] : ", inputLayout, 3, 0, DPP::PHA::RiseTimeValidationWindow);
SetUpSpinBox(sbPreTrigger, "Pre-Trigger [ns] : ", inputLayout, 1, 0, Register::DPP::PreTrigger); 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);
RComboBox * cbRCCR2Smoothing; SetUpSpinBox(sbDCOffset[MaxNChannels], "DC Offset [%] : ", inputLayout, 4, 2, DPP::ChannelDCOffset);
SetUpComboBox(cbRCCR2Smoothing, "Smoothing factor : ", inputLayout, 1, 2, Register::DPP::PHA::RCCR2SmoothingFactor); SetUpComboBoxBit(cbPolarity[MaxNChannels], "Polarity : ", inputLayout, 5, 0, DPP::Bit_DPPAlgorithmControl::ListPolarity, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::Polarity);
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);
} }
@ -621,39 +698,17 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QGridLayout * trapLayout = new QGridLayout(trapBox); QGridLayout * trapLayout = new QGridLayout(trapBox);
RSpinBox * sbTrapRiseTime; SetUpSpinBox(sbTrapRiseTime[MaxNChannels], "Rise Time [ns] : ", trapLayout, 0, 0, DPP::PHA::TrapezoidRiseTime);
SetUpSpinBox(sbTrapRiseTime, "Rise Time [ns] : ", trapLayout, 0, 0, Register::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);
RSpinBox * sbTrapFlatTop; SetUpSpinBox(sbTrapScaling[MaxNChannels], "Rescaling : ", trapLayout, 1, 2, DPP::PHA::DPPAlgorithmControl2_G);
SetUpSpinBox(sbTrapFlatTop, "Flat Top [ns] : ", trapLayout, 0, 2, Register::DPP::PHA::TrapezoidFlatTop); SetUpSpinBox(sbPeaking[MaxNChannels], "Peaking [ns] : ", trapLayout, 2, 0, DPP::PHA::PeakingTime);
SetUpSpinBox(sbPeakingHoldOff[MaxNChannels], "Peak Hold-off [ns] : ", trapLayout, 2, 2, DPP::PHA::PeakHoldOff);
RSpinBox * sbDecay; SetUpComboBoxBit(cbPeakAvg[MaxNChannels], "Peak Avg. : ", trapLayout, 3, 0, DPP::Bit_DPPAlgorithmControl::ListPeakMean, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::PeakMean);
SetUpSpinBox(sbDecay, "Decay [ns] : ", trapLayout, 1, 0, Register::DPP::PHA::DecayTime); 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);
RSpinBox * sbTrapScaling; SetUpCheckBox(chkBaselineRestore[MaxNChannels], "Baseline Restorer [G]", trapLayout, 4, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::EnableActiveBaselineRestoration);
SetUpSpinBox(sbTrapScaling, "Rescaling : ", trapLayout, 1, 2, Register::DPP::PHA::DPPAlgorithmControl2_G); SetUpSpinBox(sbFineGain[MaxNChannels], "Fine Gain : ", trapLayout, 4, 2, DPP::PHA::FineGain);
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);
} }
@ -663,46 +718,21 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QGridLayout * otherLayout = new QGridLayout(otherBox); QGridLayout * otherLayout = new QGridLayout(otherBox);
RComboBox * cbDecimateTrace; SetUpCheckBox(chkDisableSelfTrigger[MaxNChannels], "Disable Self Trigger ", otherLayout, 0, 0, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::DisableSelfTrigger);
SetUpComboBoxBit(cbDecimateTrace, "Decimate Trace : ", otherLayout, 0, 0, Register::DPP::Bit_DPPAlgorithmControl::ListTraceDecimation, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TraceDecimation); 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);
RComboBox * cbDecimateGain; SetUpCheckBox(chkTagCorrelation[MaxNChannels], "Tag Correlated events [G]", otherLayout, 1, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TagCorrelatedEvents);
SetUpComboBoxBit(cbDecimateGain, "Decimate Gain : ", otherLayout, 0, 2, Register::DPP::Bit_DPPAlgorithmControl::ListDecimationGain, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TraceDeciGain); 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);
RComboBox * cbTrigMode; SetUpSpinBox(sbNumEventAgg[MaxNChannels], "Events per Agg. [G] : ", otherLayout, 2, 0, DPP::NumberEventsPerAggregate_G);
SetUpComboBoxBit(cbTrigMode, "Trig Mode : ", otherLayout, 1, 0, Register::DPP::Bit_DPPAlgorithmControl::ListTrigMode, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::TriggerMode); 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);
QCheckBox * chkDisableSelfTrigger; SetUpComboBoxBit(cbTrigMode[MaxNChannels], "Trig Mode : ", otherLayout, 4, 0, DPP::Bit_DPPAlgorithmControl::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl::TriggerMode, 3);
SetUpCheckBox(chkDisableSelfTrigger, "Disable Self Trigger ", otherLayout, 1, 2, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::DisableSelfTrigger); 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);
QCheckBox * chkEnableRollOver; SetUpComboBoxBit(cbVetoSource[MaxNChannels], "Veto Source [G] : ", otherLayout, 7, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListVetoSource, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource);
SetUpCheckBox(chkEnableRollOver, "Enable Roll-Over Event", otherLayout, 2, 0, Register::DPP::DPPAlgorithmControl, Register::DPP::Bit_DPPAlgorithmControl::EnableRollOverFlag); 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);
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
} }
@ -718,7 +748,7 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
enableSignalSlot = false; 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++){ for( int i = 0; i < 9; i++){
if( Digitizer::ExtractBits(AcqStatus, {1, ACQToolTip[i].second}) == 0 ){ if( Digitizer::ExtractBits(AcqStatus, {1, ACQToolTip[i].second}) == 0 ){
bnACQStatus[ID][i]->setStyleSheet(""); 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++){ for( int i = 0; i < 3; i++){
if( Digitizer::ExtractBits(BdFailStatus, {1, BdFailToolTip[i].second}) == 0 ){ if( Digitizer::ExtractBits(BdFailStatus, {1, BdFailToolTip[i].second}) == 0 ){
bnBdFailStatus[ID][i]->setStyleSheet("background-color: green;"); 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++){ for( int i = 0; i < 3; i++){
if( Digitizer::ExtractBits(ReadoutStatus, {1, ReadoutToolTip[i].second}) == 0 ){ if( Digitizer::ExtractBits(ReadoutStatus, {1, ReadoutToolTip[i].second}) == 0 ){
if( ReadoutToolTip[i].second != 2 ) { 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) ); chkAutoDataFlush[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableAutoDataFlush) );
chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DecimateTrace) ); chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DecimateTrace) );
chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::TrigPropagation) ); chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::TrigPropagation) );
chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::DualTrace) ); chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DualTrace) );
chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::TrigPropagation) ); chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::TrigPropagation) );
chkEnableExtra2[ID]->setChecked( Digitizer::ExtractBits(BdCfg, Register::DPP::Bit_BoardConfig::EnableExtra2) ); 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++){ for( int i = 0; i < cbAnaProbe1[ID]->count(); i++){
if( cbAnaProbe1[ID]->itemData(i).toInt() == temp) { if( cbAnaProbe1[ID]->itemData(i).toInt() == temp) {
cbAnaProbe1[ID]->setCurrentIndex(i); 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++){ for(int i = 0; i < cbAnaProbe2[ID]->count(); i++){
if( cbAnaProbe2[ID]->itemData(i).toInt() == temp) { if( cbAnaProbe2[ID]->itemData(i).toInt() == temp) {
cbAnaProbe2[ID]->setCurrentIndex(i); cbAnaProbe2[ID]->setCurrentIndex(i);
break; 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++){ for(int i = 0; i < cbDigiProbe1[ID]->count(); i++){
if( cbDigiProbe1[ID]->itemData(i).toInt() == temp) { if( cbDigiProbe1[ID]->itemData(i).toInt() == temp) {
cbDigiProbe1[ID]->setCurrentIndex(i); 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++){ for( int i = 0; i < MaxNChannels; i++){
if( (chMask >> i ) & 0x1 ) { if( (chMask >> i ) & 0x1 ) {
bnChEnableMask[ID][i]->setStyleSheet("background-color: green;"); 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++){ for( int i = 0; i < cbAggOrg[ID]->count(); i++){
if( cbAggOrg[ID]->itemData(i).toUInt() == aggOrg ){ if( cbAggOrg[ID]->itemData(i).toUInt() == aggOrg ){
cbAggOrg[ID]->setCurrentIndex(i); 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++){ for( int i = 0 ; i < cbAnalogMonitorMode[ID]->count(); i++){
if( cbAnalogMonitorMode[ID]->itemData(i).toUInt() == anaMonitor ){ if( cbAnalogMonitorMode[ID]->itemData(i).toUInt() == anaMonitor ){
cbAnalogMonitorMode[ID]->setCurrentIndex(i); 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 )); cbLEMOMode[ID]->setCurrentIndex( ( frontPanel & 0x1 ));
if( (frontPanel >> 1 ) & 0x1 ) { // bit-1, TRIG-OUT high impedance, i.e. disable 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; enableSignalSlot = true;
} }
void DigiSettingsPanel::UpdatePHASetting(){
}
//*================================================================
//*================================================================
void DigiSettingsPanel::ReadSettingsFromBoard(){ void DigiSettingsPanel::ReadSettingsFromBoard(){
digi[ID]->ReadAllSettingsFromBoard(); digi[ID]->ReadAllSettingsFromBoard();
@ -856,7 +921,3 @@ void DigiSettingsPanel::ReadSettingsFromBoard(){
} }
//*================================================================
//*================================================================

View File

@ -31,18 +31,24 @@ signals:
private: private:
void SetUpInfo(QString label, std::string value, QGridLayout *gLayout, int row, int col); 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<unsigned short, unsigned short> bit); void SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridLayout *gLayout, int row, int col, Reg para, std::pair<unsigned short, unsigned short> bit);
void SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector<std::pair<std::string, unsigned int>> items, Register::Reg para, std::pair<unsigned short, unsigned short> bit); void SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, std::vector<std::pair<std::string, unsigned int>> items, Reg para, std::pair<unsigned short, unsigned short> bit, int colspan = 1);
void SetUpComboBox(RComboBox * &cb, QString label, QGridLayout *gLayout, int row, int col, Register::Reg para); 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, Register::Reg para); void SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout *gLayout, int row, int col, Reg para);
void CleanUpGroupBox(QGroupBox * & gBox); void CleanUpGroupBox(QGroupBox * & gBox);
void SetUpGlobalTriggerMaskAndFrontPanelMask();
void SetUpPHABoard(); void SetUpPHABoard();
void SetUpPHAChannel(); void SetUpPHAChannel();
void SetUpPSDBoard(); void SetUpPSDBoard();
void UpdatePHASetting();
Digitizer ** digi; Digitizer ** digi;
unsigned int nDigi; unsigned int nDigi;
unsigned short ID; unsigned short ID;
@ -117,6 +123,48 @@ private:
/// ============================ Channel /// ============================ Channel
QWidget * chAllSetting; 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]; //QPushButton * bnTriggerValidMask[MaxNDigitizer][MaxNChannels/2];
}; };

View File

@ -19,8 +19,6 @@
/// Reg haha("haha", 0x1234); /// Reg haha("haha", 0x1234);
/// uint32_t papa = haha; /// papa = 0x1234 /// uint32_t papa = haha; /// papa = 0x1234
namespace Register {
enum RW { ReadWrite, ReadONLY, WriteONLY}; enum RW { ReadWrite, ReadONLY, WriteONLY};
class Reg{ class Reg{
@ -311,6 +309,24 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const std::pair<unsigned short, unsigned short> EnableExtendedBlockTransfer = {1, 8} ; const std::pair<unsigned short, unsigned short> EnableExtendedBlockTransfer = {1, 8} ;
} }
namespace Bit_GlobalTriggerMask {
const std::pair<unsigned short, unsigned short> GroupedChMask = {8, 0} ;
const std::pair<unsigned short, unsigned short> MajorCoinWin = {4, 20} ;
const std::pair<unsigned short, unsigned short> MajorLevel = {2, 24} ;
const std::pair<unsigned short, unsigned short> LVDSTrigger = {1, 29} ;
const std::pair<unsigned short, unsigned short> ExtTrigger = {1, 30} ;
const std::pair<unsigned short, unsigned short> SWTrigger = {1, 31} ;
}
namespace Bit_TRGOUTMask{
const std::pair<unsigned short, unsigned short> GroupedChMask = {8, 0} ;
const std::pair<unsigned short, unsigned short> TRGOUTLogic = {2, 8} ;
const std::pair<unsigned short, unsigned short> MajorLevel = {3, 10} ;
const std::pair<unsigned short, unsigned short> LVDSTrigger = {1, 29} ;
const std::pair<unsigned short, unsigned short> ExtTrigger = {1, 30} ;
const std::pair<unsigned short, unsigned short> SWTrigger = {1, 31} ;
}
namespace Bit_FrontPanelIOControl { namespace Bit_FrontPanelIOControl {
const std::pair<unsigned short, unsigned short> LEMOLevel = {1, 0} ; const std::pair<unsigned short, unsigned short> LEMOLevel = {1, 0} ;
const std::pair<unsigned short, unsigned short> DisableTrgOut = {1, 1} ; const std::pair<unsigned short, unsigned short> DisableTrgOut = {1, 1} ;
@ -343,6 +359,16 @@ inline uint32_t Reg::CalAddress(unsigned int index){
{"Sync Clock", 0x50000}, {"Sync Clock", 0x50000},
{"Clock Phase", 0x90000}, {"Clock Phase", 0x90000},
{"BUSY/UNLOCK", 0xD0000}}; {"BUSY/UNLOCK", 0xD0000}};
}
namespace Bit_VetoWidth {
const std::pair<unsigned short, unsigned short> VetoWidth = {16, 0} ;
const std::pair<unsigned short, unsigned short> VetoStep = {2, 16} ;
const std::vector<std::pair<std::string, unsigned int>> 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}};
} }
@ -522,143 +548,156 @@ inline uint32_t Reg::CalAddress(unsigned int index){
const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W const Reg DPPAlgorithmControl2_G ("DPPAlgorithmControl2_G" , 0x1084, RW::ReadWrite, true, {}); /// R/W
const Reg EarlyBaselineFreeze ("EarlyBaselineFreeze" , 0x10D8, 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 namepace Register
const std::vector<Register::Reg> RegisterPHAList = { } // end of DPP namepace Register
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 ,
Register::DPP::RecordLength_G , const std::vector<Reg> RegisterPHAList = {
Register::DPP::InputDynamicRange , DPP::PHA::DataFlush_W ,
Register::DPP::NumberEventsPerAggregate_G , DPP::PHA::ChannelStopAcquisition ,
Register::DPP::PreTrigger , DPP::PHA::RCCR2SmoothingFactor ,
Register::DPP::TriggerThreshold , DPP::PHA::InputRiseTime ,
Register::DPP::TriggerHoldOffWidth , DPP::PHA::TrapezoidRiseTime ,
Register::DPP::DPPAlgorithmControl , DPP::PHA::TrapezoidFlatTop ,
Register::DPP::ChannelStatus_R , DPP::PHA::PeakingTime ,
Register::DPP::AMCFirmwareRevision_R , DPP::PHA::DecayTime ,
Register::DPP::ChannelDCOffset , DPP::PHA::TriggerThreshold ,
Register::DPP::ChannelADCTemperature_R , DPP::PHA::RiseTimeValidationWindow ,
Register::DPP::IndividualSoftwareTrigger_W, DPP::PHA::TriggerHoldOffWidth ,
Register::DPP::VetoWidth , DPP::PHA::PeakHoldOff ,
DPP::PHA::ShapedTriggerWidth ,
DPP::PHA::DPPAlgorithmControl2_G ,
DPP::PHA::FineGain ,
Register::DPP::TriggerValidationMask_G 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<Register::Reg> RegisterPSDList = { const std::vector<Reg> RegisterPSDList = {
Register::DPP::PSD::CFDSetting , DPP::PSD::CFDSetting ,
Register::DPP::PSD::ForcedDataFlush_W , DPP::PSD::ForcedDataFlush_W ,
Register::DPP::PSD::ChargeZeroSuppressionThreshold , DPP::PSD::ChargeZeroSuppressionThreshold ,
Register::DPP::PSD::ShortGateWidth , DPP::PSD::ShortGateWidth ,
Register::DPP::PSD::LongGateWidth , DPP::PSD::LongGateWidth ,
Register::DPP::PSD::GateOffset , DPP::PSD::GateOffset ,
Register::DPP::PSD::TriggerThreshold , DPP::PSD::TriggerThreshold ,
Register::DPP::PSD::FixedBaseline , DPP::PSD::FixedBaseline ,
Register::DPP::PSD::TriggerLatency , DPP::PSD::TriggerLatency ,
Register::DPP::PSD::ShapedTriggerWidth , DPP::PSD::ShapedTriggerWidth ,
Register::DPP::PSD::TriggerHoldOffWidth , DPP::PSD::TriggerHoldOffWidth ,
Register::DPP::PSD::ThresholdForPSDCut , DPP::PSD::ThresholdForPSDCut ,
Register::DPP::PSD::PurGapThreshold , DPP::PSD::PurGapThreshold ,
Register::DPP::PSD::DPPAlgorithmControl2_G , DPP::PSD::DPPAlgorithmControl2_G ,
Register::DPP::PSD::EarlyBaselineFreeze , DPP::PSD::EarlyBaselineFreeze ,
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<Reg> RegisterQDCList = { //TODO
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 ,
Register::DPP::TriggerValidationMask_G
}; };
/// Only Board Setting /// Only Board Setting
const std::vector<Register::Reg> RegisterDPPList = { const std::vector<Reg> RegisterDPPList = {
Register::DPP::BoardConfiguration , DPP::BoardConfiguration ,
Register::DPP::AggregateOrganization , DPP::AggregateOrganization ,
Register::DPP::ADCCalibration_W , DPP::ADCCalibration_W ,
Register::DPP::ChannelShutdown_W , DPP::ChannelShutdown_W ,
Register::DPP::AcquisitionControl , DPP::AcquisitionControl ,
Register::DPP::AcquisitionStatus_R , DPP::AcquisitionStatus_R ,
Register::DPP::SoftwareTrigger_W , DPP::SoftwareTrigger_W ,
Register::DPP::GlobalTriggerMask , DPP::GlobalTriggerMask ,
Register::DPP::FrontPanelTRGOUTEnableMask , DPP::FrontPanelTRGOUTEnableMask ,
Register::DPP::LVDSIOData , DPP::LVDSIOData ,
Register::DPP::FrontPanelIOControl , DPP::FrontPanelIOControl ,
Register::DPP::ChannelEnableMask , DPP::ChannelEnableMask ,
Register::DPP::ROCFPGAFirmwareRevision_R , DPP::ROCFPGAFirmwareRevision_R ,
Register::DPP::EventStored_R , DPP::EventStored_R ,
Register::DPP::VoltageLevelModeConfig , DPP::VoltageLevelModeConfig ,
Register::DPP::SoftwareClockSync_W , DPP::SoftwareClockSync_W ,
Register::DPP::BoardInfo_R , DPP::BoardInfo_R ,
Register::DPP::AnalogMonitorMode , DPP::AnalogMonitorMode ,
Register::DPP::EventSize_R , DPP::EventSize_R ,
Register::DPP::TimeBombDowncounter_R , DPP::TimeBombDowncounter_R ,
Register::DPP::FanSpeedControl , DPP::FanSpeedControl ,
Register::DPP::RunStartStopDelay , DPP::RunStartStopDelay ,
Register::DPP::BoardFailureStatus_R , DPP::BoardFailureStatus_R ,
Register::DPP::DisableExternalTrigger , DPP::DisableExternalTrigger ,
Register::DPP::FrontPanelLVDSIONewFeatures , DPP::FrontPanelLVDSIONewFeatures ,
Register::DPP::BufferOccupancyGain , DPP::BufferOccupancyGain ,
Register::DPP::ExtendedVetoDelay , DPP::ExtendedVetoDelay ,
Register::DPP::ReadoutControl , DPP::ReadoutControl ,
Register::DPP::ReadoutStatus_R , DPP::ReadoutStatus_R ,
Register::DPP::BoardID , DPP::BoardID ,
Register::DPP::MCSTBaseAddressAndControl , DPP::MCSTBaseAddressAndControl ,
Register::DPP::RelocationAddress , DPP::RelocationAddress ,
Register::DPP::InterruptStatusID , DPP::InterruptStatusID ,
Register::DPP::InterruptEventNumber , DPP::InterruptEventNumber ,
Register::DPP::MaxAggregatePerBlockTransfer, DPP::MaxAggregatePerBlockTransfer,
Register::DPP::Scratch , DPP::Scratch ,
Register::DPP::SoftwareReset_W , DPP::SoftwareReset_W ,
Register::DPP::SoftwareClear_W , DPP::SoftwareClear_W ,
Register::DPP::ConfigurationReload_W , DPP::ConfigurationReload_W ,
Register::DPP::ROMChecksum_R , DPP::ROMChecksum_R ,
Register::DPP::ROMChecksumByte2_R , DPP::ROMChecksumByte2_R ,
Register::DPP::ROMChecksumByte1_R , DPP::ROMChecksumByte1_R ,
Register::DPP::ROMChecksumByte0_R , DPP::ROMChecksumByte0_R ,
Register::DPP::ROMConstantByte2_R , DPP::ROMConstantByte2_R ,
Register::DPP::ROMConstantByte1_R , DPP::ROMConstantByte1_R ,
Register::DPP::ROMConstantByte0_R , DPP::ROMConstantByte0_R ,
Register::DPP::ROM_C_Code_R , DPP::ROM_C_Code_R ,
Register::DPP::ROM_R_Code_R , DPP::ROM_R_Code_R ,
Register::DPP::ROM_IEEE_OUI_Byte2_R , DPP::ROM_IEEE_OUI_Byte2_R ,
Register::DPP::ROM_IEEE_OUI_Byte1_R , DPP::ROM_IEEE_OUI_Byte1_R ,
Register::DPP::ROM_IEEE_OUI_Byte0_R , DPP::ROM_IEEE_OUI_Byte0_R ,
Register::DPP::ROM_BoardVersion_R , DPP::ROM_BoardVersion_R ,
Register::DPP::ROM_BoardFromFactor_R , DPP::ROM_BoardFromFactor_R ,
Register::DPP::ROM_BoardIDByte1_R , DPP::ROM_BoardIDByte1_R ,
Register::DPP::ROM_BoardIDByte0_R , DPP::ROM_BoardIDByte0_R ,
Register::DPP::ROM_PCB_rev_Byte3_R , DPP::ROM_PCB_rev_Byte3_R ,
Register::DPP::ROM_PCB_rev_Byte2_R , DPP::ROM_PCB_rev_Byte2_R ,
Register::DPP::ROM_PCB_rev_Byte1_R , DPP::ROM_PCB_rev_Byte1_R ,
Register::DPP::ROM_PCB_rev_Byte0_R , DPP::ROM_PCB_rev_Byte0_R ,
Register::DPP::ROM_FlashType_R , DPP::ROM_FlashType_R ,
Register::DPP::ROM_BoardSerialNumByte1_R , DPP::ROM_BoardSerialNumByte1_R ,
Register::DPP::ROM_BoardSerialNumByte0_R , DPP::ROM_BoardSerialNumByte0_R ,
Register::DPP::ROM_VCXO_Type_R DPP::ROM_VCXO_Type_R
}; };

132
Scope.cpp
View File

@ -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); 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); QLabel * lb = new QLabel(str, settingGroup);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter); lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
settingLayout->addWidget(lb, row, col); 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()); 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; int factor = digi[ID]->IsDualTrace() ? 2 : 1;
value = value * factor; value = value * factor;
} }
if( para == Register::DPP::ChannelDCOffset ){ if( para == DPP::ChannelDCOffset ){
value = uint16_t((1.0 - sb->value()/100.) * 0xFFFF); value = uint16_t((1.0 - sb->value()/100.) * 0xFFFF);
} }
if( para == Register::DPP::PHA::TriggerThreshold ){ if( para == DPP::PHA::TriggerThreshold ){
value = sb->value(); value = sb->value();
} }
@ -425,23 +425,23 @@ void Scope::SetUpPHAPanel(){
enableSignalSlot = false; enableSignalSlot = false;
int rowID = 0; int rowID = 0;
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, Register::DPP::RecordLength_G); SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::RecordLength_G);
SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, Register::DPP::PreTrigger); SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::PreTrigger);
SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, Register::DPP::ChannelDCOffset); SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::ChannelDCOffset);
sbDCOffset->setDecimals(2); sbDCOffset->setDecimals(2);
SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, Register::DPP::InputDynamicRange); SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, DPP::InputDynamicRange);
rowID ++; //============================================================= rowID ++; //=============================================================
SetUpSpinBox(sbInputRiseTime, "Input Rise Time [ns] ", rowID, 0, Register::DPP::PHA::InputRiseTime); SetUpSpinBox(sbInputRiseTime, "Input Rise Time [ns] ", rowID, 0, DPP::PHA::InputRiseTime);
SetUpSpinBox(sbThreshold, "Threshold [LSB] ", rowID, 2, Register::DPP::PHA::TriggerThreshold); SetUpSpinBox(sbThreshold, "Threshold [LSB] ", rowID, 2, DPP::PHA::TriggerThreshold);
SetUpSpinBox(sbTriggerHoldOff,"Trigger HoldOff [ns] ", rowID, 4, Register::DPP::PHA::TriggerHoldOffWidth); SetUpSpinBox(sbTriggerHoldOff,"Trigger HoldOff [ns] ", rowID, 4, DPP::PHA::TriggerHoldOffWidth);
SetUpComboBox(cbSmoothingFactor, "Smooth Factor ", rowID, 6, Register::DPP::PHA::RCCR2SmoothingFactor); SetUpComboBox(cbSmoothingFactor, "Smooth Factor ", rowID, 6, DPP::PHA::RCCR2SmoothingFactor);
rowID ++; //============================================================= rowID ++; //=============================================================
SetUpSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", rowID, 0, Register::DPP::PHA::TrapezoidRiseTime); SetUpSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", rowID, 0, DPP::PHA::TrapezoidRiseTime);
SetUpSpinBox(sbTrapFlatTop, "Trap. FlatTop [ns] ", rowID, 2, Register::DPP::PHA::TrapezoidFlatTop); SetUpSpinBox(sbTrapFlatTop, "Trap. FlatTop [ns] ", rowID, 2, DPP::PHA::TrapezoidFlatTop);
SetUpSpinBox(sbDecayTime, "Decay Time [ns] ", rowID, 4, Register::DPP::PHA::DecayTime); SetUpSpinBox(sbDecayTime, "Decay Time [ns] ", rowID, 4, DPP::PHA::DecayTime);
SetUpSpinBox(sbPeakingTime, "Peaking Time [ns] ", rowID, 6, Register::DPP::PHA::PeakingTime); SetUpSpinBox(sbPeakingTime, "Peaking Time [ns] ", rowID, 6, DPP::PHA::PeakingTime);
rowID ++; //============================================================= rowID ++; //=============================================================
SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0); SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0);
@ -449,7 +449,7 @@ void Scope::SetUpPHAPanel(){
cbPolarity->addItem("Negative", 1); cbPolarity->addItem("Negative", 1);
connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){ connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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); SetUpComboBoxSimple(cbBaselineAvg, "Baseline Avg. ", rowID, 2);
@ -462,7 +462,7 @@ void Scope::SetUpPHAPanel(){
cbBaselineAvg->addItem("16384 sample", 6); cbBaselineAvg->addItem("16384 sample", 6);
connect(cbBaselineAvg, &RComboBox::currentIndexChanged, this, [=](){ connect(cbBaselineAvg, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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); SetUpComboBoxSimple(cbPeakAvg, "Peak Avg. ", rowID, 4);
@ -472,10 +472,10 @@ void Scope::SetUpPHAPanel(){
cbPeakAvg->addItem("64 sample", 3); cbPeakAvg->addItem("64 sample", 3);
connect(cbPeakAvg, &RComboBox::currentIndexChanged, this, [=](){ connect(cbPeakAvg, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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 ++; //============================================================= rowID ++; //=============================================================
@ -486,7 +486,7 @@ void Scope::SetUpPHAPanel(){
cbAnaProbe1->addItem("Trap.", 3); cbAnaProbe1->addItem("Trap.", 3);
connect(cbAnaProbe1, &RComboBox::currentIndexChanged, this, [=](){ connect(cbAnaProbe1, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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()); dataTrace[0]->setName(cbAnaProbe1->currentText());
}); });
@ -497,7 +497,7 @@ void Scope::SetUpPHAPanel(){
cbAnaProbe2->addItem("Baseline", 3); cbAnaProbe2->addItem("Baseline", 3);
connect(cbAnaProbe2, &RComboBox::currentIndexChanged, this, [=](){ connect(cbAnaProbe2, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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()); dataTrace[1]->setName(cbAnaProbe2->currentText());
}); });
@ -517,7 +517,7 @@ void Scope::SetUpPHAPanel(){
cbDigiProbe1->addItem("Budy", 12); cbDigiProbe1->addItem("Budy", 12);
connect(cbDigiProbe1, &RComboBox::currentIndexChanged, this, [=](){ connect(cbDigiProbe1, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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()); dataTrace[2]->setName(cbDigiProbe2->currentText());
}); });
@ -533,11 +533,11 @@ void Scope::SetUpPHAPanel(){
void Scope::SetUpPSDPanel(){ void Scope::SetUpPSDPanel(){
int rowID = 0; int rowID = 0;
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, Register::DPP::RecordLength_G); SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::RecordLength_G);
SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, Register::DPP::PreTrigger); SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::PreTrigger);
SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, Register::DPP::ChannelDCOffset); SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::ChannelDCOffset);
sbDCOffset->setDecimals(2); sbDCOffset->setDecimals(2);
SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, Register::DPP::InputDynamicRange); SetUpComboBox(cbDynamicRange, "Dynamic Range ", rowID, 6, DPP::InputDynamicRange);
rowID ++; //============================================================= rowID ++; //=============================================================
SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0); SetUpComboBoxSimple(cbPolarity, "Polarity ", rowID, 0);
@ -545,7 +545,7 @@ void Scope::SetUpPSDPanel(){
cbPolarity->addItem("Negative", 1); cbPolarity->addItem("Negative", 1);
connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){ connect(cbPolarity, &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return; 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(); int ch = cbScopeCh->currentIndex();
enableSignalSlot = false; enableSignalSlot = false;
@ -585,7 +585,7 @@ void Scope::UpdateComobox(RComboBox * &cb, const Register::Reg para){
//enableSignalSlot = true; //enableSignalSlot = true;
} }
void Scope::UpdateSpinBox(RSpinBox * &sb, const Register::Reg para){ void Scope::UpdateSpinBox(RSpinBox * &sb, const Reg para){
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
enableSignalSlot = false; enableSignalSlot = false;
@ -603,37 +603,37 @@ void Scope::UpdatePanelFromMomeory(){
int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace, int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace,
unsigned int haha = digi[ID]->GetSettingFromMemory(Register::DPP::RecordLength_G, ch); unsigned int haha = digi[ID]->GetSettingFromMemory(DPP::RecordLength_G, ch);
sbReordLength->setValue(haha * Register::DPP::RecordLength_G.GetPartialStep() * ch2ns / factor); sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns / factor);
haha = digi[ID]->GetSettingFromMemory(Register::DPP::PreTrigger, ch); haha = digi[ID]->GetSettingFromMemory(DPP::PreTrigger, ch);
sbPreTrigger->setValue(haha * Register::DPP::PreTrigger.GetPartialStep() * ch2ns / factor); 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 ); 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); uint32_t DPPAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
if( Digitizer::ExtractBits(DPPAlg, Register::DPP::Bit_DPPAlgorithmControl::Polarity) ){ if( Digitizer::ExtractBits(DPPAlg, DPP::Bit_DPPAlgorithmControl::Polarity) ){
cbPolarity->setCurrentIndex(1); cbPolarity->setCurrentIndex(1);
}else{ }else{
cbPolarity->setCurrentIndex(0); cbPolarity->setCurrentIndex(0);
} }
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
UpdateSpinBox(sbInputRiseTime, Register::DPP::PHA::InputRiseTime); UpdateSpinBox(sbInputRiseTime, DPP::PHA::InputRiseTime);
UpdateSpinBox(sbThreshold, Register::DPP::PHA::TriggerThreshold); UpdateSpinBox(sbThreshold, DPP::PHA::TriggerThreshold);
UpdateSpinBox(sbTriggerHoldOff, Register::DPP::PHA::TriggerHoldOffWidth); UpdateSpinBox(sbTriggerHoldOff, DPP::PHA::TriggerHoldOffWidth);
UpdateSpinBox(sbTrapRiseTime, Register::DPP::PHA::TrapezoidRiseTime); UpdateSpinBox(sbTrapRiseTime, DPP::PHA::TrapezoidRiseTime);
UpdateSpinBox(sbTrapFlatTop, Register::DPP::PHA::TrapezoidFlatTop); UpdateSpinBox(sbTrapFlatTop, DPP::PHA::TrapezoidFlatTop);
UpdateSpinBox(sbDecayTime, Register::DPP::PHA::DecayTime); UpdateSpinBox(sbDecayTime, DPP::PHA::DecayTime);
UpdateSpinBox(sbPeakingTime, Register::DPP::PHA::PeakingTime); 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++){ for(int i = 0; i < cbBaselineAvg->count(); i++){
if( cbBaselineAvg->itemData(i).toInt() == temp) { if( cbBaselineAvg->itemData(i).toInt() == temp) {
cbBaselineAvg->setCurrentIndex(i); 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++){ for(int i = 0; i < cbPeakAvg->count(); i++){
if( cbPeakAvg->itemData(i).toInt() == temp) { if( cbPeakAvg->itemData(i).toInt() == temp) {
cbPeakAvg->setCurrentIndex(i); 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++){ for(int i = 0; i < cbAnaProbe1->count(); i++){
if( cbAnaProbe1->itemData(i).toInt() == temp) { if( cbAnaProbe1->itemData(i).toInt() == temp) {
cbAnaProbe1->setCurrentIndex(i); cbAnaProbe1->setCurrentIndex(i);
@ -659,7 +659,7 @@ void Scope::UpdatePanelFromMomeory(){
break; 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++){ for(int i = 0; i < cbAnaProbe2->count(); i++){
if( cbAnaProbe2->itemData(i).toInt() == temp) { if( cbAnaProbe2->itemData(i).toInt() == temp) {
cbAnaProbe2->setCurrentIndex(i); cbAnaProbe2->setCurrentIndex(i);
@ -667,7 +667,7 @@ void Scope::UpdatePanelFromMomeory(){
break; 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++){ for(int i = 0; i < cbDigiProbe1->count(); i++){
if( cbDigiProbe1->itemData(i).toInt() == temp) { if( cbDigiProbe1->itemData(i).toInt() == temp) {
cbDigiProbe1->setCurrentIndex(i); cbDigiProbe1->setCurrentIndex(i);
@ -686,22 +686,22 @@ void Scope::ReadSettingsFromBoard(){
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
digi[ID]->ReadRegister(Register::DPP::RecordLength_G, ch); digi[ID]->ReadRegister(DPP::RecordLength_G, ch);
digi[ID]->ReadRegister(Register::DPP::PreTrigger, ch); digi[ID]->ReadRegister(DPP::PreTrigger, ch);
digi[ID]->ReadRegister(Register::DPP::ChannelDCOffset, ch); digi[ID]->ReadRegister(DPP::ChannelDCOffset, ch);
digi[ID]->ReadRegister(Register::DPP::InputDynamicRange, ch); digi[ID]->ReadRegister(DPP::InputDynamicRange, ch);
digi[ID]->ReadRegister(Register::DPP::BoardConfiguration, ch); digi[ID]->ReadRegister(DPP::BoardConfiguration, ch);
digi[ID]->ReadRegister(Register::DPP::DPPAlgorithmControl, ch); digi[ID]->ReadRegister(DPP::DPPAlgorithmControl, ch);
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){ if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
digi[ID]->ReadRegister(Register::DPP::PHA::InputRiseTime, ch); digi[ID]->ReadRegister(DPP::PHA::InputRiseTime, ch);
digi[ID]->ReadRegister(Register::DPP::PHA::TriggerThreshold, ch); digi[ID]->ReadRegister(DPP::PHA::TriggerThreshold, ch);
digi[ID]->ReadRegister(Register::DPP::PHA::TriggerHoldOffWidth, ch); digi[ID]->ReadRegister(DPP::PHA::TriggerHoldOffWidth, ch);
digi[ID]->ReadRegister(Register::DPP::PHA::TrapezoidRiseTime, ch); digi[ID]->ReadRegister(DPP::PHA::TrapezoidRiseTime, ch);
digi[ID]->ReadRegister(Register::DPP::PHA::TrapezoidFlatTop, ch); digi[ID]->ReadRegister(DPP::PHA::TrapezoidFlatTop, ch);
digi[ID]->ReadRegister(Register::DPP::PHA::DecayTime, ch); digi[ID]->ReadRegister(DPP::PHA::DecayTime, ch);
digi[ID]->ReadRegister(Register::DPP::PHA::PeakingTime, ch); digi[ID]->ReadRegister(DPP::PHA::PeakingTime, ch);
} }

View File

@ -44,16 +44,16 @@ signals:
private: private:
void SetUpComboBoxSimple(RComboBox * &cb, QString str, int row, int col); 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 SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const Reg para);
void SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Register::Reg para); void SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Reg para);
void CleanUpSettingsGroupBox(); void CleanUpSettingsGroupBox();
void SetUpPHAPanel(); void SetUpPHAPanel();
void SetUpPSDPanel(); void SetUpPSDPanel();
void EnableControl(bool enable); void EnableControl(bool enable);
void UpdateComobox(RComboBox * &cb, const Register::Reg para); void UpdateComobox(RComboBox * &cb, const Reg para);
void UpdateSpinBox(RSpinBox * &sb, const Register::Reg para); void UpdateSpinBox(RSpinBox * &sb, const Reg para);
void UpdatePanelFromMomeory(); void UpdatePanelFromMomeory();
Digitizer ** digi; Digitizer ** digi;