uncomment filling histograms, added UpdateOtherPanels()

This commit is contained in:
splitPoleDAQ 2023-05-23 17:02:39 -04:00
parent b18610a406
commit 1ae7309eb2
8 changed files with 60 additions and 11 deletions

View File

@ -152,10 +152,10 @@ class Digitizer{
// bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(DPP::BoardConfiguration) & 0x1 );} // bool IsEnabledAutoDataFlush() {return ( GetSettingFromMemory(DPP::BoardConfiguration) & 0x1 );}
// bool IsDecimateTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 1) & 0x1 );} // bool IsDecimateTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 1) & 0x1 );}
// bool IsTriggerPropagate() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 2) & 0x1 );} // bool IsTriggerPropagate() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 2) & 0x1 );}
bool IsDualTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 11) & 0x1 );} bool IsDualTrace_PHA() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 11) & 0x1 );}
// unsigned short AnaProbe1Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 12) & 0x3 );} // unsigned short AnaProbe1Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 12) & 0x3 );}
// unsigned short AnaProbe2Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 14) & 0x3 );} // unsigned short AnaProbe2Type() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 14) & 0x3 );}
// bool IsRecordTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 16) & 0x1 );} bool IsRecordTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 16) & 0x1 );}
// bool IsEnabledExtra2() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 17) & 0x1 );} // bool IsEnabledExtra2() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 17) & 0x1 );}
// bool IsRecordTimeStamp() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 18) & 0x1 );} // bool IsRecordTimeStamp() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 18) & 0x1 );}
// bool IsRecordEnergy() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 19) & 0x1 );} // bool IsRecordEnergy() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 19) & 0x1 );}

View File

@ -655,6 +655,7 @@ void DigiSettingsPanel::SetUpCheckBox(QCheckBox * &chkBox, QString label, QGridL
digi[ID]->SetBits(para, bit, state ? 1 : 0, chID); digi[ID]->SetBits(para, bit, state ? 1 : 0, chID);
if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->SetBits(para, bit, state ? 1 : 0, chID%2 == 0 ? chID + 1 : chID - 1); if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->SetBits(para, bit, state ? 1 : 0, chID%2 == 0 ? chID + 1 : chID - 1);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
}); });
} }
@ -683,6 +684,7 @@ void DigiSettingsPanel::SetUpComboBoxBit(RComboBox * &cb, QString label, QGridLa
digi[ID]->SetBits(para, bit, cb->currentData().toUInt(), chID); digi[ID]->SetBits(para, bit, cb->currentData().toUInt(), chID);
if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->SetBits(para, bit, cb->currentData().toUInt(), chID%2 == 0 ? chID + 1 : chID - 1); if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->SetBits(para, bit, cb->currentData().toUInt(), chID%2 == 0 ? chID + 1 : chID - 1);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
}); });
} }
@ -711,6 +713,7 @@ void DigiSettingsPanel::SetUpComboBox(RComboBox * &cb, QString label, QGridLayou
digi[ID]->WriteRegister(para, cb->currentData().toUInt(), chID); digi[ID]->WriteRegister(para, cb->currentData().toUInt(), chID);
if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->WriteRegister(para, cb->currentData().toUInt(), chID%2 == 0 ? chID + 1 : chID - 1); if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->WriteRegister(para, cb->currentData().toUInt(), chID%2 == 0 ? chID + 1 : chID - 1);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
}); });
} }
@ -762,18 +765,21 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
if( para == DPP::ChannelDCOffset ){ if( para == DPP::ChannelDCOffset ){
digi[ID]->WriteRegister(para, 0xFFFF * (1.0 - sb->value() / 100. ), chID); digi[ID]->WriteRegister(para, 0xFFFF * (1.0 - sb->value() / 100. ), chID);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
return; return;
} }
if( para == DPP::PSD::CFDSetting ){ if( para == DPP::PSD::CFDSetting ){
digi[ID]->SetBits(para, DPP::PSD::Bit_CFDSetting::CFDDealy, sb->value()/digi[ID]->GetCh2ns(), chID); digi[ID]->SetBits(para, DPP::PSD::Bit_CFDSetting::CFDDealy, sb->value()/digi[ID]->GetCh2ns(), chID);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
return; return;
} }
if( para == DPP::DPPAlgorithmControl ){ if( para == DPP::DPPAlgorithmControl ){
digi[ID]->SetBits(para, {5,0}, sb->value(), chID); digi[ID]->SetBits(para, {5,0}, sb->value(), chID);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
return; return;
} }
@ -783,6 +789,7 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->WriteRegister(para, bit, chID%2 == 0 ? chID + 1 : chID - 1); if( para.IsCoupled() == true && chID >= 0 ) digi[ID]->WriteRegister(para, bit, chID%2 == 0 ? chID + 1 : chID - 1);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
emit UpdateOtherPanels();
}); });
} }

View File

