bugs fix on scope

This commit is contained in:
Ryan Tang 2024-05-17 17:45:30 -04:00
parent b79fd72fe7
commit 7ad3ed4af0
5 changed files with 61 additions and 54 deletions

View File

@ -1258,40 +1258,40 @@ std::string Digitizer::GetDPPString(int DPPType){
void Digitizer::ErrorMsg(std::string header){
switch (ret){
///case CAEN_DGTZ_Success : /** 0 */ printf("%s | Operation completed successfully.\n", header.c_str()); break;
case CAEN_DGTZ_CommError : /** -1 */ printf("%s %d | %d, Communication Error.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_GenericError : /** -2 */ printf("%s %d | %d, Unspecified error.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidParam : /** -3 */ printf("%s %d | %d, Invalid parameter.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidLinkType : /** -4 */ printf("%s %d | %d, Invalid Link Type.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidHandle : /** -5 */ printf("%s %d | %d, Invalid device handler.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_MaxDevicesError : /** -6 */ printf("%s %d | %d, Maximum number of devices exceeded.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadBoardType : /** -7 */ printf("%s %d | %d, Operation not allowed on this type of board.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadInterruptLev : /** -8 */ printf("%s %d | %d, The interrupt level is not allowed.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadEventNumber : /** -9 */ printf("%s %d | %d, The event number is bad.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_ReadDeviceRegisterFail : /** -10 */ printf("%s %d | %d, Unable to read the registry.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_WriteDeviceRegisterFail : /** -11 */ printf("%s %d | %d, Unable to write the registry.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidChannelNumber : /** -13 */ printf("%s %d | %d, The channel number is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_ChannelBusy : /** -14 */ printf("%s %d | %d, The channel is busy.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_FPIOModeInvalid : /** -15 */ printf("%s %d | %d, Invalid FPIO mode.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_WrongAcqMode : /** -16 */ printf("%s %d | %d, Wrong Acquistion mode.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_FunctionNotAllowed : /** -17 */ printf("%s %d | %d, This function is not allowed on this module.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_Timeout : /** -18 */ printf("%s %d | %d, Communication Timeout.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidBuffer : /** -19 */ printf("%s %d | %d, The buffer is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_EventNotFound : /** -20 */ printf("%s %d | %d, The event is not found.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidEvent : /** -21 */ printf("%s %d | %d, The event is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_OutOfMemory : /** -22 */ printf("%s %d | %d, Out of memory.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_CalibrationError : /** -23 */ printf("%s %d | %d, Unable to calibrate the board.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerNotFound : /** -24 */ printf("%s %d | %d, Unbale to open the digitizer.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerAlreadyOpen : /** -25 */ printf("%s %d | %d, The digitizer is already open.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerNotReady : /** -26 */ printf("%s %d | %d, The digitizer is not ready.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InterruptNotConfigured : /** -27 */ printf("%s %d | %d, The digitizer has no IRQ configured.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerMemoryCorrupted: /** -28 */ printf("%s %d | %d, The digitizer flash memory is corrupted.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DPPFirmwareNotSupported : /** -29 */ printf("%s %d | %d, The digitier DPP firmware is not supported in this lib version.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidLicense : /** -30 */ printf("%s %d | %d, Invalid firmware licence.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidDigitizerStatus : /** -31 */ printf("%s %d | %d, The digitizer is found in a corrupted status.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_UnsupportedTrace : /** -32 */ printf("%s %d | %d, The given trace is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidProbe : /** -33 */ printf("%s %d | %d, The given probe is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_UnsupportedBaseAddress : /** -34 */ printf("%s %d | %d, The base address is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_NotYetImplemented : /** -99 */ printf("%s %d | %d, The function is not yet implemented.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_CommError : /** -1 */ printf("%s digi-%d | %d, Communication Error.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_GenericError : /** -2 */ printf("%s digi-%d | %d, Unspecified error.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidParam : /** -3 */ printf("%s digi-%d | %d, Invalid parameter.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidLinkType : /** -4 */ printf("%s digi-%d | %d, Invalid Link Type.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidHandle : /** -5 */ printf("%s digi-%d | %d, Invalid device handler.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_MaxDevicesError : /** -6 */ printf("%s digi-%d | %d, Maximum number of devices exceeded.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadBoardType : /** -7 */ printf("%s digi-%d | %d, Operation not allowed on this type of board.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadInterruptLev : /** -8 */ printf("%s digi-%d | %d, The interrupt level is not allowed.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_BadEventNumber : /** -9 */ printf("%s digi-%d | %d, The event number is bad.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_ReadDeviceRegisterFail : /** -10 */ printf("%s digi-%d | %d, Unable to read the registry.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_WriteDeviceRegisterFail : /** -11 */ printf("%s digi-%d | %d, Unable to write the registry.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidChannelNumber : /** -13 */ printf("%s digi-%d | %d, The channel number is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_ChannelBusy : /** -14 */ printf("%s digi-%d | %d, The channel is busy.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_FPIOModeInvalid : /** -15 */ printf("%s digi-%d | %d, Invalid FPIO mode.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_WrongAcqMode : /** -16 */ printf("%s digi-%d | %d, Wrong Acquistion mode.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_FunctionNotAllowed : /** -17 */ printf("%s digi-%d | %d, This function is not allowed on this module.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_Timeout : /** -18 */ printf("%s digi-%d | %d, Communication Timeout.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidBuffer : /** -19 */ printf("%s digi-%d | %d, The buffer is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_EventNotFound : /** -20 */ printf("%s digi-%d | %d, The event is not found.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidEvent : /** -21 */ printf("%s digi-%d | %d, The event is invalid.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_OutOfMemory : /** -22 */ printf("%s digi-%d | %d, Out of memory.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_CalibrationError : /** -23 */ printf("%s digi-%d | %d, Unable to calibrate the board.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerNotFound : /** -24 */ printf("%s digi-%d | %d, Unbale to open the digitizer.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerAlreadyOpen : /** -25 */ printf("%s digi-%d | %d, The digitizer is already open.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerNotReady : /** -26 */ printf("%s digi-%d | %d, The digitizer is not ready.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InterruptNotConfigured : /** -27 */ printf("%s digi-%d | %d, The digitizer has no IRQ configured.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DigitizerMemoryCorrupted: /** -28 */ printf("%s digi-%d | %d, The digitizer flash memory is corrupted.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_DPPFirmwareNotSupported : /** -29 */ printf("%s digi-%d | %d, The digitier DPP firmware is not supported in this lib version.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidLicense : /** -30 */ printf("%s digi-%d | %d, Invalid firmware licence.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidDigitizerStatus : /** -31 */ printf("%s digi-%d | %d, The digitizer is found in a corrupted status.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_UnsupportedTrace : /** -32 */ printf("%s digi-%d | %d, The given trace is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_InvalidProbe : /** -33 */ printf("%s digi-%d | %d, The given probe is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_UnsupportedBaseAddress : /** -34 */ printf("%s digi-%d | %d, The base address is not supported.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
case CAEN_DGTZ_NotYetImplemented : /** -99 */ printf("%s digi-%d | %d, The function is not yet implemented.\n", header.c_str(), BoardInfo.SerialNumber, ret); break;
}
}

View File

@ -2317,7 +2317,7 @@ void DigiSettingsPanel::SetUpChannel_PSD(){
SetUpSpinBox(sbThreshold[ID][ch], "", tabLayout, ch + 1, 2, DPP::PSD::TriggerThreshold, ch);
SetUpComboBoxBit(cbTrigMode[ID][ch], "", tabLayout, ch + 1, 4, DPP::Bit_DPPAlgorithmControl_PHA::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 1, ch);
SetUpSpinBox(sbTriggerHoldOff[ID][ch], "", tabLayout, ch + 1, 6, DPP::PSD::TriggerHoldOffWidth, ch);
SetUpComboBoxBit(cbLocalTriggerValid[ID][ch], "", tabLayout, ch + 1, 8, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode, 1, ch);
SetUpComboBoxBit(cbLocalTriggerValid[ID][ch], "", tabLayout, ch + 1, 8, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalTrigValidMode, 1, ch);
}
if( i == 1 ){
@ -2327,8 +2327,8 @@ void DigiSettingsPanel::SetUpChannel_PSD(){
QLabel * lb1 = new QLabel("Trig. Counter Flag [G]", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 6);
}
SetUpSpinBox(sbShapedTrigWidth[ID][ch], "", tabLayout, ch + 1, 1, DPP::PSD::ShapedTriggerWidth, ch);
SetUpComboBoxBit(cbLocalShapedTrigger[ID][ch], "", tabLayout, ch + 1, 3, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1, ch);
SetUpComboBoxBit(cbTrigCount[ID][ch], "", tabLayout, ch + 1, 5, DPP::PSD::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag, 1, ch);
SetUpComboBoxBit(cbLocalShapedTrigger[ID][ch], "", tabLayout, ch + 1, 3, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1, ch);
SetUpComboBoxBit(cbTrigCount[ID][ch], "", tabLayout, ch + 1, 5, DPP::PSD::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::TriggerCounterFlag, 1, ch);
}
if( i == 2 ){

View File

@ -291,6 +291,10 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
CheckElog();
LogMsg("====== <font style=\"color: blue;\"><b>FSU DAQ is ready.</b></font> ======");
}
MainWindow::~MainWindow(){
@ -731,7 +735,7 @@ void MainWindow::OpenDigitizers(){
canvas->FillHistograms();
});
LogMsg(QString("Done. Opened %1 digitizer(s).").arg(nDigi));
LogMsg("====== <font style=\"color: blue;\"><b>" + QString("Done. Opened %1 digitizer(s).").arg(nDigi) + "</b></font> =====");
WaitForDigitizersOpen(false);
bnStartACQ->setStyleSheet("background-color: green;");

View File

@ -346,15 +346,17 @@ void Scope::StartScope(){
int ID = cbScopeDigi->currentIndex();
int ch = cbScopeCh->currentIndex();
oldDigi = ID;
oldCh = ch;
//save present settings, channleMap, trigger condition
traceOn[ID] = digi[ID]->IsRecordTrace();
digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PHA_CODE ){
dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch);
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 0, ch);
digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger, 0, ch);
@ -367,14 +369,17 @@ void Scope::StartScope(){
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PSD_CODE ){
dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch);
dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PSD::DPPAlgorithmControl2_G, ch);
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
//TODO ===============
digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 0, ch);
digi[ID]->SetBits(DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger, 0, ch);
digi[ID]->SetBits(DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 0, ch);
digi[ID]->SetBits(DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalTrigValidMode, 0, ch);
}
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_QDC_CODE ){
dppAlg = digi[ID]->GetSettingFromMemory(DPP::QDC::DPPAlgorithmControl, ch);
chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask);
//TODO ===============
digi[ID]->SetBits(DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TriggerMode, 0, ch); //set self-triiger
}
digi[ID]->WriteRegister(DPP::RegChannelEnableMask, (1 << ch));
@ -450,7 +455,8 @@ void Scope::StopScope(){
if( chkSoleRun->isChecked() ){
int ID = cbScopeDigi->currentIndex();
//int ID = cbScopeDigi->currentIndex();
int ID = oldDigi;
if( readDataThread[ID]->isRunning() ){
readDataThread[ID]->Stop();
@ -466,26 +472,22 @@ void Scope::StopScope(){
//restore setting
digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[ID], -1);
int ch = cbScopeCh->currentIndex();
digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask);
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PHA_CODE ){
digi[ID]->WriteRegister(DPP::DPPAlgorithmControl, dppAlg, ch);
digi[ID]->WriteRegister(DPP::PHA::DPPAlgorithmControl2_G, dppAlg2, ch);
digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask);
digi[ID]->WriteRegister(DPP::DPPAlgorithmControl, dppAlg, oldCh);
digi[ID]->WriteRegister(DPP::PHA::DPPAlgorithmControl2_G, dppAlg2, oldCh);
}
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PSD_CODE ){
digi[ID]->WriteRegister(DPP::DPPAlgorithmControl, dppAlg, ch);
digi[ID]->WriteRegister(DPP::PSD::DPPAlgorithmControl2_G, dppAlg2, ch);
digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask);
digi[ID]->WriteRegister(DPP::DPPAlgorithmControl, dppAlg, oldCh);
digi[ID]->WriteRegister(DPP::PSD::DPPAlgorithmControl2_G, dppAlg2, oldCh);
}
if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_QDC_CODE ){
digi[ID]->WriteRegister(DPP::QDC::DPPAlgorithmControl, dppAlg, ch);
digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask);
digi[ID]->WriteRegister(DPP::QDC::DPPAlgorithmControl, dppAlg, oldCh);
}
}else{
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){

View File

@ -84,6 +84,7 @@ private:
bool traceOn[MaxNDigitizer];
uint32_t dppAlg, dppAlg2, chMask; //for single channel run
unsigned short oldCh, oldDigi;
ReadDataThread ** readDataThread;
TimingThread * updateTraceThread;