add MaxRegChannels to solve the channel number and register channel number are different

This commit is contained in:
carina@hades 2023-10-06 16:50:28 -04:00
parent a72fb2fdc8
commit 1faaea4dcb
14 changed files with 714 additions and 323 deletions

View File

@ -13,7 +13,6 @@
#include <vector> #include <vector>
#include <sys/stat.h> #include <sys/stat.h>
//#include "CAENDigitizerType.h"
#include "macro.h" #include "macro.h"
#define MaxNData 10000 /// store 10k events per channels #define MaxNData 10000 /// store 10k events per channels
@ -59,6 +58,8 @@ class Data{
std::vector<short> Waveform2[MaxNChannels][MaxNData]; std::vector<short> Waveform2[MaxNChannels][MaxNData];
std::vector<bool> DigiWaveform1[MaxNChannels][MaxNData]; std::vector<bool> DigiWaveform1[MaxNChannels][MaxNData];
std::vector<bool> DigiWaveform2[MaxNChannels][MaxNData]; std::vector<bool> DigiWaveform2[MaxNChannels][MaxNData];
std::vector<bool> DigiWaveform3[MaxNChannels][MaxNData];
std::vector<bool> DigiWaveform4[MaxNChannels][MaxNData];
public: public:
Data(); Data();
@ -94,12 +95,13 @@ class Data{
unsigned int nw; unsigned int nw;
//bool SaveWaveToMemory; //bool SaveWaveToMemory;
///for temperary ///for temperary
std::vector<short> tempWaveform1; std::vector<short> tempWaveform1;
std::vector<short> tempWaveform2; std::vector<short> tempWaveform2;
std::vector<bool> tempDigiWaveform1; std::vector<bool> tempDigiWaveform1;
std::vector<bool> tempDigiWaveform2; std::vector<bool> tempDigiWaveform2;
std::vector<bool> tempDigiWaveform3;
std::vector<bool> tempDigiWaveform4;
FILE * outFile; FILE * outFile;
uint64_t FinishedOutFilesSize; // sum of files size. uint64_t FinishedOutFilesSize; // sum of files size.
@ -114,6 +116,7 @@ class Data{
int DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose); int DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
int DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose); int DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
int DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose);
}; };
@ -180,6 +183,8 @@ inline void Data::ClearData(){
Waveform2[ch][j].clear(); Waveform2[ch][j].clear();
DigiWaveform1[ch][j].clear(); DigiWaveform1[ch][j].clear();
DigiWaveform2[ch][j].clear(); DigiWaveform2[ch][j].clear();
DigiWaveform3[ch][j].clear();
DigiWaveform4[ch][j].clear();
} }
NumEventsDecoded[ch] = 0; NumEventsDecoded[ch] = 0;
@ -195,6 +200,8 @@ inline void Data::ClearData(){
tempWaveform2.clear(); tempWaveform2.clear();
tempDigiWaveform1.clear(); tempDigiWaveform1.clear();
tempDigiWaveform2.clear(); tempDigiWaveform2.clear();
tempDigiWaveform3.clear();
tempDigiWaveform4.clear();
} }
inline void Data::ClearBuffer(){ inline void Data::ClearBuffer(){
@ -415,6 +422,9 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
if( DPPType == DPPType::DPP_PSD_CODE ) { if( DPPType == DPPType::DPP_PSD_CODE ) {
if ( DecodePSDDualChannelBlock(chMask, fastDecode, verbose) < 0 ) break; if ( DecodePSDDualChannelBlock(chMask, fastDecode, verbose) < 0 ) break;
} }
if( DPPType == DPPType::DPP_QDC_CODE ) {
if ( DecodeQDCGroupedChannelBlock(chMask, fastDecode, verbose) < 0 ) break;
}
} }
}else{ }else{
if( verbose >= 1 ) printf("nw : %d, incorrect buffer header. \n", nw); if( verbose >= 1 ) printf("nw : %d, incorrect buffer header. \n", nw);
@ -855,10 +865,16 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
} }
} }
} }
nw = nw +1 ; word = ReadBuffer(nw, verbose);
unsigned int extra = word; unsigned int extra = 0;
unsigned long long extTimeStamp = 0; unsigned long long extTimeStamp = 0;
if( extraOption == 0 || extraOption == 2 ) extTimeStamp = (extra >> 16);
if( hasExtra ){
nw = nw +1 ; word = ReadBuffer(nw, verbose);
extra = word;
extTimeStamp = 0;
if( extraOption == 0 || extraOption == 2 ) extTimeStamp = (extra >> 16);
}
unsigned long long timeStamp = (extTimeStamp << 31) ; unsigned long long timeStamp = (extTimeStamp << 31) ;
timeStamp = timeStamp + timeStamp0; timeStamp = timeStamp + timeStamp0;
@ -876,17 +892,17 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
DataIndex[channel] = 0; DataIndex[channel] = 0;
} }
Energy2[channel][DataIndex[channel]] = Qshort;
Energy[channel][DataIndex[channel]] = Qlong;
Timestamp[channel][DataIndex[channel]] = timeStamp;
if( extraOption == 2 ) fineTime[channel][DataIndex[channel]] = extra & 0x3FF;
NumEventsDecoded[channel] ++; NumEventsDecoded[channel] ++;
if( !pileup){ if( !pileup){
NumNonPileUpDecoded[channel] ++; NumNonPileUpDecoded[channel] ++;
TotNumNonPileUpEvents[channel] ++; TotNumNonPileUpEvents[channel] ++;
} }
Energy2[channel][DataIndex[channel]] = Qshort;
Energy[channel][DataIndex[channel]] = Qlong;
Timestamp[channel][DataIndex[channel]] = timeStamp;
if( extraOption == 2 ) fineTime[channel][DataIndex[channel]] = extra & 0x3FF;
if( !fastDecode ) { if( !fastDecode ) {
if( hasDualTrace ){ if( hasDualTrace ){
Waveform1[channel][DataIndex[channel]] = tempWaveform1; Waveform1[channel][DataIndex[channel]] = tempWaveform1;
@ -918,4 +934,143 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
return nw; return nw;
} }
//*=================================================
inline int Data::DecodeQDCGroupedChannelBlock(unsigned int ChannelMask, bool fastDecode, int verbose){
nw = nw + 1;
unsigned int word = ReadBuffer(nw, verbose);
if( (word >> 31) != 1 ) return 0;
unsigned int aggSize = ( word & 0x3FFFFF ) ;
if( verbose >= 2 ) printf(" size : %d \n", aggSize);
unsigned int nEvents = 0;
nw = nw + 1; word = ReadBuffer(nw, verbose);
unsigned int nSample = ( word & 0xFFFF ) * 8;
unsigned int analogProbe = ( (word >> 22 ) & 0x3 );
bool hasWaveForm = ( (word >> 27 ) & 0x1 );
bool hasExtra = ( (word >> 28 ) & 0x1 );
bool hasTimeStamp = ( (word >> 29 ) & 0x1 );
bool hasEnergy = ( (word >> 30 ) & 0x1 );
if( (word >> 31 ) != 1 ) return 0;
if( verbose >= 2 ) {
printf("Charge : %d, Time: %d, Wave : %d, Extra: %d\n", hasEnergy, hasTimeStamp, hasWaveForm, hasExtra);
printf(".... analog Probe (%d): ", analogProbe);
switch(analogProbe){
case 0 : printf("Input\n"); break;
case 1 : printf("Smoothed Input\n"); break;
case 2 : printf("Baseline\n"); break;
}
}
nEvents = (aggSize -2) / (nSample/2 + 2 + hasExtra );
if( verbose >= 2 ) printf("----------------- nEvents : %d, fast decode : %d\n", nEvents, fastDecode);
///========= Decode an event
for( unsigned int ev = 0; ev < nEvents ; ev++){
if( verbose >= 2 ) printf("--------------------------- event : %d\n", ev);
nw = nw +1 ; word = ReadBuffer(nw, verbose);
unsigned int timeStamp0 = (word & 0xFFFFFFFF);
if( verbose >= 2 ) printf("timeStamp %u \n", timeStamp0);
// bool channelTag = ((word >> 31) & 0x1);
// int channel = ChannelMask*2 + channelTag;
///===== read waveform
if( !fastDecode ) {
tempWaveform1.clear();
tempDigiWaveform1.clear();
tempDigiWaveform2.clear();
tempDigiWaveform3.clear();
tempDigiWaveform4.clear();
}
if( fastDecode ){
nw += nSample/2;
}else{
for( unsigned int wi = 0; wi < nSample/2; wi++){
nw = nw +1 ; word = ReadBuffer(nw, verbose-4);
tempWaveform1.push_back(( word & 0xFFF));
tempWaveform1.push_back((( word >> 16) & 0xFFF));
tempDigiWaveform1.push_back((( word >> 12 ) & 0x1 )); //Gate
tempDigiWaveform1.push_back((( word >> 28 ) & 0x1 ));
tempDigiWaveform2.push_back((( word >> 13 ) & 0x1 )); //Trigger
tempDigiWaveform2.push_back((( word >> 29 ) & 0x1 ));
tempDigiWaveform3.push_back((( word >> 14 ) & 0x1 )); //Triger Hold Off
tempDigiWaveform3.push_back((( word >> 30 ) & 0x1 ));
tempDigiWaveform4.push_back((( word >> 15 ) & 0x1 )); //Over-Threshold
tempDigiWaveform4.push_back((( word >> 31 ) & 0x1 ));
if( verbose >= 3 ){
printf("%4d| %5d, %d, %d, %d, %d \n", 2*wi, (word & 0xFFF) , (( word >> 12 ) & 0x1 ), (( word >> 13 ) & 0x1 ), (( word >> 14 ) & 0x1 ), (( word >> 15 ) & 0x1 ));
printf("%4d| %5d, %d, %d, %d, %d \n", 2*wi+1, (( word >> 16) & 0xFFF), (( word >> 28 ) & 0x1 ), (( word >> 29 ) & 0x1 ), (( word >> 30 ) & 0x1 ), (( word >> 31 ) & 0x1 ));
}
}
}
unsigned long long extTimeStamp = 0;
unsigned int baseline = 0;
unsigned long extra = 0;
if( hasExtra ){
nw = nw +1 ; word = ReadBuffer(nw, verbose);
extra = word;
baseline = (word & 0xFFF);
extTimeStamp = (word >> 16);
}
unsigned long long timeStamp = (extTimeStamp << 31) ;
timeStamp = timeStamp + timeStamp0;
nw = nw +1 ; word = ReadBuffer(nw, verbose);
unsigned int energy = (( word >> 16) & 0xFFFF);
bool pileup = ((word >> 27) & 0x1);
bool OverRange = ((word >> 26)& 0x1);
unsigned short subCh = ((word >> 28)& 0xF);
unsigned short channel = ChannelMask*8 + subCh;
DataIndex[channel] ++;
if( DataIndex[channel] >= MaxNData ) {
LoopIndex[channel] ++;
DataIndex[channel] = 0;
}
Energy[channel][DataIndex[channel]] = energy;
Timestamp[channel][DataIndex[channel]] = timeStamp;
NumEventsDecoded[channel] ++;
if( !pileup && !OverRange){
NumNonPileUpDecoded[channel] ++;
TotNumNonPileUpEvents[channel] ++;
}
if( !fastDecode ) {
Waveform1[channel][DataIndex[channel]] = tempWaveform1;
DigiWaveform1[channel][DataIndex[channel]] = tempDigiWaveform1;
DigiWaveform2[channel][DataIndex[channel]] = tempDigiWaveform2;
DigiWaveform3[channel][DataIndex[channel]] = tempDigiWaveform3;
DigiWaveform4[channel][DataIndex[channel]] = tempDigiWaveform4;
}
if( verbose >= 2 ) printf("extra : 0x%lx, baseline : %d\n", extra, baseline);
if( verbose >= 1 ) printf("ch : %2d, energy : %d, timestamp : %llu\n",
channel, energy, timeStamp);
}
return nw;
}
#endif #endif

View File

@ -109,6 +109,7 @@ class Digitizer{
bool GetChannelOnOff(unsigned ch) { channelMask = GetSettingFromMemory(DPP::ChannelEnableMask); return (channelMask & ( 1 << ch) );} bool GetChannelOnOff(unsigned ch) { channelMask = GetSettingFromMemory(DPP::ChannelEnableMask); return (channelMask & ( 1 << ch) );}
float GetTick2ns() const {return tick2ns;} float GetTick2ns() const {return tick2ns;}
int GetNChannels() const {return NChannel;} int GetNChannels() const {return NChannel;}
int GetRegChannels() const {return DPPType == DPPType::DPP_QDC_CODE ? NCoupledCh : NChannel;}
int GetNCoupledCh() const {return NCoupledCh;} int GetNCoupledCh() const {return NCoupledCh;}
int GetHandle() const {return handle;} int GetHandle() const {return handle;}
int GetDPPType() const {return DPPType;} int GetDPPType() const {return DPPType;}

View File

@ -264,11 +264,12 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
SetUpChannelMask(iDigi); SetUpChannelMask(iDigi);
if( digi[iDigi]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard(); if( digi[iDigi]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpBoard_PHA();
if( digi[iDigi]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDBoard(); if( digi[iDigi]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpBoard_PSD();
if( digi[iDigi]->GetDPPType() == V1740_DPP_QDC_CODE ) SetUpBoard_QDC();
SetUpGlobalTriggerMaskAndFrontPanelMask(bdGlbTRGOUTLayout[iDigi]);
SetUpACQReadOutTab(); SetUpACQReadOutTab();
SetUpGlobalTriggerMaskAndFrontPanelMask(bdGlbTRGOUTLayout[iDigi]);
} }
@ -281,8 +282,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
chTab = new QTabWidget(tab); chTab = new QTabWidget(tab);
tabLayout_V2->addWidget(chTab); tabLayout_V2->addWidget(chTab);
if( digi[iDigi]->GetDPPType() == V1730_DPP_PHA_CODE) SetUpPHAChannel(); if( digi[iDigi]->GetDPPType() == V1730_DPP_PHA_CODE) SetUpChannel_PHA();
if( digi[iDigi]->GetDPPType() == V1730_DPP_PSD_CODE) SetUpPSDChannel(); if( digi[iDigi]->GetDPPType() == V1730_DPP_PSD_CODE) SetUpChannel_PSD();
} }
@ -498,8 +499,6 @@ void DigiSettingsPanel::CleanUpGroupBox(QGroupBox * & gBox){
void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * & gLayout){ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * & gLayout){
//^=============================== Others
SetUpComboBoxBit(cbLEMOMode[ID], "LEMO Mode ", gLayout, 0, 0, DPP::Bit_FrontPanelIOControl::ListLEMOLevel, DPP::FrontPanelIOControl, DPP::Bit_FrontPanelIOControl::LEMOLevel, 1, 0); SetUpComboBoxBit(cbLEMOMode[ID], "LEMO Mode ", gLayout, 0, 0, DPP::Bit_FrontPanelIOControl::ListLEMOLevel, DPP::FrontPanelIOControl, DPP::Bit_FrontPanelIOControl::LEMOLevel, 1, 0);
///============================ Trig out mode ///============================ Trig out mode
@ -529,7 +528,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
SetUpCheckBox(chkEnableExternalTrigger[ID], "Enable TRG-IN ", gLayout, 1, 1, DPP::DisableExternalTrigger, {1, 0}); SetUpCheckBox(chkEnableExternalTrigger[ID], "Enable TRG-IN ", gLayout, 1, 1, DPP::DisableExternalTrigger, {1, 0});
///============================ Trig In mode ///============================ Trig In mode
QLabel * trgInMode = new QLabel("TRI-In Mode ", this); QLabel * trgInMode = new QLabel("TRI-In Mode ", this);
trgInMode->setAlignment(Qt::AlignRight | Qt::AlignCenter); trgInMode->setAlignment(Qt::AlignRight | Qt::AlignCenter);
gLayout->addWidget(trgInMode, 2, 0); gLayout->addWidget(trgInMode, 2, 0);
@ -586,17 +585,20 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
sbVoltageLevel[ID]->setToolTipDuration(-1); sbVoltageLevel[ID]->setToolTipDuration(-1);
//^=============================== Global Mask, TRG-OUT Mask //^=============================== Global Mask, TRG-OUT Mask
QWidget * kaka = new QWidget(this); QWidget * kaka = new QWidget(this);
gLayout->addWidget(kaka, 7, 0, 1, 4); gLayout->addWidget(kaka, 7, 0, 1, 4);
QGridLayout * maskLayout = new QGridLayout(kaka); QGridLayout * maskLayout = new QGridLayout(kaka);
maskLayout->setAlignment(Qt::AlignLeft); maskLayout->setAlignment(Qt::AlignLeft);
maskLayout->setSpacing(2); maskLayout->setSpacing(2);
int coupledNum = 2;
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ) coupledNum = 8;
for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){ for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){
if( i % 2 == 0 ){ if( i % 2 == 0 ){
QLabel * chIDLabel = new QLabel(QString::number(2*i) + "-" + QString::number(2*i + 1), this); QLabel * chIDLabel = new QLabel(QString::number(coupledNum*i) + "-" + QString::number(coupledNum*(i+1) - 1), this);
chIDLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom); chIDLabel->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
maskLayout->addWidget(chIDLabel, 0, 1 + i, 1, 2); maskLayout->addWidget(chIDLabel, 0, 1 + i, 1, 2);
} }
@ -617,6 +619,8 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
} }
}); });
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ) bnGlobalTriggerMask[ID][i]->setEnabled(false);
bnTRGOUTMask[ID][i] = new QPushButton(this); bnTRGOUTMask[ID][i] = new QPushButton(this);
bnTRGOUTMask[ID][i]->setFixedSize(QSize(20,20)); bnTRGOUTMask[ID][i]->setFixedSize(QSize(20,20));
bnTRGOUTMask[ID][i]->setToolTipDuration(-1); bnTRGOUTMask[ID][i]->setToolTipDuration(-1);
@ -692,12 +696,14 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
}); });
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ) sbGlbMajLvl[ID]->setEnabled(false);
//*============================================
QLabel * lbOtherTrigger = new QLabel("OR trigger", this); QLabel * lbOtherTrigger = new QLabel("OR trigger", this);
lbOtherTrigger->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); lbOtherTrigger->setAlignment(Qt::AlignBottom | Qt::AlignHCenter);
maskLayout->addWidget(lbOtherTrigger, 0, 12); maskLayout->addWidget(lbOtherTrigger, 0, 12);
//*============================================
cbGlbUseOtherTriggers[ID] = new RComboBox(this); cbGlbUseOtherTriggers[ID] = new RComboBox(this);
cbGlbUseOtherTriggers[ID]->addItem("None", 0); cbGlbUseOtherTriggers[ID]->addItem("None", 0);
cbGlbUseOtherTriggers[ID]->addItem("TRG-IN", 1); cbGlbUseOtherTriggers[ID]->addItem("TRG-IN", 1);
@ -710,6 +716,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
}); });
//*============================================
QLabel * lbTrgOut = new QLabel("TRG-OUT Mask : ", this); QLabel * lbTrgOut = new QLabel("TRG-OUT Mask : ", this);
lbTrgOut->setAlignment(Qt::AlignRight | Qt::AlignCenter); lbTrgOut->setAlignment(Qt::AlignRight | Qt::AlignCenter);
maskLayout->addWidget(lbTrgOut, 2, 0); maskLayout->addWidget(lbTrgOut, 2, 0);
@ -718,7 +725,6 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
lbTrgOutLogic->setAlignment(Qt::AlignRight | Qt::AlignCenter); lbTrgOutLogic->setAlignment(Qt::AlignRight | Qt::AlignCenter);
maskLayout->addWidget(lbTrgOutLogic, 2, 9); maskLayout->addWidget(lbTrgOutLogic, 2, 9);
//*============================================
cbTRGOUTLogic[ID] = new RComboBox(this); cbTRGOUTLogic[ID] = new RComboBox(this);
cbTRGOUTLogic[ID]->addItem("OR", 0); cbTRGOUTLogic[ID]->addItem("OR", 0);
cbTRGOUTLogic[ID]->addItem("AND", 1); cbTRGOUTLogic[ID]->addItem("AND", 1);
@ -765,6 +771,11 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
}); });
//^============================================ Trigger Validation Mask //^============================================ Trigger Validation Mask
if( digi[ID]->GetDPPType() == DPPType::DPP_QDC_CODE ) {
QLabel * info = new QLabel ("No Trigger Mask for DPP-QDC firmware", this);
bdTriggerLayout[ID]->addWidget(info, 0, 0, 1, 13 );
return;
}
QLabel * info = new QLabel ("Each Row define the trigger requested by other coupled channels.", this); QLabel * info = new QLabel ("Each Row define the trigger requested by other coupled channels.", this);
bdTriggerLayout[ID]->addWidget(info, 0, 0, 1, 13 ); bdTriggerLayout[ID]->addWidget(info, 0, 0, 1, 13 );
@ -1083,7 +1094,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
copyFromLayout->addWidget(cbFromBoard, 0, 0, 1, 2*div); copyFromLayout->addWidget(cbFromBoard, 0, 0, 1, 2*div);
connect(cbFromBoard, &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons); connect(cbFromBoard, &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons);
for( int i = 0 ; i < MaxNChannels; i++ ){ for( int i = 0 ; i < MaxRegChannel; i++ ){
QLabel * leCh = new QLabel(QString::number(i), copyFromBox); QLabel * leCh = new QLabel(QString::number(i), copyFromBox);
leCh->setAlignment(Qt::AlignRight); leCh->setAlignment(Qt::AlignRight);
copyFromLayout->addWidget(leCh, i%div + 1, 2*(i/div)); copyFromLayout->addWidget(leCh, i%div + 1, 2*(i/div));
@ -1092,7 +1103,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
connect(rbCh[i], &QRadioButton::clicked, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons); connect(rbCh[i], &QRadioButton::clicked, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons);
int id1 = cbFromBoard->currentIndex(); int id1 = cbFromBoard->currentIndex();
if( i >= digi[id1]->GetNChannels() ) rbCh[i]->setEnabled(false); if( i >= digi[id1]->GetRegChannels() ) rbCh[i]->setEnabled(false);
} }
//---------- Acton buttons //---------- Acton buttons
@ -1116,7 +1127,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
copyToLayout->addWidget(cbToBoard, 0, 0, 1, 2*div); copyToLayout->addWidget(cbToBoard, 0, 0, 1, 2*div);
connect(cbToBoard, &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons); connect(cbToBoard, &RComboBox::currentIndexChanged, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons);
for( int i = 0 ; i < MaxNChannels; i++ ){ for( int i = 0 ; i < MaxRegChannel; i++ ){
QLabel * leCh = new QLabel(QString::number(i), copyToBox); QLabel * leCh = new QLabel(QString::number(i), copyToBox);
leCh->setAlignment(Qt::AlignRight); leCh->setAlignment(Qt::AlignRight);
copyToLayout->addWidget(leCh, i%div + 1, 2*(i/div)); copyToLayout->addWidget(leCh, i%div + 1, 2*(i/div));
@ -1125,7 +1136,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
connect(chkCh[i], &QCheckBox::clicked, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons); connect(chkCh[i], &QCheckBox::clicked, this, &DigiSettingsPanel::CheckRadioAndCheckedButtons);
int id1 = cbToBoard->currentIndex(); int id1 = cbToBoard->currentIndex();
if( i >= digi[id1]->GetNChannels() ) chkCh[i]->setEnabled(false); if( i >= digi[id1]->GetRegChannels() ) chkCh[i]->setEnabled(false);
} }
bnCopyBoard->setEnabled(false); bnCopyBoard->setEnabled(false);
@ -1148,7 +1159,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PHA_CODE ) regList = RegisterPHAList; if( digi[fromIndex]->GetDPPType() == V1730_DPP_PHA_CODE ) regList = RegisterPHAList;
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterPSDList; if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterPSDList;
for( int i = 0; i < digi[toIndex]->GetNChannels() ; i++){ for( int i = 0; i < digi[toIndex]->GetRegChannels() ; i++){
//Copy setting //Copy setting
for( int k = 0; k < (int) regList.size(); k ++){ for( int k = 0; k < (int) regList.size(); k ++){
if( regList[k].GetRWType() != RW::ReadWrite ) continue; if( regList[k].GetRWType() != RW::ReadWrite ) continue;
@ -1174,7 +1185,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterPSDList; if( digi[fromIndex]->GetDPPType() == V1730_DPP_PSD_CODE ) regList = RegisterPSDList;
int fromCh = -1; int fromCh = -1;
for( int i = 0; i < MaxNChannels; i++) { for( int i = 0; i < MaxRegChannel; i++) {
if( rbCh[i]->isChecked() ) { if( rbCh[i]->isChecked() ) {
fromCh = i; fromCh = i;
break; break;
@ -1183,7 +1194,7 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
if( fromCh == -1 ) return; if( fromCh == -1 ) return;
for( int i = 0; i < MaxNChannels; i++){ for( int i = 0; i < MaxRegChannel; i++){
if( ! chkCh[i]->isChecked() ) return; if( ! chkCh[i]->isChecked() ) return;
//Copy setting //Copy setting
for( int k = 0; k < (int) regList.size(); k ++){ for( int k = 0; k < (int) regList.size(); k ++){
@ -1216,7 +1227,7 @@ void DigiSettingsPanel::SetUpChannelMask(unsigned int digiID){
chLayout->setAlignment(Qt::AlignLeft); chLayout->setAlignment(Qt::AlignLeft);
chLayout->setSpacing(0); chLayout->setSpacing(0);
int nChGrp = digi[digiID]->GetNChannels(); int nChGrp = digi[digiID]->GetRegChannels();
if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ) nChGrp = digi[digiID]->GetNCoupledCh(); if( digi[digiID]->GetDPPType() == DPPType::DPP_QDC_CODE ) nChGrp = digi[digiID]->GetNCoupledCh();
for( int i = 0; i < nChGrp; i++){ for( int i = 0; i < nChGrp; i++){
@ -1312,7 +1323,8 @@ void DigiSettingsPanel::SetUpACQReadOutTab(){
} }
} }
void DigiSettingsPanel::SetUpPHABoard(){ //&###########################################################
void DigiSettingsPanel::SetUpBoard_PHA(){
printf("============== %s \n", __func__); printf("============== %s \n", __func__);
SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", bdCfgLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableAutoDataFlush); SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", bdCfgLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableAutoDataFlush);
@ -1336,8 +1348,7 @@ void DigiSettingsPanel::SetUpPHABoard(){
} }
//&########################################################### void DigiSettingsPanel::SetUpChannel_PHA(){
void DigiSettingsPanel::SetUpPHAChannel(){
QWidget * chAllSetting = new QWidget(this); QWidget * chAllSetting = new QWidget(this);
//chAllSetting->setStyleSheet("background-color: #ECECEC;"); //chAllSetting->setStyleSheet("background-color: #ECECEC;");
@ -1370,14 +1381,16 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QHBoxLayout * papa = new QHBoxLayout(jaja); QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft); papa->setAlignment(Qt::AlignLeft);
const unsigned short numChannel = digi[ID]->GetRegChannels();
{//^============================== Channel selection {//^============================== Channel selection
QLabel * lbChSel = new QLabel ("Ch : ", this); QLabel * lbChSel = new QLabel ("Channel : ", this);
lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight);
papa->addWidget(lbChSel); papa->addWidget(lbChSel);
chSelection[ID] = new RComboBox(this); chSelection[ID] = new RComboBox(this);
chSelection[ID]->addItem("All Ch.", -1); chSelection[ID]->addItem("All Ch.", -1);
for( int i = 0; i < digi[ID]->GetNChannels(); i++) chSelection[ID]->addItem(QString::number(i), i); for( int i = 0; i < numChannel; i++) chSelection[ID]->addItem(QString::number(i), i);
papa->addWidget(chSelection[ID]); papa->addWidget(chSelection[ID]);
connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){
@ -1385,8 +1398,6 @@ void DigiSettingsPanel::SetUpPHAChannel(){
}); });
} }
const unsigned short maxNChannel = digi[ID]->GetNChannels();
{//*========================= input {//*========================= input
QGroupBox * inputBox = new QGroupBox("input Settings", this); QGroupBox * inputBox = new QGroupBox("input Settings", this);
allSettingLayout->addWidget(inputBox); allSettingLayout->addWidget(inputBox);
@ -1394,14 +1405,14 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QGridLayout * inputLayout = new QGridLayout(inputBox); QGridLayout * inputLayout = new QGridLayout(inputBox);
inputLayout->setSpacing(2); inputLayout->setSpacing(2);
SetUpSpinBox(sbRecordLength[ID][maxNChannel], "Record Length [G][ns] : ", inputLayout, 0, 0, DPP::RecordLength_G); SetUpSpinBox(sbRecordLength[ID][numChannel], "Record Length [G][ns] : ", inputLayout, 0, 0, DPP::RecordLength_G);
SetUpComboBox(cbDynamicRange[ID][maxNChannel], "Dynamic Range : ", inputLayout, 0, 2, DPP::InputDynamicRange); SetUpComboBox(cbDynamicRange[ID][numChannel], "Dynamic Range : ", inputLayout, 0, 2, DPP::InputDynamicRange);
SetUpSpinBox(sbPreTrigger[ID][maxNChannel], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::PreTrigger); SetUpSpinBox(sbPreTrigger[ID][numChannel], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::PreTrigger);
SetUpComboBox(cbRCCR2Smoothing[ID][maxNChannel], "Smoothing factor : ", inputLayout, 1, 2, DPP::PHA::RCCR2SmoothingFactor); SetUpComboBox(cbRCCR2Smoothing[ID][numChannel], "Smoothing factor : ", inputLayout, 1, 2, DPP::PHA::RCCR2SmoothingFactor);
SetUpSpinBox(sbInputRiseTime[ID][maxNChannel], "Rise Time [ns] : ", inputLayout, 2, 0, DPP::PHA::InputRiseTime); SetUpSpinBox(sbInputRiseTime[ID][numChannel], "Rise Time [ns] : ", inputLayout, 2, 0, DPP::PHA::InputRiseTime);
SetUpSpinBox(sbDCOffset[ID][maxNChannel], "DC Offset [%] : ", inputLayout, 2, 2, DPP::ChannelDCOffset); SetUpSpinBox(sbDCOffset[ID][numChannel], "DC Offset [%] : ", inputLayout, 2, 2, DPP::ChannelDCOffset);
SetUpSpinBox(sbRiseTimeValidWin[ID][maxNChannel], "Rise Time Valid. Win. [ns] : ", inputLayout, 3, 0, DPP::PHA::RiseTimeValidationWindow); SetUpSpinBox(sbRiseTimeValidWin[ID][numChannel], "Rise Time Valid. Win. [ns] : ", inputLayout, 3, 0, DPP::PHA::RiseTimeValidationWindow);
SetUpComboBoxBit(cbPolarity[ID][maxNChannel], "Polarity : ", inputLayout, 3, 2, DPP::Bit_DPPAlgorithmControl_PHA::ListPolarity, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::Polarity); SetUpComboBoxBit(cbPolarity[ID][numChannel], "Polarity : ", inputLayout, 3, 2, DPP::Bit_DPPAlgorithmControl_PHA::ListPolarity, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::Polarity);
} }
@ -1412,14 +1423,14 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QGridLayout * trigLayout = new QGridLayout(trigBox); QGridLayout * trigLayout = new QGridLayout(trigBox);
trigLayout->setSpacing(2); trigLayout->setSpacing(2);
SetUpCheckBox(chkDisableSelfTrigger[ID][maxNChannel], "Disable Self Trigger ", trigLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger); SetUpCheckBox(chkDisableSelfTrigger[ID][numChannel], "Disable Self Trigger ", trigLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger);
SetUpSpinBox(sbThreshold[ID][maxNChannel], "Threshold [LSB] : ", trigLayout, 0, 2, DPP::PHA::TriggerThreshold); SetUpSpinBox(sbThreshold[ID][numChannel], "Threshold [LSB] : ", trigLayout, 0, 2, DPP::PHA::TriggerThreshold);
SetUpComboBoxBit(cbTrigMode[ID][maxNChannel], "Trig Mode : ", trigLayout, 1, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 1); SetUpComboBoxBit(cbTrigMode[ID][numChannel], "Trig Mode : ", trigLayout, 1, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 1);
SetUpSpinBox(sbTriggerHoldOff[ID][maxNChannel], "Tigger Hold-off [ns] : ", trigLayout, 1, 2, DPP::PHA::TriggerHoldOffWidth); SetUpSpinBox(sbTriggerHoldOff[ID][numChannel], "Tigger Hold-off [ns] : ", trigLayout, 1, 2, DPP::PHA::TriggerHoldOffWidth);
SetUpComboBoxBit(cbLocalTriggerValid[ID][maxNChannel], "Local Trig. Valid. [G] : ", trigLayout, 2, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode); SetUpComboBoxBit(cbLocalTriggerValid[ID][numChannel], "Local Trig. Valid. [G] : ", trigLayout, 2, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode);
SetUpComboBoxBit(cbTrigCount[ID][maxNChannel], "Trig. Counter Flag [G] : ", trigLayout, 2, 2, DPP::PHA::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag); SetUpComboBoxBit(cbTrigCount[ID][numChannel], "Trig. Counter Flag [G] : ", trigLayout, 2, 2, DPP::PHA::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag);
SetUpComboBoxBit(cbLocalShapedTrigger[ID][maxNChannel], "Local Shaped Trig. [G] : ", trigLayout, 3, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1); SetUpComboBoxBit(cbLocalShapedTrigger[ID][numChannel], "Local Shaped Trig. [G] : ", trigLayout, 3, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1);
SetUpSpinBox(sbShapedTrigWidth[ID][maxNChannel], "Shaped Trig. Width [ns] : ", trigLayout, 3, 2, DPP::PHA::ShapedTriggerWidth); SetUpSpinBox(sbShapedTrigWidth[ID][numChannel], "Shaped Trig. Width [ns] : ", trigLayout, 3, 2, DPP::PHA::ShapedTriggerWidth);
} }
{//*===================== Trapezoid {//*===================== Trapezoid
@ -1429,17 +1440,17 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QGridLayout * trapLayout = new QGridLayout(trapBox); QGridLayout * trapLayout = new QGridLayout(trapBox);
trapLayout->setSpacing(2); trapLayout->setSpacing(2);
SetUpSpinBox(sbTrapRiseTime[ID][maxNChannel], "Rise Time [ns] : ", trapLayout, 0, 0, DPP::PHA::TrapezoidRiseTime); SetUpSpinBox(sbTrapRiseTime[ID][numChannel], "Rise Time [ns] : ", trapLayout, 0, 0, DPP::PHA::TrapezoidRiseTime);
SetUpSpinBox(sbTrapFlatTop[ID][maxNChannel], "Flat Top [ns] : ", trapLayout, 0, 2, DPP::PHA::TrapezoidFlatTop); SetUpSpinBox(sbTrapFlatTop[ID][numChannel], "Flat Top [ns] : ", trapLayout, 0, 2, DPP::PHA::TrapezoidFlatTop);
SetUpSpinBox(sbDecay[ID][maxNChannel], "Decay [ns] : ", trapLayout, 1, 0, DPP::PHA::DecayTime); SetUpSpinBox(sbDecay[ID][numChannel], "Decay [ns] : ", trapLayout, 1, 0, DPP::PHA::DecayTime);
SetUpSpinBox(sbTrapScaling[ID][maxNChannel], "Rescaling : ", trapLayout, 1, 2, DPP::DPPAlgorithmControl); SetUpSpinBox(sbTrapScaling[ID][numChannel], "Rescaling : ", trapLayout, 1, 2, DPP::DPPAlgorithmControl);
SetUpSpinBox(sbPeaking[ID][maxNChannel], "Peaking [ns] : ", trapLayout, 2, 0, DPP::PHA::PeakingTime); SetUpSpinBox(sbPeaking[ID][numChannel], "Peaking [ns] : ", trapLayout, 2, 0, DPP::PHA::PeakingTime);
SetUpSpinBox(sbPeakingHoldOff[ID][maxNChannel], "Peak Hold-off [ns] : ", trapLayout, 2, 2, DPP::PHA::PeakHoldOff); SetUpSpinBox(sbPeakingHoldOff[ID][numChannel], "Peak Hold-off [ns] : ", trapLayout, 2, 2, DPP::PHA::PeakHoldOff);
SetUpComboBoxBit(cbPeakAvg[ID][maxNChannel], "Peak Avg. : ", trapLayout, 3, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListPeakMean, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::PeakMean); SetUpComboBoxBit(cbPeakAvg[ID][numChannel], "Peak Avg. : ", trapLayout, 3, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListPeakMean, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::PeakMean);
SetUpComboBoxBit(cbBaseLineAvg[ID][maxNChannel], "Baseline Avg. : ", trapLayout, 3, 2, DPP::Bit_DPPAlgorithmControl_PHA::ListBaselineAvg, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::BaselineAvg); SetUpComboBoxBit(cbBaseLineAvg[ID][numChannel], "Baseline Avg. : ", trapLayout, 3, 2, DPP::Bit_DPPAlgorithmControl_PHA::ListBaselineAvg, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::BaselineAvg);
SetUpCheckBox(chkActiveBaseline[ID][maxNChannel], "Active basline [G]", trapLayout, 4, 0, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ActivebaselineCalulation); SetUpCheckBox(chkActiveBaseline[ID][numChannel], "Active basline [G]", trapLayout, 4, 0, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ActivebaselineCalulation);
SetUpCheckBox(chkBaselineRestore[ID][maxNChannel], "Baseline Restorer [G]", trapLayout, 4, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::EnableActiveBaselineRestoration); SetUpCheckBox(chkBaselineRestore[ID][numChannel], "Baseline Restorer [G]", trapLayout, 4, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::EnableActiveBaselineRestoration);
SetUpSpinBox(sbFineGain[ID][maxNChannel], "Fine Gain : ", trapLayout, 4, 2, DPP::PHA::FineGain); SetUpSpinBox(sbFineGain[ID][numChannel], "Fine Gain : ", trapLayout, 4, 2, DPP::PHA::FineGain);
} }
@ -1450,18 +1461,18 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QGridLayout * otherLayout = new QGridLayout(otherBox); QGridLayout * otherLayout = new QGridLayout(otherBox);
otherLayout->setSpacing(2); otherLayout->setSpacing(2);
SetUpCheckBox(chkEnableRollOver[ID][maxNChannel], "Enable Roll-Over Event", otherLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::EnableRollOverFlag); SetUpCheckBox(chkEnableRollOver[ID][numChannel], "Enable Roll-Over Event", otherLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::EnableRollOverFlag);
SetUpCheckBox(chkEnablePileUp[ID][maxNChannel], "Allow Pile-up Event", otherLayout, 0, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::EnablePileUpFlag); SetUpCheckBox(chkEnablePileUp[ID][numChannel], "Allow Pile-up Event", otherLayout, 0, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::EnablePileUpFlag);
SetUpCheckBox(chkTagCorrelation[ID][maxNChannel], "Tag Correlated events [G]", otherLayout, 1, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TagCorrelatedEvents); SetUpCheckBox(chkTagCorrelation[ID][numChannel], "Tag Correlated events [G]", otherLayout, 1, 1, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TagCorrelatedEvents);
SetUpSpinBox(sbNumEventAgg[ID][maxNChannel], "Events per Agg. [G] : ", otherLayout, 1, 2, DPP::NumberEventsPerAggregate_G); SetUpSpinBox(sbNumEventAgg[ID][numChannel], "Events per Agg. [G] : ", otherLayout, 1, 2, DPP::NumberEventsPerAggregate_G);
SetUpComboBoxBit(cbDecimateTrace[ID][maxNChannel], "Decimate Trace : ", otherLayout, 2, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListTraceDecimation, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TraceDecimation); SetUpComboBoxBit(cbDecimateTrace[ID][numChannel], "Decimate Trace : ", otherLayout, 2, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListTraceDecimation, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TraceDecimation);
SetUpComboBoxBit(cbDecimateGain[ID][maxNChannel], "Decimate Gain : ", otherLayout, 2, 2, DPP::Bit_DPPAlgorithmControl_PHA::ListDecimationGain, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TraceDeciGain); SetUpComboBoxBit(cbDecimateGain[ID][numChannel], "Decimate Gain : ", otherLayout, 2, 2, DPP::Bit_DPPAlgorithmControl_PHA::ListDecimationGain, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TraceDeciGain);
SetUpComboBoxBit(cbVetoSource[ID][maxNChannel], "Veto Source [G] : ", otherLayout, 3, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListVetoSource, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource); SetUpComboBoxBit(cbVetoSource[ID][numChannel], "Veto Source [G] : ", otherLayout, 3, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListVetoSource, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource);
SetUpSpinBox(sbVetoWidth[ID][maxNChannel], "Veto Width : ", otherLayout, 3, 2, DPP::VetoWidth); SetUpSpinBox(sbVetoWidth[ID][numChannel], "Veto Width : ", otherLayout, 3, 2, DPP::VetoWidth);
SetUpComboBoxBit(cbVetoStep[ID][maxNChannel], "Veto Step : ", otherLayout, 4, 0, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 1); SetUpComboBoxBit(cbVetoStep[ID][numChannel], "Veto Step : ", otherLayout, 4, 0, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 1);
SetUpComboBoxBit(cbExtra2Option[ID][maxNChannel], "Extra2 Option [G] : ", otherLayout, 5, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 3); SetUpComboBoxBit(cbExtra2Option[ID][numChannel], "Extra2 Option [G] : ", otherLayout, 5, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 3);
SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][maxNChannel], "TRG-OUT Ch. Prb. [G] : ", otherLayout, 6, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ChannelProbe); SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][numChannel], "TRG-OUT Ch. Prb. [G] : ", otherLayout, 6, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ChannelProbe);
} }
@ -1476,7 +1487,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QStringList chStatusInfo = {"SPI bus is busy.", "ADC Calibration is done.", "ADC shutdown, over-heat"}; QStringList chStatusInfo = {"SPI bus is busy.", "ADC Calibration is done.", "ADC shutdown, over-heat"};
for( int i = 0; i < maxNChannel; i++){ for( int i = 0; i < numChannel; i++){
QLabel * lbChID = new QLabel (QString::number(i), this); QLabel * lbChID = new QLabel (QString::number(i), this);
lbChID->setAlignment(Qt::AlignRight | Qt::AlignCenter); lbChID->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -1497,7 +1508,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
} }
QPushButton * bnADCCali = new QPushButton("ADC Calibration", this); QPushButton * bnADCCali = new QPushButton("ADC Calibration", this);
statusLayout->addWidget(bnADCCali, maxNChannel + 1, 0, 1, 5); statusLayout->addWidget(bnADCCali, numChannel + 1, 0, 1, 5);
if( QString::fromStdString(digi[ID]->GetModelName()).contains("25") || QString::fromStdString(digi[ID]->GetModelName()).contains("30") ){ if( QString::fromStdString(digi[ID]->GetModelName()).contains("25") || QString::fromStdString(digi[ID]->GetModelName()).contains("30") ){
bnADCCali->setEnabled(false); bnADCCali->setEnabled(false);
@ -1505,7 +1516,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
connect(bnADCCali, &QPushButton::clicked, this, [=](){ connect(bnADCCali, &QPushButton::clicked, this, [=](){
digi[ID]->WriteRegister(DPP::ADCCalibration_W, 1); digi[ID]->WriteRegister(DPP::ADCCalibration_W, 1);
for( int i = 0 ; i < digi[ID]->GetNChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); for( int i = 0 ; i < digi[ID]->GetRegChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
}); });
} }
@ -1533,7 +1544,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -1596,7 +1607,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
chid->setFixedWidth(20); chid->setFixedWidth(20);
@ -1656,7 +1667,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -1720,7 +1731,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
chid->setFixedWidth(20); chid->setFixedWidth(20);
@ -1770,7 +1781,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
} }
//&########################################################### //&###########################################################
void DigiSettingsPanel::SetUpPSDBoard(){ void DigiSettingsPanel::SetUpBoard_PSD(){
printf("============== %s \n", __func__); printf("============== %s \n", __func__);
SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", bdCfgLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableAutoDataFlush); SetUpCheckBox(chkAutoDataFlush[ID], "Auto Data Flush", bdCfgLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableAutoDataFlush);
@ -1786,7 +1797,7 @@ void DigiSettingsPanel::SetUpPSDBoard(){
} }
void DigiSettingsPanel::SetUpPSDChannel(){ void DigiSettingsPanel::SetUpChannel_PSD(){
QWidget * chAllSetting = new QWidget(this); QWidget * chAllSetting = new QWidget(this);
//chAllSetting->setStyleSheet("background-color: #ECECEC;"); //chAllSetting->setStyleSheet("background-color: #ECECEC;");
@ -1819,6 +1830,8 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QHBoxLayout * papa = new QHBoxLayout(jaja); QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft); papa->setAlignment(Qt::AlignLeft);
const unsigned short numChannel = digi[ID]->GetRegChannels();
{//^============================== Channel selection {//^============================== Channel selection
QLabel * lbChSel = new QLabel ("Ch : ", this); QLabel * lbChSel = new QLabel ("Ch : ", this);
lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight); lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight);
@ -1826,7 +1839,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
chSelection[ID] = new RComboBox(this); chSelection[ID] = new RComboBox(this);
chSelection[ID]->addItem("All Ch.", -1); chSelection[ID]->addItem("All Ch.", -1);
for( int i = 0; i < digi[ID]->GetNChannels(); i++) chSelection[ID]->addItem(QString::number(i), i); for( int i = 0; i < numChannel; i++) chSelection[ID]->addItem(QString::number(i), i);
papa->addWidget(chSelection[ID]); papa->addWidget(chSelection[ID]);
connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){ connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){
@ -1834,8 +1847,6 @@ void DigiSettingsPanel::SetUpPSDChannel(){
}); });
} }
const unsigned short maxNChannel = digi[ID]->GetNChannels();
{//*=============== input {//*=============== input
QGroupBox * inputBox = new QGroupBox("input Settings", this); QGroupBox * inputBox = new QGroupBox("input Settings", this);
allSettingLayout->addWidget(inputBox); allSettingLayout->addWidget(inputBox);
@ -1843,47 +1854,47 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QGridLayout * inputLayout = new QGridLayout(inputBox); QGridLayout * inputLayout = new QGridLayout(inputBox);
inputLayout->setSpacing(2); inputLayout->setSpacing(2);
SetUpSpinBox(sbRecordLength[ID][maxNChannel], "Record Length [G][ns] : ", inputLayout, 0, 0, DPP::RecordLength_G); SetUpSpinBox(sbRecordLength[ID][numChannel], "Record Length [G][ns] : ", inputLayout, 0, 0, DPP::RecordLength_G);
SetUpComboBox(cbDynamicRange[ID][maxNChannel], "Dynamic Range : ", inputLayout, 0, 2, DPP::InputDynamicRange); SetUpComboBox(cbDynamicRange[ID][numChannel], "Dynamic Range : ", inputLayout, 0, 2, DPP::InputDynamicRange);
SetUpSpinBox(sbPreTrigger[ID][maxNChannel], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::PreTrigger); SetUpSpinBox(sbPreTrigger[ID][numChannel], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::PreTrigger);
SetUpComboBoxBit(cbChargeSensitivity[ID][maxNChannel], "Charge Sensitivity : ", inputLayout, 1, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListChargeSensitivity_2Vpp, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::ChargeSensitivity); SetUpComboBoxBit(cbChargeSensitivity[ID][numChannel], "Charge Sensitivity : ", inputLayout, 1, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListChargeSensitivity_2Vpp, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::ChargeSensitivity);
SetUpSpinBox(sbDCOffset[ID][maxNChannel], "DC Offset [%] : ", inputLayout, 2, 0, DPP::ChannelDCOffset); SetUpSpinBox(sbDCOffset[ID][numChannel], "DC Offset [%] : ", inputLayout, 2, 0, DPP::ChannelDCOffset);
SetUpComboBoxBit(cbPolarity[ID][maxNChannel], "Polarity : ", inputLayout, 2, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListPolarity, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::Polarity); SetUpComboBoxBit(cbPolarity[ID][numChannel], "Polarity : ", inputLayout, 2, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListPolarity, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::Polarity);
SetUpCheckBox(chkChargePedestal[ID][maxNChannel], "Add Charge Pedestal", inputLayout, 3, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::ChargePedestal); SetUpCheckBox(chkChargePedestal[ID][numChannel], "Add Charge Pedestal", inputLayout, 3, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::ChargePedestal);
connect( cbDynamicRange[ID][maxNChannel], &RComboBox::currentTextChanged, this, [=](QString text){ connect( cbDynamicRange[ID][numChannel], &RComboBox::currentTextChanged, this, [=](QString text){
enableSignalSlot = false; enableSignalSlot = false;
int chargeIndex = cbChargeSensitivity[ID][maxNChannel]->currentIndex(); int chargeIndex = cbChargeSensitivity[ID][numChannel]->currentIndex();
cbChargeSensitivity[ID][maxNChannel]->clear(); cbChargeSensitivity[ID][numChannel]->clear();
cbChargeSensitivity[ID][maxNChannel]->addItem("", -999); cbChargeSensitivity[ID][numChannel]->addItem("", -999);
const std::vector<std::pair<std::string, unsigned int>> list = text.contains("0.5") ? DPP::Bit_DPPAlgorithmControl_PSD::ListChargeSensitivity_p5Vpp : DPP::Bit_DPPAlgorithmControl_PSD::ListChargeSensitivity_2Vpp; const std::vector<std::pair<std::string, unsigned int>> list = text.contains("0.5") ? DPP::Bit_DPPAlgorithmControl_PSD::ListChargeSensitivity_p5Vpp : DPP::Bit_DPPAlgorithmControl_PSD::ListChargeSensitivity_2Vpp;
for( int i = 0; i < (int) list.size(); i++) cbChargeSensitivity[ID][maxNChannel]->addItem(QString::fromStdString(list[i].first), list[i].second); for( int i = 0; i < (int) list.size(); i++) cbChargeSensitivity[ID][numChannel]->addItem(QString::fromStdString(list[i].first), list[i].second);
cbChargeSensitivity[ID][maxNChannel]->setCurrentIndex(chargeIndex); cbChargeSensitivity[ID][numChannel]->setCurrentIndex(chargeIndex);
enableSignalSlot = true; enableSignalSlot = true;
}); });
SetUpSpinBox(sbFixedBaseline[ID][maxNChannel], "Fixed Baseline : ", inputLayout, 3, 2, DPP::PSD::FixedBaseline); SetUpSpinBox(sbFixedBaseline[ID][numChannel], "Fixed Baseline : ", inputLayout, 3, 2, DPP::PSD::FixedBaseline);
SetUpCheckBox(chkBaseLineCal[ID][maxNChannel], "Baseline ReCal.", inputLayout, 4, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::BaselineCal); SetUpCheckBox(chkBaseLineCal[ID][numChannel], "Baseline ReCal.", inputLayout, 4, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::BaselineCal);
SetUpComboBoxBit(cbBaseLineAvg[ID][maxNChannel], "Baseline Avg. : ", inputLayout, 4, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListBaselineAvg, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::BaselineAvg); SetUpComboBoxBit(cbBaseLineAvg[ID][numChannel], "Baseline Avg. : ", inputLayout, 4, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListBaselineAvg, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::BaselineAvg);
connect(cbBaseLineAvg[ID][maxNChannel], &RComboBox::currentIndexChanged, this, [=](){ connect(cbBaseLineAvg[ID][numChannel], &RComboBox::currentIndexChanged, this, [=](){
sbFixedBaseline[ID][maxNChannel]->setEnabled( cbBaseLineAvg[ID][maxNChannel]->currentData().toInt() == 0); sbFixedBaseline[ID][numChannel]->setEnabled( cbBaseLineAvg[ID][numChannel]->currentData().toInt() == 0);
}); });
SetUpCheckBox(chkDiscardQLong[ID][maxNChannel], "Discard QLong < QThr.", inputLayout, 5, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DiscardQLongSmallerQThreshold); SetUpCheckBox(chkDiscardQLong[ID][numChannel], "Discard QLong < QThr.", inputLayout, 5, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DiscardQLongSmallerQThreshold);
SetUpSpinBox(sbChargeZeroSupZero[ID][maxNChannel], "Q-Threshold : ", inputLayout, 5, 2, DPP::PSD::ChargeZeroSuppressionThreshold); SetUpSpinBox(sbChargeZeroSupZero[ID][numChannel], "Q-Threshold : ", inputLayout, 5, 2, DPP::PSD::ChargeZeroSuppressionThreshold);
SetUpSpinBox(sbPSDCutThreshold[ID][maxNChannel], "PSD Cut Threshold : ", inputLayout, 6, 0, DPP::PSD::ThresholdForPSDCut); SetUpSpinBox(sbPSDCutThreshold[ID][numChannel], "PSD Cut Threshold : ", inputLayout, 6, 0, DPP::PSD::ThresholdForPSDCut);
SetUpCheckBox(chkCutBelow[ID][maxNChannel], "Cut Below Thr.", inputLayout, 7, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutBelow); SetUpCheckBox(chkCutBelow[ID][numChannel], "Cut Below Thr.", inputLayout, 7, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutBelow);
SetUpCheckBox(chkCutAbove[ID][maxNChannel], "Cut Above Thr.", inputLayout, 7, 2, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutAbove); SetUpCheckBox(chkCutAbove[ID][numChannel], "Cut Above Thr.", inputLayout, 7, 2, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutAbove);
SetUpCheckBox(chkRejOverRange[ID][maxNChannel], "Rej. Over-Range ", inputLayout, 7, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::RejectOverRange); SetUpCheckBox(chkRejOverRange[ID][numChannel], "Rej. Over-Range ", inputLayout, 7, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::RejectOverRange);
} }
@ -1894,25 +1905,25 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QGridLayout * trigLayout = new QGridLayout(trigBox); QGridLayout * trigLayout = new QGridLayout(trigBox);
trigLayout->setSpacing(2); trigLayout->setSpacing(2);
SetUpCheckBox(chkDisableOppositePulse[ID][maxNChannel], "Disable 0-Xing inhibit from opp. pulse", trigLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DisableOppositePolarityInhibitZeroCrossingOnCFD, -1, 2); SetUpCheckBox(chkDisableOppositePulse[ID][numChannel], "Disable 0-Xing inhibit from opp. pulse", trigLayout, 0, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DisableOppositePolarityInhibitZeroCrossingOnCFD, -1, 2);
SetUpCheckBox(chkDisableSelfTrigger[ID][maxNChannel], "Disable Self Trigger ", trigLayout, 0, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DisableSelfTrigger); SetUpCheckBox(chkDisableSelfTrigger[ID][numChannel], "Disable Self Trigger ", trigLayout, 0, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DisableSelfTrigger);
SetUpCheckBox(chkRejPileUp[ID][maxNChannel], "Rej. Pile-Up ", trigLayout, 1, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::RejectPileup); SetUpCheckBox(chkRejPileUp[ID][numChannel], "Rej. Pile-Up ", trigLayout, 1, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::RejectPileup);
SetUpCheckBox(chkPileUpInGate[ID][maxNChannel], "Pile-Up in Gate", trigLayout, 1, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::PileupWithinGate); SetUpCheckBox(chkPileUpInGate[ID][numChannel], "Pile-Up in Gate", trigLayout, 1, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::PileupWithinGate);
SetUpCheckBox(chkDisableTriggerHysteresis[ID][maxNChannel], "Disbale Trig. Hysteresis ", trigLayout, 2, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DisableTriggerHysteresis, -1, 2); SetUpCheckBox(chkDisableTriggerHysteresis[ID][numChannel], "Disbale Trig. Hysteresis ", trigLayout, 2, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DisableTriggerHysteresis, -1, 2);
SetUpSpinBox(sbThreshold[ID][maxNChannel], "Threshold [LSB] : ", trigLayout, 2, 2, DPP::PSD::TriggerThreshold); SetUpSpinBox(sbThreshold[ID][numChannel], "Threshold [LSB] : ", trigLayout, 2, 2, DPP::PSD::TriggerThreshold);
SetUpComboBoxBit(cbLocalTriggerValid[ID][maxNChannel], "Local Trig. Valid. [G] : ", trigLayout, 3, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalTrigValidMode); SetUpComboBoxBit(cbLocalTriggerValid[ID][numChannel], "Local Trig. Valid. [G] : ", trigLayout, 3, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalTrigValidMode);
SetUpComboBoxBit(cbTrigMode[ID][maxNChannel], "Trig Mode : ", trigLayout, 3, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TriggerMode); SetUpComboBoxBit(cbTrigMode[ID][numChannel], "Trig Mode : ", trigLayout, 3, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TriggerMode);
SetUpComboBoxBit(cbAdditionLocalTrigValid[ID][maxNChannel], "Local Trig. Valid. Opt [G] : ", trigLayout, 4, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListAdditionLocalTrigValid, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::AdditionLocalTrigValid); SetUpComboBoxBit(cbAdditionLocalTrigValid[ID][numChannel], "Local Trig. Valid. Opt [G] : ", trigLayout, 4, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListAdditionLocalTrigValid, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::AdditionLocalTrigValid);
SetUpSpinBox(sbTriggerHoldOff[ID][maxNChannel], "Tigger Hold-off [ns] : ", trigLayout, 4, 2, DPP::PSD::TriggerHoldOffWidth); SetUpSpinBox(sbTriggerHoldOff[ID][numChannel], "Tigger Hold-off [ns] : ", trigLayout, 4, 2, DPP::PSD::TriggerHoldOffWidth);
SetUpComboBoxBit(cbLocalShapedTrigger[ID][maxNChannel], "Local Shaped Trig. [G] : ", trigLayout, 5, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1); SetUpComboBoxBit(cbLocalShapedTrigger[ID][numChannel], "Local Shaped Trig. [G] : ", trigLayout, 5, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1);
SetUpComboBoxBit(cbDiscriMode[ID][maxNChannel], "Discri. Mode : ", trigLayout, 5, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListDiscriminationMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DiscriminationMode); SetUpComboBoxBit(cbDiscriMode[ID][numChannel], "Discri. Mode : ", trigLayout, 5, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListDiscriminationMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::DiscriminationMode);
SetUpComboBoxBit(cbTrigCount[ID][maxNChannel], "Trig. Counter Flag [G] : ", trigLayout, 6, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::TriggerCounterFlag); SetUpComboBoxBit(cbTrigCount[ID][numChannel], "Trig. Counter Flag [G] : ", trigLayout, 6, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::TriggerCounterFlag);
SetUpSpinBox(sbShapedTrigWidth[ID][maxNChannel], "Shaped Trig. Width [ns] : ", trigLayout, 6, 2, DPP::PSD::ShapedTriggerWidth); SetUpSpinBox(sbShapedTrigWidth[ID][numChannel], "Shaped Trig. Width [ns] : ", trigLayout, 6, 2, DPP::PSD::ShapedTriggerWidth);
SetUpComboBoxBit(cbTriggerOpt[ID][maxNChannel], "Trigger Count opt : ", trigLayout, 7, 0, DPP::Bit_DPPAlgorithmControl_PSD::ListTriggerCountOpt, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TriggerCountOpt, 1); SetUpComboBoxBit(cbTriggerOpt[ID][numChannel], "Trigger Count opt : ", trigLayout, 7, 0, DPP::Bit_DPPAlgorithmControl_PSD::ListTriggerCountOpt, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TriggerCountOpt, 1);
SetUpSpinBox(sbTriggerLatency[ID][maxNChannel], "Trigger Latency [ns] : ", trigLayout, 7, 2, DPP::PSD::TriggerLatency); SetUpSpinBox(sbTriggerLatency[ID][numChannel], "Trigger Latency [ns] : ", trigLayout, 7, 2, DPP::PSD::TriggerLatency);
} }
{//*===================== PSD {//*===================== PSD
@ -1922,16 +1933,16 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QGridLayout * trapLayout = new QGridLayout(trapBox); QGridLayout * trapLayout = new QGridLayout(trapBox);
trapLayout->setSpacing(2); trapLayout->setSpacing(2);
SetUpSpinBox(sbShortGate[ID][maxNChannel], "Short Gate [ns] : ", trapLayout, 1, 0, DPP::PSD::ShortGateWidth); SetUpSpinBox(sbShortGate[ID][numChannel], "Short Gate [ns] : ", trapLayout, 1, 0, DPP::PSD::ShortGateWidth);
SetUpSpinBox(sbLongGate[ID][maxNChannel], "Long Gate [ns] : ", trapLayout, 1, 2, DPP::PSD::LongGateWidth); SetUpSpinBox(sbLongGate[ID][numChannel], "Long Gate [ns] : ", trapLayout, 1, 2, DPP::PSD::LongGateWidth);
SetUpSpinBox(sbGateOffset[ID][maxNChannel], "Gate Offset [ns] : ", trapLayout, 2, 0, DPP::PSD::GateOffset); SetUpSpinBox(sbGateOffset[ID][numChannel], "Gate Offset [ns] : ", trapLayout, 2, 0, DPP::PSD::GateOffset);
SetUpSpinBox(sbPURGAPThreshold[ID][maxNChannel], "PUR-GAP Threshold : ", trapLayout, 3, 0, DPP::PSD::PurGapThreshold); SetUpSpinBox(sbPURGAPThreshold[ID][numChannel], "PUR-GAP Threshold : ", trapLayout, 3, 0, DPP::PSD::PurGapThreshold);
SetUpComboBoxBit(cbSmoothedChargeIntegration[ID][maxNChannel], "Smooth Q-integr. [G] : ", trapLayout, 3, 2, DPP::PSD::Bit_DPPAlgorithmControl2::ListSmoothedChargeIntegration, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::SmoothedChargeIntegration, 1, 1); SetUpComboBoxBit(cbSmoothedChargeIntegration[ID][numChannel], "Smooth Q-integr. [G] : ", trapLayout, 3, 2, DPP::PSD::Bit_DPPAlgorithmControl2::ListSmoothedChargeIntegration, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::SmoothedChargeIntegration, 1, 1);
SetUpSpinBox(sbCFDDely[ID][maxNChannel], "CFD Delay [ns] : ", trapLayout, 4, 0, DPP::PSD::CFDSetting); SetUpSpinBox(sbCFDDely[ID][numChannel], "CFD Delay [ns] : ", trapLayout, 4, 0, DPP::PSD::CFDSetting);
SetUpComboBoxBit(cbCFDFraction[ID][maxNChannel], "CFD Fraction : ", trapLayout, 4, 2, DPP::PSD::Bit_CFDSetting::ListCFDFraction, DPP::PSD::CFDSetting, DPP::PSD::Bit_CFDSetting::CFDFraction, 1); SetUpComboBoxBit(cbCFDFraction[ID][numChannel], "CFD Fraction : ", trapLayout, 4, 2, DPP::PSD::Bit_CFDSetting::ListCFDFraction, DPP::PSD::CFDSetting, DPP::PSD::Bit_CFDSetting::CFDFraction, 1);
SetUpComboBoxBit(cbCFDInterpolation[ID][maxNChannel], "CFD interpolaton : ", trapLayout, 5, 0, DPP::PSD::Bit_CFDSetting::ListItepolation, DPP::PSD::CFDSetting, DPP::PSD::Bit_CFDSetting::Interpolation, 3); SetUpComboBoxBit(cbCFDInterpolation[ID][numChannel], "CFD interpolaton : ", trapLayout, 5, 0, DPP::PSD::Bit_CFDSetting::ListItepolation, DPP::PSD::CFDSetting, DPP::PSD::Bit_CFDSetting::Interpolation, 3);
} }
@ -1942,26 +1953,26 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QGridLayout * otherLayout = new QGridLayout(otherBox); QGridLayout * otherLayout = new QGridLayout(otherBox);
otherLayout->setSpacing(2); otherLayout->setSpacing(2);
SetUpCheckBox(chkMarkSaturation[ID][maxNChannel], "Mark Saturation Pulse [G]", otherLayout, 0, 0, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::MarkSaturation, -1, 2); SetUpCheckBox(chkMarkSaturation[ID][numChannel], "Mark Saturation Pulse [G]", otherLayout, 0, 0, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::MarkSaturation, -1, 2);
SetUpCheckBox(chkResetTimestampByTRGIN[ID][maxNChannel], "TRI-IN Reset Timestamp [G]", otherLayout, 0, 2, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ResetTimestampByTRGIN, -1, 2); SetUpCheckBox(chkResetTimestampByTRGIN[ID][numChannel], "TRI-IN Reset Timestamp [G]", otherLayout, 0, 2, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ResetTimestampByTRGIN, -1, 2);
SetUpCheckBox(chkTestPule[ID][maxNChannel], "Int. Test Pulse", otherLayout, 1, 0, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::InternalTestPulse); SetUpCheckBox(chkTestPule[ID][numChannel], "Int. Test Pulse", otherLayout, 1, 0, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::InternalTestPulse);
if( digi[ID]->GetBoardInfo().Model == CAEN_DGTZ_V1730 ){ if( digi[ID]->GetBoardInfo().Model == CAEN_DGTZ_V1730 ){
SetUpComboBoxBit(cbTestPulseRate[ID][maxNChannel], "Test Pulse Rate : ", otherLayout, 1, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListTestPulseRate_730, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TestPulseRate); SetUpComboBoxBit(cbTestPulseRate[ID][numChannel], "Test Pulse Rate : ", otherLayout, 1, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListTestPulseRate_730, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TestPulseRate);
} }
if( digi[ID]->GetBoardInfo().Model == CAEN_DGTZ_V1725 ){ if( digi[ID]->GetBoardInfo().Model == CAEN_DGTZ_V1725 ){
SetUpComboBoxBit(cbTestPulseRate[ID][maxNChannel], "Test Pulse Rate : ", otherLayout, 1, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListTestPulseRate_725, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TestPulseRate); SetUpComboBoxBit(cbTestPulseRate[ID][numChannel], "Test Pulse Rate : ", otherLayout, 1, 2, DPP::Bit_DPPAlgorithmControl_PSD::ListTestPulseRate_725, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::TestPulseRate);
} }
SetUpComboBoxBit(cbExtra2Option[ID][maxNChannel], "Extra word Option [G] : ", otherLayout, 2, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListExtraWordOpt, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ExtraWordOption, 3); SetUpComboBoxBit(cbExtra2Option[ID][numChannel], "Extra word Option [G] : ", otherLayout, 2, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListExtraWordOpt, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ExtraWordOption, 3);
SetUpSpinBox(sbNumEventAgg[ID][maxNChannel], "Events per Agg. [G] : ", otherLayout, 3, 0, DPP::NumberEventsPerAggregate_G); SetUpSpinBox(sbNumEventAgg[ID][numChannel], "Events per Agg. [G] : ", otherLayout, 3, 0, DPP::NumberEventsPerAggregate_G);
SetUpComboBoxBit(cbVetoSource[ID][maxNChannel], "Veto Source [G] : ", otherLayout, 5, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListVetoSource, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::VetoSource); SetUpComboBoxBit(cbVetoSource[ID][numChannel], "Veto Source [G] : ", otherLayout, 5, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListVetoSource, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::VetoSource);
SetUpComboBoxBit(cbVetoMode[ID][maxNChannel], "Veto Mode [G] : ", otherLayout, 5, 2, DPP::PSD::Bit_DPPAlgorithmControl2::ListVetoMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::VetoMode); SetUpComboBoxBit(cbVetoMode[ID][numChannel], "Veto Mode [G] : ", otherLayout, 5, 2, DPP::PSD::Bit_DPPAlgorithmControl2::ListVetoMode, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::VetoMode);
SetUpSpinBox(sbVetoWidth[ID][maxNChannel], "Veto Width : ", otherLayout, 6, 0, DPP::VetoWidth); SetUpSpinBox(sbVetoWidth[ID][numChannel], "Veto Width : ", otherLayout, 6, 0, DPP::VetoWidth);
SetUpComboBoxBit(cbVetoStep[ID][maxNChannel], "Veto Step : ", otherLayout, 6, 2, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 1); SetUpComboBoxBit(cbVetoStep[ID][numChannel], "Veto Step : ", otherLayout, 6, 2, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 1);
SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][maxNChannel], "TRG-OUT Ch. Prb. [G] : ", otherLayout, 7, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ChannelProbe); SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][numChannel], "TRG-OUT Ch. Prb. [G] : ", otherLayout, 7, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ChannelProbe);
} }
{//^================== status {//^================== status
@ -1975,7 +1986,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QStringList chStatusInfo = {"SPI bus is busy.", "ADC Calibration is done.", "ADC shutdown, over-heat"}; QStringList chStatusInfo = {"SPI bus is busy.", "ADC Calibration is done.", "ADC shutdown, over-heat"};
for( int i = 0; i < maxNChannel; i++){ for( int i = 0; i < numChannel; i++){
QLabel * lbChID = new QLabel (QString::number(i), this); QLabel * lbChID = new QLabel (QString::number(i), this);
lbChID->setAlignment(Qt::AlignRight | Qt::AlignCenter); lbChID->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -1996,7 +2007,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
} }
QPushButton * bnADCCali = new QPushButton("ADC Calibration", this); QPushButton * bnADCCali = new QPushButton("ADC Calibration", this);
statusLayout->addWidget(bnADCCali, maxNChannel + 1, 0, 1, 5); statusLayout->addWidget(bnADCCali, numChannel + 1, 0, 1, 5);
if( QString::fromStdString(digi[ID]->GetModelName()).contains("25") || QString::fromStdString(digi[ID]->GetModelName()).contains("30") ){ if( QString::fromStdString(digi[ID]->GetModelName()).contains("25") || QString::fromStdString(digi[ID]->GetModelName()).contains("30") ){
bnADCCali->setEnabled(false); bnADCCali->setEnabled(false);
@ -2004,7 +2015,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
connect(bnADCCali, &QPushButton::clicked, this, [=](){ connect(bnADCCali, &QPushButton::clicked, this, [=](){
digi[ID]->WriteRegister(DPP::ADCCalibration_W, 1); digi[ID]->WriteRegister(DPP::ADCCalibration_W, 1);
for( int i = 0 ; i < digi[ID]->GetNChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); for( int i = 0 ; i < digi[ID]->GetRegChannels(); i++ ) digi[ID]->ReadRegister(DPP::ChannelStatus_R, i);
UpdatePanelFromMemory(); UpdatePanelFromMemory();
}); });
} }
@ -2032,7 +2043,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -2069,7 +2080,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QLabel * lb1 = new QLabel("PSD Cut Threshold", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 2); QLabel * lb1 = new QLabel("PSD Cut Threshold", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 2);
} }
SetUpSpinBox(sbPSDCutThreshold[ID][ch], "", tabLayout, ch + 1, 1, DPP::PSD::ThresholdForPSDCut, ch); SetUpSpinBox(sbPSDCutThreshold[ID][ch], "", tabLayout, ch + 1, 1, DPP::PSD::ThresholdForPSDCut, ch);
SetUpCheckBox(chkCutBelow[ID][ch], "Cut Below Thr. ", tabLayout, ch + 1, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutBelow, ch); SetUpCheckBox(chkCutBelow[ID][ch], "Cut Below Thr. ", tabLayout, ch + 1, 3, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutBelow, ch);
SetUpCheckBox(chkCutAbove[ID][ch], "Cut Above Thr. ", tabLayout, ch + 1, 4, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutAbove, ch); SetUpCheckBox(chkCutAbove[ID][ch], "Cut Above Thr. ", tabLayout, ch + 1, 4, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::EnablePSDCutAbove, ch);
SetUpCheckBox(chkRejOverRange[ID][ch], "Rej. Over-Range ", tabLayout, ch + 1, 5, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::RejectOverRange, ch); SetUpCheckBox(chkRejOverRange[ID][ch], "Rej. Over-Range ", tabLayout, ch + 1, 5, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PSD::RejectOverRange, ch);
@ -2143,7 +2154,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
chid->setFixedWidth(20); chid->setFixedWidth(20);
@ -2226,7 +2237,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
@ -2294,7 +2305,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0); QLabel * lb0 = new QLabel("Ch.", this); lb0->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb0, 0, 0);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch++){
QLabel * chid = new QLabel(QString::number(ch), this); QLabel * chid = new QLabel(QString::number(ch), this);
chid->setAlignment(Qt::AlignRight | Qt::AlignCenter); chid->setAlignment(Qt::AlignRight | Qt::AlignCenter);
chid->setFixedWidth(20); chid->setFixedWidth(20);
@ -2349,6 +2360,122 @@ void DigiSettingsPanel::SetUpPSDChannel(){
} }
}
//&###########################################################
void DigiSettingsPanel::SetUpBoard_QDC(){
printf("============== %s \n", __func__);
SetUpCheckBox(chkTraceRecording[ID], "Record Trace ", bdCfgLayout[ID], 1, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace);
SetUpCheckBox(chkEnableExtra2[ID], "Enable Extra ", bdCfgLayout[ID], 2, 0, DPP::BoardConfiguration, DPP::Bit_BoardConfig::EnableExtra2);
SetUpComboBoxBit(cbAnaProbe1[ID], "Ana. Probe ", bdCfgLayout[ID], 3, 0, DPP::Bit_BoardConfig::ListAnaProbe_QDC, DPP::BoardConfiguration, DPP::Bit_BoardConfig::AnalogProbe1, 1, 0);
SetUpComboBoxBit(cbExtTriggerMode[ID], "Ext. Trig. Mode ", bdCfgLayout[ID], 4, 0, DPP::Bit_BoardConfig::ListExtTriggerMode_QDC, DPP::BoardConfiguration, DPP::Bit_BoardConfig::ExtTriggerMode_QDC, 1, 0);
SetUpSpinBox(sbRecordLength_QDC[ID], "Record Length [ns] ", bdCfgLayout[ID], 5, 0, DPP::QDC::RecordLength);
SetUpSpinBox(sbEventPreAgg_QDC[ID], "Event pre Agg. ", bdCfgLayout[ID], 6, 0, DPP::QDC::NumberEventsPerAggregate);
}
void DigiSettingsPanel::SetUpChannel_QDC(){
QWidget * chAllSetting = new QWidget(this);
//chAllSetting->setStyleSheet("background-color: #ECECEC;");
chTab->addTab(chAllSetting, "Group Settings");
QWidget * chStatus = new QWidget(this);
//chStatus->setStyleSheet("background-color: #ECECEC;");
chTab->addTab(chStatus, "Status");
QWidget * chInput = new QWidget(this);
chTab->addTab(chInput, "Input");
QWidget * chTrig = new QWidget(this);
chTab->addTab(chTrig, "Trigger");
QWidget * chTrap = new QWidget(this);
chTab->addTab(chTrap, "QDC");
QWidget * chOthers = new QWidget(this);
chTab->addTab(chOthers, "Others");
//^======================== All Group
QVBoxLayout * allSettingLayout = new QVBoxLayout(chAllSetting);
allSettingLayout->setAlignment(Qt::AlignTop);
allSettingLayout->setSpacing(2);
QWidget * jaja = new QWidget(this);
allSettingLayout->addWidget(jaja);
QHBoxLayout * papa = new QHBoxLayout(jaja);
papa->setAlignment(Qt::AlignLeft);
const unsigned short numGroup = digi[ID]->GetNCoupledCh();
{//^============================== Group selection
QLabel * lbChSel = new QLabel ("Group : ", this);
lbChSel->setAlignment(Qt::AlignCenter | Qt::AlignRight);
papa->addWidget(lbChSel);
chSelection[ID] = new RComboBox(this);
chSelection[ID]->addItem("All Grp.", -1);
for( int i = 0; i < numGroup; i++) chSelection[ID]->addItem(QString::number(i), i);
papa->addWidget(chSelection[ID]);
connect(chSelection[ID], &RComboBox::currentIndexChanged, this, [=](){
SyncAllChannelsTab_QDC();
});
}
{//*=============== input
QGroupBox * inputBox = new QGroupBox("input Settings", this);
allSettingLayout->addWidget(inputBox);
QGridLayout * inputLayout = new QGridLayout(inputBox);
inputLayout->setSpacing(2);
SetUpSpinBox(sbPreTrigger[ID][numGroup], "Pre-Trigger [ns] : ", inputLayout, 1, 0, DPP::QDC::PreTrigger_G);
SetUpSpinBox(sbDCOffset[ID][numGroup], "DC Offset [%] : ", inputLayout, 2, 0, DPP::QDC::DCOffset_G);
SetUpComboBoxBit(cbPolarity[ID][numGroup], "Polarity : ", inputLayout, 2, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::Polarity);
SetUpSpinBox(sbFixedBaseline[ID][numGroup], "Fixed Baseline : ", inputLayout, 3, 2, DPP::QDC::FixedBaseline_G);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 4, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg);
connect(cbBaseLineAvg[ID][numGroup], &RComboBox::currentIndexChanged, this, [=](){
sbFixedBaseline[ID][numGroup]->setEnabled( cbBaseLineAvg[ID][numGroup]->currentData().toInt() == 0);
});
SetUpSpinBox(sbShortGate[ID][numGroup], "Gate Width [ns] : ", inputLayout, 5, 0, DPP::QDC::GateWidth_G);
SetUpSpinBox(sbGateOffset[ID][numGroup], "Gate Offset [ns] : ", inputLayout, 6, 0, DPP::QDC::GateOffset_G);
SetUpSpinBox(sbTriggerHoldOff[ID][numGroup], "Trig. Holdoff [ns] : ", inputLayout, 7, 0, DPP::QDC::TriggerHoldOffWidth_G);
SetUpSpinBox(sbShapedTrigWidth[ID][numGroup], "Trig. Out Width [ns] : ", inputLayout, 8, 0, DPP::QDC::TRGOUTWidth_G);
SetUpCheckBox(chkOverthreshold[ID][numGroup], "Enable OverThreshold Width ", inputLayout, 9, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::OverThresholdWitdhEnable);
SetUpSpinBox(sbOverThresholdWidth[ID][numGroup], "OverThreshold Width [ns] : ", inputLayout, 9, 2, DPP::QDC::OverThresholdWidth_G);
SetUpComboBoxBit(cbChargeSensitivity[ID][numGroup], "Charge Sen. : ", inputLayout, 10, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListChargeSensitivity, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::ChargeSensitivity);
SetUpCheckBox(chkTestPule[ID][numGroup], "Int. Test Pulse", inputLayout, 11, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse);
SetUpComboBoxBit(cbTestPulseRate[ID][numGroup], "Test Pulse Rate : ", inputLayout, 11, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 12, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
SetUpComboBoxBit(cbTrigMode[ID][numGroup], "Trig. Mode : ", inputLayout, 13, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListTrigMode, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::TriggerMode);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 14, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg);
SetUpCheckBox(chkDisableSelfTrigger[ID][numGroup], "Disable Self Trigger ", inputLayout, 15, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::DisableSelfTrigger);
SetUpCheckBox(chkDisableTriggerHysteresis[ID][numGroup], "Disbale Trig. Hysteresis ", inputLayout, 16, 0, DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::Bit_DPPAlgorithmControl::DisableTriggerHysteresis, -1, 2);
//Trigger Thredhold
//DC offset
}
} }
//&########################################################### //&###########################################################
@ -2408,7 +2535,7 @@ void DigiSettingsPanel::UpdateBoardAndChannelsStatus(){
} }
//*========================================== Channel Status //*========================================== Channel Status
for( int i = 0; i < digi[ID]->GetNChannels(); i++){ for( int i = 0; i < digi[ID]->GetRegChannels(); i++){
uint32_t chStatus = digi[ID]->ReadRegister(DPP::ChannelStatus_R, i); uint32_t chStatus = digi[ID]->ReadRegister(DPP::ChannelStatus_R, i);
bnChStatus[ID][i][0]->setStyleSheet( ( (chStatus >> 2 ) & 0x1 ) ? "background-color: red;" : ""); bnChStatus[ID][i][0]->setStyleSheet( ( (chStatus >> 2 ) & 0x1 ) ? "background-color: red;" : "");
@ -2431,12 +2558,15 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
//*======================================== //*========================================
uint32_t BdCfg = digi[ID]->GetSettingFromMemory(DPP::BoardConfiguration); uint32_t BdCfg = digi[ID]->GetSettingFromMemory(DPP::BoardConfiguration);
chkAutoDataFlush[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableAutoDataFlush) );
chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::TrigPropagation) );
chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::RecordTrace) ); chkTraceRecording[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::RecordTrace) );
chkEnableExtra2[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableExtra2) ); chkEnableExtra2[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableExtra2) );
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE || digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ){
chkAutoDataFlush[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::EnableAutoDataFlush) );
chkTrigPropagation[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::TrigPropagation) );
}
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) { if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) {
chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DecimateTrace) ); chkDecimateTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DecimateTrace) );
chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DualTrace) ); chkDualTrace[ID]->setChecked( Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::DualTrace) );
@ -2497,9 +2627,27 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
} }
} }
} }
if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ) {
int temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::AnalogProbe1);
for( int i = 0; i < cbAnaProbe1[ID]->count(); i++){
if( cbAnaProbe1[ID]->itemData(i).toInt() == temp) {
cbAnaProbe1[ID]->setCurrentIndex(i);
break;
}
}
temp = Digitizer::ExtractBits(BdCfg, DPP::Bit_BoardConfig::ExtTriggerMode_QDC);
for( int i = 0; i < cbExtTriggerMode[ID]->count(); i++){
if( cbExtTriggerMode[ID]->itemData(i).toInt() == temp) {
cbExtTriggerMode[ID]->setCurrentIndex(i);
break;
}
}
}
//*======================================== //*========================================
uint32_t chMask = digi[ID]->GetSettingFromMemory(DPP::ChannelEnableMask); uint32_t chMask = digi[ID]->GetSettingFromMemory(DPP::ChannelEnableMask);
for( int i = 0; i < digi[ID]->GetNChannels(); i++){ for( int i = 0; i < digi[ID]->GetRegChannels(); i++){
if( (chMask >> i ) & 0x1 ) { if( (chMask >> i ) & 0x1 ) {
bnChEnableMask[ID][i]->setStyleSheet("background-color: green;"); bnChEnableMask[ID][i]->setStyleSheet("background-color: green;");
}else{ }else{
@ -2566,16 +2714,18 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
//*======================================== //*========================================
uint32_t glbTrgMask = digi[ID]->GetSettingFromMemory(DPP::GlobalTriggerMask); uint32_t glbTrgMask = digi[ID]->GetSettingFromMemory(DPP::GlobalTriggerMask);
for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){ if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE || digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ){
if( (glbTrgMask >> i ) & 0x1 ){ for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){
bnGlobalTriggerMask[ID][i]->setStyleSheet("background-color: green;"); if( (glbTrgMask >> i ) & 0x1 ){
}else{ bnGlobalTriggerMask[ID][i]->setStyleSheet("background-color: green;");
bnGlobalTriggerMask[ID][i]->setStyleSheet(""); }else{
bnGlobalTriggerMask[ID][i]->setStyleSheet("");
}
} }
sbGlbMajLvl[ID]->setValue( Digitizer::ExtractBits(glbTrgMask, DPP::Bit_GlobalTriggerMask::MajorLevel) );
} }
sbGlbMajCoinWin[ID]->setValue( Digitizer::ExtractBits(glbTrgMask, DPP::Bit_GlobalTriggerMask::MajorCoinWin) ); sbGlbMajCoinWin[ID]->setValue( Digitizer::ExtractBits(glbTrgMask, DPP::Bit_GlobalTriggerMask::MajorCoinWin) );
sbGlbMajLvl[ID]->setValue( Digitizer::ExtractBits(glbTrgMask, DPP::Bit_GlobalTriggerMask::MajorLevel) );
cbGlbUseOtherTriggers[ID]->setCurrentIndex(Digitizer::ExtractBits(glbTrgMask, {2, 30})); cbGlbUseOtherTriggers[ID]->setCurrentIndex(Digitizer::ExtractBits(glbTrgMask, {2, 30}));
//*======================================== //*========================================
@ -2605,27 +2755,40 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
cbInterruptMode[ID]->setCurrentIndex(Digitizer::ExtractBits(readoutCtl, DPP::Bit_ReadoutControl::InterrupReleaseMode)); cbInterruptMode[ID]->setCurrentIndex(Digitizer::ExtractBits(readoutCtl, DPP::Bit_ReadoutControl::InterrupReleaseMode));
//*======================================== //*========================================
for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){ if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE || digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ){
uint32_t trigger = digi[ID]->GetSettingFromMemory(DPP::TriggerValidationMask_G, 2*i ); for( int i = 0; i < digi[ID]->GetNCoupledCh(); i++){
uint32_t trigger = digi[ID]->GetSettingFromMemory(DPP::TriggerValidationMask_G, 2*i );
cbMaskLogic[ID][i]->setCurrentIndex( (trigger >> 8 ) & 0x3 ); cbMaskLogic[ID][i]->setCurrentIndex( (trigger >> 8 ) & 0x3 );
chkMaskExtTrigger[ID][i]->setEnabled((((trigger >> 8 ) & 0x3) != 2)); chkMaskExtTrigger[ID][i]->setEnabled((((trigger >> 8 ) & 0x3) != 2));
sbMaskMajorLevel[ID][i]->setValue( ( trigger >> 10 ) & 0x3 ); sbMaskMajorLevel[ID][i]->setValue( ( trigger >> 10 ) & 0x3 );
chkMaskExtTrigger[ID][i]->setChecked( ( trigger >> 30 ) & 0x1 ); chkMaskExtTrigger[ID][i]->setChecked( ( trigger >> 30 ) & 0x1 );
chkMaskSWTrigger[ID][i]->setChecked( ( trigger >> 31 ) & 0x1 ); chkMaskSWTrigger[ID][i]->setChecked( ( trigger >> 31 ) & 0x1 );
for( int j = 0; j < digi[ID]->GetNCoupledCh(); j++){ for( int j = 0; j < digi[ID]->GetNCoupledCh(); j++){
if( ( trigger >> j ) & 0x1 ) { if( ( trigger >> j ) & 0x1 ) {
bnTriggerMask[ID][i][j]->setStyleSheet("background-color: green;"); bnTriggerMask[ID][i][j]->setStyleSheet("background-color: green;");
}else{ }else{
bnTriggerMask[ID][i][j]->setStyleSheet(""); bnTriggerMask[ID][i][j]->setStyleSheet("");
}
} }
} }
} }
//*======================================== QDC only
if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ){
uint32_t recordLength = digi[ID]->GetSettingFromMemory(DPP::QDC::RecordLength);
sbRecordLength_QDC[ID]->setValue(recordLength & 0xFFF);
uint32_t eventPreAgg = digi[ID]->GetSettingFromMemory(DPP::QDC::NumberEventsPerAggregate);
sbEventPreAgg_QDC[ID]->setValue(eventPreAgg & 0x3FF);
}
//*======================================== update channels/group setting
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) UpdateSettings_PHA(); if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) UpdateSettings_PHA();
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) UpdateSettings_PSD(); if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) UpdateSettings_PSD();
if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ) UpdateSettings_QDC();
enableSignalSlot = true; enableSignalSlot = true;
} }
@ -2684,10 +2847,10 @@ void DigiSettingsPanel::UpdateComboBoxBit(RComboBox * & cb, uint32_t fullBit, st
} }
void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxNChannels+1]){ void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxRegChannel+1]){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
const int nCh = digi[ID]->GetNChannels(); const int nCh = digi[ID]->GetRegChannels();
int ch = chSelection[ID]->currentData().toInt(); int ch = chSelection[ID]->currentData().toInt();
@ -2717,10 +2880,10 @@ void DigiSettingsPanel::SyncSpinBox(RSpinBox *(&spb)[][MaxNChannels+1]){
} }
void DigiSettingsPanel::SyncComboBox(RComboBox *(&cb)[][MaxNChannels+1]){ void DigiSettingsPanel::SyncComboBox(RComboBox *(&cb)[][MaxRegChannel+1]){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
const int nCh = digi[ID]->GetNChannels(); const int nCh = digi[ID]->GetRegChannels();
int ch = chSelection[ID]->currentData().toInt(); int ch = chSelection[ID]->currentData().toInt();
@ -2748,10 +2911,10 @@ void DigiSettingsPanel::SyncComboBox(RComboBox *(&cb)[][MaxNChannels+1]){
} }
} }
void DigiSettingsPanel::SyncCheckBox(QCheckBox *(&chk)[][MaxNChannels+1]){ void DigiSettingsPanel::SyncCheckBox(QCheckBox *(&chk)[][MaxRegChannel+1]){
if( !enableSignalSlot ) return; if( !enableSignalSlot ) return;
const int nCh = digi[ID]->GetNChannels(); const int nCh = digi[ID]->GetRegChannels();
int ch = chSelection[ID]->currentData().toInt(); int ch = chSelection[ID]->currentData().toInt();
if( ch >= 0 ){ if( ch >= 0 ){
enableSignalSlot = false; enableSignalSlot = false;
@ -2829,7 +2992,7 @@ void DigiSettingsPanel::UpdateSettings_PHA(){
//printf("------ %s \n", __func__); //printf("------ %s \n", __func__);
for( int ch = 0; ch < digi[ID]->GetNChannels(); ch ++){ for( int ch = 0; ch < digi[ID]->GetRegChannels(); ch ++){
UpdateSpinBox(sbRecordLength[ID][ch], DPP::RecordLength_G, ch); UpdateSpinBox(sbRecordLength[ID][ch], DPP::RecordLength_G, ch);
UpdateSpinBox(sbPreTrigger[ID][ch], DPP::PreTrigger, ch); UpdateSpinBox(sbPreTrigger[ID][ch], DPP::PreTrigger, ch);
UpdateSpinBox(sbInputRiseTime[ID][ch], DPP::PHA::InputRiseTime, ch); UpdateSpinBox(sbInputRiseTime[ID][ch], DPP::PHA::InputRiseTime, ch);
@ -2956,7 +3119,7 @@ void DigiSettingsPanel::UpdateSettings_PSD(){
// printf("------ %s \n", __func__); // printf("------ %s \n", __func__);
for(int ch = 0; ch < digi[ID]->GetNChannels(); ch ++){ for(int ch = 0; ch < digi[ID]->GetRegChannels(); ch ++){
UpdateSpinBox(sbRecordLength[ID][ch], DPP::RecordLength_G, ch); UpdateSpinBox(sbRecordLength[ID][ch], DPP::RecordLength_G, ch);
UpdateSpinBox(sbPreTrigger[ID][ch], DPP::PreTrigger, ch); UpdateSpinBox(sbPreTrigger[ID][ch], DPP::PreTrigger, ch);
@ -3045,9 +3208,9 @@ void DigiSettingsPanel::CheckRadioAndCheckedButtons(){
int id1 = cbFromBoard->currentIndex(); int id1 = cbFromBoard->currentIndex();
int id2 = cbToBoard->currentIndex(); int id2 = cbToBoard->currentIndex();
for( int i = 0 ; i < MaxNChannels; i++){ for( int i = 0 ; i < MaxRegChannel; i++){
if( i >= digi[id1]->GetNChannels() ) rbCh[i]->setEnabled(false); if( i >= digi[id1]->GetRegChannels() ) rbCh[i]->setEnabled(false);
if( i >= digi[id2]->GetNChannels() ) chkCh[i]->setEnabled(false); if( i >= digi[id2]->GetRegChannels() ) chkCh[i]->setEnabled(false);
} }
if( digi[id1]->GetDPPType() != digi[id2]->GetDPPType() ){ if( digi[id1]->GetDPPType() != digi[id2]->GetDPPType() ){
@ -3063,18 +3226,18 @@ void DigiSettingsPanel::CheckRadioAndCheckedButtons(){
} }
int chFromIndex = -1; int chFromIndex = -1;
for( int i = 0 ; i < digi[id1]->GetNChannels() ; i++){ for( int i = 0 ; i < digi[id1]->GetRegChannels() ; i++){
if( rbCh[i]->isChecked() && cbFromBoard->currentIndex() == cbToBoard->currentIndex()){ if( rbCh[i]->isChecked() && cbFromBoard->currentIndex() == cbToBoard->currentIndex()){
chFromIndex = i; chFromIndex = i;
chkCh[i]->setChecked(false); chkCh[i]->setChecked(false);
} }
} }
for( int i = 0 ; i < digi[id1]->GetNChannels() ; i++) chkCh[i]->setEnabled(true); for( int i = 0 ; i < digi[id1]->GetRegChannels() ; i++) chkCh[i]->setEnabled(true);
if( chFromIndex >= 0 && cbFromBoard->currentIndex() == cbToBoard->currentIndex() ) chkCh[chFromIndex]->setEnabled(false); if( chFromIndex >= 0 && cbFromBoard->currentIndex() == cbToBoard->currentIndex() ) chkCh[chFromIndex]->setEnabled(false);
bool isToIndexCleicked = false; bool isToIndexCleicked = false;
for( int i = 0 ; i < digi[id1]->GetNChannels() ; i++){ for( int i = 0 ; i < digi[id1]->GetRegChannels() ; i++){
if( chkCh[i]->isChecked() ){ if( chkCh[i]->isChecked() ){
isToIndexCleicked = true; isToIndexCleicked = true;
} }

View File

@ -47,19 +47,22 @@ private:
void SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * & gLayout); void SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * & gLayout);
void SetUpInquiryCopyTab(); void SetUpInquiryCopyTab();
void SetUpPHABoard(); void SetUpBoard_PHA();
void SetUpPHAChannel(); void SetUpChannel_PHA();
void SetUpPSDBoard(); void SetUpBoard_PSD();
void SetUpPSDChannel(); void SetUpChannel_PSD();
void SetUpBoard_QDC();
void SetUpChannel_QDC();
void UpdateSpinBox(RSpinBox * &sb, Reg para, int ch); void UpdateSpinBox(RSpinBox * &sb, Reg para, int ch);
void UpdateComboBox(RComboBox * &cb, Reg para, int ch); void UpdateComboBox(RComboBox * &cb, Reg para, int ch);
void UpdateComboBoxBit(RComboBox * &cb, uint32_t fullBit, std::pair<unsigned short, unsigned short> bit); void UpdateComboBoxBit(RComboBox * &cb, uint32_t fullBit, std::pair<unsigned short, unsigned short> bit);
void SyncSpinBox(RSpinBox *(&spb)[][MaxNChannels+1]); void SyncSpinBox(RSpinBox *(&spb)[][MaxRegChannel+1]);
void SyncComboBox(RComboBox *(&cb)[][MaxNChannels+1]); void SyncComboBox(RComboBox *(&cb)[][MaxRegChannel+1]);
void SyncCheckBox(QCheckBox *(&chk)[][MaxNChannels+1]); void SyncCheckBox(QCheckBox *(&chk)[][MaxRegChannel+1]);
void UpdateBoardAndChannelsStatus(); // ReadRegister void UpdateBoardAndChannelsStatus(); // ReadRegister
@ -80,8 +83,8 @@ private:
RComboBox * cbFromBoard; RComboBox * cbFromBoard;
RComboBox * cbToBoard; RComboBox * cbToBoard;
QRadioButton * rbCh[MaxNChannels]; // Copy from ch QRadioButton * rbCh[MaxRegChannel]; // Copy from ch
QCheckBox * chkCh[MaxNChannels]; // Copy to Ch QCheckBox * chkCh[MaxRegChannel]; // Copy to Ch
QPushButton * bnCopyBoard; QPushButton * bnCopyBoard;
QPushButton * bnCopyChannel; QPushButton * bnCopyChannel;
@ -124,7 +127,7 @@ private:
RComboBox * cbDigiProbe1[MaxNDigitizer]; RComboBox * cbDigiProbe1[MaxNDigitizer];
RComboBox * cbDigiProbe2[MaxNDigitizer]; RComboBox * cbDigiProbe2[MaxNDigitizer];
QPushButton * bnChEnableMask[MaxNDigitizer][MaxNChannels]; QPushButton * bnChEnableMask[MaxNDigitizer][MaxRegChannel];
RComboBox * cbAggOrg[MaxNDigitizer]; RComboBox * cbAggOrg[MaxNDigitizer];
RSpinBox * sbAggNum[MaxNDigitizer]; RSpinBox * sbAggNum[MaxNDigitizer];
QCheckBox * chkEnableExternalTrigger[MaxNDigitizer]; QCheckBox * chkEnableExternalTrigger[MaxNDigitizer];
@ -152,11 +155,11 @@ private:
QCheckBox * chkEnableExtendedBlockTransfer[MaxNDigitizer]; QCheckBox * chkEnableExtendedBlockTransfer[MaxNDigitizer];
/// ============================= trigger validation mask /// ============================= trigger validation mask
RComboBox * cbMaskLogic[MaxNDigitizer][MaxNChannels/2]; RComboBox * cbMaskLogic[MaxNDigitizer][MaxRegChannel/2];
RSpinBox * sbMaskMajorLevel[MaxNDigitizer][MaxNChannels/2]; RSpinBox * sbMaskMajorLevel[MaxNDigitizer][MaxRegChannel/2];
QCheckBox * chkMaskExtTrigger[MaxNDigitizer][MaxNChannels/2]; QCheckBox * chkMaskExtTrigger[MaxNDigitizer][MaxRegChannel/2];
QCheckBox * chkMaskSWTrigger[MaxNDigitizer][MaxNChannels/2]; QCheckBox * chkMaskSWTrigger[MaxNDigitizer][MaxRegChannel/2];
QPushButton * bnTriggerMask[MaxNDigitizer][MaxNChannels/2][MaxNChannels/2]; QPushButton * bnTriggerMask[MaxNDigitizer][MaxRegChannel/2][MaxRegChannel/2];
/// ============================= board Status /// ============================= board Status
QPushButton * bnACQStatus[MaxNDigitizer][9]; QPushButton * bnACQStatus[MaxNDigitizer][9];
@ -167,12 +170,12 @@ private:
QLineEdit * leReadOutStatus[MaxNDigitizer]; QLineEdit * leReadOutStatus[MaxNDigitizer];
/// ============================= Mask Configure /// ============================= Mask Configure
QPushButton * bnGlobalTriggerMask[MaxNDigitizer][MaxNChannels/2]; QPushButton * bnGlobalTriggerMask[MaxNDigitizer][MaxRegChannel/2];
RSpinBox * sbGlbMajCoinWin[MaxNDigitizer]; RSpinBox * sbGlbMajCoinWin[MaxNDigitizer];
RSpinBox * sbGlbMajLvl[MaxNDigitizer]; RSpinBox * sbGlbMajLvl[MaxNDigitizer];
RComboBox * cbGlbUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31 RComboBox * cbGlbUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
QPushButton * bnTRGOUTMask[MaxNDigitizer][MaxNChannels/2]; QPushButton * bnTRGOUTMask[MaxNDigitizer][MaxRegChannel/2];
RSpinBox * sbTRGOUTMajLvl[MaxNDigitizer]; RSpinBox * sbTRGOUTMajLvl[MaxNDigitizer];
RComboBox * cbTRGOUTLogic[MaxNDigitizer]; RComboBox * cbTRGOUTLogic[MaxNDigitizer];
RComboBox * cbTRGOUTUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31 RComboBox * cbTRGOUTUseOtherTriggers[MaxNDigitizer]; // combine bit 30, 31
@ -183,93 +186,107 @@ private:
RComboBox * chSelection[MaxNDigitizer]; RComboBox * chSelection[MaxNDigitizer];
//----------- common for PHA and PSD //----------- common for PHA and PSD
RSpinBox * sbRecordLength[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbRecordLength[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDynamicRange[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbDynamicRange[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPreTrigger[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbPreTrigger[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbThreshold[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbThreshold[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbDCOffset[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbDCOffset[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbPolarity[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbPolarity[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbShapedTrigWidth[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbShapedTrigWidth[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTriggerHoldOff[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbTriggerHoldOff[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTrigMode[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbTrigMode[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbBaseLineAvg[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbBaseLineAvg[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbNumEventAgg[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbNumEventAgg[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbVetoWidth[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbVetoWidth[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbVetoStep[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbVetoStep[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbLocalShapedTrigger[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbLocalShapedTrigger[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbLocalTriggerValid[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbLocalTriggerValid[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbExtra2Option[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbExtra2Option[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbVetoSource[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbVetoSource[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDisableSelfTrigger[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkDisableSelfTrigger[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTrigCount[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbTrigCount[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTRGOUTChannelProbe[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbTRGOUTChannelProbe[MaxNDigitizer][MaxRegChannel + 1];
//---------- PHA //---------- PHA
RComboBox * cbRCCR2Smoothing[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbRCCR2Smoothing[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbInputRiseTime[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbInputRiseTime[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbRiseTimeValidWin[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbRiseTimeValidWin[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTrapRiseTime[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbTrapRiseTime[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTrapFlatTop[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbTrapFlatTop[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbDecay[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbDecay[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTrapScaling[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbTrapScaling[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPeaking[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbPeaking[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPeakingHoldOff[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbPeakingHoldOff[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbPeakAvg[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbPeakAvg[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkActiveBaseline[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkActiveBaseline[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkBaselineRestore[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkBaselineRestore[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbFineGain[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbFineGain[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkEnableRollOver[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkEnableRollOver[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkEnablePileUp[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkEnablePileUp[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkTagCorrelation[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkTagCorrelation[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDecimateTrace[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbDecimateTrace[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDecimateGain[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbDecimateGain[MaxNDigitizer][MaxRegChannel + 1];
//---------------- PSD //---------------- PSD
RComboBox * cbChargeSensitivity[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbChargeSensitivity[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkChargePedestal[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkChargePedestal[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTriggerOpt[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbTriggerOpt[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbDiscriMode[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbDiscriMode[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkPileUpInGate[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkPileUpInGate[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkTestPule[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkTestPule[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbTestPulseRate[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbTestPulseRate[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkBaseLineCal[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkBaseLineCal[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDiscardQLong[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkDiscardQLong[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkRejPileUp[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkRejPileUp[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkCutBelow[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkCutBelow[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkCutAbove[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkCutAbove[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkRejOverRange[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkRejOverRange[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDisableTriggerHysteresis[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkDisableTriggerHysteresis[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkDisableOppositePulse[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkDisableOppositePulse[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbChargeZeroSupZero[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbChargeZeroSupZero[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbShortGate[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbShortGate[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbLongGate[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbLongGate[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbGateOffset[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbGateOffset[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbFixedBaseline[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbFixedBaseline[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbTriggerLatency[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbTriggerLatency[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPSDCutThreshold[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbPSDCutThreshold[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbPURGAPThreshold[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbPURGAPThreshold[MaxNDigitizer][MaxRegChannel + 1];
RSpinBox * sbCFDDely[MaxNDigitizer][MaxNChannels + 1]; RSpinBox * sbCFDDely[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbCFDFraction[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbCFDFraction[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbCFDInterpolation[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbCFDInterpolation[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbSmoothedChargeIntegration[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbSmoothedChargeIntegration[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkMarkSaturation[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkMarkSaturation[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbAdditionLocalTrigValid[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbAdditionLocalTrigValid[MaxNDigitizer][MaxRegChannel + 1];
RComboBox * cbVetoMode[MaxNDigitizer][MaxNChannels + 1]; RComboBox * cbVetoMode[MaxNDigitizer][MaxRegChannel + 1];
QCheckBox * chkResetTimestampByTRGIN[MaxNDigitizer][MaxNChannels + 1]; QCheckBox * chkResetTimestampByTRGIN[MaxNDigitizer][MaxRegChannel + 1];
//------------------- QDC
RComboBox * cbExtTriggerMode[MaxNDigitizer];
RSpinBox * sbRecordLength_QDC[MaxNDigitizer];
RSpinBox * sbEventPreAgg_QDC[MaxNDigitizer];
//...... reuse varaible
//Gate Width -> sbShortGate
//Gate offset -> sbGateOffset
//PreTrigger -> sbPreTrigger
//Trig Hold off with -> sbTriggerHoldOff
//Trig out width -> sbShapedTrigWidth
QCheckBox * chkOverthreshold[MaxNDigitizer][MaxRegChannel+1];
RSpinBox * sbOverThresholdWidth[MaxNDigitizer][MaxRegChannel + 1];
//RSpinBox * sbSubChOffset[MaxNDigitizer][MaxRegChannel + 1];
//---------------- channel status //---------------- channel status
QPushButton * bnChStatus[MaxNDigitizer][MaxNChannels][3]; QPushButton * bnChStatus[MaxNDigitizer][MaxRegChannel][3];
QLineEdit * leADCTemp[MaxNDigitizer][MaxNChannels]; QLineEdit * leADCTemp[MaxNDigitizer][MaxRegChannel];
}; };

View File

@ -261,7 +261,7 @@ int main(int argc, char **argv) {
//check if Data Index near MaxNData. if near by 50%, break //check if Data Index near MaxNData. if near by 50%, break
//printf("-----------------------------------\n"); //printf("-----------------------------------\n");
for( int i = 0; i < nGroup; i++){ for( int i = 0; i < nGroup; i++){
for( int ch = 0; ch < MaxNChannels; ch ++){ for( int ch = 0; ch < MaxRegChannel; ch ++){
if( data[i]->LoopIndex[ch]*MaxNData + data[i]->DataIndex[ch] - lastLoopIndex[i][ch]*MaxNData - lastDataIndex[i][ch] > MaxNData * 0.5 ) { if( data[i]->LoopIndex[ch]*MaxNData + data[i]->DataIndex[ch] - lastLoopIndex[i][ch]*MaxNData - lastDataIndex[i][ch] > MaxNData * 0.5 ) {
breakFlag = true; breakFlag = true;
//printf("digi:%d | ch: %d DataIndex: %d (%d) \n", data[i]->boardSN, ch, data[i]->DataIndex[ch], lastDataIndex[i][ch]); //printf("digi:%d | ch: %d DataIndex: %d (%d) \n", data[i]->boardSN, ch, data[i]->DataIndex[ch], lastDataIndex[i][ch]);

View File

@ -31,7 +31,7 @@ void MultiBuilder::ClearEvents(){
for( int i = 0; i < MaxNEvent; i++) events[i].clear(); for( int i = 0; i < MaxNEvent; i++) events[i].clear();
for( int i = 0; i < MaxNDigitizer; i++){ for( int i = 0; i < MaxNDigitizer; i++){
for( int j = 0; j < MaxNChannels; j++){ for( int j = 0; j < MaxRegChannel; j++){
loopIndex[i][j] = 0; loopIndex[i][j] = 0;
nextIndex[i][j] = -1; nextIndex[i][j] = -1;
chExhaused[i][j] = false; chExhaused[i][j] = false;
@ -51,7 +51,7 @@ void MultiBuilder::PrintStat(){
printf("Total number of evet built : %ld\n", totalEventBuilt); printf("Total number of evet built : %ld\n", totalEventBuilt);
for( int i = 0; i < nData ; i++){ for( int i = 0; i < nData ; i++){
for( int ch = 0; ch < MaxNChannels ; ch++){ for( int ch = 0; ch < MaxRegChannel ; ch++){
printf("%d %3d %2d | %7d (%d)\n", i, snList[i], ch, nextIndex[i][ch], loopIndex[i][ch]); printf("%d %3d %2d | %7d (%d)\n", i, snList[i], ch, nextIndex[i][ch], loopIndex[i][ch]);
} }
} }
@ -68,11 +68,11 @@ void MultiBuilder::FindEarlistTimeAndCh(bool verbose){
for( int i = 0; i < nData; i++){ for( int i = 0; i < nData; i++){
for( int j = 0; j < MaxNChannels; j++ ){ for( int j = 0; j < MaxRegChannel; j++ ){
chExhaused[i][j] = false; chExhaused[i][j] = false;
} }
for(unsigned int ch = 0; ch < MaxNChannels; ch ++){ for(unsigned int ch = 0; ch < MaxRegChannel; ch ++){
if( data[i]->Timestamp[ch][data[i]->DataIndex[ch]] == 0 || data[i]->DataIndex[ch] == -1 || loopIndex[i][ch] * MaxNData + nextIndex[i][ch] > data[i]->LoopIndex[ch] * MaxNData + data[i]->DataIndex[ch]) { if( data[i]->Timestamp[ch][data[i]->DataIndex[ch]] == 0 || data[i]->DataIndex[ch] == -1 || loopIndex[i][ch] * MaxNData + nextIndex[i][ch] > data[i]->LoopIndex[ch] * MaxNData + data[i]->DataIndex[ch]) {
nExhaushedCh ++; nExhaushedCh ++;
chExhaused[i][ch] = true; chExhaused[i][ch] = true;
@ -104,11 +104,11 @@ void MultiBuilder::FindLatestTimeAndCh(bool verbose){
for( int i = 0; i < nData; i++){ for( int i = 0; i < nData; i++){
for( int j = 0; j < MaxNChannels; j++ ){ for( int j = 0; j < MaxRegChannel; j++ ){
chExhaused[i][j] = false; chExhaused[i][j] = false;
} }
for(unsigned int ch = 0; ch < MaxNChannels; ch ++){ for(unsigned int ch = 0; ch < MaxRegChannel; ch ++){
// printf(" %d, %d | %d", i, ch, nextIndex[i][ch]); // printf(" %d, %d | %d", i, ch, nextIndex[i][ch]);
if( nextIndex[i][ch] < 0 ) { if( nextIndex[i][ch] < 0 ) {
nExhaushedCh ++; nExhaushedCh ++;
@ -137,7 +137,7 @@ void MultiBuilder::FindLatestTimeOfData(bool verbose){
latestCh = -1; latestCh = -1;
latestDigi = -1; latestDigi = -1;
for( int i = 0; i < nData; i++){ for( int i = 0; i < nData; i++){
for( unsigned ch = 0; ch < MaxNChannels; ch++ ){ for( unsigned ch = 0; ch < MaxRegChannel; ch++ ){
int index = data[i]->DataIndex[ch]; int index = data[i]->DataIndex[ch];
if( index == -1 ) continue; if( index == -1 ) continue;
if( data[i]->Timestamp[ch][index] > latestTime ) { if( data[i]->Timestamp[ch][index] > latestTime ) {
@ -155,7 +155,7 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
FindLatestTimeOfData(verbose); FindLatestTimeOfData(verbose);
FindEarlistTimeAndCh(verbose); FindEarlistTimeAndCh(verbose);
if( earlistCh == -1 || nExhaushedCh == nData * MaxNChannels) return; /// no data if( earlistCh == -1 || nExhaushedCh == nData * MaxRegChannel) return; /// no data
eventBuilt = 0; eventBuilt = 0;
//======= Start building event //======= Start building event
@ -177,8 +177,8 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
// printf("##### %d/%d | ", k, nData); // printf("##### %d/%d | ", k, nData);
// data[k]->PrintAllData(true, 10); // data[k]->PrintAllData(true, 10);
for( unsigned int i = 0; i < MaxNChannels; i++){ for( unsigned int i = 0; i < MaxRegChannel; i++){
int ch = (i + earlistCh ) % MaxNChannels; int ch = (i + earlistCh ) % MaxRegChannel;
if( chExhaused[bd][ch] ) continue; if( chExhaused[bd][ch] ) continue;
if( loopIndex[bd][ch] * MaxNData + nextIndex[bd][ch] > data[bd]->LoopIndex[ch] * MaxNData + data[bd]->DataIndex[ch]) { if( loopIndex[bd][ch] * MaxNData + nextIndex[bd][ch] > data[bd]->LoopIndex[ch] * MaxNData + data[bd]->DataIndex[ch]) {
nExhaushedCh ++; nExhaushedCh ++;
@ -234,7 +234,7 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
printf("%02d, %02d | %d | %5d %llu \n", bd, chxxx, nextIndex[bd][chxxx], events[eventIndex][i].energy, events[eventIndex][i].timestamp); printf("%02d, %02d | %d | %5d %llu \n", bd, chxxx, nextIndex[bd][chxxx], events[eventIndex][i].energy, events[eventIndex][i].timestamp);
} }
if( nExhaushedCh == nData * MaxNChannels ) { if( nExhaushedCh == nData * MaxRegChannel ) {
printf("######################### no more event to be built\n"); printf("######################### no more event to be built\n");
break; break;
} }
@ -249,7 +249,7 @@ void MultiBuilder::BuildEvents(bool isFinal, bool skipTrace, bool verbose){
break; break;
} }
}while(nExhaushedCh < nData * MaxNChannels); }while(nExhaushedCh < nData * MaxRegChannel);
} }
@ -259,7 +259,7 @@ void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
// remember the end of DataIndex, prevent over build // remember the end of DataIndex, prevent over build
for( int k = 0; k < nData; k++){ for( int k = 0; k < nData; k++){
for( int i = 0; i < MaxNChannels; i++){ for( int i = 0; i < MaxRegChannel; i++){
nextIndex[k][i] = data[k]->DataIndex[i]; nextIndex[k][i] = data[k]->DataIndex[i];
} }
} }
@ -281,8 +281,8 @@ void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
for( int k = 0; k < nData; k++){ for( int k = 0; k < nData; k++){
int bd = (k + latestDigi) % nData; int bd = (k + latestDigi) % nData;
for( unsigned int i = 0; i < MaxNChannels; i++){ for( unsigned int i = 0; i < MaxRegChannel; i++){
int ch = (i + latestCh) % MaxNChannels; int ch = (i + latestCh) % MaxRegChannel;
if( chExhaused[bd][ch] ) continue; if( chExhaused[bd][ch] ) continue;
//if( nextIndex[bd][ch] <= lastBackWardIndex[bd][ch] || nextIndex[bd][ch] < 0){ //if( nextIndex[bd][ch] <= lastBackWardIndex[bd][ch] || nextIndex[bd][ch] < 0){
if( nextIndex[bd][ch] < 0){ if( nextIndex[bd][ch] < 0){
@ -330,7 +330,7 @@ void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
printf("%02d, %02d | %d | %5d %llu \n", bd, chxxx, nextIndex[bd][chxxx], events[eventIndex][i].energy, events[eventIndex][i].timestamp); printf("%02d, %02d | %d | %5d %llu \n", bd, chxxx, nextIndex[bd][chxxx], events[eventIndex][i].energy, events[eventIndex][i].timestamp);
} }
if( nExhaushedCh == nData * MaxNChannels ) { if( nExhaushedCh == nData * MaxRegChannel ) {
printf("######################### no more event to be built\n"); printf("######################### no more event to be built\n");
break; break;
} }
@ -338,11 +338,11 @@ void MultiBuilder::BuildEventsBackWard(int maxNumEvent, bool verbose){
} }
}while(nExhaushedCh < nData * MaxNChannels && eventBuilt <= maxNumEvent); }while(nExhaushedCh < nData * MaxRegChannel && eventBuilt <= maxNumEvent);
// // remember the end of DataIndex, prevent over build // // remember the end of DataIndex, prevent over build
// for( int k = 0; k < nData; k++){ // for( int k = 0; k < nData; k++){
// for( int i = 0; i < MaxNChannels; i++){ // for( int i = 0; i < MaxRegChannel; i++){
// lastBackWardIndex[k][i] = data[k]->DataIndex[i]; // lastBackWardIndex[k][i] = data[k]->DataIndex[i];
// } // }
// } // }

View File

@ -70,11 +70,11 @@ private:
Data ** data; // assume all data has MaxNChannel (16) Data ** data; // assume all data has MaxNChannel (16)
unsigned short timeWindow; unsigned short timeWindow;
int loopIndex[MaxNDigitizer][MaxNChannels]; int loopIndex[MaxNDigitizer][MaxRegChannel];
int nextIndex[MaxNDigitizer][MaxNChannels]; int nextIndex[MaxNDigitizer][MaxRegChannel];
int nExhaushedCh; int nExhaushedCh;
bool chExhaused[MaxNDigitizer][MaxNChannels]; bool chExhaused[MaxNDigitizer][MaxRegChannel];
void FindEarlistTimeAndCh(bool verbose = false); // search thtough the nextIndex void FindEarlistTimeAndCh(bool verbose = false); // search thtough the nextIndex
unsigned long long earlistTime; unsigned long long earlistTime;
@ -87,7 +87,7 @@ private:
void FindLatestTimeOfData(bool verbose = false); void FindLatestTimeOfData(bool verbose = false);
int lastBackWardIndex[MaxNDigitizer][MaxNChannels]; int lastBackWardIndex[MaxNDigitizer][MaxRegChannel];
}; };

View File

@ -278,9 +278,14 @@ namespace DPP {
/// -------------------- QDC only /// -------------------- QDC only
const std::pair<unsigned short, unsigned short> ExtTriggerMode_QDC = {2, 20} ; const std::pair<unsigned short, unsigned short> ExtTriggerMode_QDC = {2, 20} ;
const std::vector<std::pair<std::string, unsigned int>> ListExtTriggerMode_QDC = {{"Trigger", 0}, const std::vector<std::pair<std::string, unsigned int>> ListExtTriggerMode_QDC = {{"Trigger", 0},
{"Veto", 1}, {"Veto", 1},
{"Anti-Veto", 2}}; {"Anti-Veto", 2}};
const std::vector<std::pair<std::string, unsigned int>> ListAnaProbe_QDC = {{"Input", 0},
{"Smoothed Input", 1},
{"Baseline", 2}};
} }
namespace Bit_DPPAlgorithmControl_PHA { namespace Bit_DPPAlgorithmControl_PHA {
@ -398,9 +403,11 @@ namespace DPP {
namespace Bit_AcquistionControl { namespace Bit_AcquistionControl {
const std::pair<unsigned short, unsigned short> StartStopMode = {2, 0} ; const std::pair<unsigned short, unsigned short> StartStopMode = {2, 0} ;
const std::pair<unsigned short, unsigned short> ACQStartArm = {1, 2} ; const std::pair<unsigned short, unsigned short> ACQStartArm = {1, 2} ;
const std::pair<unsigned short, unsigned short> TrigCountMode_QDC = {1, 3} ;
const std::pair<unsigned short, unsigned short> PLLRef = {1, 6} ; const std::pair<unsigned short, unsigned short> PLLRef = {1, 6} ;
const std::pair<unsigned short, unsigned short> LVDSBusyEnable = {1, 8} ; const std::pair<unsigned short, unsigned short> LVDSBusyEnable = {1, 8} ;
const std::pair<unsigned short, unsigned short> LVDSVetoEnable = {1, 9} ; const std::pair<unsigned short, unsigned short> LVDSVetoEnable = {1, 9} ;
const std::pair<unsigned short, unsigned short> LVDSRunInMode = {1, 11} ;
const std::pair<unsigned short, unsigned short> VetoTRGOut = {1, 12} ; const std::pair<unsigned short, unsigned short> VetoTRGOut = {1, 12} ;
const std::vector<std::pair<std::string, unsigned int>> ListStartStopMode = {{"SW controlled", 0}, const std::vector<std::pair<std::string, unsigned int>> ListStartStopMode = {{"SW controlled", 0},
@ -413,6 +420,9 @@ namespace DPP {
const std::vector<std::pair<std::string, unsigned int>> ListPLLRef = {{"Internal 50 MHz", 0}, const std::vector<std::pair<std::string, unsigned int>> ListPLLRef = {{"Internal 50 MHz", 0},
{"Ext. CLK-IN", 1}}; {"Ext. CLK-IN", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListTrigCountMode_QDC = {{"Comb. ch", 0},
{"Comb. ch + TRG-IN + SW", 1}};
} }
namespace Bit_AcqStatus { namespace Bit_AcqStatus {
@ -782,7 +792,7 @@ namespace DPP {
const Reg GateWidth_G ("GateWidth" , 0x1030, RW::ReadWrite, true, 0xFFF, 1); /// R/W const Reg GateWidth_G ("GateWidth" , 0x1030, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg GateOffset_G ("GateOfset" , 0x1034, RW::ReadWrite, true, 0xFF, 1); /// R/W const Reg GateOffset_G ("GateOfset" , 0x1034, RW::ReadWrite, true, 0xFF, 1); /// R/W
const Reg FixedBaseline_G ("FixedBaseline" , 0x1038, RW::ReadWrite, true, 0xFFF, 1); /// R/W const Reg FixedBaseline_G ("FixedBaseline" , 0x1038, RW::ReadWrite, true, 0xFFF, 1); /// R/W
const Reg Pretrigger_G ("PreTrigger" , 0x103C, RW::ReadWrite, true, 0xFF, 1); /// R/W const Reg PreTrigger_G ("PreTrigger" , 0x103C, RW::ReadWrite, true, 0xFF, 1); /// R/W
const Reg DPPAlgorithmControl_G ("DPPAlgorithmControl" , 0x1040, RW::ReadWrite, true, {}); /// R/W const Reg DPPAlgorithmControl_G ("DPPAlgorithmControl" , 0x1040, RW::ReadWrite, true, {}); /// R/W
const Reg TriggerHoldOffWidth_G ("Trigger Hold-off width" , 0x1074, RW::ReadWrite, true, 0xFFFF, 1); /// R/W const Reg TriggerHoldOffWidth_G ("Trigger Hold-off width" , 0x1074, RW::ReadWrite, true, 0xFFFF, 1); /// R/W
const Reg TRGOUTWidth_G ("Trigger out width" , 0x1078, RW::ReadWrite, true, 0xFFFF, 1); /// R/W const Reg TRGOUTWidth_G ("Trigger out width" , 0x1078, RW::ReadWrite, true, 0xFFFF, 1); /// R/W
@ -798,9 +808,55 @@ namespace DPP {
const Reg NumberEventsPerAggregate ("Number of Events per Aggregate", 0x8020, RW::ReadWrite, false, 0x3FF, 1); /// R/W const Reg NumberEventsPerAggregate ("Number of Events per Aggregate", 0x8020, RW::ReadWrite, false, 0x3FF, 1); /// R/W
const Reg RecordLength ("Record Length" , 0x8024, RW::ReadWrite, false, 0xFFF, 1); /// R/W const Reg RecordLength ("Record Length" , 0x8024, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg GroupEnableMask ("Group Enable Mask" , 0x8120, RW::ReadWrite, false, 0xFF, 1); /// R/W const Reg GroupEnableMask ("Group Enable Mask" , 0x8120, RW::ReadWrite, false, 0xFF, 1); /// R/W
namespace Bit_DPPAlgorithmControl {
const std::pair<unsigned short, unsigned short> ChargeSensitivity = {3, 0} ; /// length, smallest pos
const std::pair<unsigned short, unsigned short> InternalTestPulse = {1, 4};
const std::pair<unsigned short, unsigned short> TestPulseRate = {2, 5};
const std::pair<unsigned short, unsigned short> OverThresholdWitdhEnable = {1, 7};
const std::pair<unsigned short, unsigned short> ChargePedestal = {1, 8};
const std::pair<unsigned short, unsigned short> InputSmoothingFactor = {3, 12};
const std::pair<unsigned short, unsigned short> Polarity = {1, 16};
const std::pair<unsigned short, unsigned short> TriggerMode = {2, 18};
const std::pair<unsigned short, unsigned short> BaselineAvg = {3, 20};
const std::pair<unsigned short, unsigned short> DisableSelfTrigger = {1, 24};
const std::pair<unsigned short, unsigned short> DisableTriggerHysteresis = {1, 30};
const std::vector<std::pair<std::string, unsigned int>> ListChargeSensitivity = {{"0.16 pC", 0},
{"0.32 pC", 1},
{"0.64 pC", 2},
{"1.28 pC", 3},
{"2.56 pC", 4},
{"5.12 pC", 5},
{"10.24 pC", 6},
{"20.48 pC", 7}};
const std::vector<std::pair<std::string, unsigned int>> ListTestPulseRate = {{"1 kHz", 0},
{"10 kHz", 1},
{"100 kHz", 2},
{"1 MHz", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListInputSmoothingFactor = {{"Disabled", 0},
{"2 samples", 1},
{"4 samples", 2},
{"8 samples", 3},
{"16 samples", 4},
{"32 samples", 5},
{"64 samples", 6}};
const std::vector<std::pair<std::string, unsigned int>> ListPolarity = {{"Positive", 0},
{"Negative", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListTrigMode = {{"Self-Trigger", 0},
{"Coupled OR", 1}};
const std::vector<std::pair<std::string, unsigned int>> ListBaselineAvg = {{"Fixed", 0},
{"4 samples", 1},
{"16 samples", 2},
{"64 samples", 3}};
}
} }
} // end of DPP namepace Register } // end of DPP namepace Register
@ -865,13 +921,15 @@ const std::vector<Reg> RegisterPSDList = {
DPP::TriggerValidationMask_G DPP::TriggerValidationMask_G
}; };
const std::vector<Reg> RegisterQDCList = { //TODO const std::vector<Reg> RegisterQDCList = {
DPP::QDC::GateWidth_G, DPP::QDC::GateWidth_G,
DPP::QDC::GateOffset_G, DPP::QDC::GateOffset_G,
DPP::QDC::FixedBaseline_G, DPP::QDC::FixedBaseline_G,
DPP::QDC::Pretrigger_G, DPP::QDC::PreTrigger_G,
DPP::QDC::DPPAlgorithmControl_G, DPP::QDC::DPPAlgorithmControl_G,
DPP::QDC::TriggerHoldOffWidth_G, DPP::QDC::TriggerHoldOffWidth_G,
DPP::QDC::TRGOUTWidth_G,
DPP::QDC::OverThresholdWidth_G,
DPP::QDC::GroupStatus_RG, DPP::QDC::GroupStatus_RG,
DPP::QDC::AMCFirmwareRevision_RG, DPP::QDC::AMCFirmwareRevision_RG,
DPP::QDC::DCOffset_G, DPP::QDC::DCOffset_G,

View File

@ -102,7 +102,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
ID = 0; ID = 0;
cbScopeDigi->setCurrentIndex(0); cbScopeDigi->setCurrentIndex(0);
for( int i = 0; i < digi[0]->GetNChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); for( int i = 0; i < digi[0]->GetRegChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i));
tick2ns = digi[ID]->GetTick2ns(); tick2ns = digi[ID]->GetTick2ns();
factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1; factor = digi[ID]->IsDualTrace_PHA() ? 2 : 1;
@ -119,7 +119,7 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
enableSignalSlot = false; enableSignalSlot = false;
//---setup cbScopeCh //---setup cbScopeCh
cbScopeCh->clear(); cbScopeCh->clear();
for( int i = 0; i < digi[ID]->GetNChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i)); for( int i = 0; i < digi[ID]->GetRegChannels(); i++) cbScopeCh->addItem("Ch-" + QString::number(i));
//---Setup SettingGroup //---Setup SettingGroup
CleanUpSettingsGroupBox(); CleanUpSettingsGroupBox();

View File

@ -34,7 +34,7 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
connect( cbDigi, &RComboBox::currentIndexChanged, this, &SingleSpectra::ChangeHistView); connect( cbDigi, &RComboBox::currentIndexChanged, this, &SingleSpectra::ChangeHistView);
cbCh = new RComboBox(this); cbCh = new RComboBox(this);
for( int i = 0; i < MaxNChannels; i++) cbCh->addItem("ch-" + QString::number( i ), i); for( int i = 0; i < MaxRegChannel; i++) cbCh->addItem("ch-" + QString::number( i ), i);
ctrlLayout->addWidget(cbCh, 0, 2, 1, 2); ctrlLayout->addWidget(cbCh, 0, 2, 1, 2);
connect( cbCh, &RComboBox::currentIndexChanged, this, &SingleSpectra::ChangeHistView); connect( cbCh, &RComboBox::currentIndexChanged, this, &SingleSpectra::ChangeHistView);
@ -42,7 +42,7 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
ctrlLayout->addWidget(bnClearHist, 0, 4, 1, 2); ctrlLayout->addWidget(bnClearHist, 0, 4, 1, 2);
connect(bnClearHist, &QPushButton::clicked, this, [=](){ connect(bnClearHist, &QPushButton::clicked, this, [=](){
for( unsigned int i = 0; i < nDigi; i++){ for( unsigned int i = 0; i < nDigi; i++){
for( int j = 0; j < MaxNChannels; j++){ for( int j = 0; j < MaxRegChannel; j++){
if( hist[i][j] ) hist[i][j]->Clear(); if( hist[i][j] ) hist[i][j]->Clear();
lastFilledIndex[i][j] = -1; lastFilledIndex[i][j] = -1;
loopFilledIndex[i][j] = 0; loopFilledIndex[i][j] = 0;
@ -107,7 +107,7 @@ SingleSpectra::~SingleSpectra(){
void SingleSpectra::ClearInternalDataCount(){ void SingleSpectra::ClearInternalDataCount(){
for( unsigned int i = 0; i < nDigi; i++){ for( unsigned int i = 0; i < nDigi; i++){
for( int ch = 0; ch < MaxNChannels ; ch++) { for( int ch = 0; ch < MaxRegChannel ; ch++) {
lastFilledIndex[i][ch] = -1; lastFilledIndex[i][ch] = -1;
loopFilledIndex[i][ch] = 0; loopFilledIndex[i][ch] = 0;
} }

View File

@ -43,7 +43,7 @@ private:
Digitizer ** digi; Digitizer ** digi;
unsigned short nDigi; unsigned short nDigi;
Histogram1D * hist[MaxNDigitizer][MaxNChannels]; Histogram1D * hist[MaxNDigitizer][MaxRegChannel];
RComboBox * cbDivision; RComboBox * cbDivision;
@ -54,8 +54,8 @@ private:
QGridLayout * histLayout; QGridLayout * histLayout;
int oldBd, oldCh; int oldBd, oldCh;
int lastFilledIndex[MaxNDigitizer][MaxNChannels]; int lastFilledIndex[MaxNDigitizer][MaxRegChannel];
int loopFilledIndex[MaxNDigitizer][MaxNChannels]; int loopFilledIndex[MaxNDigitizer][MaxRegChannel];
bool fillHistograms; bool fillHistograms;

View File

@ -135,10 +135,6 @@ inline void Encore::UpdateHistograms(){
hRight->Fill(ID-100, eC ); hRight->Fill(ID-100, eC );
sum[ID-100] += eC ; sum[ID-100] += eC ;
} }
if( 200 <= ID && ID < 300 ) {
hRight->Fill(ID-200, eC );
sum[ID-200] += eC ;
}
} }
for( int ch = 0; ch < 17; ch++){ for( int ch = 0; ch < 17; ch++){

View File

@ -6,7 +6,8 @@
#define MaxNDigitizer MaxNPorts * MaxNBoards #define MaxNDigitizer MaxNPorts * MaxNBoards
#define MaxNChannels 16 //for QDC, this is group. #define MaxRegChannel 16
#define MaxNChannels 64
#define MaxRecordLength 0x3fff * 8 #define MaxRecordLength 0x3fff * 8
#define MaxSaveFileSize 1024 * 1024 * 1024 * 2 #define MaxSaveFileSize 1024 * 1024 * 1024 * 2

View File

@ -292,10 +292,10 @@ int main(int argc, char* argv[]){
int Nb; /// number of byte int Nb; /// number of byte
char *buffer = NULL; /// readout buffer char *buffer = NULL; /// readout buffer
uint32_t DataIndex[MaxNChannels]; uint32_t DataIndex[MaxRegChannel];
uint32_t AllocatedSize, BufferSize; uint32_t AllocatedSize, BufferSize;
CAEN_DGTZ_DPP_PHA_Event_t *Events[MaxNChannels]; /// events buffer CAEN_DGTZ_DPP_PHA_Event_t *Events[MaxRegChannel]; /// events buffer
CAEN_DGTZ_DPP_PHA_Waveforms_t *Waveform[MaxNChannels]; /// waveforms buffer CAEN_DGTZ_DPP_PHA_Waveforms_t *Waveform[MaxRegChannel]; /// waveforms buffer
ret = CAEN_DGTZ_MallocReadoutBuffer(handle, &buffer, &AllocatedSize); ret = CAEN_DGTZ_MallocReadoutBuffer(handle, &buffer, &AllocatedSize);
printf("allowcated %d byte ( %d words) for buffer\n", AllocatedSize, AllocatedSize/4); printf("allowcated %d byte ( %d words) for buffer\n", AllocatedSize, AllocatedSize/4);