complete the digiSetting Panel

This commit is contained in:
Ryan Tang 2023-03-14 16:17:22 -04:00
parent 5b7ef6ad4b
commit 74a17b07de
7 changed files with 528 additions and 442 deletions

View File

@ -37,13 +37,13 @@ void Digitizer2Gen::Initialization(){
acqON = false; acqON = false;
settingFileName = ""; settingFileName = "";
boardSettings = DIGIPARA::DIG::AllSettings; boardSettings = PHA::DIG::AllSettings;
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = DIGIPARA::CH::AllSettings; for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
for( int index = 0 ; index < 4; index ++) VGASetting[index] = DIGIPARA::VGA::VGAGain; for( int index = 0 ; index < 4; index ++) VGASetting[index] = PHA::VGA::VGAGain;
//build map //build map
for( int i = 0; i < (int) DIGIPARA::DIG::AllSettings.size(); i++) boardMap[DIGIPARA::DIG::AllSettings[i].GetPara()] = i; for( int i = 0; i < (int) PHA::DIG::AllSettings.size(); i++) boardMap[PHA::DIG::AllSettings[i].GetPara()] = i;
for( int i = 0; i < (int) DIGIPARA::CH::AllSettings.size(); i++) chMap[DIGIPARA::CH::AllSettings[i].GetPara()] = i; for( int i = 0; i < (int) PHA::CH::AllSettings.size(); i++) chMap[PHA::CH::AllSettings[i].GetPara()] = i;
} }
@ -215,21 +215,21 @@ int Digitizer2Gen::OpenDigitizer(const char * url){
ReadAllSettings(); ReadAllSettings();
serialNumber = atoi(ReadValue("/par/SerialNum").c_str()); serialNumber = atoi(ReadValue("/par/SerialNum").c_str());
FPGAType = GetSettingValue(DIGIPARA::DIG::FirmwareType); FPGAType = GetSettingValue(PHA::DIG::FirmwareType);
nChannels = atoi(ReadValue("/par/NumCh").c_str()); nChannels = atoi(ReadValue("/par/NumCh").c_str());
int adcRate = atoi(GetSettingValue(DIGIPARA::DIG::ADC_SampleRate).c_str()); int adcRate = atoi(GetSettingValue(PHA::DIG::ADC_SampleRate).c_str());
ch2ns = 1000/adcRate; ch2ns = 1000/adcRate;
printf(" IP address : %s\n", GetSettingValue(DIGIPARA::DIG::IPAddress).c_str()); printf(" IP address : %s\n", GetSettingValue(PHA::DIG::IPAddress).c_str());
printf(" Net Mask : %s\n", GetSettingValue(DIGIPARA::DIG::NetMask).c_str()); printf(" Net Mask : %s\n", GetSettingValue(PHA::DIG::NetMask).c_str());
printf(" Gateway : %s\n", GetSettingValue(DIGIPARA::DIG::Gateway).c_str()); printf(" Gateway : %s\n", GetSettingValue(PHA::DIG::Gateway).c_str());
printf(" Model name : %s\n", GetSettingValue(DIGIPARA::DIG::ModelName).c_str()); printf(" Model name : %s\n", GetSettingValue(PHA::DIG::ModelName).c_str());
printf(" CUP version : %s\n", GetSettingValue(DIGIPARA::DIG::CupVer).c_str()); printf(" CUP version : %s\n", GetSettingValue(PHA::DIG::CupVer).c_str());
printf(" DPP Type : %s\n", GetSettingValue(DIGIPARA::DIG::FirmwareType).c_str()); printf(" DPP Type : %s\n", GetSettingValue(PHA::DIG::FirmwareType).c_str());
printf(" DPP Version : %s\n", FPGAType.c_str()); printf(" DPP Version : %s\n", FPGAType.c_str());
printf("Serial number : %d\n", serialNumber); printf("Serial number : %d\n", serialNumber);
printf(" ADC bits : %s\n", GetSettingValue(DIGIPARA::DIG::ADC_bit).c_str()); printf(" ADC bits : %s\n", GetSettingValue(PHA::DIG::ADC_bit).c_str());
printf(" ADC rate : %d Msps, ch2ns : %d ns\n", adcRate, ch2ns); printf(" ADC rate : %d Msps, ch2ns : %d ns\n", adcRate, ch2ns);
printf(" Channels : %d\n", nChannels); printf(" Channels : %d\n", nChannels);

View File

@ -104,13 +104,9 @@ class Reg {
//^==================== Some digitizer parameters //^==================== Some digitizer parameters
namespace PHA{
// To avoid typo
namespace DIGIPARA{
const unsigned short TraceStep = 8; const unsigned short TraceStep = 8;
namespace DIG{ namespace DIG{
///============== read only ///============== read only

File diff suppressed because it is too large Load Diff

View File

@ -34,6 +34,7 @@ public:
private slots: private slots:
void onTriggerClick(int haha); void onTriggerClick(int haha);
void ReadTriggerMap();
void SaveSettings(); void SaveSettings();
void LoadSettings(); void LoadSettings();
@ -156,8 +157,12 @@ private:
RSpinBox * VGA[MaxNumberOfDigitizer][4]; RSpinBox * VGA[MaxNumberOfDigitizer][4];
//--------------- trigger map //--------------- trigger map
QPushButton *bn[MaxNumberOfChannel][MaxNumberOfChannel]; RComboBox * cbAllEvtTrigger;
bool bnClickStatus[MaxNumberOfChannel][MaxNumberOfChannel]; RComboBox * cbAllWaveTrigger;
RComboBox * cbAllCoinMask;
RSpinBox * sbAllCoinLength;
QPushButton * trgMap[MaxNumberOfChannel][MaxNumberOfChannel];
bool trgMapClickStatus[MaxNumberOfChannel][MaxNumberOfChannel];
//--------------- Channel status //--------------- Channel status
QPushButton * chStatus[MaxNumberOfDigitizer][MaxNumberOfChannel][9]; QPushButton * chStatus[MaxNumberOfDigitizer][MaxNumberOfChannel][9];
@ -222,13 +227,14 @@ private:
//------------------------- //-------------------------
QLineEdit * leSettingFile[MaxNumberOfDigitizer]; QLineEdit * leSettingFile[MaxNumberOfDigitizer];
void SetStartSource(); void SetStartSource();
void SetGlobalTriggerSource(); void SetGlobalTriggerSource();
void SetupShortComboBox(RComboBox * &cbb, Reg para); void SetupShortComboBox(RComboBox * &cbb, Reg para);
void SetupComboBox(RComboBox * &cbb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1); void SetupComboBox(RComboBox * &cbb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SetupSpinBox(RSpinBox * &spb, const Reg para, int ch_index, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1); void SetupSpinBox(RSpinBox * &spb, const Reg para, int ch_index, bool isMaster, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SyncComboBox(RComboBox *(&cbb)[][MaxNumberOfChannel+1], int ch); void SyncComboBox(RComboBox *(&cbb)[][MaxNumberOfChannel+1], int ch);
void SyncSpinBox(RSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch); void SyncSpinBox(RSpinBox *(&spb)[][MaxNumberOfChannel+1], int ch);
@ -243,7 +249,7 @@ private:
void ReadChannelSetting(int cbIndex); void ReadChannelSetting(int cbIndex);
void CheckRadioAndCheckedButtons(); void CheckRadioAndCheckedButtons();
bool CopyChannelSettings(); bool CopyChannelSettings(int digiFrom, int chFrom, int digiTo, int chTo);
bool CopyBoardSettings(); bool CopyBoardSettings();
bool CopyWholeDigitizer(); bool CopyWholeDigitizer();

View File

@ -748,10 +748,10 @@ void MainWindow::UpdateScalar(){
//=========== another method, directly readValue //=========== another method, directly readValue
digiMTX.lock(); digiMTX.lock();
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){ for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++){
std::string time = digi[iDigi]->ReadValue(DIGIPARA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount std::string time = digi[iDigi]->ReadValue(PHA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount
haha[ch] = digi[iDigi]->ReadValue(DIGIPARA::CH::SelfTrgRate, ch); haha[ch] = digi[iDigi]->ReadValue(PHA::CH::SelfTrgRate, ch);
leTrigger[iDigi][ch]->setText(QString::fromStdString(haha[ch])); leTrigger[iDigi][ch]->setText(QString::fromStdString(haha[ch]));
std::string kaka = digi[iDigi]->ReadValue(DIGIPARA::CH::ChannelSavedCount, ch); std::string kaka = digi[iDigi]->ReadValue(PHA::CH::ChannelSavedCount, ch);
acceptRate[ch] = atoi(kaka.c_str())*1e9*1.0 / atol(time.c_str()); acceptRate[ch] = atoi(kaka.c_str())*1e9*1.0 / atol(time.c_str());
//if( kaka != "0" ) printf("%s, %s | %.2f\n", time.c_str(), kaka.c_str(), acceptRate); //if( kaka != "0" ) printf("%s, %s | %.2f\n", time.c_str(), kaka.c_str(), acceptRate);
leAccept[iDigi][ch]->setText(QString::number(acceptRate[ch],'f', 1)); leAccept[iDigi][ch]->setText(QString::number(acceptRate[ch],'f', 1));

118
scope.cpp
View File

@ -82,8 +82,8 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int iDigi = cbScopeDigi->currentIndex(); int iDigi = cbScopeDigi->currentIndex();
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::ChannelEnable, "False", -1); digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
digi[iDigi]->WriteValue(DIGIPARA::CH::ChannelEnable, "True", ch); digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
ReadScopeSettings(); ReadScopeSettings();
UpdateSettingsPanel(); UpdateSettingsPanel();
digiMTX.unlock(); digiMTX.unlock();
@ -123,9 +123,9 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
rowID ++; rowID ++;
//TODO --- add None //TODO --- add None
cbAnaProbe[0] = new RComboBox(this); cbAnaProbe[0] = new RComboBox(this);
for( int i = 0; i < (int) DIGIPARA::CH::WaveAnalogProbe0.GetAnswers().size(); i++ ) { for( int i = 0; i < (int) PHA::CH::WaveAnalogProbe0.GetAnswers().size(); i++ ) {
cbAnaProbe[0]->addItem(QString::fromStdString((DIGIPARA::CH::WaveAnalogProbe0.GetAnswers())[i].second), cbAnaProbe[0]->addItem(QString::fromStdString((PHA::CH::WaveAnalogProbe0.GetAnswers())[i].second),
QString::fromStdString((DIGIPARA::CH::WaveAnalogProbe0.GetAnswers())[i].first)); QString::fromStdString((PHA::CH::WaveAnalogProbe0.GetAnswers())[i].first));
} }
cbAnaProbe[1] = new RComboBox(this); cbAnaProbe[1] = new RComboBox(this);
@ -144,7 +144,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
if( chkSetAllChannel->isChecked() ) ch = -1; if( chkSetAllChannel->isChecked() ) ch = -1;
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::WaveAnalogProbe0, (cbAnaProbe[0]->currentData()).toString().toStdString(), ch); digi[iDigi]->WriteValue(PHA::CH::WaveAnalogProbe0, (cbAnaProbe[0]->currentData()).toString().toStdString(), ch);
digiMTX.unlock(); digiMTX.unlock();
}); });
@ -154,15 +154,15 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
if( chkSetAllChannel->isChecked() ) ch = -1; if( chkSetAllChannel->isChecked() ) ch = -1;
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::WaveAnalogProbe1, (cbAnaProbe[1]->currentData()).toString().toStdString(), ch); digi[iDigi]->WriteValue(PHA::CH::WaveAnalogProbe1, (cbAnaProbe[1]->currentData()).toString().toStdString(), ch);
digiMTX.unlock(); digiMTX.unlock();
}); });
//TODO --- add None //TODO --- add None
cbDigProbe[0] = new RComboBox(this); cbDigProbe[0] = new RComboBox(this);
for( int i = 0; i < (int) DIGIPARA::CH::WaveDigitalProbe0.GetAnswers().size(); i++ ) { for( int i = 0; i < (int) PHA::CH::WaveDigitalProbe0.GetAnswers().size(); i++ ) {
cbDigProbe[0]->addItem(QString::fromStdString((DIGIPARA::CH::WaveDigitalProbe0.GetAnswers())[i].second), cbDigProbe[0]->addItem(QString::fromStdString((PHA::CH::WaveDigitalProbe0.GetAnswers())[i].second),
QString::fromStdString((DIGIPARA::CH::WaveDigitalProbe0.GetAnswers())[i].first)); QString::fromStdString((PHA::CH::WaveDigitalProbe0.GetAnswers())[i].first));
} }
cbDigProbe[1] = new RComboBox(this); cbDigProbe[1] = new RComboBox(this);
@ -191,7 +191,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
if( chkSetAllChannel->isChecked() ) ch = -1; if( chkSetAllChannel->isChecked() ) ch = -1;
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::WaveDigitalProbe0, (cbDigProbe[0]->currentData()).toString().toStdString(), ch); digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe0, (cbDigProbe[0]->currentData()).toString().toStdString(), ch);
digiMTX.unlock(); digiMTX.unlock();
}); });
connect(cbDigProbe[1], &RComboBox::currentIndexChanged, this, [=](){ connect(cbDigProbe[1], &RComboBox::currentIndexChanged, this, [=](){
@ -200,7 +200,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
if( chkSetAllChannel->isChecked() ) ch = -1; if( chkSetAllChannel->isChecked() ) ch = -1;
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::WaveDigitalProbe1, (cbDigProbe[1]->currentData()).toString().toStdString(), ch); digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe1, (cbDigProbe[1]->currentData()).toString().toStdString(), ch);
digiMTX.unlock(); digiMTX.unlock();
}); });
connect(cbDigProbe[2], &RComboBox::currentIndexChanged, this, [=](){ connect(cbDigProbe[2], &RComboBox::currentIndexChanged, this, [=](){
@ -209,7 +209,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
if( chkSetAllChannel->isChecked() ) ch = -1; if( chkSetAllChannel->isChecked() ) ch = -1;
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::WaveDigitalProbe2, (cbDigProbe[2]->currentData()).toString().toStdString(), ch); digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe2, (cbDigProbe[2]->currentData()).toString().toStdString(), ch);
digiMTX.unlock(); digiMTX.unlock();
}); });
connect(cbDigProbe[3], &RComboBox::currentIndexChanged, this, [=](){ connect(cbDigProbe[3], &RComboBox::currentIndexChanged, this, [=](){
@ -218,7 +218,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
if( chkSetAllChannel->isChecked() ) ch = -1; if( chkSetAllChannel->isChecked() ) ch = -1;
digiMTX.lock(); digiMTX.lock();
digi[iDigi]->WriteValue(DIGIPARA::CH::WaveDigitalProbe3, (cbDigProbe[3]->currentData()).toString().toStdString(), ch); digi[iDigi]->WriteValue(PHA::CH::WaveDigitalProbe3, (cbDigProbe[3]->currentData()).toString().toStdString(), ch);
digiMTX.unlock(); digiMTX.unlock();
}); });
@ -240,30 +240,30 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
QGridLayout * bLayout = new QGridLayout(box); QGridLayout * bLayout = new QGridLayout(box);
bLayout->setSpacing(0); bLayout->setSpacing(0);
ScopeMakeSpinBox(sbRL, "Record Lenght [ns] ", bLayout, 0, 0, DIGIPARA::CH::RecordLength); ScopeMakeSpinBox(sbRL, "Record Lenght [ns] ", bLayout, 0, 0, PHA::CH::RecordLength);
ScopeMakeSpinBox(sbThreshold, "Threshold [LSB] ", bLayout, 0, 2, DIGIPARA::CH::TriggerThreshold); ScopeMakeSpinBox(sbThreshold, "Threshold [LSB] ", bLayout, 0, 2, PHA::CH::TriggerThreshold);
ScopeMakeComoBox(cbPolarity, "Polarity ", bLayout, 0, 4, DIGIPARA::CH::Polarity); ScopeMakeComoBox(cbPolarity, "Polarity ", bLayout, 0, 4, PHA::CH::Polarity);
ScopeMakeComoBox(cbWaveRes, "Wave Re. ", bLayout, 0, 6, DIGIPARA::CH::WaveResolution); ScopeMakeComoBox(cbWaveRes, "Wave Re. ", bLayout, 0, 6, PHA::CH::WaveResolution);
//------------------ next row //------------------ next row
ScopeMakeSpinBox(sbPT, "Pre Trigger [ns] ", bLayout, 1, 0, DIGIPARA::CH::PreTrigger); ScopeMakeSpinBox(sbPT, "Pre Trigger [ns] ", bLayout, 1, 0, PHA::CH::PreTrigger);
ScopeMakeSpinBox(sbDCOffset, "DC offset [%] ", bLayout, 1, 2, DIGIPARA::CH::DC_Offset); ScopeMakeSpinBox(sbDCOffset, "DC offset [%] ", bLayout, 1, 2, PHA::CH::DC_Offset);
ScopeMakeSpinBox(sbTimeRiseTime, "Trigger Rise Time [ns] ", bLayout, 1, 4, DIGIPARA::CH::TimeFilterRiseTime); ScopeMakeSpinBox(sbTimeRiseTime, "Trigger Rise Time [ns] ", bLayout, 1, 4, PHA::CH::TimeFilterRiseTime);
ScopeMakeSpinBox(sbTimeGuard, "Trigger Guard [ns] ", bLayout, 1, 6, DIGIPARA::CH::TimeFilterRetriggerGuard); ScopeMakeSpinBox(sbTimeGuard, "Trigger Guard [ns] ", bLayout, 1, 6, PHA::CH::TimeFilterRetriggerGuard);
//----------------- next row //----------------- next row
ScopeMakeSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", bLayout, 2, 0, DIGIPARA::CH::EnergyFilterRiseTime); ScopeMakeSpinBox(sbTrapRiseTime, "Trap. Rise Time [ns] ", bLayout, 2, 0, PHA::CH::EnergyFilterRiseTime);
ScopeMakeSpinBox(sbTrapFlatTop, "Trap. Flat Top [ns] ", bLayout, 2, 2, DIGIPARA::CH::EnergyFilterFlatTop); ScopeMakeSpinBox(sbTrapFlatTop, "Trap. Flat Top [ns] ", bLayout, 2, 2, PHA::CH::EnergyFilterFlatTop);
ScopeMakeSpinBox(sbTrapPoleZero, "Trap. Pole Zero [ns] ", bLayout, 2, 4, DIGIPARA::CH::EnergyFilterPoleZero); ScopeMakeSpinBox(sbTrapPoleZero, "Trap. Pole Zero [ns] ", bLayout, 2, 4, PHA::CH::EnergyFilterPoleZero);
ScopeMakeSpinBox(sbEnergyFineGain, "Energy Fine Gain ", bLayout, 2, 6, DIGIPARA::CH::EnergyFilterFineGain); ScopeMakeSpinBox(sbEnergyFineGain, "Energy Fine Gain ", bLayout, 2, 6, PHA::CH::EnergyFilterFineGain);
//----------------- next row //----------------- next row
ScopeMakeSpinBox(sbTrapPeaking, "Trap. Peaking [%] ", bLayout, 3, 0, DIGIPARA::CH::EnergyFilterPeakingPosition); ScopeMakeSpinBox(sbTrapPeaking, "Trap. Peaking [%] ", bLayout, 3, 0, PHA::CH::EnergyFilterPeakingPosition);
ScopeMakeComoBox(cbTrapPeakAvg, "Trap. Peaking ", bLayout, 3, 2, DIGIPARA::CH::EnergyFilterPeakingAvg); ScopeMakeComoBox(cbTrapPeakAvg, "Trap. Peaking ", bLayout, 3, 2, PHA::CH::EnergyFilterPeakingAvg);
ScopeMakeSpinBox(sbBaselineGuard, "Baseline Guard [ns] ", bLayout, 3, 4, DIGIPARA::CH::EnergyFilterBaselineGuard); ScopeMakeSpinBox(sbBaselineGuard, "Baseline Guard [ns] ", bLayout, 3, 4, PHA::CH::EnergyFilterBaselineGuard);
ScopeMakeComoBox(cbBaselineAvg, "Baseline Avg ", bLayout, 3, 6, DIGIPARA::CH::EnergyFilterBaselineAvg); ScopeMakeComoBox(cbBaselineAvg, "Baseline Avg ", bLayout, 3, 6, PHA::CH::EnergyFilterBaselineAvg);
ScopeMakeSpinBox(sbPileUpGuard, "Pile-up Guard [ns] ", bLayout, 4, 0, DIGIPARA::CH::EnergyFilterPileUpGuard); ScopeMakeSpinBox(sbPileUpGuard, "Pile-up Guard [ns] ", bLayout, 4, 0, PHA::CH::EnergyFilterPileUpGuard);
ScopeMakeComoBox(cbLowFreqFilter, "Low Freq. Filter ", bLayout, 4, 2, DIGIPARA::CH::EnergyFilterLowFreqFilter); ScopeMakeComoBox(cbLowFreqFilter, "Low Freq. Filter ", bLayout, 4, 2, PHA::CH::EnergyFilterLowFreqFilter);
} }
@ -283,7 +283,7 @@ Scope::Scope(Digitizer2Gen **digi, unsigned int nDigi, ReadDataThread ** readDat
layout->addWidget(lbinfo, rowID, 5); layout->addWidget(lbinfo, rowID, 5);
rowID ++; rowID ++;
QLabel * lbinfo2 = new QLabel("Maximum time range is " + QString::number(MaxDisplayTraceDataLength * DIGIPARA::TraceStep) + " ns due to processing speed.", this); QLabel * lbinfo2 = new QLabel("Maximum time range is " + QString::number(MaxDisplayTraceDataLength * PHA::TraceStep) + " ns due to processing speed.", this);
layout->addWidget(lbinfo2, rowID, 0, 1, 5); layout->addWidget(lbinfo2, rowID, 0, 1, 5);
@ -343,32 +343,32 @@ void Scope::ReadScopeSettings(){
allowChange = false; allowChange = false;
for( int i = 0 ; i < 2; i++){ for( int i = 0 ; i < 2; i++){
ScopeReadComboBoxValue(iDigi, ch, cbAnaProbe[i], DIGIPARA::CH::AnalogProbe[i]); ScopeReadComboBoxValue(iDigi, ch, cbAnaProbe[i], PHA::CH::AnalogProbe[i]);
} }
for( int i = 0 ; i < 4; i++){ for( int i = 0 ; i < 4; i++){
ScopeReadComboBoxValue(iDigi, ch, cbDigProbe[i], DIGIPARA::CH::DigitalProbe[i]); ScopeReadComboBoxValue(iDigi, ch, cbDigProbe[i], PHA::CH::DigitalProbe[i]);
} }
ScopeReadComboBoxValue(iDigi, ch, cbPolarity, DIGIPARA::CH::Polarity); ScopeReadComboBoxValue(iDigi, ch, cbPolarity, PHA::CH::Polarity);
ScopeReadComboBoxValue(iDigi, ch, cbWaveRes, DIGIPARA::CH::WaveResolution); ScopeReadComboBoxValue(iDigi, ch, cbWaveRes, PHA::CH::WaveResolution);
ScopeReadComboBoxValue(iDigi, ch, cbTrapPeakAvg, DIGIPARA::CH::EnergyFilterPeakingAvg); ScopeReadComboBoxValue(iDigi, ch, cbTrapPeakAvg, PHA::CH::EnergyFilterPeakingAvg);
ScopeReadComboBoxValue(iDigi, ch, cbBaselineAvg, DIGIPARA::CH::EnergyFilterBaselineAvg); ScopeReadComboBoxValue(iDigi, ch, cbBaselineAvg, PHA::CH::EnergyFilterBaselineAvg);
ScopeReadComboBoxValue(iDigi, ch, cbLowFreqFilter, DIGIPARA::CH::EnergyFilterLowFreqFilter); ScopeReadComboBoxValue(iDigi, ch, cbLowFreqFilter, PHA::CH::EnergyFilterLowFreqFilter);
ScopeReadSpinBoxValue(iDigi, ch, sbRL, DIGIPARA::CH::RecordLength); ScopeReadSpinBoxValue(iDigi, ch, sbRL, PHA::CH::RecordLength);
ScopeReadSpinBoxValue(iDigi, ch, sbPT, DIGIPARA::CH::PreTrigger); ScopeReadSpinBoxValue(iDigi, ch, sbPT, PHA::CH::PreTrigger);
ScopeReadSpinBoxValue(iDigi, ch, sbDCOffset, DIGIPARA::CH::DC_Offset); ScopeReadSpinBoxValue(iDigi, ch, sbDCOffset, PHA::CH::DC_Offset);
ScopeReadSpinBoxValue(iDigi, ch, sbThreshold, DIGIPARA::CH::TriggerThreshold); ScopeReadSpinBoxValue(iDigi, ch, sbThreshold, PHA::CH::TriggerThreshold);
ScopeReadSpinBoxValue(iDigi, ch, sbTimeRiseTime, DIGIPARA::CH::TimeFilterRiseTime); ScopeReadSpinBoxValue(iDigi, ch, sbTimeRiseTime, PHA::CH::TimeFilterRiseTime);
ScopeReadSpinBoxValue(iDigi, ch, sbTimeGuard, DIGIPARA::CH::TimeFilterRetriggerGuard); ScopeReadSpinBoxValue(iDigi, ch, sbTimeGuard, PHA::CH::TimeFilterRetriggerGuard);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapRiseTime, DIGIPARA::CH::EnergyFilterRiseTime); ScopeReadSpinBoxValue(iDigi, ch, sbTrapRiseTime, PHA::CH::EnergyFilterRiseTime);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapFlatTop, DIGIPARA::CH::EnergyFilterFlatTop); ScopeReadSpinBoxValue(iDigi, ch, sbTrapFlatTop, PHA::CH::EnergyFilterFlatTop);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapPoleZero, DIGIPARA::CH::EnergyFilterPoleZero); ScopeReadSpinBoxValue(iDigi, ch, sbTrapPoleZero, PHA::CH::EnergyFilterPoleZero);
ScopeReadSpinBoxValue(iDigi, ch, sbEnergyFineGain, DIGIPARA::CH::EnergyFilterFineGain); ScopeReadSpinBoxValue(iDigi, ch, sbEnergyFineGain, PHA::CH::EnergyFilterFineGain);
ScopeReadSpinBoxValue(iDigi, ch, sbTrapPeaking, DIGIPARA::CH::EnergyFilterPeakingPosition); ScopeReadSpinBoxValue(iDigi, ch, sbTrapPeaking, PHA::CH::EnergyFilterPeakingPosition);
ScopeReadSpinBoxValue(iDigi, ch, sbBaselineGuard, DIGIPARA::CH::EnergyFilterBaselineGuard); ScopeReadSpinBoxValue(iDigi, ch, sbBaselineGuard, PHA::CH::EnergyFilterBaselineGuard);
ScopeReadSpinBoxValue(iDigi, ch, sbPileUpGuard, DIGIPARA::CH::EnergyFilterPileUpGuard); ScopeReadSpinBoxValue(iDigi, ch, sbPileUpGuard, PHA::CH::EnergyFilterPileUpGuard);
sbRL->setStyleSheet(""); sbRL->setStyleSheet("");
sbPT->setStyleSheet(""); sbPT->setStyleSheet("");
@ -403,8 +403,8 @@ void Scope::StartScope(){
ReadScopeSettings(); ReadScopeSettings();
digi[iDigi]->WriteValue(DIGIPARA::CH::ChannelEnable, "False", -1); digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "False", -1);
digi[iDigi]->WriteValue(DIGIPARA::CH::ChannelEnable, "True", ch); digi[iDigi]->WriteValue(PHA::CH::ChannelEnable, "True", ch);
digi[iDigi]->SetPHADataFormat(0); digi[iDigi]->SetPHADataFormat(0);
digi[iDigi]->StartACQ(); digi[iDigi]->StartACQ();
@ -433,7 +433,7 @@ void Scope::StopScope(){
if( digi[i]->IsDummy() ) continue; if( digi[i]->IsDummy() ) continue;
digiMTX.lock(); digiMTX.lock();
digi[i]->StopACQ(); digi[i]->StopACQ();
digi[i]->WriteValue(DIGIPARA::CH::ChannelEnable, "True", -1); digi[i]->WriteValue(PHA::CH::ChannelEnable, "True", -1);
digiMTX.unlock(); digiMTX.unlock();
readDataThread[i]->quit(); readDataThread[i]->quit();
@ -452,15 +452,15 @@ void Scope::UpdateScope(){
int iDigi = cbScopeDigi->currentIndex(); int iDigi = cbScopeDigi->currentIndex();
int ch = cbScopeCh->currentIndex(); int ch = cbScopeCh->currentIndex();
int sample2ns = DIGIPARA::TraceStep * (1 << cbWaveRes->currentIndex()); int sample2ns = PHA::TraceStep * (1 << cbWaveRes->currentIndex());
emit UpdateScalar(); emit UpdateScalar();
if( digi ){ if( digi ){
digiMTX.lock(); digiMTX.lock();
std::string time = digi[iDigi]->ReadValue(DIGIPARA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount std::string time = digi[iDigi]->ReadValue(PHA::CH::ChannelRealtime, ch); // for refreashing SelfTrgRate and SavedCount
std::string haha = digi[iDigi]->ReadValue(DIGIPARA::CH::SelfTrgRate, ch); std::string haha = digi[iDigi]->ReadValue(PHA::CH::SelfTrgRate, ch);
leTriggerRate->setText(QString::fromStdString(haha)); leTriggerRate->setText(QString::fromStdString(haha));
if( atoi(haha.c_str()) == 0 ) { if( atoi(haha.c_str()) == 0 ) {
digiMTX.unlock(); digiMTX.unlock();

View File

@ -98,7 +98,7 @@ int main(int argc, char* argv[]){
//printf("===================================\n"); //printf("===================================\n");
printf("======== index : %d \n", digi->FindIndex(DIGIPARA::CH::ChannelEnable)); printf("======== index : %d \n", digi->FindIndex(PHA::CH::ChannelEnable));
//digi->LoadSettingsFromFile("settings_21245.dat"); //digi->LoadSettingsFromFile("settings_21245.dat");
//printf("%s \n", digi->ReadValue("/ch/0/par/ChRealtimeMonitor").c_str()); //printf("%s \n", digi->ReadValue("/ch/0/par/ChRealtimeMonitor").c_str());