update PSD and PHA register

This commit is contained in:
carina@hades 2023-10-04 13:13:38 -04:00
parent 66484b6003
commit bf38251dec
4 changed files with 64 additions and 15 deletions

View File

@ -35,7 +35,7 @@ class Data{
double TriggerRate[MaxNChannels]; /// Hz
double NonPileUpRate[MaxNChannels]; /// Hz
unsigned long TotNumEvents[MaxNChannels];
unsigned long TotNumNonPileUpEvents[MaxNChannels];
unsigned short NumEventsDecoded[MaxNChannels]; /// reset at every decode
unsigned short NumNonPileUpDecoded[MaxNChannels]; /// reset at every decode
@ -124,7 +124,7 @@ inline Data::Data(){
DPPTypeStr = "";
IsNotRollOverFakeAgg = false;
buffer = NULL;
for ( int i = 0; i < MaxNChannels; i++) TotNumEvents[i] = 0;
for ( int i = 0; i < MaxNChannels; i++) TotNumNonPileUpEvents[i] = 0;
ClearData();
ClearTriggerRate();
nw = 0;
@ -182,7 +182,7 @@ inline void Data::ClearData(){
NumEventsDecoded[ch] = 0;
NumNonPileUpDecoded[ch] = 0;
TotNumEvents[ch] = 0 ;
TotNumNonPileUpEvents[ch] = 0 ;
calIndexes[ch][0] = -1;
calIndexes[ch][1] = -1;
@ -272,7 +272,7 @@ inline void Data::PrintStat() const{
printf("%2s | %6s | %9s | %9s | %6s | %6s(%4s)\n", "ch", "# Evt.", "Rate [Hz]", "Accept", "Tot. Evt.", "index", "loop");
printf("---+--------+-----------+-----------+----------\n");
for(int ch = 0; ch < MaxNChannels; ch++){
printf("%2d | %6d | %9.2f | %9.2f | %6lu | %6d(%2d)\n", ch, NumEventsDecoded[ch], TriggerRate[ch], NonPileUpRate[ch], TotNumEvents[ch], DataIndex[ch], LoopIndex[ch]);
printf("%2d | %6d | %9.2f | %9.2f | %6lu | %6d(%2d)\n", ch, NumEventsDecoded[ch], TriggerRate[ch], NonPileUpRate[ch], TotNumNonPileUpEvents[ch], DataIndex[ch], LoopIndex[ch]);
}
printf("---+--------+-----------+-----------+----------\n");
}
@ -673,10 +673,10 @@ inline int Data::DecodePHADualChannelBlock(unsigned int ChannelMask, bool fastDe
if(extra2Option == 2 ) fineTime[channel][DataIndex[channel]] = (extra2 & 0x03FF );
PileUp[channel][DataIndex[channel]] = pileUp;
NumEventsDecoded[channel] ++;
TotNumEvents[channel] ++;
if( !pileUp ) {
NumNonPileUpDecoded[channel] ++;
TotNumNonPileUpEvents[channel] ++;
}
if( !fastDecode ) {
@ -845,6 +845,7 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
nw = nw +1 ; word = ReadBuffer(nw, verbose);
unsigned int Qlong = (( word >> 16) & 0xFFFF);
bool pileup = ((word >> 15) & 0x1);
unsigned int Qshort = (word & 0x7FFF);
bool isEnergyCorrect = ((word >> 15) & 0x1); // the PUR, either pileup or saturated
@ -856,8 +857,10 @@ inline int Data::DecodePSDDualChannelBlock(unsigned int ChannelMask, bool fastDe
}
NumEventsDecoded[channel] ++;
NumNonPileUpDecoded[channel] ++;
TotNumEvents[channel] ++;
if( !pileup){
NumNonPileUpDecoded[channel] ++;
TotNumNonPileUpEvents[channel] ++;
}
Energy2[channel][DataIndex[channel]] = Qshort;
Energy[channel][DataIndex[channel]] = Qlong;

View File

@ -264,8 +264,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
SetUpChannelMask();
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard();
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDBoard();
if( digi[iDigi]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHABoard();
if( digi[iDigi]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDBoard();
SetUpGlobalTriggerMaskAndFrontPanelMask(bdGlbTRGOUTLayout[iDigi]);
SetUpACQReadOutTab();
@ -854,9 +854,9 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
});
SetUpCheckBox(chkEnableExternalTrigger[ID], "Enable TRG-IN ", gLayout, 1, 1, DPP::DisableExternalTrigger, {1, 0});
///============================ 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);
gLayout->addWidget(trgInMode, 2, 0);
@ -873,7 +873,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
});
///============================ Trig In Mezzanines
QLabel * trgInMezzaninesMode = new QLabel("TRI-In Mezzanines ", this);
QLabel * trgInMezzaninesMode = new QLabel("TRI-In Mezzanines ", this);
trgInMezzaninesMode->setAlignment(Qt::AlignRight | Qt::AlignCenter);
gLayout->addWidget(trgInMezzaninesMode, 3, 0);
@ -894,7 +894,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
cbTRINMezzanines[ID]->setEnabled(state);
});
SetUpComboBox(cbAnalogMonitorMode[ID], "Analog Monitor Mode ", gLayout, 4, 0, DPP::AnalogMonitorMode, 0);
SetUpComboBox(cbAnalogMonitorMode[ID], "Analog Monitor Mode ", gLayout, 4, 0, DPP::AnalogMonitorMode, 0);
connect(cbAnalogMonitorMode[ID], &RComboBox::currentIndexChanged, this, [=](int index){
if( index < 2) {
@ -913,7 +913,7 @@ void DigiSettingsPanel::SetUpGlobalTriggerMaskAndFrontPanelMask(QGridLayout * &
sbVoltageLevel[ID]->setToolTipDuration(-1);
//^=============================== Global Mask, TRG-OUT Mask
QWidget * kaka = new QWidget(this);
QWidget * kaka = new QWidget(this);
gLayout->addWidget(kaka, 7, 0, 1, 4);
QGridLayout * maskLayout = new QGridLayout(kaka);
@ -1435,6 +1435,8 @@ void DigiSettingsPanel::SetUpPHAChannel(){
SetUpComboBoxBit(cbVetoStep[ID][MaxNChannels], "Veto Step : ", otherLayout, 4, 0, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 1);
SetUpComboBoxBit(cbExtra2Option[ID][MaxNChannels], "Extra2 Option [G] : ", otherLayout, 5, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 3);
SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][MaxNChannels], "TRG-OUT Ch. Prb. [G] : ", otherLayout, 6, 0, DPP::PHA::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ChannelProbe);
}
{//^================== status
@ -1728,8 +1730,11 @@ void DigiSettingsPanel::SetUpPHAChannel(){
if( i == 3 ){
if( ch == 0 ){
QLabel * lb2 = new QLabel("Extra2 Option [G]", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2);
QLabel * lb3 = new QLabel("TRG-OUT Ch. Prb. [G]", this); lb3->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb3, 0, 4);
}
SetUpComboBoxBit(cbExtra2Option[ID][ch], "", tabLayout, ch + 1, 1, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 2, ch);
SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][ch], "", tabLayout, ch + 1, 3, DPP::PHA::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::ChannelProbe, 2, ch);
}
}
}
@ -1928,6 +1933,7 @@ void DigiSettingsPanel::SetUpPSDChannel(){
SetUpSpinBox(sbVetoWidth[ID][MaxNChannels], "Veto Width : ", otherLayout, 6, 0, DPP::VetoWidth);
SetUpComboBoxBit(cbVetoStep[ID][MaxNChannels], "Veto Step : ", otherLayout, 6, 2, DPP::Bit_VetoWidth::ListVetoStep, DPP::VetoWidth, DPP::Bit_VetoWidth::VetoStep, 1);
SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][MaxNChannels], "TRG-OUT Ch. Prb. [G] : ", otherLayout, 7, 0, DPP::PSD::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ChannelProbe);
}
{//^================== status
@ -2304,8 +2310,11 @@ void DigiSettingsPanel::SetUpPSDChannel(){
if( i == 3 ){
if( ch == 0 ){
QLabel * lb2 = new QLabel("Extra Option [G]", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2);
QLabel * lb3 = new QLabel("TRG-OUT Ch. Prb. [G]", this); lb3->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb3, 0, 4);
}
SetUpComboBoxBit(cbExtra2Option[ID][ch], "", tabLayout, ch + 1, 1, DPP::PHA::Bit_DPPAlgorithmControl2::ListExtra2, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option, 2, ch);
SetUpComboBoxBit(cbTRGOUTChannelProbe[ID][MaxNChannels], "", tabLayout, ch + 1, 3, DPP::PSD::Bit_DPPAlgorithmControl2::ListChannelProbe, DPP::PSD::DPPAlgorithmControl2_G, DPP::PSD::Bit_DPPAlgorithmControl2::ChannelProbe, 2, ch);
}
}
}
@ -2518,7 +2527,11 @@ void DigiSettingsPanel::UpdatePanelFromMemory(){
cbTRGOUTMode[ID]->setCurrentIndex(0);
}else{
unsigned int trgOutBit = ((frontPanel >> 14 ) & 0x3F ) << 14 ;
printf("%u = 0x%x\n", trgOutBit, trgOutBit);
for( int i = 0; i < cbTRGOUTMode[ID]->count() ; i++ ){
printf("%d , %u = 0x%x\n", i, cbTRGOUTMode[ID]->itemData(i).toUInt() , cbTRGOUTMode[ID]->itemData(i).toUInt());
if( cbTRGOUTMode[ID]->itemData(i).toUInt() == trgOutBit ){
cbTRGOUTMode[ID]->setCurrentIndex(i);
break;
@ -2774,6 +2787,7 @@ void DigiSettingsPanel::SyncAllChannelsTab_PHA(){
SyncComboBox(cbTrigCount);
SyncComboBox(cbExtra2Option);
SyncComboBox(cbVetoStep);
SyncComboBox(cbTRGOUTChannelProbe);
SyncCheckBox(chkDisableSelfTrigger);
SyncCheckBox(chkEnableRollOver);
@ -2837,6 +2851,7 @@ void DigiSettingsPanel::UpdatePHASetting(){
UpdateComboBoxBit(cbVetoSource[ID][ch], dpp2, DPP::PHA::Bit_DPPAlgorithmControl2::VetoSource);
UpdateComboBoxBit(cbTrigCount[ID][ch], dpp2, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag);
UpdateComboBoxBit(cbExtra2Option[ID][ch], dpp2, DPP::PHA::Bit_DPPAlgorithmControl2::Extra2Option);
UpdateComboBoxBit(cbTRGOUTChannelProbe[ID][ch], dpp2, DPP::PHA::Bit_DPPAlgorithmControl2::ChannelProbe);
uint32_t vetoBit = digi[ID]->GetSettingFromMemory(DPP::VetoWidth, ch);
@ -2973,7 +2988,8 @@ void DigiSettingsPanel::UpdatePSDSetting(){
UpdateComboBoxBit(cbVetoSource[ID][ch], dpp2, DPP::PSD::Bit_DPPAlgorithmControl2::VetoSource);
UpdateComboBoxBit(cbVetoMode[ID][ch], dpp2, DPP::PSD::Bit_DPPAlgorithmControl2::VetoMode);
UpdateComboBoxBit(cbExtra2Option[ID][ch], dpp2, DPP::PSD::Bit_DPPAlgorithmControl2::ExtraWordOption);
UpdateComboBoxBit(cbTRGOUTChannelProbe[ID][ch], dpp2, DPP::PHA::Bit_DPPAlgorithmControl2::ChannelProbe);
uint32_t CFDBit = digi[ID]->GetSettingFromMemory(DPP::PSD::CFDSetting, ch);
UpdateSpinBox(sbCFDDely[ID][ch], DPP::PSD::CFDSetting, ch);

View File

@ -201,6 +201,8 @@ private:
QCheckBox * chkDisableSelfTrigger[MaxNDigitizer][MaxNChannels + 1];
RComboBox * cbTrigCount[MaxNDigitizer][MaxNChannels + 1];
RComboBox * cbTRGOUTChannelProbe[MaxNDigitizer][MaxNChannels + 1];
//---------- PHA
RComboBox * cbRCCR2Smoothing[MaxNDigitizer][MaxNChannels + 1];
RSpinBox * sbInputRiseTime[MaxNDigitizer][MaxNChannels + 1];

View File

@ -615,6 +615,7 @@ namespace DPP {
const std::pair<unsigned short, unsigned short> TriggerCounterFlag = {2, 16} ;
const std::pair<unsigned short, unsigned short> ActivebaselineCalulation = {1, 18} ;
const std::pair<unsigned short, unsigned short> TagCorrelatedEvents = {1, 19} ;
const std::pair<unsigned short, unsigned short> ChannelProbe = {4, 20} ;
const std::pair<unsigned short, unsigned short> EnableActiveBaselineRestoration = {1, 29} ;
const std::vector<std::pair<std::string, unsigned int>> ListLocalShapeTrigMode = {{"Disabled", 0},
@ -643,6 +644,19 @@ namespace DPP {
{"128", 1},
{"8192", 2}};
const std::vector<std::pair<std::string, unsigned int>> ListChannelProbe = {{"Acq Armed", 1},
{"Self-Trig", 2},
{"Pile-Up", 3},
{"Pile-Up / Self-Trig", 4},
{"Veto", 5},
{"Coincident", 6},
{"Trig Valid.", 7},
{"Trig Valid. Acq Windown", 8},
{"Anti-coin. Event", 9},
{"Discard no coin. Event", 10},
{"Valid Event", 11},
{"Not Valid Event", 12}};
}
}
@ -687,6 +701,7 @@ namespace DPP {
const std::pair<unsigned short, unsigned short> SmoothedChargeIntegration = {5, 11} ;
const std::pair<unsigned short, unsigned short> TriggerCounterFlag = {2, 16} ;
const std::pair<unsigned short, unsigned short> VetoSource = {2, 18} ;
const std::pair<unsigned short, unsigned short> ChannelProbe = {4, 20} ;
const std::pair<unsigned short, unsigned short> MarkSaturation = {1, 24} ;
const std::pair<unsigned short, unsigned short> AdditionLocalTrigValid = {2, 25} ;
const std::pair<unsigned short, unsigned short> VetoMode = {1, 27} ;
@ -721,6 +736,19 @@ namespace DPP {
{"Common (Global Trig. Mask)", 1},
{"Difference (Trig. Mask)", 2},
{"Negative Saturation", 3}};
const std::vector<std::pair<std::string, unsigned int>> ListChannelProbe = {{"OverThreshold", 1},
{"Self-Trig", 2},
{"Pile-Up", 3},
{"Pile-Up / Self-Trig", 4},
{"Veto", 5},
{"Coincident", 6},
{"Trig Valid.", 7},
{"Trig Valid. Acq Windown", 8},
{"Neutron Pulse", 9},
{"Gamma Pulse", 10},
{"Neutron Pulse (gate end)", 11},
{"Gamma Pulse (gate end)", 12}};
const std::vector<std::pair<std::string, unsigned int>> ListTrigCounter = {{"1024", 0},
{"128", 1},