add ITL-AB and LVDS setting parameters, re-structure the digiSetting UI, leave space for LVDS and ITL settings

This commit is contained in:
Ryan Tang 2023-09-18 17:05:13 -04:00
parent 38525125c4
commit 49fe750070
7 changed files with 477 additions and 316 deletions

View File

@ -40,10 +40,14 @@ void Digitizer2Gen::Initialization(){
settingFileName = "";
boardSettings = PHA::DIG::AllSettings;
for( int ch = 0; ch < MaxNumberOfChannel ; ch ++) chSettings[ch] = PHA::CH::AllSettings;
for( int index = 0 ; index < 4; index ++) VGASetting[index] = PHA::VGA::VGAGain;
for( int index = 0 ; index < 4; index ++) {
VGASetting[index] = PHA::VGA::VGAGain;
LVDSSettings[index] = PHA::LVDS::AllSettings;
}
//build map
for( int i = 0; i < (int) PHA::DIG::AllSettings.size(); i++) boardMap[PHA::DIG::AllSettings[i].GetPara()] = i;
for( int i = 0; i < (int) PHA::LVDS::AllSettings.size(); i++) LVDSMap[PHA::LVDS::AllSettings[i].GetPara()] = i;
for( int i = 0; i < (int) PHA::CH::AllSettings.size(); i++) chMap[PHA::CH::AllSettings[i].GetPara()] = i;
}
@ -98,7 +102,7 @@ int Digitizer2Gen::FindIndex(const Reg para){
case TYPE::CH: return chMap[para.GetPara()];
case TYPE::DIG: return boardMap[para.GetPara()];
case TYPE::VGA: return 0;
case TYPE::LVDS: return -1;
case TYPE::LVDS: return LVDSMap[para.GetPara()];
}
return -1;
}
@ -125,7 +129,7 @@ std::string Digitizer2Gen::ReadValue(const Reg para, int ch_index, bool verbose
case TYPE::CH : chSettings[ch_index][index].SetValue(ans); break;
case TYPE::DIG : boardSettings[index].SetValue(ans); break;
case TYPE::VGA : VGASetting[ch_index].SetValue(ans); break;
case TYPE::LVDS: return "LVDS not implemented.";
case TYPE::LVDS: LVDSSettings[ch_index][index].SetValue(ans);break;
}
return ans;
@ -768,6 +772,14 @@ void Digitizer2Gen::ReadAllSettings(){
if( ModelName == "VX2745" && FPGAType == "DPP_PHA") for(int i = 0; i < 4 ; i ++) ReadValue(VGASetting[i], i);
for( int index = 0; index < 4; index++){
for( int i = 0; i < (int) LVDSSettings[index].size(); i++){
if( LVDSSettings[index][i].ReadWrite() == RW::WriteOnly) continue;
ReadValue(LVDSSettings[index][i], index, false);
//printf("%d %d | %s | %s \n", index, i, LVDSSettings[index][i].GetPara().c_str(), LVDSSettings[index][i].GetValue().c_str());
}
}
for(int ch = 0; ch < nChannels ; ch++ ){
for( int i = 0; i < (int) chSettings[ch].size(); i++){
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
@ -805,6 +817,20 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
count ++;
}
}
for( int i = 0; i < (int) LVDSSettings[0].size(); i++){
for( int index = 0; index < 4; index++){
if( LVDSSettings[index][i].ReadWrite() == RW::WriteOnly) continue;
totCount ++;
if( LVDSSettings[index][i].GetValue() == "") break;
fprintf(saveFile, "%-45s!%d!%4d!%s\n", LVDSSettings[index][i].GetFullPara(index).c_str(),
LVDSSettings[index][i].ReadWrite(),
7000 + 4 * index + i,
LVDSSettings[index][i].GetValue().c_str());
count ++;
}
}
for( int i = 0; i < (int) chSettings[0].size(); i++){
for(int ch = 0; ch < nChannels ; ch++ ){
if( chSettings[ch][i].ReadWrite() == RW::WriteOnly) continue;
@ -820,7 +846,7 @@ int Digitizer2Gen::SaveSettingsToFile(const char * saveFileName, bool setReadOnl
fclose(saveFile);
if( count != totCount ) {
remove(saveFileName);
printf("!!!!! some setting is empty. !!!!!! ");
return -1;
}
@ -883,7 +909,7 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
}
int id = atoi(idStr);
if( id < 8000){ // channel
if( id < 7000){ // channel
int ch = id / 100;
int index = id - ch * 100;
chSettings[ch][index].SetValue(value);
@ -892,6 +918,11 @@ bool Digitizer2Gen::LoadSettingsFromFile(const char * loadFileName){
// chSettings[ch][index].ReadWrite(), id,
// chSettings[ch][index].GetValue().c_str());
}else if ( 7000 <= id && id < 8000){ // LVDS
int index = (id-7000)/4;
int ch = id - 7000 - index * 4;
LVDSSettings[index][ch].SetValue(value);
}else if ( 8000 <= id && id < 9000){ // board
boardSettings[id - 8000].SetValue(value);
//printf("%s|%d|%d|%s\n", boardSettings[id-8000].GetFullPara().c_str(),
@ -924,7 +955,7 @@ std::string Digitizer2Gen::GetSettingValue(const Reg para, unsigned int ch_index
case TYPE::DIG: return boardSettings[index].GetValue();
case TYPE::CH: return chSettings[ch_index][index].GetValue();
case TYPE::VGA: return VGASetting[ch_index].GetValue();
case TYPE::LVDS: return "not defined";
case TYPE::LVDS: return LVDSSettings[ch_index][index].GetValue();
default : return "invalid";
}
return "no such parameter";

View File

@ -60,9 +60,11 @@ class Digitizer2Gen {
std::string settingFileName;
std::vector<Reg> boardSettings;
std::vector<Reg> chSettings[MaxNumberOfChannel];
std::vector<Reg> LVDSSettings[4];
Reg VGASetting[4];
std::map<std::string, int> boardMap;
std::map<std::string, int> LVDSMap;
std::map<std::string, int> chMap;
public:

View File

@ -25,6 +25,7 @@ public:
void run(){
stop = false;
clock_gettime(CLOCK_REALTIME, &ta);
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread started.");
while(!stop){
digiMTX[ID].lock();
@ -34,7 +35,7 @@ public:
if( ret == CAEN_FELib_Success){
if( isSaveData) digi->SaveDataToFile();
}else if(ret == CAEN_FELib_Stop){
digi->ErrorMsg("No more data");
digi->ErrorMsg("ReadData Thread No more data");
//emit endOfLastData();
break;
}else{
@ -53,6 +54,9 @@ public:
}
}
}
emit sendMsg("Digi-" + QString::number(digi->GetSerialNumber()) + " ReadDataThread stopped.");
}
signals:
void sendMsg(const QString &msg);

View File

@ -199,7 +199,7 @@ namespace PHA{
{"SyncIn", "SyncIn Signal"},
{"SIN", "S-IN Signal"},
{"GPIO", "GPIO Signal"},
{"AccepTrg", "Acceped Trigger Signal"},
{"AcceptTrg", "Acceped Trigger Signal"},
{"TrgClk", "Trigger Clock"}});
const Reg GPIOMode ("GPIOMode", RW::ReadWrite, TYPE::DIG, {{"Disabled", "Disabled"},
{"TRGIN", "TRG-IN"},
@ -248,6 +248,24 @@ namespace PHA{
const Reg DACoutChSelect ("DACoutChSelect", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"64", ""}, {"1",""}}, ANSTYPE::INTEGER);
const Reg EnableOffsetCalibration ("EnOffsetCalibration", RW::ReadWrite, TYPE::DIG, {{"True", "Applied Cali."}, {"False", "No Cali."}});
const Reg ITLAMainLogic ("ITLAMainLogic", RW::ReadWrite, TYPE::DIG, {{"OR", "OR"},{"AND", "AND"}, {"Majority", "Majority"}});
const Reg ITLAMajorityLev ("ITLAMajorityLev", RW::ReadWrite, TYPE::DIG, {{"1", ""},{"63", ""}, {"1", ""}}, ANSTYPE::INTEGER);
const Reg ITLAPairLogic ("ITLAPairLogic", RW::ReadWrite, TYPE::DIG, {{"OR", "OR"},{"AND", "AND"}, {"NONE", "NONE"}});
const Reg ITLAPolarity ("ITLAPolarity", RW::ReadWrite, TYPE::DIG, {{"Direct", "Direct"},{"Inverted", "Inverted"}});
const Reg ITLAMask ("ITLAMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BYTE, "64-bit");
const Reg ITLAGateWidth ("ITLAGateWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"524280", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
const Reg ITLBMainLogic ("ITLBMainLogic", RW::ReadWrite, TYPE::DIG, {{"OR", "OR"},{"AND", "AND"}, {"Majority", "Majority"}});
const Reg ITLBMajorityLev ("ITLBMajorityLev", RW::ReadWrite, TYPE::DIG, {{"1", ""},{"63", ""}, {"1", ""}}, ANSTYPE::INTEGER);
const Reg ITLBPairLogic ("ITLBPairLogic", RW::ReadWrite, TYPE::DIG, {{"OR", "OR"},{"AND", "AND"}, {"NONE", "NONE"}});
const Reg ITLBPolarity ("ITLBPolarity", RW::ReadWrite, TYPE::DIG, {{"Direct", "Direct"},{"Inverted", "Inverted"}});
const Reg ITLBMask ("ITLBMask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BYTE, "64-bit");
const Reg ITLBGateWidth ("ITLBGateWidth", RW::ReadWrite, TYPE::DIG, {{"0", ""}, {"524280", ""}, {"8", ""}}, ANSTYPE::INTEGER, "ns");
const Reg LVDSIOReg ("LVDSIOReg", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::STR);
//const Reg LVDSTrgMask ("lvdstrgmask", RW::ReadWrite, TYPE::DIG, {}, ANSTYPE::BYTE, "64-bit");
/// ========== command
const Reg Reset ("Reset", RW::WriteOnly, TYPE::DIG, {}, ANSTYPE::NONE, "", true);
const Reg ClearData ("ClearData", RW::WriteOnly, TYPE::DIG, {}, ANSTYPE::NONE, "", true); // clear memory, setting not affected
@ -338,7 +356,21 @@ namespace PHA{
DACoutMode ,
DACoutStaticLevel ,
DACoutChSelect ,
EnableOffsetCalibration
EnableOffsetCalibration ,
ITLAMainLogic ,
ITLAMajorityLev ,
ITLAPairLogic ,
ITLAPolarity ,
ITLAMask ,
ITLAGateWidth ,
ITLBMainLogic ,
ITLBMajorityLev ,
ITLBPairLogic ,
ITLBPolarity ,
ITLBMask ,
ITLBGateWidth ,
LVDSIOReg
//LVDSTrgMask
};
@ -348,6 +380,22 @@ namespace PHA{
const Reg VGAGain ("VGAGain", RW::ReadWrite, TYPE::VGA, {{"0", ""},{"40", ""}, {"0.5",""}}, ANSTYPE::INTEGER, "dB"); // VX2745 only
}
namespace LVDS{
const Reg LVDSMode ("LVDSMode", RW::ReadWrite, TYPE::LVDS, {{"SelfTriggers", "Self-Trigger"},
{"Sync", "Sync"},
{"IORegister", "IORegister"}});
const Reg LVDSDirection ("LVDSDirection", RW::ReadWrite, TYPE::LVDS, {{"Input", "Input"},
{"Output", "Output"}});
const std::vector<Reg> AllSettings = {
LVDSMode ,
LVDSDirection
};
}
namespace CH{
/// ========= red only
@ -526,6 +574,8 @@ namespace PHA{
const Reg EnergyFilterBaselineGuardSample ("EnergyFilterBaselineGuardS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"1000", ""}, {"1", ""}}, ANSTYPE::INTEGER, "sample");
const Reg EnergyFilterPileUpGuardSample ("EnergyFilterPileUpGuardS", RW::ReadWrite, TYPE::CH, {{"0", ""},{"8000", ""}, {"1", ""}}, ANSTYPE::INTEGER, "sample");
const Reg ITLConnect ("ITLConnect", RW::ReadWrite, TYPE::CH, {{"Disabled", "Disabled"},{"ITLA", "ITLA"}, {"ITLB", "ITLB"}});
const std::vector<Reg> AllSettings = {
SelfTrgRate ,
ChannelStatus ,
@ -585,7 +635,8 @@ namespace PHA{
EnergyFilterFlatTopSample ,
EnergyFilterPoleZeroSample ,
EnergyFilterBaselineGuardSample ,
EnergyFilterPileUpGuardSample
EnergyFilterPileUpGuardSample ,
ITLConnect
};
}

View File

@ -36,6 +36,20 @@ The test.cpp is a demo code to use the ClassDigitizer2Gen.h/cpp.
https://fsunuc.physics.fsu.edu/wiki/index.php/FRIB_SOLARIS_Collaboration
# Additional function
## connect to analysis working directory
When the analysis path is set, it will do servera things
- save the expName.sh
- save Settings
- try to load the Mapping.h in the working directory
## End run bash script
When run stop, it will run the bash script under the directory scripts/endRUnScript.h
# Required / Development enviroment
Ubuntu 22.04
@ -64,3 +78,7 @@ in the *.pro, add
run ` qmake6 *.pro` it will generate Makefile
then ` make`
# Known Issues
The "Accp." Rate in the Scaler does not included the coincident condition. This is related to the ChSavedEventCnt from the firmware.

View File

@ -264,298 +264,335 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
}
{//^====================== Group Board settings
digiBox[iDigi] = new QGroupBox("Board Settings", tab);
//digiBox->setSizePolicy(sizePolicy);
QGridLayout * boardLayout = new QGridLayout(digiBox[iDigi]);
tabLayout_V1->addWidget(digiBox[iDigi]);
int rowId = 0;
//-------------------------------------
SetupComboBox(cbbClockSource[iDigi], PHA::DIG::ClockSource, -1, true, "Clock Source :", boardLayout, rowId, 0, 1, 2);
{//^============================ Board Settings tab
QLabel * lbEnClockFP = new QLabel("Enable Clock Out Font Panel :", tab);
lbEnClockFP->setAlignment(Qt::AlignRight | Qt::AlignCenter);
boardLayout->addWidget(lbEnClockFP, rowId, 2, 1, 3);
QTabWidget * bdTab = new QTabWidget(tab);
tabLayout_V1->addWidget(bdTab);
cbbEnClockFrontPanel[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbEnClockFrontPanel[iDigi], rowId, 5);
SetupShortComboBox(cbbEnClockFrontPanel[iDigi], PHA::DIG::EnableClockOutFrontPanel);
connect(cbbEnClockFrontPanel[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableClockOutFrontPanel.GetPara());
msg += " = " + cbbEnClockFrontPanel[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableClockOutFrontPanel, cbbEnClockFrontPanel[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
cbbEnClockFrontPanel[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbEnClockFrontPanel[ID]->setStyleSheet("color:red;");
}
});
{//^====================== Group Board settings
bdCfg[iDigi] = new QWidget(this);
bdTab->addTab(bdCfg[iDigi], "Board");
//-------------------------------------
rowId ++;
QLabel * lbStartSource = new QLabel("Start Source :", tab);
lbStartSource->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStartSource, rowId, 0);
//digiBox[iDigi] = new QGroupBox("Board Settings", tab);
// //digiBox->setSizePolicy(sizePolicy);
QGridLayout * boardLayout = new QGridLayout(bdCfg[iDigi]);
boardLayout->setAlignment(Qt::AlignTop);
boardLayout->setSpacing(2);
//tabLayout_V1->addWidget(digiBox[iDigi]);
for( int i = 0; i < (int) PHA::DIG::StartSource.GetAnswers().size(); i++){
ckbStartSource[iDigi][i] = new QCheckBox( QString::fromStdString((PHA::DIG::StartSource.GetAnswers())[i].second), tab);
boardLayout->addWidget(ckbStartSource[iDigi][i], rowId, 1 + i);
connect(ckbStartSource[iDigi][i], &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetStartSource);
}
int rowId = 0;
//-------------------------------------
SetupComboBox(cbbClockSource[iDigi], PHA::DIG::ClockSource, -1, true, "Clock Source :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
rowId ++;
QLabel * lbGlobalTrgSource = new QLabel("Global Trigger Source :", tab);
lbGlobalTrgSource->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbGlobalTrgSource, rowId, 0);
QLabel * lbEnClockFP = new QLabel("Enable Clock Out Font Panel :", tab);
lbEnClockFP->setAlignment(Qt::AlignRight | Qt::AlignCenter);
boardLayout->addWidget(lbEnClockFP, rowId, 2, 1, 3);
for( int i = 0; i < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
ckbGlbTrgSource[iDigi][i] = new QCheckBox( QString::fromStdString((PHA::DIG::GlobalTriggerSource.GetAnswers())[i].second), tab);
boardLayout->addWidget(ckbGlbTrgSource[iDigi][i], rowId, 1 + i);
connect(ckbGlbTrgSource[iDigi][i], &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetGlobalTriggerSource);
}
//-------------------------------------
rowId ++;
SetupComboBox(cbbTrgOut[iDigi], PHA::DIG::TrgOutMode, -1, true, "Trg-OUT Mode :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
rowId ++;
SetupComboBox(cbbGPIO[iDigi], PHA::DIG::GPIOMode, -1, true, "GPIO Mode :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
QLabel * lbAutoDisarmAcq = new QLabel("Auto disarm ACQ :", tab);
lbAutoDisarmAcq->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbAutoDisarmAcq, rowId, 4, 1, 2);
cbbAutoDisarmAcq[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbAutoDisarmAcq[iDigi], rowId, 6);
SetupShortComboBox(cbbAutoDisarmAcq[iDigi], PHA::DIG::EnableAutoDisarmACQ);
connect(cbbAutoDisarmAcq[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableAutoDisarmACQ.GetPara());
msg += " = " + cbbAutoDisarmAcq[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableAutoDisarmACQ, cbbAutoDisarmAcq[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
cbbAutoDisarmAcq[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbAutoDisarmAcq[ID]->setStyleSheet("color:red;");
}
});
//-------------------------------------
rowId ++;
SetupComboBox(cbbBusyIn[iDigi], PHA::DIG::BusyInSource, -1, true, "Busy In Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbStatEvents = new QLabel("Stat. Event :", tab);
lbStatEvents->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStatEvents, rowId, 4, 1, 2);
cbbStatEvents[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbStatEvents[iDigi], rowId, 6);
SetupShortComboBox(cbbStatEvents[iDigi], PHA::DIG::EnableStatisticEvents);
connect(cbbStatEvents[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableStatisticEvents.GetPara());
msg += " = " + cbbStatEvents[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString()) ){
SendLogMsg(msg + "|OK.");
cbbStatEvents[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbStatEvents[ID]->setStyleSheet("color:red");
}
});
//-------------------------------------
rowId ++;
SetupComboBox(cbbSyncOut[iDigi], PHA::DIG::SyncOutMode, -1, true, "Sync Out mode :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
rowId ++;
SetupComboBox(cbbBoardVetoSource[iDigi], PHA::DIG::BoardVetoSource, -1, true, "Board Veto Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbBdVetoWidth = new QLabel("Board Veto Width [ns] :", tab);
lbBdVetoWidth->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbBdVetoWidth, rowId, 3, 1, 2);
dsbBdVetoWidth[iDigi] = new RSpinBox(tab, 0); // may be QDoubleSpinBox
dsbBdVetoWidth[iDigi]->setMinimum(0);
dsbBdVetoWidth[iDigi]->setMaximum(34359738360);
dsbBdVetoWidth[iDigi]->setSingleStep(20);
dsbBdVetoWidth[iDigi]->SetToolTip();
boardLayout->addWidget(dsbBdVetoWidth[iDigi], rowId, 5);
connect(dsbBdVetoWidth[iDigi], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
dsbBdVetoWidth[ID]->setStyleSheet("color:blue;");
});
connect(dsbBdVetoWidth[iDigi], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoWidth.GetPara());
msg += " = " + QString::number(dsbBdVetoWidth[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoWidth, std::to_string(dsbBdVetoWidth[iDigi]->value()), -1) ){
dsbBdVetoWidth[ID]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
dsbBdVetoWidth[ID]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
cbbBdVetoPolarity[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbBdVetoPolarity[iDigi], rowId, 6);
SetupShortComboBox(cbbBdVetoPolarity[iDigi], PHA::DIG::BoardVetoPolarity);
//-------------------------------------
rowId ++;
SetupSpinBox(spbRunDelay[iDigi], PHA::DIG::RunDelay, -1, false, "Run Delay [ns] :", boardLayout, rowId, 0);
//-------------------------------------
QLabel * lbClockOutDelay = new QLabel("Temp. Clock Out Delay [ps] :", tab);
lbClockOutDelay->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay, rowId, 3, 1, 2);
dsbVolatileClockOutDelay[iDigi] = new RSpinBox(tab, 3);
dsbVolatileClockOutDelay[iDigi]->setMinimum(-18888.888);
dsbVolatileClockOutDelay[iDigi]->setMaximum(18888.888);
dsbVolatileClockOutDelay[iDigi]->setSingleStep(74.074);
dsbVolatileClockOutDelay[iDigi]->setValue(0);
dsbVolatileClockOutDelay[iDigi]->SetToolTip();
boardLayout->addWidget(dsbVolatileClockOutDelay[iDigi], rowId, 5);
connect(dsbVolatileClockOutDelay[iDigi], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
dsbVolatileClockOutDelay[ID]->setStyleSheet("color:blue;");
});
connect(dsbVolatileClockOutDelay[iDigi], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
double step = dsbVolatileClockOutDelay[ID]->singleStep();
double value = dsbVolatileClockOutDelay[ID]->value();
dsbVolatileClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::VolatileClockOutDelay.GetPara());
msg += " = " + QString::number(dsbVolatileClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::VolatileClockOutDelay, std::to_string(dsbVolatileClockOutDelay[ID]->value()), -1) ){
dsbVolatileClockOutDelay[ID]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
dsbVolatileClockOutDelay[ID]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
//-------------------------------------
rowId ++;
SetupComboBox(cbbIOLevel[iDigi], PHA::DIG::IO_Level, -1, true, "IO Level :", boardLayout, rowId, 0, 1, 2);
QLabel * lbClockOutDelay2 = new QLabel("Perm. Clock Out Delay [ps] :", tab);
lbClockOutDelay2->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay2, rowId, 3, 1, 2);
dsbClockOutDelay[iDigi] = new RSpinBox(tab, 3);
dsbClockOutDelay[iDigi]->setMinimum(-18888.888);
dsbClockOutDelay[iDigi]->setMaximum(18888.888);
dsbClockOutDelay[iDigi]->setValue(0);
dsbClockOutDelay[iDigi]->setSingleStep(74.074);
dsbClockOutDelay[iDigi]->SetToolTip();
boardLayout->addWidget(dsbClockOutDelay[iDigi], rowId, 5);
connect(dsbClockOutDelay[iDigi], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
dsbClockOutDelay[ID]->setStyleSheet("color:blue;");
});
connect(dsbClockOutDelay[iDigi], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
double step = dsbClockOutDelay[ID]->singleStep();
double value = dsbClockOutDelay[ID]->value();
dsbClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::PermanentClockOutDelay.GetPara());
msg += " = " + QString::number(dsbClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::PermanentClockOutDelay, std::to_string(dsbClockOutDelay[ID]->value()), -1) ){
dsbClockOutDelay[ID]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
dsbClockOutDelay[ID]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
}
{//^====================== Test Pulse settings
testPulseBox[iDigi] = new QGroupBox("Test Pulse Settings", tab);
tabLayout_V1->addWidget(testPulseBox[iDigi]);
QGridLayout * testPulseLayout = new QGridLayout(testPulseBox[iDigi]);
testPulseLayout->setAlignment(Qt::AlignLeft);
testPulseLayout->setVerticalSpacing(0);
SetupSpinBox(dsbTestPuslePeriod[iDigi], PHA::DIG::TestPulsePeriod, -1, false, "Period [ns] :", testPulseLayout, 0, 0);
SetupSpinBox(dsbTestPusleWidth[iDigi], PHA::DIG::TestPulseWidth, -1, false, "Width [ns] :", testPulseLayout, 0, 2);
SetupSpinBox(spbTestPusleLowLevel[iDigi], PHA::DIG::TestPulseLowLevel, -1, false, "Low Lvl. [LSB] :", testPulseLayout, 0, 4);
SetupSpinBox(spbTestPusleHighLevel[iDigi], PHA::DIG::TestPulseHighLevel, -1, false, "High Lvl. [LSB] :", testPulseLayout, 0, 6);
dsbTestPuslePeriod[iDigi]->setFixedSize(110, 30);
dsbTestPuslePeriod[iDigi]->setDecimals(0);
dsbTestPusleWidth[iDigi]->setFixedSize(110, 30);
dsbTestPusleWidth[iDigi]->setDecimals(0);
for( int i = 0; i < testPulseLayout->columnCount(); i++) testPulseLayout->setColumnStretch(i, 0 );
}
{//^====================== VGA settings
VGABox[iDigi] = new QGroupBox("Gain Amplifier Settings", tab);
tabLayout_V1->addWidget(VGABox[iDigi]);
QGridLayout * vgaLayout = new QGridLayout(VGABox[iDigi]);
vgaLayout->setVerticalSpacing(0);
//vgaLayout->setAlignment(Qt::AlignLeft);
for( int k = 0; k < 4; k ++){
QLabel * lb = new QLabel("VGA-" + QString::number(k) + " [dB] :", tab);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
vgaLayout->addWidget(lb, 0, 2*k);
VGA[iDigi][k] = new RSpinBox(tab, 1);
VGA[iDigi][k]->setMinimum(0);
VGA[iDigi][k]->setMaximum(40);
VGA[iDigi][k]->setSingleStep(0.5);
VGA[iDigi][k]->SetToolTip();
vgaLayout->addWidget(VGA[iDigi][k], 0, 2*k+1);
connect(VGA[iDigi][k], &RSpinBox::valueChanged, this, [=](){
cbbEnClockFrontPanel[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbEnClockFrontPanel[iDigi], rowId, 5);
SetupShortComboBox(cbbEnClockFrontPanel[iDigi], PHA::DIG::EnableClockOutFrontPanel);
connect(cbbEnClockFrontPanel[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
VGA[ID][k]->setStyleSheet("color:blue;");
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableClockOutFrontPanel.GetPara());
msg += " = " + cbbEnClockFrontPanel[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableClockOutFrontPanel, cbbEnClockFrontPanel[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
cbbEnClockFrontPanel[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbEnClockFrontPanel[ID]->setStyleSheet("color:red;");
}
});
connect(VGA[iDigi][k], &RSpinBox::returnPressed, this, [=](){
//-------------------------------------
rowId ++;
QLabel * lbStartSource = new QLabel("Start Source :", tab);
lbStartSource->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStartSource, rowId, 0);
for( int i = 0; i < (int) PHA::DIG::StartSource.GetAnswers().size(); i++){
ckbStartSource[iDigi][i] = new QCheckBox( QString::fromStdString((PHA::DIG::StartSource.GetAnswers())[i].second), tab);
boardLayout->addWidget(ckbStartSource[iDigi][i], rowId, 1 + i);
connect(ckbStartSource[iDigi][i], &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetStartSource);
}
//-------------------------------------
rowId ++;
QLabel * lbGlobalTrgSource = new QLabel("Global Trigger Source :", tab);
lbGlobalTrgSource->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbGlobalTrgSource, rowId, 0);
for( int i = 0; i < (int) PHA::DIG::GlobalTriggerSource.GetAnswers().size(); i++){
ckbGlbTrgSource[iDigi][i] = new QCheckBox( QString::fromStdString((PHA::DIG::GlobalTriggerSource.GetAnswers())[i].second), tab);
boardLayout->addWidget(ckbGlbTrgSource[iDigi][i], rowId, 1 + i);
connect(ckbGlbTrgSource[iDigi][i], &QCheckBox::stateChanged, this, &DigiSettingsPanel::SetGlobalTriggerSource);
}
//-------------------------------------
rowId ++;
SetupComboBox(cbbTrgOut[iDigi], PHA::DIG::TrgOutMode, -1, true, "Trg-OUT Mode :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
rowId ++;
SetupComboBox(cbbGPIO[iDigi], PHA::DIG::GPIOMode, -1, true, "GPIO Mode :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
QLabel * lbAutoDisarmAcq = new QLabel("Auto disarm ACQ :", tab);
lbAutoDisarmAcq->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbAutoDisarmAcq, rowId, 4, 1, 2);
cbbAutoDisarmAcq[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbAutoDisarmAcq[iDigi], rowId, 6);
SetupShortComboBox(cbbAutoDisarmAcq[iDigi], PHA::DIG::EnableAutoDisarmACQ);
connect(cbbAutoDisarmAcq[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %s \n", para.GetPara().c_str(), ch_index, cbb->currentData().toString().toStdString().c_str());
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableAutoDisarmACQ.GetPara());
msg += " = " + cbbAutoDisarmAcq[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableAutoDisarmACQ, cbbAutoDisarmAcq[ID]->currentData().toString().toStdString())){
SendLogMsg(msg + "|OK.");
cbbAutoDisarmAcq[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbAutoDisarmAcq[ID]->setStyleSheet("color:red;");
}
});
//-------------------------------------
rowId ++;
SetupComboBox(cbbBusyIn[iDigi], PHA::DIG::BusyInSource, -1, true, "Busy In Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbStatEvents = new QLabel("Stat. Event :", tab);
lbStatEvents->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbStatEvents, rowId, 4, 1, 2);
cbbStatEvents[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbStatEvents[iDigi], rowId, 6);
SetupShortComboBox(cbbStatEvents[iDigi], PHA::DIG::EnableStatisticEvents);
connect(cbbStatEvents[iDigi], &RComboBox::currentIndexChanged, this, [=](){
if( !enableSignalSlot ) return;
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::EnableStatisticEvents.GetPara());
msg += " = " + cbbStatEvents[ID]->currentData().toString();
if( digi[ID]->WriteValue(PHA::DIG::EnableStatisticEvents, cbbStatEvents[ID]->currentData().toString().toStdString()) ){
SendLogMsg(msg + "|OK.");
cbbStatEvents[ID]->setStyleSheet("");
}else{
SendLogMsg(msg + "|Fail.");
cbbStatEvents[ID]->setStyleSheet("color:red");
}
});
//-------------------------------------
rowId ++;
SetupComboBox(cbbSyncOut[iDigi], PHA::DIG::SyncOutMode, -1, true, "Sync Out mode :", boardLayout, rowId, 0, 1, 2);
//-------------------------------------
rowId ++;
SetupComboBox(cbbBoardVetoSource[iDigi], PHA::DIG::BoardVetoSource, -1, true, "Board Veto Source :", boardLayout, rowId, 0, 1, 2);
QLabel * lbBdVetoWidth = new QLabel("Board Veto Width [ns] :", tab);
lbBdVetoWidth->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbBdVetoWidth, rowId, 3, 1, 2);
dsbBdVetoWidth[iDigi] = new RSpinBox(tab, 0); // may be QDoubleSpinBox
dsbBdVetoWidth[iDigi]->setMinimum(0);
dsbBdVetoWidth[iDigi]->setMaximum(34359738360);
dsbBdVetoWidth[iDigi]->setSingleStep(20);
dsbBdVetoWidth[iDigi]->SetToolTip();
boardLayout->addWidget(dsbBdVetoWidth[iDigi], rowId, 5);
connect(dsbBdVetoWidth[iDigi], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
dsbBdVetoWidth[ID]->setStyleSheet("color:blue;");
});
connect(dsbBdVetoWidth[iDigi], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
double step = VGA[ID][k]->singleStep();
double value = VGA[ID][k]->value();
VGA[ID][k]->setValue( (std::round(value/step) * step) );
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::VGA::VGAGain.GetPara());
if( PHA::VGA::VGAGain.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(k);
msg += " = " + QString::number(VGA[ID][k]->value());
if( digi[ID]->WriteValue(PHA::VGA::VGAGain, std::to_string(VGA[ID][k]->value()), k)){
VGA[ID][k]->setStyleSheet("");
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::BoardVetoWidth.GetPara());
msg += " = " + QString::number(dsbBdVetoWidth[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::BoardVetoWidth, std::to_string(dsbBdVetoWidth[iDigi]->value()), -1) ){
dsbBdVetoWidth[ID]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
VGA[ID][k]->setStyleSheet("color:red;");
dsbBdVetoWidth[ID]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
cbbBdVetoPolarity[iDigi] = new RComboBox(tab);
boardLayout->addWidget(cbbBdVetoPolarity[iDigi], rowId, 6);
SetupShortComboBox(cbbBdVetoPolarity[iDigi], PHA::DIG::BoardVetoPolarity);
//-------------------------------------
rowId ++;
SetupSpinBox(spbRunDelay[iDigi], PHA::DIG::RunDelay, -1, false, "Run Delay [ns] :", boardLayout, rowId, 0);
//-------------------------------------
QLabel * lbClockOutDelay = new QLabel("Temp. Clock Out Delay [ps] :", tab);
lbClockOutDelay->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay, rowId, 3, 1, 2);
dsbVolatileClockOutDelay[iDigi] = new RSpinBox(tab, 3);
dsbVolatileClockOutDelay[iDigi]->setMinimum(-18888.888);
dsbVolatileClockOutDelay[iDigi]->setMaximum(18888.888);
dsbVolatileClockOutDelay[iDigi]->setSingleStep(74.074);
dsbVolatileClockOutDelay[iDigi]->setValue(0);
dsbVolatileClockOutDelay[iDigi]->SetToolTip();
boardLayout->addWidget(dsbVolatileClockOutDelay[iDigi], rowId, 5);
connect(dsbVolatileClockOutDelay[iDigi], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
dsbVolatileClockOutDelay[ID]->setStyleSheet("color:blue;");
});
connect(dsbVolatileClockOutDelay[iDigi], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
double step = dsbVolatileClockOutDelay[ID]->singleStep();
double value = dsbVolatileClockOutDelay[ID]->value();
dsbVolatileClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::VolatileClockOutDelay.GetPara());
msg += " = " + QString::number(dsbVolatileClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::VolatileClockOutDelay, std::to_string(dsbVolatileClockOutDelay[ID]->value()), -1) ){
dsbVolatileClockOutDelay[ID]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
dsbVolatileClockOutDelay[ID]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
//-------------------------------------
rowId ++;
SetupComboBox(cbbIOLevel[iDigi], PHA::DIG::IO_Level, -1, true, "IO Level :", boardLayout, rowId, 0, 1, 2);
QLabel * lbClockOutDelay2 = new QLabel("Perm. Clock Out Delay [ps] :", tab);
lbClockOutDelay2->setAlignment(Qt::AlignRight);
boardLayout->addWidget(lbClockOutDelay2, rowId, 3, 1, 2);
dsbClockOutDelay[iDigi] = new RSpinBox(tab, 3);
dsbClockOutDelay[iDigi]->setMinimum(-18888.888);
dsbClockOutDelay[iDigi]->setMaximum(18888.888);
dsbClockOutDelay[iDigi]->setValue(0);
dsbClockOutDelay[iDigi]->setSingleStep(74.074);
dsbClockOutDelay[iDigi]->SetToolTip();
boardLayout->addWidget(dsbClockOutDelay[iDigi], rowId, 5);
connect(dsbClockOutDelay[iDigi], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
dsbClockOutDelay[ID]->setStyleSheet("color:blue;");
});
connect(dsbClockOutDelay[iDigi], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
double step = dsbClockOutDelay[ID]->singleStep();
double value = dsbClockOutDelay[ID]->value();
dsbClockOutDelay[ID]->setValue( (std::round(value/step) * step) );
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::DIG::PermanentClockOutDelay.GetPara());
msg += " = " + QString::number(dsbClockOutDelay[iDigi]->value());
if( digi[ID]->WriteValue(PHA::DIG::PermanentClockOutDelay, std::to_string(dsbClockOutDelay[ID]->value()), -1) ){
dsbClockOutDelay[ID]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
dsbClockOutDelay[ID]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
}
{//^====================== Test Pulse settings
bdTestPulse[iDigi] = new QWidget(this);
bdTab->addTab(bdTestPulse[iDigi], "Test Pulse");
QGridLayout * testPulseLayout = new QGridLayout(bdTestPulse[iDigi]);
testPulseLayout->setAlignment(Qt::AlignTop);
testPulseLayout->setSpacing(2);
SetupSpinBox(dsbTestPuslePeriod[iDigi], PHA::DIG::TestPulsePeriod, -1, false, "Period [ns] :", testPulseLayout, 0, 0);
SetupSpinBox(dsbTestPusleWidth[iDigi], PHA::DIG::TestPulseWidth, -1, false, "Width [ns] :", testPulseLayout, 1, 0);
SetupSpinBox(spbTestPusleLowLevel[iDigi], PHA::DIG::TestPulseLowLevel, -1, false, "Low Lvl. [LSB] :", testPulseLayout, 2, 0);
SetupSpinBox(spbTestPusleHighLevel[iDigi], PHA::DIG::TestPulseHighLevel, -1, false, "High Lvl. [LSB] :", testPulseLayout, 3, 0);
// dsbTestPuslePeriod[iDigi]->setFixedSize(110, 30);
// dsbTestPuslePeriod[iDigi]->setDecimals(0);
// dsbTestPusleWidth[iDigi]->setFixedSize(110, 30);
// dsbTestPusleWidth[iDigi]->setDecimals(0);
for( int i = 0; i < testPulseLayout->columnCount(); i++) testPulseLayout->setColumnStretch(i, 0 );
}
{//^====================== VGA settings
bdVGA[iDigi] = new QWidget(this);
bdTab->addTab(bdVGA[iDigi], "VGA Setting");
QGridLayout * vgaLayout = new QGridLayout(bdVGA[iDigi]);
//vgaLayout->setVerticalSpacing(0);
vgaLayout->setAlignment(Qt::AlignTop);
for( int k = 0; k < 4; k ++){
QLabel * lb = new QLabel("VGA-" + QString::number(k) + " [dB] :", tab);
lb->setAlignment(Qt::AlignRight | Qt::AlignCenter);
vgaLayout->addWidget(lb, k, 0);
VGA[iDigi][k] = new RSpinBox(tab, 1);
VGA[iDigi][k]->setMinimum(0);
VGA[iDigi][k]->setMaximum(40);
VGA[iDigi][k]->setSingleStep(0.5);
VGA[iDigi][k]->SetToolTip();
vgaLayout->addWidget(VGA[iDigi][k], k, 1);
connect(VGA[iDigi][k], &RSpinBox::valueChanged, this, [=](){
if( !enableSignalSlot ) return;
VGA[ID][k]->setStyleSheet("color:blue;");
});
connect(VGA[iDigi][k], &RSpinBox::returnPressed, this, [=](){
if( !enableSignalSlot ) return;
//printf("%s %d %d \n", para.GetPara().c_str(), ch_index, spb->value());
double step = VGA[ID][k]->singleStep();
double value = VGA[ID][k]->value();
VGA[ID][k]->setValue( (std::round(value/step) * step) );
QString msg;
msg = "DIG:"+ QString::number(digi[ID]->GetSerialNumber()) + "|" + QString::fromStdString(PHA::VGA::VGAGain.GetPara());
if( PHA::VGA::VGAGain.GetType() == TYPE::VGA ) msg += ",VGA:" + QString::number(k);
msg += " = " + QString::number(VGA[ID][k]->value());
if( digi[ID]->WriteValue(PHA::VGA::VGAGain, std::to_string(VGA[ID][k]->value()), k)){
VGA[ID][k]->setStyleSheet("");
SendLogMsg(msg + "|OK.");
}else{
VGA[ID][k]->setStyleSheet("color:red;");
SendLogMsg(msg + "|Fail.");
}
});
}
}
{//^====================== LVDS
bdLVDS[iDigi] = new QWidget(this);
bdTab->addTab(bdLVDS[iDigi], "LVDS");
QGridLayout * LVDSLayout = new QGridLayout(bdLVDS[iDigi]);
LVDSLayout->setAlignment(Qt::AlignTop);
//LVDSLayout->setSpacing(2);
}
{//^====================== ITL
bdITL[iDigi] = new QWidget(this);
bdTab->addTab(bdITL[iDigi], "ITL-A/B");
QGridLayout * ITLLayout = new QGridLayout(bdITL[iDigi]);
ITLLayout->setAlignment(Qt::AlignTop);
}
}
{//^====================== Group channel settings
@ -1018,17 +1055,17 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer2Gen ** digi, unsigned short nDigi
int rowID = 0;
//----------------------------
SetupComboBox( cbAllEvtTrigger[iDigi], PHA::CH::EventTriggerSource, -1, false, "Event Trigger Source (all ch.)", triggerLayout, rowID, 0);
SetupComboBox( cbAllWaveTrigger[iDigi], PHA::CH::WaveTriggerSource, -1, false, "Wave Trigger Source (all ch.)", triggerLayout, rowID, 2);
// SetupComboBox( cbAllEvtTrigger[iDigi], PHA::CH::EventTriggerSource, -1, false, "Event Trigger Source (all ch.)", triggerLayout, rowID, 0);
// SetupComboBox( cbAllWaveTrigger[iDigi], PHA::CH::WaveTriggerSource, -1, false, "Wave Trigger Source (all ch.)", triggerLayout, rowID, 2);
//----------------------------
rowID ++;
SetupComboBox( cbAllCoinMask[iDigi], PHA::CH::CoincidenceMask, -1, false, "Coincident Mask (all ch.)", triggerLayout, rowID, 0);
SetupSpinBox( sbAllCoinLength[iDigi], PHA::CH::CoincidenceLength, -1, false, "Coincident Length [ns] (all ch.)", triggerLayout, rowID, 2);
// //----------------------------
// rowID ++;
// SetupComboBox( cbAllCoinMask[iDigi], PHA::CH::CoincidenceMask, -1, false, "Coincident Mask (all ch.)", triggerLayout, rowID, 0);
// SetupSpinBox( sbAllCoinLength[iDigi], PHA::CH::CoincidenceLength, -1, false, "Coincident Length [ns] (all ch.)", triggerLayout, rowID, 2);
//----------------------------
rowID ++;
SetupComboBox( cbAllAntiCoinMask[iDigi], PHA::CH::AntiCoincidenceMask, -1, false, "Anti-Coincident Mask (all ch.)", triggerLayout, rowID, 0);
// //----------------------------
// rowID ++;
// SetupComboBox( cbAllAntiCoinMask[iDigi], PHA::CH::AntiCoincidenceMask, -1, false, "Anti-Coincident Mask (all ch.)", triggerLayout, rowID, 0);
QSignalMapper * triggerMapper = new QSignalMapper(tab);
connect(triggerMapper, &QSignalMapper::mappedInt, this, &DigiSettingsPanel::onTriggerClick);
@ -1584,11 +1621,11 @@ void DigiSettingsPanel::ReadTriggerMap(){
//printf("%s\n", __func__);
cbAllEvtTrigger[ID]->setCurrentIndex(cbbEvtTrigger[ID][MaxNumberOfChannel]->currentIndex());
cbAllWaveTrigger[ID]->setCurrentIndex(cbbWaveTrigger[ID][MaxNumberOfChannel]->currentIndex());
cbAllCoinMask[ID]->setCurrentIndex(cbbCoinMask[ID][MaxNumberOfChannel]->currentIndex());
cbAllAntiCoinMask[ID]->setCurrentIndex(cbbAntiCoinMask[ID][MaxNumberOfChannel]->currentIndex());
sbAllCoinLength[ID]->setValue(spbCoinLength[ID][MaxNumberOfChannel]->value());
// cbAllEvtTrigger[ID]->setCurrentIndex(cbbEvtTrigger[ID][MaxNumberOfChannel]->currentIndex());
// cbAllWaveTrigger[ID]->setCurrentIndex(cbbWaveTrigger[ID][MaxNumberOfChannel]->currentIndex());
// cbAllCoinMask[ID]->setCurrentIndex(cbbCoinMask[ID][MaxNumberOfChannel]->currentIndex());
// cbAllAntiCoinMask[ID]->setCurrentIndex(cbbAntiCoinMask[ID][MaxNumberOfChannel]->currentIndex());
// sbAllCoinLength[ID]->setValue(spbCoinLength[ID][MaxNumberOfChannel]->value());
for( int ch = 0; ch < (int) digi[ID]->GetNChannels(); ch ++){
@ -1640,9 +1677,13 @@ void DigiSettingsPanel::EnableControl(){
for( int id = 0; id < nDigi; id ++){
bool enable = !digi[id]->IsAcqOn();
digiBox[id]->setEnabled(enable);
if( digi[id]->GetFPGAType() == "DPP_PHA") VGABox[id]->setEnabled(enable);
if( ckbGlbTrgSource[id][3]->isChecked() ) testPulseBox[id]->setEnabled(enable);
//digiBox[id]->setEnabled(enable);
//if( digi[id]->GetFPGAType() == "DPP_PHA") VGABox[id]->setEnabled(enable);
//if( ckbGlbTrgSource[id][3]->isChecked() ) testPulseBox[id]->setEnabled(enable);
bdCfg[id]->setEnabled(enable);
bdTestPulse[id]->setEnabled(enable);
box1[id]->setEnabled(enable);
box3[id]->setEnabled(enable);
box4[id]->setEnabled(enable);
@ -1660,7 +1701,7 @@ void DigiSettingsPanel::EnableControl(){
bnSoftwareStart[id]->setEnabled(enable);
bnSoftwareStop[id]->setEnabled(enable);
if( digi[id]->GetFPGAType() != "DPP_PHA" || digi[id]->GetModelName() != "VX2745" ) VGABox[id]->setEnabled(false);
if( digi[id]->GetFPGAType() != "DPP_PHA" || digi[id]->GetModelName() != "VX2745" ) bdVGA[id]->setEnabled(false);
QVector<QTabWidget*> tempArray = {inputTab[id], trapTab[id], probeTab[id], otherTab[id] };
@ -1815,13 +1856,13 @@ void DigiSettingsPanel::UpdatePanelFromMemory(bool onlyStatus){
result = QString::fromStdString(digi[ID]->GetSettingValue(PHA::DIG::GlobalTriggerSource));
resultList = result.remove(QChar(' ')).split("|");
testPulseBox[ID]->setEnabled(false);
bdTestPulse[ID]->setEnabled(false);
for( int j = 0; j < (int) PHA::DIG::StartSource.GetAnswers().size(); j++){
ckbGlbTrgSource[ID][j]->setChecked(false);
for( int i = 0; i < resultList.count(); i++){
if( resultList[i] == QString::fromStdString((PHA::DIG::GlobalTriggerSource.GetAnswers())[j].first) ) {
ckbGlbTrgSource[ID][j]->setChecked(true);
if( resultList[i] == "TestPulse" ) testPulseBox[ID]->setEnabled(true);
if( resultList[i] == "TestPulse" ) bdTestPulse[ID]->setEnabled(true);
}
}
}
@ -1998,13 +2039,13 @@ void DigiSettingsPanel::SetGlobalTriggerSource(){
if( !enableSignalSlot ) return;
std::string value = "";
testPulseBox[ID]->setEnabled(false);
bdTestPulse[ID]->setEnabled(false);
for( int i = 0; i < (int) PHA::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 += PHA::DIG::GlobalTriggerSource.GetAnswers()[i].first;
if( PHA::DIG::GlobalTriggerSource.GetAnswers()[i].first == "TestPulse" ) testPulseBox[ID]->setEnabled(true);
if( PHA::DIG::GlobalTriggerSource.GetAnswers()[i].first == "TestPulse" ) bdTestPulse[ID]->setEnabled(true);
}
}

View File

@ -60,9 +60,9 @@ private:
QTabWidget * tabWidget;
//------------ Layout/GroupBox
QGroupBox * digiBox[MaxNumberOfDigitizer];
QGroupBox * VGABox[MaxNumberOfDigitizer];
QGroupBox * testPulseBox[MaxNumberOfDigitizer];
//QGroupBox * digiBox[MaxNumberOfDigitizer];
//QGroupBox * VGABox[MaxNumberOfDigitizer];
//QGroupBox * testPulseBox[MaxNumberOfDigitizer];
QGroupBox * box0[MaxNumberOfDigitizer];
QGroupBox * box1[MaxNumberOfDigitizer];
@ -133,6 +133,18 @@ private:
QPushButton * bnSoftwareStop[MaxNumberOfChannel];
//-------------- board settings
//QGridLayout * bdCfgLayout[MaxNumberOfDigitizer];
//QGridLayout * bdTestPulseLayout[MaxNumberOfDigitizer];
//QGridLayout * bdVGALayout[MaxNumberOfDigitizer];
QGridLayout * bdLVDSLayout[MaxNumberOfDigitizer];
QWidget * bdCfg[MaxNumberOfDigitizer];
QWidget * bdTestPulse[MaxNumberOfDigitizer];
QWidget * bdVGA[MaxNumberOfDigitizer];
QWidget * bdLVDS[MaxNumberOfDigitizer];
QWidget * bdITL[MaxNumberOfDigitizer];
RComboBox * cbbClockSource[MaxNumberOfDigitizer];
RComboBox * cbbEnClockFrontPanel[MaxNumberOfDigitizer];
QCheckBox * ckbStartSource[MaxNumberOfDigitizer][5];
@ -160,12 +172,14 @@ private:
//-------------- VGA
RSpinBox * VGA[MaxNumberOfDigitizer][4];
//-------------- LVDS
//--------------- trigger map
RComboBox * cbAllEvtTrigger[MaxNumberOfDigitizer];
RComboBox * cbAllWaveTrigger[MaxNumberOfDigitizer];
RComboBox * cbAllCoinMask[MaxNumberOfDigitizer];
RComboBox * cbAllAntiCoinMask[MaxNumberOfDigitizer];
RSpinBox * sbAllCoinLength[MaxNumberOfDigitizer];
//RComboBox * cbAllEvtTrigger[MaxNumberOfDigitizer];
//RComboBox * cbAllWaveTrigger[MaxNumberOfDigitizer];
//RComboBox * cbAllCoinMask[MaxNumberOfDigitizer];
//RComboBox * cbAllAntiCoinMask[MaxNumberOfDigitizer];
//RSpinBox * sbAllCoinLength[MaxNumberOfDigitizer];
QPushButton * trgMap[MaxNumberOfDigitizer][MaxNumberOfChannel][MaxNumberOfChannel];
bool trgMapClickStatus[MaxNumberOfDigitizer][MaxNumberOfChannel][MaxNumberOfChannel];