QDC Recordlength only for the whole board

This commit is contained in:
Ryan Tang 2024-03-19 18:36:49 -04:00
parent bebff94e62
commit 64dfac3ee2
5 changed files with 70 additions and 36 deletions

View File

@ -437,7 +437,7 @@ int Digitizer::ProgramBoard_QDC(){
int ret = 0;
//WriteRegister(DPP::QDC::NumberEventsPerAggregate, 0x10, -1);
WriteRegister(DPP::QDC::RecordLength, 16, -1); // 128 sample = 2048 ns
WriteRegister(DPP::QDC::RecordLength_W, 16, -1); // 128 sample = 2048 ns
WriteRegister(DPP::QDC::PreTrigger, 60, -1); // at 60 sample = 960 ns
@ -715,6 +715,11 @@ void Digitizer::WriteRegister (Reg registerAddress, uint32_t value, int ch, bool
}
}
if( ret == 0 && isSave2MemAndFile && registerAddress == DPP::QDC::RecordLength_W){
SetSettingToMemory(registerAddress, value, 0);
SaveSettingToFile(registerAddress, value, 0);
}
std::stringstream ss;
ss << std::hex << registerAddress.ActualAddress(ch);
ErrorMsg("WriteRegister:0x" + ss.str()+ "(" + registerAddress.GetName() + ")");
@ -848,6 +853,8 @@ void Digitizer::ReadAllSettingsFromBoard(bool force){
ReadRegister(RegisterBoardList_QDC[p]);
}
ReadQDCRecordLength();
regChannelMask = GetSettingFromMemory(DPP::QDC::GroupEnableMask);
for( int ch = 0; ch < GetNumRegChannels(); ch ++){
@ -892,7 +899,7 @@ void Digitizer::ProgramSettingsToBoard(){
haha = DPP::FrontPanelIOControl; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
haha = DPP::FrontPanelTRGOUTEnableMask; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
haha = DPP::RegChannelEnableMask; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
/// Channels Setting
for( int ch = 0; ch < NumInputCh; ch ++){
if( DPPType == V1730_DPP_PHA_CODE ){
@ -932,6 +939,8 @@ void Digitizer::ProgramSettingsToBoard(){
haha = DPP::FrontPanelIOControl; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
haha = DPP::FrontPanelTRGOUTEnableMask; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
haha = DPP::QDC::GroupEnableMask; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
haha = DPP::QDC::RecordLength_W; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
// haha = DPP::QDC::NumberEventsPerAggregate; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
/// Channels Setting
for( int ch = 0; ch < GetNumRegChannels(); ch ++){

View File

@ -185,6 +185,18 @@ class Digitizer{
bool IsDualTrace_PHA() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 11) & 0x1 );}
bool IsRecordTrace() {return ( (GetSettingFromMemory(DPP::BoardConfiguration) >> 16) & 0x1 );}
//QDC read recordLength
uint32_t ReadQDCRecordLength() {
returnData = ReadRegister(DPP::QDC::RecordLength_R);
Reg temp = DPP::QDC::RecordLength_R;
int indexR = temp.Index(0);
temp = DPP::QDC::RecordLength_W;
int indexW = temp.Index(0);
setting[indexW] = setting[indexR];
//printf("%d %d | %u %u \n", indexR, indexW, setting[indexR], setting[indexW]);
return returnData;
}
};

View File

@ -933,8 +933,15 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
RComboBox * cbBdReg = new RComboBox(inquiryBox);
cbBdReg->setFixedWidth(300);
for( int i = 0; i < (int) RegisterBoardList_PHAPSD.size() ; i++ ){
cbBdReg->addItem( QString::fromStdString(RegisterBoardList_PHAPSD[i].GetName()) + " [0x" + QString::number(RegisterBoardList_PHAPSD[i].GetAddress(), 16).toUpper() + "]", RegisterBoardList_PHAPSD[i].GetAddress());
if( digi[0]->GetDPPType() == V1740_DPP_QDC_CODE ){
for( int i = 0; i < (int) RegisterBoardList_QDC.size() ; i++ ){
cbBdReg->addItem( QString::fromStdString(RegisterBoardList_QDC[i].GetName()) + " [0x" + QString::number(RegisterBoardList_QDC[i].GetAddress(), 16).toUpper() + "]", RegisterBoardList_QDC[i].GetAddress());
}
}else{
for( int i = 0; i < (int) RegisterBoardList_PHAPSD.size() ; i++ ){
cbBdReg->addItem( QString::fromStdString(RegisterBoardList_PHAPSD[i].GetName()) + " [0x" + QString::number(RegisterBoardList_PHAPSD[i].GetAddress(), 16).toUpper() + "]", RegisterBoardList_PHAPSD[i].GetAddress());
}
}
regLayout->addWidget(cbBdReg, 1, 1);
@ -1105,6 +1112,8 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
cbBdReg->currentIndexChanged(regID);
UpdatePanelFromMemory();
}else{
leBdRegSet->setText("use Hex 0xAB123");
leBdRegSet->setStyleSheet("color : red;");
@ -1128,6 +1137,9 @@ void DigiSettingsPanel::SetUpInquiryCopyTab(){
leChRegSet->setStyleSheet("");
cbChReg->currentIndexChanged(regID);
UpdatePanelFromMemory();
}else{
leChRegSet->setText("use Hex 0xAB123");
leChRegSet->setStyleSheet("color : red;");
@ -2439,6 +2451,9 @@ void DigiSettingsPanel::SetUpBoard_QDC(){
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(sbNumEventAgg[ID][0], "Event pre Agg. : ", bdCfgLayout[ID], 5, 0, DPP::QDC::NumberEventsPerAggregate, -1, true);
SetUpSpinBox(sbRecordLength[ID][0], "Record Length [ns] : ", bdCfgLayout[ID], 6, 0, DPP::QDC::RecordLength_W, -1, true);
}
void DigiSettingsPanel::SetUpChannel_QDC(){
@ -2506,14 +2521,14 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QGridLayout * inputLayout = new QGridLayout(inputBox);
inputLayout->setSpacing(2);
SetUpSpinBox(sbRecordLength[ID][numGroup], "Record Length [ns] : ", inputLayout, 1, 0, DPP::QDC::RecordLength, -1, true);
SetUpSpinBox(sbDCOffset[ID][numGroup], "DC Offset [%] : ", inputLayout, 1, 0, DPP::QDC::DCOffset);
SetUpSpinBox(sbPreTrigger[ID][numGroup], "Pre-Trigger [ns] : ", inputLayout, 1, 2, DPP::QDC::PreTrigger);
SetUpSpinBox(sbDCOffset[ID][numGroup], "DC Offset [%] : ", inputLayout, 2, 0, DPP::QDC::DCOffset);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 2, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
SetUpComboBoxBit(cbPolarity[ID][numGroup], "Polarity : ", inputLayout, 2, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity);
SetUpSpinBox(sbFixedBaseline[ID][numGroup], "Fixed Baseline : ", inputLayout, 4, 0, DPP::QDC::FixedBaseline);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 4, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][numGroup], "Input Smoothing : ", inputLayout, 3, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor);
SetUpSpinBox(sbFixedBaseline[ID][numGroup], "Fixed Baseline : ", inputLayout, 3, 0, DPP::QDC::FixedBaseline);
SetUpComboBoxBit(cbBaseLineAvg[ID][numGroup], "Baseline Avg. : ", inputLayout, 3, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListBaselineAvg, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::BaselineAvg);
connect(cbBaseLineAvg[ID][numGroup], &RComboBox::currentIndexChanged, this, [=](){
sbFixedBaseline[ID][numGroup]->setEnabled( cbBaseLineAvg[ID][numGroup]->currentData().toInt() == 0);
@ -2693,10 +2708,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
otherLayout->setSpacing(2);
SetUpCheckBox(chkTestPule[ID][numGroup], "Int. Test Pulse", otherLayout, 0, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse);
SetUpComboBoxBit(cbTestPulseRate[ID][numGroup], "Test Pulse Rate : ", otherLayout, 1, 0, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate);
SetUpSpinBox(sbNumEventAgg[ID][numGroup], "Event pre Agg. : ", otherLayout, 0, 2, DPP::QDC::NumberEventsPerAggregate);
SetUpComboBoxBit(cbTestPulseRate[ID][numGroup], "Test Pulse Rate : ", otherLayout, 0, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate);
}
{//^================== status
@ -2761,14 +2773,14 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
if( ch == 0 ){
QLabel * lb2 = new QLabel("DC offset [%]", this); lb2->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb2, 0, 2);
QLabel * lb3 = new QLabel("Record Length [ns]", this); lb3->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb3, 0, 4);
// QLabel * lb3 = new QLabel("Record Length [ns]", this); lb3->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb3, 0, 4);
QLabel * lb4 = new QLabel("Pre-Trigger [ns]", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 6);
QLabel * lb6 = new QLabel("Polarity", this); lb6->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb6, 0, 8);
QLabel * lb7 = new QLabel("Input Smoothing", this); lb7->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb7, 0, 10);
}
SetUpSpinBox(sbDCOffset[ID][ch], "", tabLayout, ch + 1, 1, DPP::QDC::DCOffset, ch);
SetUpSpinBox(sbRecordLength[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::RecordLength, ch);
// SetUpSpinBox(sbRecordLength[ID][ch], "", tabLayout, ch + 1, 3, DPP::QDC::RecordLength, ch);
SetUpSpinBox(sbPreTrigger[ID][ch], "", tabLayout, ch + 1, 5, DPP::QDC::PreTrigger, ch);
SetUpComboBoxBit(cbPolarity[ID][ch], "", tabLayout, ch + 1, 7, DPP::QDC::Bit_DPPAlgorithmControl::ListPolarity, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::Polarity, 1, ch);
SetUpComboBoxBit(cbRCCR2Smoothing[ID][ch], "", tabLayout, ch + 1, 9, DPP::QDC::Bit_DPPAlgorithmControl::ListInputSmoothingFactor, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InputSmoothingFactor, 1, ch);
@ -2882,7 +2894,7 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
QWidget ** tabID = new QWidget * [nTab];
for( int i = 0; i < nTab; i++){
for( int i = 0; i < nTab; i++){
tabID [i] = new QWidget(this);
trigTab->addTab(tabID[i], tabName[i]);
@ -2961,7 +2973,6 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
}
SetUpCheckBox(chkDisableSelfTrigger[ID][ch], "Disable Self Trigger ", tabLayout, ch+1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::DisableSelfTrigger, ch);
SetUpCheckBox(chkDisableTriggerHysteresis[ID][ch], "Disbale Trig. Hysteresis ", tabLayout, ch+1, 3, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::DisableTriggerHysteresis, ch, 2);
SetUpSpinBox(sbNumEventAgg[ID][ch], "", tabLayout, ch+1, 5, DPP::QDC::NumberEventsPerAggregate, ch);
}
@ -3059,12 +3070,10 @@ void DigiSettingsPanel::SetUpChannel_QDC(){
if( i == 0 ){
if( ch == 0 ){
QLabel * lb3 = new QLabel("Test Pulse Rate", this); lb3->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb3, 0, 3);
QLabel * lb4 = new QLabel("Event pre Agg.", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 5);
// QLabel * lb4 = new QLabel("Event pre Agg.", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 5);
}
SetUpCheckBox(chkTestPule[ID][ch], "Int. Test Pulse", tabLayout, ch + 1, 1, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::InternalTestPulse, ch);
SetUpComboBoxBit(cbTestPulseRate[ID][ch], "", tabLayout, ch + 1, 2, DPP::QDC::Bit_DPPAlgorithmControl::ListTestPulseRate, DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TestPulseRate, 1, ch);
SetUpSpinBox(sbNumEventAgg[ID][ch], "", tabLayout, ch + 1, 4, DPP::QDC::NumberEventsPerAggregate, ch);
}
}
@ -3805,12 +3814,12 @@ void DigiSettingsPanel::SyncAllChannelsTab_QDC(){
if( !enableSignalSlot ) return;
SyncSpinBox(sbRecordLength);
// SyncSpinBox(sbRecordLength);
SyncSpinBox(sbPreTrigger);
SyncSpinBox(sbDCOffset);
SyncSpinBox(sbTriggerHoldOff);
SyncSpinBox(sbShapedTrigWidth);
SyncSpinBox(sbNumEventAgg);
// SyncSpinBox(sbNumEventAgg);
SyncSpinBox(sbShortGate);
SyncSpinBox(sbGateOffset);
//SyncSpinBox(sbOverThresholdWidth);
@ -3898,14 +3907,17 @@ void DigiSettingsPanel::SyncAllChannelsTab_QDC(){
void DigiSettingsPanel::UpdateSettings_QDC(){
enableSignalSlot = false;
uint32_t haha = digi[ID]->ReadQDCRecordLength();
sbRecordLength[ID][0]->setValue(haha * 8 * 16);
UpdateSpinBox(sbNumEventAgg[ID][0], DPP::QDC::NumberEventsPerAggregate, -1);
for(int grp = 0; grp < digi[ID]->GetNumRegChannels(); grp ++){
UpdateSpinBox(sbRecordLength[ID][grp], DPP::QDC::RecordLength, grp);
UpdateSpinBox(sbPreTrigger[ID][grp], DPP::QDC::PreTrigger, grp);
UpdateSpinBox(sbDCOffset[ID][grp], DPP::QDC::DCOffset, grp);
UpdateSpinBox(sbTriggerHoldOff[ID][grp], DPP::QDC::TriggerHoldOffWidth, grp);
UpdateSpinBox(sbShapedTrigWidth[ID][grp], DPP::QDC::TRGOUTWidth, grp);
UpdateSpinBox(sbNumEventAgg[ID][grp], DPP::QDC::NumberEventsPerAggregate, grp);
UpdateSpinBox(sbShortGate[ID][grp], DPP::QDC::GateWidth, grp);
UpdateSpinBox(sbGateOffset[ID][grp], DPP::QDC::GateOffset, grp);
//UpdateSpinBox(sbOverThresholdWidth[ID][grp], DPP::QDC::OverThresholdWidth, grp);
@ -3969,14 +3981,12 @@ void DigiSettingsPanel::UpdateSettings_QDC(){
sbSubChThreshold[ID][grp][6]->setValue(threshold_6);
sbSubChThreshold[ID][grp][7]->setValue(threshold_7);
}
enableSignalSlot = true;
SyncAllChannelsTab_QDC();
}
void DigiSettingsPanel::CheckRadioAndCheckedButtons(){

View File

@ -786,8 +786,6 @@ namespace DPP {
}
namespace QDC { // Register already grouped in channel. and there no control for indiviual channel except the Fine DC offset and threshold, so it is like no group
const Reg NumberEventsPerAggregate ("Number of Events per Aggregate", 0x1020, RW::ReadWrite, false, 0x3FF, -1); /// R/W
const Reg RecordLength ("Record Length" , 0x1024, RW::ReadWrite, false, 0x1FFF, 8); /// R
const Reg GateWidth ("GateWidth" , 0x1030, RW::ReadWrite, false, 0xFFF, 1); /// R/W
const Reg GateOffset ("GateOfset" , 0x1034, RW::ReadWrite, false, 0xFF, 1); /// R/W
const Reg FixedBaseline ("FixedBaseline" , 0x1038, RW::ReadWrite, false, 0xFFF, -1); /// R/W
@ -812,8 +810,9 @@ namespace DPP {
const Reg TriggerThreshold_sub7 ("Trigger Threshold sub7" , 0x10EC, RW::ReadWrite, false, 0xFFF, -1); /// R/W
const Reg GroupEnableMask ("Group Enable Mask" , 0x8120, RW::ReadWrite, false, 0xFF, -1); /// R/W
const Reg NumberEventsPerAggregate ("Number of Events per Aggregate", 0x8020, RW::ReadWrite, false, 0x3FF, -1); /// R/W
const Reg RecordLength_W ("Record Length_W" , 0x8024, RW::WriteONLY, false, 0x1FFF, 8); /// R/W
const Reg RecordLength_R ("Record Length_R" , 0x1024, RW::ReadONLY, false, 0x1FFF, 8); /// R/W
namespace Bit_DPPAlgorithmControl {
@ -928,7 +927,7 @@ const std::vector<Reg> RegisterChannelList_PSD = {
};
const std::vector<Reg> RegisterChannelList_QDC = {
DPP::QDC::RecordLength,
// DPP::QDC::RecordLength,
DPP::QDC::GateWidth,
DPP::QDC::GateOffset,
DPP::QDC::FixedBaseline,
@ -955,7 +954,6 @@ const std::vector<Reg> RegisterChannelList_QDC = {
/// Only Board Setting
const std::vector<Reg> RegisterBoardList_PHAPSD = {
DPP::BoardConfiguration ,
DPP::AggregateOrganization ,
DPP::ADCCalibration_W ,
@ -1027,7 +1025,8 @@ const std::vector<Reg> RegisterBoardList_QDC = {
DPP::BoardConfiguration ,
DPP::AggregateOrganization,
DPP::QDC::NumberEventsPerAggregate,
// DPP::QDC::RecordLength_W,
DPP::QDC::RecordLength_W,
DPP::QDC::RecordLength_R,
DPP::AcquisitionControl,
DPP::AcquisitionStatus_R,
DPP::SoftwareTrigger_W,

View File

@ -883,7 +883,7 @@ void Scope::SetUpPanel_QDC() {
int rowID = 0;
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::QDC::RecordLength);
SetUpSpinBox(sbReordLength, "Record Length [ns] ", rowID, 0, DPP::QDC::RecordLength_W);
SetUpSpinBox(sbPreTrigger, "Pre Trigger [ns] ", rowID, 2, DPP::QDC::PreTrigger);
SetUpSpinBox(sbDCOffset, "DC offset [%] ", rowID, 4, DPP::QDC::DCOffset);
sbDCOffset->setDecimals(2);
@ -1223,7 +1223,8 @@ void Scope::UpdatePanel_QDC(){
uint32_t haha = digi[ID]->GetSettingFromMemory(DPP::QDC::DCOffset, grp);
sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 );
UpdateSpinBox(sbReordLength, DPP::QDC::RecordLength);
//UpdateSpinBox(sbReordLength, DPP::QDC::RecordLength);
sbReordLength->setValue(digi[ID]->ReadQDCRecordLength());
UpdateSpinBox(sbPreTrigger, DPP::QDC::PreTrigger);
UpdateSpinBox(sbShortGate, DPP::QDC::GateWidth);
@ -1300,7 +1301,10 @@ void Scope::ReadSettingsFromBoard(){
int ch = cbScopeCh->currentIndex();
int grp = ch/8;
digi[ID]->ReadRegister(DPP::QDC::RecordLength, grp);
//digi[ID]->ReadRegister(DPP::QDC::RecordLength, grp);
digi[ID]->ReadQDCRecordLength();
digi[ID]->ReadRegister(DPP::QDC::PreTrigger, grp);
digi[ID]->ReadRegister(DPP::QDC::DCOffset, grp);
digi[ID]->ReadRegister(DPP::QDC::DPPAlgorithmControl, grp);