@ -21,7 +21,7 @@ public:
DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QString rawDataPath, QMainWindow * parent = nullptr); DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QString rawDataPath, QMainWindow * parent = nullptr);
~DigiSettingsPanel(); ~DigiSettingsPanel();
private slots: public slots:
void UpdatePanelFromMemory(); void UpdatePanelFromMemory();
void ReadSettingsFromBoard(); void ReadSettingsFromBoard();
@ -30,6 +30,7 @@ private slots:
signals: signals:
void SendLogMsg(const QString &msg); void SendLogMsg(const QString &msg);
void UpdateOtherPanels();
private: private:
@ -68,7 +69,6 @@ private:
void CheckRadioAndCheckedButtons(); void CheckRadioAndCheckedButtons();
Digitizer ** digi; Digitizer ** digi;
unsigned int nDigi; unsigned int nDigi;
unsigned short ID; unsigned short ID;

View File

@ -393,6 +393,7 @@ void MainWindow::OpenDigitizers(){
QCoreApplication::processEvents(); //to prevent Qt said application not responding. QCoreApplication::processEvents(); //to prevent Qt said application not responding.
} }
canvas = new Canvas(digi, nDigi);
histThread = new TimingThread(this); histThread = new TimingThread(this);
histThread->SetWaitTimeinSec(0.5); histThread->SetWaitTimeinSec(0.5);
connect(histThread, &TimingThread::timeUp, this, [=](){ connect(histThread, &TimingThread::timeUp, this, [=](){
@ -660,7 +661,7 @@ void MainWindow::StartACQ(){
} }
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>"); lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
//if( canvas != nullptr ) histThread->start(); if( canvas != nullptr ) histThread->start();
bnStartACQ->setEnabled(false); bnStartACQ->setEnabled(false);
bnStopACQ->setEnabled(true); bnStopACQ->setEnabled(true);
@ -847,6 +848,9 @@ void MainWindow::OpenScope(){
}); });
connect(scope, &Scope::UpdateScaler, this, &MainWindow::UpdateScalar); connect(scope, &Scope::UpdateScaler, this, &MainWindow::UpdateScalar);
connect(scope, &Scope::UpdateOtherPanels, this, [=](){ UpdateAllPanels(1); });
scope->show(); scope->show();
}else{ }else{
scope->show(); scope->show();
@ -867,6 +871,8 @@ void MainWindow::OpenDigiSettings(){
if( digiSettings == nullptr ) { if( digiSettings == nullptr ) {
digiSettings = new DigiSettingsPanel(digi, nDigi, rawDataPath); digiSettings = new DigiSettingsPanel(digi, nDigi, rawDataPath);
//connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg); //connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
connect(digiSettings, &DigiSettingsPanel::UpdateOtherPanels, this, [=](){ UpdateAllPanels(2); });
digiSettings->show(); digiSettings->show();
}else{ }else{
digiSettings->show(); digiSettings->show();
@ -889,6 +895,24 @@ void MainWindow::OpenCanvas(){
} }
//***************************************************************
//***************************************************************
void MainWindow::UpdateAllPanels(int panelID){
//panelID is the source panel that call
// scope = 1;
// digiSetting = 2;
if( panelID == 1 ){ // from scope
if( digiSettings && digiSettings->isVisible() ) digiSettings->UpdatePanelFromMemory();
}
if( panelID == 2 ){
if(scope && scope->isVisible() ) scope->UpdatePanelFromMomeory();
}
}
//*************************************************************** //***************************************************************
//*************************************************************** //***************************************************************
void MainWindow::LogMsg(QString msg){ void MainWindow::LogMsg(QString msg){

View File

@ -61,6 +61,8 @@ private slots:
void OpenCanvas(); void OpenCanvas();
void UpdateAllPanels(int panelID);
private: private:
Digitizer ** digi; Digitizer ** digi;

View File

@ -8,8 +8,11 @@ INCLUDEPATH += .
QT += core widgets charts QT += core widgets charts
QMAKE_CXXFLAGS += `root-config --cflags --glibs` #QMAKE_CXXFLAGS += `root-config --cflags --glibs`
LIBS += -lCAENDigitizer `root-config --cflags --glibs` #LIBS += -lCAENDigitizer `root-config --cflags --glibs`
#QMAKE_CXXFLAGS += -g
LIBS += -lCAENDigitizer
# You can make your code fail to compile if you use deprecated APIs. # You can make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line. # In order to do so, uncomment the following line.

View File

@ -13,6 +13,8 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
this->nDigi = nDigi; this->nDigi = nDigi;
this->readDataThread = readDataThread; this->readDataThread = readDataThread;
for( unsigned int i = 0; i < nDigi; i++){ traceOn[i] = digi[i]->IsRecordTrace();}
setWindowTitle("Scope"); setWindowTitle("Scope");
setGeometry(0, 0, 1000, 800); setGeometry(0, 0, 1000, 800);
setWindowFlags( this->windowFlags() & ~Qt::WindowCloseButtonHint ); setWindowFlags( this->windowFlags() & ~Qt::WindowCloseButtonHint );
@ -230,6 +232,7 @@ void Scope::StartScope(){
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){ for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1);
digi[iDigi]->GetData()->SetSaveWaveToMemory(true); digi[iDigi]->GetData()->SetSaveWaveToMemory(true);
digi[iDigi]->StartACQ(); digi[iDigi]->StartACQ();
@ -244,6 +247,8 @@ void Scope::StartScope(){
readDataThread[iDigi]->start(); readDataThread[iDigi]->start();
} }
emit UpdateOtherPanels();
updateTraceThread->start(); updateTraceThread->start();
bnScopeStart->setEnabled(false); bnScopeStart->setEnabled(false);
@ -273,8 +278,12 @@ void Scope::StopScope(){
digiMTX[iDigi].lock(); digiMTX[iDigi].lock();
digi[iDigi]->StopACQ(); digi[iDigi]->StopACQ();
digiMTX[iDigi].unlock(); digiMTX[iDigi].unlock();
digi[iDigi]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[iDigi], -1);
} }
emit UpdateOtherPanels();
bnScopeStart->setEnabled(true); bnScopeStart->setEnabled(true);
bnScopeStop->setEnabled(false); bnScopeStop->setEnabled(false);
@ -292,7 +301,7 @@ void Scope::UpdateScope(){
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
int ch2ns = digi[ID]->GetCh2ns(); int ch2ns = digi[ID]->GetCh2ns();
int factor = digi[ID]->IsDualTrace() ? 2 : 1; int factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1;
digiMTX[ID].lock(); digiMTX[ID].lock();
Data * data = digi[ID]->GetData(); Data * data = digi[ID]->GetData();
@ -374,6 +383,7 @@ void Scope::SetUpComboBox(RComboBox * &cb, QString str, int row, int col, const
if( digi[ID]->GetErrorCode() == CAEN_DGTZ_Success ){ if( digi[ID]->GetErrorCode() == CAEN_DGTZ_Success ){
SendLogMsg(msg + " | OK."); SendLogMsg(msg + " | OK.");
cb->setStyleSheet(""); cb->setStyleSheet("");
emit UpdateOtherPanels();
}else{ }else{
SendLogMsg(msg + " | Fail."); SendLogMsg(msg + " | Fail.");
cb->setStyleSheet("color:red;"); cb->setStyleSheet("color:red;");
@ -421,7 +431,7 @@ 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 == DPP::RecordLength_G){ if( para == DPP::RecordLength_G){
int factor = digi[ID]->IsDualTrace() ? 2 : 1; int factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1;
value = value * factor; value = value * factor;
} }
@ -441,6 +451,7 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re
if( digi[ID]->GetErrorCode() == CAEN_DGTZ_Success ){ if( digi[ID]->GetErrorCode() == CAEN_DGTZ_Success ){
SendLogMsg(msg + " | OK."); SendLogMsg(msg + " | OK.");
sb->setStyleSheet(""); sb->setStyleSheet("");
emit UpdateOtherPanels();
}else{ }else{
SendLogMsg(msg + " | Fail."); SendLogMsg(msg + " | Fail.");
sb->setStyleSheet("color:red;"); sb->setStyleSheet("color:red;");

View File

@ -37,11 +37,12 @@ public:
event->accept(); event->accept();
} }
private slots: public slots:
void StartScope(); void StartScope();
void StopScope(); void StopScope();
void UpdateScope(); void UpdateScope();
void ReadSettingsFromBoard(); void ReadSettingsFromBoard();
void UpdatePanelFromMomeory();
signals: signals:
@ -49,6 +50,7 @@ signals:
void SendLogMsg(const QString &msg); void SendLogMsg(const QString &msg);
void TellACQOnOff(const bool onOff); void TellACQOnOff(const bool onOff);
void UpdateScaler(); void UpdateScaler();
void UpdateOtherPanels();
private: private:
@ -63,7 +65,6 @@ private:
void UpdateComobox(RComboBox * &cb, const Reg para); void UpdateComobox(RComboBox * &cb, const Reg para);
void UpdateSpinBox(RSpinBox * &sb, const Reg para); void UpdateSpinBox(RSpinBox * &sb, const Reg para);
void UpdatePanelFromMomeory();
void UpdatePHAPanel(); void UpdatePHAPanel();
void UpdatePSDPanel(); void UpdatePSDPanel();
@ -71,6 +72,7 @@ private:
unsigned short nDigi; unsigned short nDigi;
unsigned short ID; // the id of digi, index of cbScopeDigi unsigned short ID; // the id of digi, index of cbScopeDigi
int ch2ns; int ch2ns;
bool traceOn[MaxNDigitizer];
ReadDataThread ** readDataThread; ReadDataThread ** readDataThread;
TimingThread * updateTraceThread; TimingThread * updateTraceThread;