simplified digiSettingPanel, can set values for (almost) Combox and SpinBox

This commit is contained in:
Ryan Tang 2023-03-01 12:26:37 -05:00
parent 684f603bf7
commit 44897f79d2
4 changed files with 174 additions and 191 deletions

View File

@ -91,6 +91,25 @@ std::string Digitizer2Gen::GetPath(uint64_t handle){
//########################################### Read Write //########################################### Read Write
int Digitizer2Gen::FindIndex(const Reg para){ int Digitizer2Gen::FindIndex(const Reg para){
/*
printf("%s %s || ", __func__, para.GetPara().c_str());
int index = -1;
switch (para.GetType() ){
case TYPE::CH: {
index = chMap[para.GetPara()];
printf("%s \n", DIGIPARA::CH::AllSettings[index].GetPara().c_str());
} break;
case TYPE::DIG: {
index = boardMap[para.GetPara()];
printf("%s \n", DIGIPARA::DIG::AllSettings[index].GetPara().c_str());
}break;
case TYPE::VGA: return 0;
case TYPE::LVDS: return -1;
}
return index;
*/
switch (para.GetType() ){ switch (para.GetType() ){
case TYPE::CH: return chMap[para.GetPara()]; case TYPE::CH: return chMap[para.GetPara()];
case TYPE::DIG: return boardMap[para.GetPara()]; case TYPE::DIG: return boardMap[para.GetPara()];
@ -128,7 +147,7 @@ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose
} }
bool Digitizer2Gen::WriteValue(const char * parameter, std::string value){ bool Digitizer2Gen::WriteValue(const char * parameter, std::string value){
if( !isConnected ) return false; if( !isConnected ) return false;
printf(" %s|%-45s|%s|\n", __func__, parameter, value.c_str()); printf(" %s|%-45s|%s|\n", __func__, parameter, value.c_str());
ret = CAEN_FELib_SetValue(handle, parameter, value.c_str()); ret = CAEN_FELib_SetValue(handle, parameter, value.c_str());
if (ret != CAEN_FELib_Success) { if (ret != CAEN_FELib_Success) {
@ -140,7 +159,7 @@ bool Digitizer2Gen::WriteValue(const char * parameter, std::string value){
} }
bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
if( WriteValue(para.GetFullPara(ch_index).c_str(), value)){ if( WriteValue(para.GetFullPara(ch_index).c_str(), value) || isDummy){
int index = FindIndex(para); int index = FindIndex(para);
if( index != -1 ){ if( index != -1 ){
switch(para.GetType()){ switch(para.GetType()){
@ -150,9 +169,25 @@ bool Digitizer2Gen::WriteValue(const Reg para, std::string value, int ch_index){
}else{ }else{
for( int ch = 0; ch < nChannels; ch++ ) chSettings[ch][index].SetValue(value); for( int ch = 0; ch < nChannels; ch++ ) chSettings[ch][index].SetValue(value);
} }
//if( ch_index < 0 ) ch_index = 0;
//printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
// chSettings[ch_index][index].GetFullPara(ch_index).c_str(),
// chSettings[ch_index][index].GetValue().c_str());
}break;
case TYPE::VGA : {
VGASetting[ch_index].SetValue(value);
//printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
// VGASetting[ch_index].GetFullPara(ch_index).c_str(),
// VGASetting[ch_index].GetValue().c_str());
}break;
case TYPE::DIG : {
boardSettings[index].SetValue(value);
//printf("%s %s %s |%s|\n", __func__, para.GetPara().c_str(),
// boardSettings[index].GetFullPara(ch_index).c_str(),
// boardSettings[index].GetValue().c_str());
}break; }break;
case TYPE::VGA : VGASetting[ch_index].SetValue(value); break;
case TYPE::DIG : boardSettings[index].SetValue(value); break;
case TYPE::LVDS : break; case TYPE::LVDS : break;
} }
} }

View File

@ -80,9 +80,9 @@ class Digitizer2Gen {
int FindIndex(const Reg para); // get index from DIGIPARA int FindIndex(const Reg para); // get index from DIGIPARA
std::string ReadValue(const char * parameter, bool verbose = false); std::string ReadValue(const char * parameter, bool verbose = false);
std::string ReadValue(const Reg para, int ch_index = -1, bool verbose = false); std::string ReadValue(const Reg para, int ch_index = -1, bool verbose = false); // read digitizer and save to memory
bool WriteValue(const char * parameter, std::string value); bool WriteValue(const char * parameter, std::string value);
bool WriteValue(const Reg para, std::string value, int ch_index = -1); bool WriteValue(const Reg para, std::string value, int ch_index = -1); // write digituzer and save to memory
void SendCommand(const char * parameter); void SendCommand(const char * parameter);
void SendCommand(std::string shortPara); void SendCommand(std::string shortPara);

View File

@ -43,6 +43,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//@========================== Tab for each digitizer //@========================== Tab for each digitizer
for(unsigned short iDigi = 0; iDigi < this->nDigi; iDigi++){ for(unsigned short iDigi = 0; iDigi < this->nDigi; iDigi++){
const int nChannel = digi[iDigi]->GetNChannels();
QScrollArea * scrollArea = new QScrollArea(this); QScrollArea * scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(true); scrollArea->setWidgetResizable(true);
scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
@ -214,13 +216,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
int rowId = 0; int rowId = 0;
//------------------------------------- //-------------------------------------
rowId ++; SetupComboBox(cbbClockSource[iDigi], DIGIPARA::DIG::ClockSource, -1, "Clock Source :", boardLayout, rowId, 0, 1, 2);
cbbClockSource[iDigi] = new QComboBox(tab);
SetupComboBox(cbbClockSource[iDigi], DIGIPARA::DIG::ClockSource, "Clock Source :", boardLayout, rowId, 0, 1, 2);
connect(cbbClockSource[iDigi], &QComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
digi[ID]->WriteValue(DIGIPARA::DIG::ClockSource, cbbClockSource[ID]->currentData().toString().toStdString());
});
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
@ -231,6 +227,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
for( int i = 0; i < (int) DIGIPARA::DIG::StartSource.GetAnswers().size(); i++){ for( int i = 0; i < (int) DIGIPARA::DIG::StartSource.GetAnswers().size(); i++){
ckbStartSource[iDigi][i] = new QCheckBox( QString::fromStdString((DIGIPARA::DIG::StartSource.GetAnswers())[i].second), tab); ckbStartSource[iDigi][i] = new QCheckBox( QString::fromStdString((DIGIPARA::DIG::StartSource.GetAnswers())[i].second), tab);
boardLayout->addWidget(ckbStartSource[iDigi][i], rowId, 1 + i); boardLayout->addWidget(ckbStartSource[iDigi][i], rowId, 1 + i);
connect(ckbStartSource[iDigi][i], &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetStartSource);
} }
//------------------------------------- //-------------------------------------
@ -246,13 +243,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
cbbTrgOut[iDigi] = new QComboBox(tab); SetupComboBox(cbbTrgOut[iDigi], DIGIPARA::DIG::TrgOutMode, -1, "Trg-OUT Mode :", boardLayout, rowId, 0, 1, 2);
SetupComboBox(cbbTrgOut[iDigi], DIGIPARA::DIG::TrgOutMode, "Trg-OUT Mode :", boardLayout, rowId, 0, 1, 2);
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
cbbGPIO[iDigi] = new QComboBox(tab); SetupComboBox(cbbGPIO[iDigi], DIGIPARA::DIG::GPIOMode, -1, "GPIO Mode :", boardLayout, rowId, 0, 1, 2);
SetupComboBox(cbbGPIO[iDigi], DIGIPARA::DIG::GPIOMode, "GPIO Mode :", boardLayout, rowId, 0, 1, 2);
//------------------------------------- //-------------------------------------
QLabel * lbAutoDisarmAcq = new QLabel("Auto disarm ACQ :", tab); QLabel * lbAutoDisarmAcq = new QLabel("Auto disarm ACQ :", tab);
@ -265,8 +260,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
cbbBusyIn[iDigi] = new QComboBox(tab); SetupComboBox(cbbBusyIn[iDigi], DIGIPARA::DIG::BusyInSource, -1, "Busy In Source :", boardLayout, rowId, 0, 1, 2);
SetupComboBox(cbbBusyIn[iDigi], DIGIPARA::DIG::BusyInSource, "Busy In Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbStatEvents = new QLabel("Stat. Event :", tab); QLabel * lbStatEvents = new QLabel("Stat. Event :", tab);
lbStatEvents->setAlignment(Qt::AlignRight); lbStatEvents->setAlignment(Qt::AlignRight);
@ -275,16 +269,18 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
cbbStatEvents[iDigi] = new QComboBox(tab); cbbStatEvents[iDigi] = new QComboBox(tab);
boardLayout->addWidget(cbbStatEvents[iDigi], rowId, 6); boardLayout->addWidget(cbbStatEvents[iDigi], rowId, 6);
SetupShortComboBox(cbbStatEvents[iDigi], DIGIPARA::DIG::EnableStatisticEvents); SetupShortComboBox(cbbStatEvents[iDigi], DIGIPARA::DIG::EnableStatisticEvents);
connect(cbbStatEvents[iDigi], &QComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
digi[ID]->WriteValue(DIGIPARA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString());
});
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
cbbSyncOut[iDigi] = new QComboBox(tab); SetupComboBox(cbbSyncOut[iDigi], DIGIPARA::DIG::SyncOutMode, -1, "Sync Out mode :", boardLayout, rowId, 0, 1, 2);
SetupComboBox(cbbSyncOut[iDigi], DIGIPARA::DIG::SyncOutMode, "Sync Out mode :", boardLayout, rowId, 0, 1, 2);
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
cbbBoardVetoSource[iDigi] = new QComboBox(tab); SetupComboBox(cbbBoardVetoSource[iDigi], DIGIPARA::DIG::BoardVetoSource, -1, "Board Veto Source :", boardLayout, rowId, 0, 1, 2);
SetupComboBox(cbbBoardVetoSource[iDigi], DIGIPARA::DIG::BoardVetoSource, "Board Veto Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbBdVetoWidth = new QLabel("Board Veto Width [ns] :", tab); QLabel * lbBdVetoWidth = new QLabel("Board Veto Width [ns] :", tab);
lbBdVetoWidth->setAlignment(Qt::AlignRight); lbBdVetoWidth->setAlignment(Qt::AlignRight);
@ -295,6 +291,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
spbBdVetoWidth[iDigi]->setMaximum(38360); spbBdVetoWidth[iDigi]->setMaximum(38360);
spbBdVetoWidth[iDigi]->setSingleStep(20); spbBdVetoWidth[iDigi]->setSingleStep(20);
boardLayout->addWidget(spbBdVetoWidth[iDigi], rowId, 5); boardLayout->addWidget(spbBdVetoWidth[iDigi], rowId, 5);
//TODO---- make connection
cbbBdVetoPolarity[iDigi] = new QComboBox(tab); cbbBdVetoPolarity[iDigi] = new QComboBox(tab);
boardLayout->addWidget(cbbBdVetoPolarity[iDigi], rowId, 6); boardLayout->addWidget(cbbBdVetoPolarity[iDigi], rowId, 6);
@ -303,7 +301,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
spbRunDelay[iDigi] = new QSpinBox(tab); spbRunDelay[iDigi] = new QSpinBox(tab);
SetupSpinBox(spbRunDelay[iDigi], DIGIPARA::DIG::RunDelay, "Run Delay [ns] :", boardLayout, rowId, 0); SetupSpinBox(spbRunDelay[iDigi], DIGIPARA::DIG::RunDelay, -1, "Run Delay [ns] :", boardLayout, rowId, 0);
//------------------------------------- //-------------------------------------
QLabel * lbClockOutDelay = new QLabel("Temp. Clock Out Delay [ps] :", tab); QLabel * lbClockOutDelay = new QLabel("Temp. Clock Out Delay [ps] :", tab);
@ -318,8 +316,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------------- //-------------------------------------
rowId ++; rowId ++;
cbbIOLevel[iDigi] = new QComboBox(tab); SetupComboBox(cbbIOLevel[iDigi], DIGIPARA::DIG::IO_Level, -1, "IO Level :", boardLayout, rowId, 0, 1, 2);
SetupComboBox(cbbIOLevel[iDigi], DIGIPARA::DIG::IO_Level, "IO Level :", boardLayout, rowId, 0, 1, 2);
QLabel * lbClockOutDelay2 = new QLabel("Perm. Clock Out Delay [ps] :", tab); QLabel * lbClockOutDelay2 = new QLabel("Perm. Clock Out Delay [ps] :", tab);
@ -408,44 +405,40 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QGridLayout * layout1 = new QGridLayout(box1); QGridLayout * layout1 = new QGridLayout(box1);
rowID = 0; rowID = 0;
ckbChEnabled[iDigi][ch] = new QCheckBox("On/Off", tab); ckbChEnabled = new QCheckBox **[nDigi];
for( int i = 0; i < nDigi; i++) {
ckbChEnabled[i] = new QCheckBox * [nChannel + 1];
for( int j = 0; j < nChannel + 1; j ++){
ckbChEnabled[i][j] = new QCheckBox("On/Off", tab);
}
}
ckbChEnabled[iDigi][ch]->setLayoutDirection(Qt::RightToLeft); ckbChEnabled[iDigi][ch]->setLayoutDirection(Qt::RightToLeft);
layout1->addWidget(ckbChEnabled[iDigi][ch], rowID, 0); layout1->addWidget(ckbChEnabled[iDigi][ch], rowID, 0);
onOffMapper->setMapping(ckbChEnabled[iDigi][ch], (iDigi << 12) + ch); onOffMapper->setMapping(ckbChEnabled[iDigi][ch], (iDigi << 12) + ch);
connect(ckbChEnabled[iDigi][ch], SIGNAL(clicked()), onOffMapper, SLOT(map())); connect(ckbChEnabled[iDigi][ch], SIGNAL(clicked()), onOffMapper, SLOT(map()));
cbbWaveSource[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbWaveSource[iDigi][ch], DIGIPARA::CH::WaveDataSource, -1, "Wave Data Source", layout1, rowID, 1, 1, 2);
SetupComboBox(cbbWaveSource[iDigi][ch], DIGIPARA::CH::WaveDataSource, "Wave Data Source", layout1, rowID, 1, 1, 2);
rowID ++; rowID ++;
cbbWaveRes[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbWaveRes[iDigi][ch], DIGIPARA::CH::WaveResolution, -1, "Wave Resol.", layout1, rowID, 0);
SetupComboBox(cbbWaveRes[iDigi][ch], DIGIPARA::CH::WaveResolution, "Wave Resol.", layout1, rowID, 0); SetupComboBox(cbbWaveSave[iDigi][ch], DIGIPARA::CH::WaveSaving, -1, "Wave Save", layout1, rowID, 2);
cbbWaveSave[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbWaveSave[iDigi][ch], DIGIPARA::CH::WaveSaving, "Wave Save", layout1, rowID, 2);
rowID ++; rowID ++;
cbbParity[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbParity[iDigi][ch], DIGIPARA::CH::Polarity, -1, "Parity", layout1, rowID, 0);
SetupComboBox(cbbParity[iDigi][ch], DIGIPARA::CH::Polarity, "Parity", layout1, rowID, 0); SetupComboBox(cbbLowFilter[iDigi][ch], DIGIPARA::CH::EnergyFilterLowFreqFilter, -1, "Low Freq. Filter", layout1, rowID, 2);
cbbLowFilter[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbLowFilter[iDigi][ch], DIGIPARA::CH::EnergyFilterLowFreqFilter, "Low Freq. Filter", layout1, rowID, 2);
rowID ++; rowID ++;
spbDCOffset[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbDCOffset[iDigi][ch], DIGIPARA::CH::DC_Offset, -1, "DC Offset [%]", layout1, rowID, 0);
SetupSpinBox(spbDCOffset[iDigi][ch], DIGIPARA::CH::DC_Offset, "DC Offset [%]", layout1, rowID, 0); SetupSpinBox(spbThreshold[iDigi][ch], DIGIPARA::CH::TriggerThreshold, -1, "Threshold [LSB]", layout1, rowID, 2);
spbThreshold[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbThreshold[iDigi][ch], DIGIPARA::CH::TriggerThreshold, "Threshold [LSB]", layout1, rowID, 2);
rowID ++; rowID ++;
spbInputRiseTime[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbInputRiseTime[iDigi][ch], DIGIPARA::CH::TimeFilterRiseTime, -1, "Input Rise Time [ns]", layout1, rowID, 0);
SetupSpinBox(spbInputRiseTime[iDigi][ch], DIGIPARA::CH::TimeFilterRiseTime, "Input Rise Time [ns]", layout1, rowID, 0); SetupSpinBox(spbTriggerGuard[iDigi][ch], DIGIPARA::CH::TimeFilterRetriggerGuard, -1, "Trigger Guard [ns]", layout1, rowID, 2);
spbTriggerGuard[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbTriggerGuard[iDigi][ch], DIGIPARA::CH::TimeFilterRetriggerGuard, "Trigger Guard [ns]", layout1, rowID, 2);
rowID ++; rowID ++;
spbRecordLength[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbRecordLength[iDigi][ch], DIGIPARA::CH::RecordLength, -1, "Record Length [ns]", layout1, rowID, 0);
SetupSpinBox(spbRecordLength[iDigi][ch], DIGIPARA::CH::RecordLength, "Record Length [ns]", layout1, rowID, 0); SetupSpinBox(spbPreTrigger[iDigi][ch], DIGIPARA::CH::PreTrigger, -1, "Pre Trigger [ns]", layout1, rowID, 2);
spbPreTrigger[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbPreTrigger[iDigi][ch], DIGIPARA::CH::PreTrigger, "Pre Trigger [ns]", layout1, rowID, 2);
} }
@ -455,34 +448,22 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QGridLayout * layout3 = new QGridLayout(box3); QGridLayout * layout3 = new QGridLayout(box3);
//------------------------------ //------------------------------
rowID = 0; rowID = 0;
SetupSpinBox(spbTrapRiseTime[iDigi][ch], DIGIPARA::CH::EnergyFilterRiseTime, -1, "Trap. Rise Time [ns]", layout3, rowID, 0);
//------------------------------ SetupSpinBox(spbTrapFlatTop[iDigi][ch], DIGIPARA::CH::EnergyFilterFlatTop, -1, "Trap. Flat Top [ns]", layout3, rowID, 2);
rowID ++; SetupSpinBox(spbTrapPoleZero[iDigi][ch], DIGIPARA::CH::EnergyFilterPoleZero, -1, "Trap. Pole Zero [ns]", layout3, rowID, 4);
spbTrapRiseTime[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbTrapRiseTime[iDigi][ch], DIGIPARA::CH::EnergyFilterRiseTime, "Trap. Rise Time [ns]", layout3, rowID, 0);
spbTrapFlatTop[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbTrapFlatTop[iDigi][ch], DIGIPARA::CH::EnergyFilterFlatTop, "Trap. Flat Top [ns]", layout3, rowID, 2);
spbTrapPoleZero[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbTrapPoleZero[iDigi][ch], DIGIPARA::CH::EnergyFilterPoleZero, "Trap. Pole Zero [ns]", layout3, rowID, 4);
//------------------------------ //------------------------------
rowID ++; rowID ++;
spbPeaking[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbPeaking[iDigi][ch], DIGIPARA::CH::EnergyFilterPeakingPosition, -1, "Peaking [%]", layout3, rowID, 0);
SetupSpinBox(spbPeaking[iDigi][ch], DIGIPARA::CH::EnergyFilterPeakingPosition, "Peaking [%]", layout3, rowID, 0); SetupSpinBox(spbBaselineGuard[iDigi][ch], DIGIPARA::CH::EnergyFilterBaselineGuard, -1, "Baseline Guard [ns]", layout3, rowID, 2);
spbBaselineGuard[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbPileupGuard[iDigi][ch], DIGIPARA::CH::EnergyFilterPileUpGuard, -1, "Pile-up Guard [ns]", layout3, rowID, 4);
SetupSpinBox(spbBaselineGuard[iDigi][ch], DIGIPARA::CH::EnergyFilterBaselineGuard, "Baseline Guard [ns]", layout3, rowID, 2);
spbPileupGuard[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbPileupGuard[iDigi][ch], DIGIPARA::CH::EnergyFilterPileUpGuard, "Pile-up Guard [ns]", layout3, rowID, 4);
//------------------------------ //------------------------------
rowID ++; rowID ++;
cbbPeakingAvg[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbPeakingAvg[iDigi][ch], DIGIPARA::CH::EnergyFilterPeakingAvg, -1, "Peak Avg", layout3, rowID, 0);
SetupComboBox(cbbPeakingAvg[iDigi][ch], DIGIPARA::CH::EnergyFilterPeakingAvg, "Peak Avg", layout3, rowID, 0); SetupComboBox(cbbBaselineAvg[iDigi][ch], DIGIPARA::CH::EnergyFilterBaselineAvg, -1, "Baseline Avg", layout3, rowID, 2);
cbbBaselineAvg[iDigi][ch] = new QComboBox(tab); SetupSpinBox(spbFineGain[iDigi][ch], DIGIPARA::CH::EnergyFilterFineGain, -1, "Fine Gain", layout3, rowID, 4);
SetupComboBox(cbbBaselineAvg[iDigi][ch], DIGIPARA::CH::EnergyFilterBaselineAvg, "Baseline Avg", layout3, rowID, 2);
spbFineGain[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbFineGain[iDigi][ch], DIGIPARA::CH::EnergyFilterFineGain, "Fine Gain", layout3, rowID, 4);
} }
@ -491,27 +472,20 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
allLayout->addWidget(box4); allLayout->addWidget(box4);
QGridLayout * layout4 = new QGridLayout(box4); QGridLayout * layout4 = new QGridLayout(box4);
//------------------------------ //------------------------------
rowID = 0; rowID = 0;
cbbAnaProbe0[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbAnaProbe0[iDigi][ch], DIGIPARA::CH::WaveAnalogProbe0, -1, "Analog Prob. 0", layout4, rowID, 0, 1, 2);
SetupComboBox(cbbAnaProbe0[iDigi][ch], DIGIPARA::CH::WaveAnalogProbe0, "Analog Prob. 0", layout4, rowID, 0, 1, 2); SetupComboBox(cbbAnaProbe1[iDigi][ch], DIGIPARA::CH::WaveAnalogProbe1, -1, "Analog Prob. 1", layout4, rowID, 3, 1, 2);
cbbAnaProbe1[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbAnaProbe1[iDigi][ch], DIGIPARA::CH::WaveAnalogProbe1, "Analog Prob. 1", layout4, rowID, 3, 1, 2);
//------------------------------ //------------------------------
rowID ++; rowID ++;
cbbDigProbe0[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe0, -1, "Digitial Prob. 0", layout4, rowID, 0, 1, 2);
SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe0, "Digitial Prob. 0", layout4, rowID, 0, 1, 2); SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe1, -1, "Digitial Prob. 1", layout4, rowID, 3, 1, 2);
cbbDigProbe0[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe1, "Digitial Prob. 1", layout4, rowID, 3, 1, 2);
//------------------------------ //------------------------------
rowID ++; rowID ++;
cbbDigProbe0[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe2, -1, "Digitial Prob. 2", layout4, rowID, 0, 1, 2);
SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe2, "Digitial Prob. 2", layout4, rowID, 0, 1, 2); SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe3, -1, "Digitial Prob. 3", layout4, rowID, 3, 1, 2);
cbbDigProbe0[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbDigProbe0[iDigi][ch], DIGIPARA::CH::WaveDigitalProbe3, "Digitial Prob. 3", layout4, rowID, 3, 1, 2);
} }
@ -522,16 +496,12 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------ //------------------------------
rowID = 0; rowID = 0;
cbbEvtTrigger[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbEvtTrigger[iDigi][ch], DIGIPARA::CH::EventTriggerSource, -1, "Event Trig. Source", layout5, rowID, 0);
SetupComboBox(cbbEvtTrigger[iDigi][ch], DIGIPARA::CH::EventTriggerSource, "Event Trig. Source", layout5, rowID, 0); SetupComboBox(cbbWaveTrigger[iDigi][ch], DIGIPARA::CH::WaveTriggerSource, -1, "Wave Trig. Source", layout5, rowID, 2);
cbbWaveTrigger[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbWaveTrigger[iDigi][ch], DIGIPARA::CH::WaveTriggerSource, "Wave Trig. Source", layout5, rowID, 2);
//------------------------------ //------------------------------
rowID ++; rowID ++;
cbbChVetoSrc[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbChVetoSrc[iDigi][ch], DIGIPARA::CH::ChannelVetoSource, -1, "Veto Source", layout5, rowID, 0);
SetupComboBox(cbbChVetoSrc[iDigi][ch], DIGIPARA::CH::ChannelVetoSource, "Veto Source", layout5, rowID, 0);
QLabel * lbTriggerMask = new QLabel("Trigger Mask", tab); QLabel * lbTriggerMask = new QLabel("Trigger Mask", tab);
lbTriggerMask->setAlignment(Qt::AlignCenter | Qt::AlignRight); lbTriggerMask->setAlignment(Qt::AlignCenter | Qt::AlignRight);
@ -542,18 +512,13 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------ //------------------------------
rowID ++; rowID ++;
cbbCoinMask[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbCoinMask[iDigi][ch], DIGIPARA::CH::CoincidenceMask, -1, "Coin. Mask", layout5, rowID, 0);
SetupComboBox(cbbCoinMask[iDigi][ch], DIGIPARA::CH::CoincidenceMask, "Coin. Mask", layout5, rowID, 0); SetupComboBox(cbbAntiCoinMask[iDigi][ch], DIGIPARA::CH::AntiCoincidenceMask, -1, "Anti-Coin. Mask", layout5, rowID, 2);
cbbAntiCoinMask[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbAntiCoinMask[iDigi][ch], DIGIPARA::CH::AntiCoincidenceMask, "Anti-Coin. Mask", layout5, rowID, 2);
//------------------------------ //------------------------------
rowID ++; rowID ++;
spbCoinLength[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbCoinLength[iDigi][ch], DIGIPARA::CH::CoincidenceLength, -1, "Coin. Length [ns]", layout5, rowID, 0);
SetupSpinBox(spbCoinLength[iDigi][ch], DIGIPARA::CH::CoincidenceLength, "Coin. Length [ns]", layout5, rowID, 0); SetupSpinBox(spbADCVetoWidth[iDigi][ch], DIGIPARA::CH::ADCVetoWidth, -1, "ADC Veto Length [ns]", layout5, rowID, 2);
spbADCVetoWidth[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbADCVetoWidth[iDigi][ch], DIGIPARA::CH::ADCVetoWidth, "ADC Veto Length [ns]", layout5, rowID, 2);
for( int i = 0; i < layout5->columnCount(); i++) layout5->setColumnStretch(i, 1); for( int i = 0; i < layout5->columnCount(); i++) layout5->setColumnStretch(i, 1);
@ -566,17 +531,13 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
//------------------------------ //------------------------------
rowID = 0 ; rowID = 0 ;
cbbEventSelector[iDigi][ch] = new QComboBox(tab); SetupComboBox(cbbEventSelector[iDigi][ch], DIGIPARA::CH::EventSelector, -1, "Event Selector", layout6, rowID, 0);
SetupComboBox(cbbEventSelector[iDigi][ch], DIGIPARA::CH::EventSelector, "Event Selector", layout6, rowID, 0); SetupComboBox(cbbWaveSelector[iDigi][ch], DIGIPARA::CH::WaveSelector, -1, "Wave Selector", layout6, rowID, 2);
cbbWaveSelector[iDigi][ch] = new QComboBox(tab);
SetupComboBox(cbbWaveSelector[iDigi][ch], DIGIPARA::CH::WaveSelector, "Wave Selector", layout6, rowID, 2);
//------------------------------ //------------------------------
rowID ++; rowID ++;
spbEnergySkimLow[iDigi][ch] = new QSpinBox(tab); SetupSpinBox(spbEnergySkimLow[iDigi][ch], DIGIPARA::CH::EnergySkimLowDiscriminator, -1, "Energy Skim Low", layout6, rowID, 0);
SetupSpinBox(spbEnergySkimLow[iDigi][ch], DIGIPARA::CH::EnergySkimLowDiscriminator, "Energy Skim Low", layout6, rowID, 0); SetupSpinBox(spbEnergySkimHigh[iDigi][ch], DIGIPARA::CH::EnergySkimHighDiscriminator, -1, "Energy Skim High", layout6, rowID, 2);
spbEnergySkimHigh[iDigi][ch] = new QSpinBox(tab);
SetupSpinBox(spbEnergySkimHigh[iDigi][ch], DIGIPARA::CH::EnergySkimHighDiscriminator, "Energy Skim High", layout6, rowID, 2);
} }
@ -588,7 +549,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
} }
{//@============== input tab {//@============== input tab
QTabWidget * inputTab = new QTabWidget(tab); QTabWidget * inputTab = new QTabWidget(tab);
chTabWidget->addTab(inputTab, "Input"); chTabWidget->addTab(inputTab, "Input");
@ -602,7 +564,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
allLayout->setVerticalSpacing(0); allLayout->setVerticalSpacing(0);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch++){
ckbChEnabled[iDigi][ch] = new QCheckBox(QString::number(ch)); allLayout->addWidget(ckbChEnabled[iDigi][ch], ch/4, ch%4); ckbChEnabled[iDigi][ch]->setText(QString::number(ch));
allLayout->addWidget(ckbChEnabled[iDigi][ch], ch/4, ch%4);
ckbChEnabled[iDigi][ch]->setLayoutDirection(Qt::RightToLeft); ckbChEnabled[iDigi][ch]->setLayoutDirection(Qt::RightToLeft);
onOffMapper->setMapping(ckbChEnabled[iDigi][ch], (iDigi << 12) + ch); onOffMapper->setMapping(ckbChEnabled[iDigi][ch], (iDigi << 12) + ch);
@ -611,69 +574,31 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
} }
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbDCOffset[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbDCOffset, DIGIPARA::CH::DC_Offset, "DC Offset [%]", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbDCOffset, DIGIPARA::CH::DC_Offset, "DC Offset [%]", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbThreshold[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbThreshold, DIGIPARA::CH::TriggerThreshold, "Threshold [LSB]", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbThreshold, DIGIPARA::CH::TriggerThreshold, "Threshold [LSB]", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbParity[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbParity, DIGIPARA::CH::Polarity, "Parity", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbParity, DIGIPARA::CH::Polarity, "Parity", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbRecordLength[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbRecordLength, DIGIPARA::CH::RecordLength, "Record Length [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbRecordLength, DIGIPARA::CH::RecordLength, "Record Length [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbPreTrigger[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbPreTrigger, DIGIPARA::CH::PreTrigger, "PreTrigger [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbPreTrigger, DIGIPARA::CH::PreTrigger, "PreTrigger [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbInputRiseTime[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbInputRiseTime, DIGIPARA::CH::TimeFilterRiseTime, "Input Rise Time [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbInputRiseTime, DIGIPARA::CH::TimeFilterRiseTime, "Input Rise Time [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbTriggerGuard[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbTriggerGuard, DIGIPARA::CH::TimeFilterRetriggerGuard, "Trigger Guard [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbTriggerGuard, DIGIPARA::CH::TimeFilterRetriggerGuard, "Trigger Guard [ns]", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbLowFilter[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbLowFilter, DIGIPARA::CH::EnergyFilterLowFreqFilter, "Low Freq. Filter", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbLowFilter, DIGIPARA::CH::EnergyFilterLowFreqFilter, "Low Freq. Filter", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbWaveSource[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbWaveSource, DIGIPARA::CH::WaveDataSource, "Wave Data Dource", inputTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbWaveSource, DIGIPARA::CH::WaveDataSource, "Wave Data Dource", inputTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbWaveRes[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbWaveRes, DIGIPARA::CH::WaveResolution, "Wave Resol.", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbWaveRes, DIGIPARA::CH::WaveResolution, "Wave Resol.", inputTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbWaveSave[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbWaveSave, DIGIPARA::CH::WaveSaving, "Wave Save", inputTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbWaveSave, DIGIPARA::CH::WaveSaving, "Wave Save", inputTab, iDigi, digi[iDigi]->GetNChannels());
} }
{//@============== Trap tab {//@============== Trap tab
QTabWidget * trapTab = new QTabWidget(tab); QTabWidget * trapTab = new QTabWidget(tab);
chTabWidget->addTab(trapTab, "Trapezoid"); chTabWidget->addTab(trapTab, "Trapezoid");
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbTrapRiseTime[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbTrapRiseTime, DIGIPARA::CH::EnergyFilterRiseTime, "Trap. Rise Time [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbTrapRiseTime, DIGIPARA::CH::EnergyFilterRiseTime, "Trap. Rise Time [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbTrapFlatTop[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbTrapFlatTop, DIGIPARA::CH::EnergyFilterFlatTop, "Trap. Flat Top [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbTrapFlatTop, DIGIPARA::CH::EnergyFilterFlatTop, "Trap. Flat Top [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbTrapPoleZero[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbTrapPoleZero, DIGIPARA::CH::EnergyFilterPoleZero, "Trap. Pole Zero [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbTrapPoleZero, DIGIPARA::CH::EnergyFilterPoleZero, "Trap. Pole Zero [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbPeaking[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbPeaking, DIGIPARA::CH::EnergyFilterPeakingAvg, "Peaking [%]", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbPeaking, DIGIPARA::CH::EnergyFilterPeakingAvg, "Peaking [%]", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbPeakingAvg[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbPeakingAvg, DIGIPARA::CH::EnergyFilterPeakingAvg, "Peak Avg.", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbPeakingAvg, DIGIPARA::CH::EnergyFilterPeakingAvg, "Peak Avg.", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbBaselineAvg[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbBaselineAvg, DIGIPARA::CH::EnergyFilterBaselineAvg, "Baseline Avg.", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbBaselineAvg, DIGIPARA::CH::EnergyFilterBaselineAvg, "Baseline Avg.", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbFineGain[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbFineGain, DIGIPARA::CH::EnergyFilterFineGain, "Fine Gain", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbFineGain, DIGIPARA::CH::EnergyFilterFineGain, "Fine Gain", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbBaselineGuard[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbBaselineGuard, DIGIPARA::CH::EnergyFilterBaselineGuard, "Baseline Guard [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbBaselineGuard, DIGIPARA::CH::EnergyFilterBaselineGuard, "Baseline Guard [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbPileupGuard[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbPileupGuard, DIGIPARA::CH::EnergyFilterPileUpGuard, "Pile-up Guard [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbPileupGuard, DIGIPARA::CH::EnergyFilterPileUpGuard, "Pile-up Guard [ns]", trapTab, iDigi, digi[iDigi]->GetNChannels());
} }
@ -682,22 +607,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QTabWidget * probeTab = new QTabWidget(tab); QTabWidget * probeTab = new QTabWidget(tab);
chTabWidget->addTab(probeTab, "Probe"); chTabWidget->addTab(probeTab, "Probe");
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbAnaProbe0[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbAnaProbe0, DIGIPARA::CH::WaveAnalogProbe0, "Analog Prob. 0", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbAnaProbe0, DIGIPARA::CH::WaveAnalogProbe0, "Analog Prob. 0", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbAnaProbe1[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbAnaProbe1, DIGIPARA::CH::WaveAnalogProbe1, "Analog Prob. 1", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbAnaProbe1, DIGIPARA::CH::WaveAnalogProbe1, "Analog Prob. 1", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbDigProbe0[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbDigProbe0, DIGIPARA::CH::WaveDigitalProbe0, "Digital Prob. 0", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbDigProbe0, DIGIPARA::CH::WaveDigitalProbe0, "Digital Prob. 0", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbDigProbe1[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbDigProbe1, DIGIPARA::CH::WaveDigitalProbe1, "Digital Prob. 1", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbDigProbe1, DIGIPARA::CH::WaveDigitalProbe1, "Digital Prob. 1", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbDigProbe2[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbDigProbe2, DIGIPARA::CH::WaveDigitalProbe2, "Digital Prob. 2", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbDigProbe2, DIGIPARA::CH::WaveDigitalProbe2, "Digital Prob. 2", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbDigProbe3[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbDigProbe3, DIGIPARA::CH::WaveDigitalProbe3, "Digital Prob. 3", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbDigProbe3, DIGIPARA::CH::WaveDigitalProbe3, "Digital Prob. 3", probeTab, iDigi, digi[iDigi]->GetNChannels(), 2);
} }
@ -706,16 +620,9 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QTabWidget * otherTab = new QTabWidget(tab); QTabWidget * otherTab = new QTabWidget(tab);
chTabWidget->addTab(otherTab, "Others"); chTabWidget->addTab(otherTab, "Others");
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbEventSelector[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbEventSelector, DIGIPARA::CH::EventSelector, "Event Selector", otherTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbEventSelector, DIGIPARA::CH::EventSelector, "Event Selector", otherTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbWaveSelector[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbWaveSelector, DIGIPARA::CH::WaveSelector, "Wave Selector", otherTab, iDigi, digi[iDigi]->GetNChannels(), 2 ); SetupComboBoxTab(cbbWaveSelector, DIGIPARA::CH::WaveSelector, "Wave Selector", otherTab, iDigi, digi[iDigi]->GetNChannels(), 2 );
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbEnergySkimLow[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbEnergySkimLow, DIGIPARA::CH::EnergySkimLowDiscriminator, "Energy Skim Low", otherTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbEnergySkimLow, DIGIPARA::CH::EnergySkimLowDiscriminator, "Energy Skim Low", otherTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbEnergySkimHigh[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbEnergySkimHigh, DIGIPARA::CH::EnergySkimHighDiscriminator, "Energy Skim High", otherTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbEnergySkimHigh, DIGIPARA::CH::EnergySkimHighDiscriminator, "Energy Skim High", otherTab, iDigi, digi[iDigi]->GetNChannels());
} }
@ -724,25 +631,12 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
QTabWidget * triggerTab = new QTabWidget(tab); QTabWidget * triggerTab = new QTabWidget(tab);
chTabWidget->addTab(triggerTab, "Trigger"); chTabWidget->addTab(triggerTab, "Trigger");
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbEvtTrigger[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbEvtTrigger, DIGIPARA::CH::EventTriggerSource, "Event Trig. Source", triggerTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbEvtTrigger, DIGIPARA::CH::EventTriggerSource, "Event Trig. Source", triggerTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbWaveTrigger[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbWaveTrigger, DIGIPARA::CH::WaveTriggerSource, "Wave Trig. Source", triggerTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbWaveTrigger, DIGIPARA::CH::WaveTriggerSource, "Wave Trig. Source", triggerTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbChVetoSrc[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbChVetoSrc, DIGIPARA::CH::ChannelVetoSource, "Veto Source", triggerTab, iDigi, digi[iDigi]->GetNChannels(), 2); SetupComboBoxTab(cbbChVetoSrc, DIGIPARA::CH::ChannelVetoSource, "Veto Source", triggerTab, iDigi, digi[iDigi]->GetNChannels(), 2);
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbCoinMask[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbCoinMask, DIGIPARA::CH::CoincidenceMask, "Coin. Mask", triggerTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbCoinMask, DIGIPARA::CH::CoincidenceMask, "Coin. Mask", triggerTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) cbbAntiCoinMask[iDigi][ch] = new QComboBox(tab);
SetupComboBoxTab(cbbAntiCoinMask, DIGIPARA::CH::AntiCoincidenceMask, "Anti-Coin. Mask", triggerTab, iDigi, digi[iDigi]->GetNChannels()); SetupComboBoxTab(cbbAntiCoinMask, DIGIPARA::CH::AntiCoincidenceMask, "Anti-Coin. Mask", triggerTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbCoinLength[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbCoinLength, DIGIPARA::CH::CoincidenceLength, "Coin. Length [ns]", triggerTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbCoinLength, DIGIPARA::CH::CoincidenceLength, "Coin. Length [ns]", triggerTab, iDigi, digi[iDigi]->GetNChannels());
for( int ch = 0; ch < digi[iDigi]->GetNChannels(); ch ++ ) spbADCVetoWidth[iDigi][ch] = new QSpinBox(tab);
SetupSpinBoxTab(spbADCVetoWidth, DIGIPARA::CH::ADCVetoWidth, "ADC Veto Length [ns]", triggerTab, iDigi, digi[iDigi]->GetNChannels()); SetupSpinBoxTab(spbADCVetoWidth, DIGIPARA::CH::ADCVetoWidth, "ADC Veto Length [ns]", triggerTab, iDigi, digi[iDigi]->GetNChannels());
} }
@ -803,9 +697,11 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
} }
} }
} //=== end of channel group } //=== end of channel group
} //=== end of tab } //=== end of tab
enableSignalSlot = true;
} }
@ -1013,7 +909,43 @@ void DigiSettingsPanel::ShowSettingsToPanel(){
enableSignalSlot = true; enableSignalSlot = true;
} }
//^###########################################################################
void DigiSettingsPanel::SetStartSource(){
if( !enableSignalSlot ) return;
std::string value = "";
for( int i = 0; i < (int) DIGIPARA::DIG::StartSource.GetAnswers().size(); i++){
if( ckbStartSource[ID][i]->isChecked() ){
//printf("----- %s \n", DIGIPARA::DIG::StartSource.GetAnswers()[i].first.c_str());
if( value != "" ) value += " | ";
value += DIGIPARA::DIG::StartSource.GetAnswers()[i].first;
}
}
printf("================ %s\n", value.c_str());
digi[ID]->WriteValue(DIGIPARA::DIG::StartSource, value);
}
void DigiSettingsPanel::SetGlobalTriggerSource(){
if( !enableSignalSlot ) return;
std::string value = "";
for( int i = 0; i < (int) DIGIPARA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
if( ckbGlbTrgSource[ID][i]->isChecked() ){
//printf("----- %s \n", DIGIPARA::DIG::StartSource.GetAnswers()[i].first.c_str());
if( value != "" ) value += " | ";
value += DIGIPARA::DIG::GlobalTriggerSource.GetAnswers()[i].first;
}
}
printf("================ %s\n", value.c_str());
digi[ID]->WriteValue(DIGIPARA::DIG::GlobalTriggerSource, value);
}
//^###########################################################################
void DigiSettingsPanel::SetupShortComboBox(QComboBox *cbb, Reg para){ void DigiSettingsPanel::SetupShortComboBox(QComboBox *cbb, Reg para){
for( int i = 0 ; i < (int) para.GetAnswers().size(); i++){ for( int i = 0 ; i < (int) para.GetAnswers().size(); i++){
cbb->addItem(QString::fromStdString((para.GetAnswers())[i].second), cbb->addItem(QString::fromStdString((para.GetAnswers())[i].second),
@ -1021,26 +953,38 @@ void DigiSettingsPanel::SetupShortComboBox(QComboBox *cbb, Reg para){
} }
} }
void DigiSettingsPanel::SetupComboBox(QComboBox *cbb, Reg para, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){ void DigiSettingsPanel::SetupComboBox(QComboBox *&cbb, const Reg para, int ch_index, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){
QLabel * lb = new QLabel(labelTxt, this); QLabel * lb = new QLabel(labelTxt, this);
layout->addWidget(lb, row, col); layout->addWidget(lb, row, col);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter); lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
cbb = new QComboBox(this);
layout->addWidget(cbb, row, col+1, srow, scol); layout->addWidget(cbb, row, col+1, srow, scol);
for( int i = 0 ; i < (int) para.GetAnswers().size(); i++){ for( int i = 0 ; i < (int) para.GetAnswers().size(); i++){
cbb->addItem(QString::fromStdString((para.GetAnswers())[i].second), QString::fromStdString((para.GetAnswers())[i].first)); cbb->addItem(QString::fromStdString((para.GetAnswers())[i].second), QString::fromStdString((para.GetAnswers())[i].first));
} }
connect(cbb, &QComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
digi[ID]->WriteValue(para, cbb->currentData().toString().toStdString(), ch_index);
});
} }
void DigiSettingsPanel::SetupSpinBox(QSpinBox *spb, Reg para, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){ void DigiSettingsPanel::SetupSpinBox(QSpinBox *&spb, const Reg para, int ch_index, QString labelTxt, QGridLayout *layout, int row, int col, int srow, int scol){
QLabel * lb = new QLabel(labelTxt, this); QLabel * lb = new QLabel(labelTxt, this);
layout->addWidget(lb, row, col); layout->addWidget(lb, row, col);
lb->setAlignment(Qt::AlignRight| Qt::AlignCenter); lb->setAlignment(Qt::AlignRight| Qt::AlignCenter);
spb = new QSpinBox(this);
spb->setMinimum(atoi( para.GetAnswers()[0].first.c_str())); spb->setMinimum(atoi( para.GetAnswers()[0].first.c_str()));
spb->setMaximum(atoi( para.GetAnswers()[1].first.c_str())); spb->setMaximum(atoi( para.GetAnswers()[1].first.c_str()));
layout->addWidget(spb, row, col + 1, srow, scol); layout->addWidget(spb, row, col + 1, srow, scol);
connect(spb, &QSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
digi[ID]->WriteValue(para, std::to_string(spb->value()), ch_index);
});
} }
void DigiSettingsPanel::SetupSpinBoxTab(QSpinBox *spb[][MaxNumberOfChannel+1], Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel){ void DigiSettingsPanel::SetupSpinBoxTab(QSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel){
QWidget * tabPage = new QWidget(this); tabWidget->addTab(tabPage, text); QWidget * tabPage = new QWidget(this); tabWidget->addTab(tabPage, text);
QGridLayout * allLayout = new QGridLayout(tabPage); QGridLayout * allLayout = new QGridLayout(tabPage);
//allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter); //allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
@ -1048,11 +992,11 @@ void DigiSettingsPanel::SetupSpinBoxTab(QSpinBox *spb[][MaxNumberOfChannel+1], R
allLayout->setHorizontalSpacing(10); allLayout->setHorizontalSpacing(10);
allLayout->setVerticalSpacing(0); allLayout->setVerticalSpacing(0);
for( int ch = 0; ch < nChannel; ch++){ for( int ch = 0; ch < nChannel; ch++){
SetupSpinBox(spb[iDigi][ch], para, "ch-"+QString::number(ch)+ " ", allLayout, ch/4, ch%4 * 2); SetupSpinBox(spb[iDigi][ch], para, ch, "ch-"+QString::number(ch)+ " ", allLayout, ch/4, ch%4 * 2);
} }
} }
void DigiSettingsPanel::SetupComboBoxTab(QComboBox *cbb[][MaxNumberOfChannel + 1], Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel, int nCol){ void DigiSettingsPanel::SetupComboBoxTab(QComboBox *(&cbb)[][MaxNumberOfChannel + 1], const Reg para, QString text, QTabWidget *tabWidget, int iDigi, int nChannel, int nCol){
QWidget * tabPage = new QWidget(this); tabWidget->addTab(tabPage, text); QWidget * tabPage = new QWidget(this); tabWidget->addTab(tabPage, text);
QGridLayout * allLayout = new QGridLayout(tabPage); QGridLayout * allLayout = new QGridLayout(tabPage);
//allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter); //allLayout->setAlignment(Qt::AlignTop | Qt::AlignHCenter);
@ -1060,7 +1004,7 @@ void DigiSettingsPanel::SetupComboBoxTab(QComboBox *cbb[][MaxNumberOfChannel + 1
allLayout->setHorizontalSpacing(10); allLayout->setHorizontalSpacing(10);
allLayout->setVerticalSpacing(0); allLayout->setVerticalSpacing(0);
for( int ch = 0; ch < nChannel; ch++){ for( int ch = 0; ch < nChannel; ch++){
SetupComboBox(cbb[iDigi][ch], para, "ch-"+QString::number(ch) + " ", allLayout, ch/nCol, ch%nCol * 3); SetupComboBox(cbb[iDigi][ch], para, ch, "ch-"+QString::number(ch) + " ", allLayout, ch/nCol, ch%nCol * 3);
} }
} }

View File

@ -89,7 +89,7 @@ private:
bool bnClickStatus[MaxNumberOfChannel][MaxNumberOfChannel]; bool bnClickStatus[MaxNumberOfChannel][MaxNumberOfChannel];
//--------------- Channel settings //--------------- Channel settings
QCheckBox * ckbChEnabled[MaxNumberOfDigitizer][MaxNumberOfChannel + 1]; // index = 64 is for all channels QCheckBox *** ckbChEnabled;
QSpinBox * spbRecordLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1]; QSpinBox * spbRecordLength[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
QSpinBox * spbPreTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1]; QSpinBox * spbPreTrigger[MaxNumberOfDigitizer][MaxNumberOfChannel + 1];
@ -146,13 +146,17 @@ private:
//------------------------- //-------------------------
QLineEdit * leSettingFile[MaxNumberOfDigitizer]; QLineEdit * leSettingFile[MaxNumberOfDigitizer];
void SetStartSource();
void SetGlobalTriggerSource();
void SetupShortComboBox(QComboBox * cbb, Reg para); void SetupShortComboBox(QComboBox * cbb, Reg para);
void SetupComboBox(QComboBox * cbb, Reg para, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1); void SetupComboBox(QComboBox * &cbb, const Reg para, int ch_index, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SetupSpinBox(QSpinBox *spb, Reg para, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1); void SetupSpinBox(QSpinBox * &spb, const Reg para, int ch_index, QString labelTxt, QGridLayout * layout, int row, int col, int srow = 1, int scol = 1);
void SetupSpinBoxTab(QSpinBox *spb[][MaxNumberOfChannel+1], Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel); void SetupSpinBoxTab(QSpinBox *(&spb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel);
void SetupComboBoxTab(QComboBox *cbb[][MaxNumberOfChannel+1], Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel, int nCol = 4); void SetupComboBoxTab(QComboBox *(&cbb)[][MaxNumberOfChannel+1], const Reg para, QString text, QTabWidget * tabWidget, int iDigi, int nChannel, int nCol = 4);
void ReadCombBoxValue(QComboBox * cbb, const Reg para ); void ReadCombBoxValue(QComboBox * cbb, const Reg para );