Created an artifical Register 0x8044 for SWDecimation. Simplify a lot of things
This commit is contained in:
parent
256390ffaf
commit
fa3e015e3e
|
@ -743,6 +743,8 @@ void Digitizer::WriteRegister (Reg registerAddress, uint32_t value, int ch, bool
|
|||
|
||||
ret = CAEN_DGTZ_WriteRegister(handle, registerAddress.ActualAddress(ch), value);
|
||||
|
||||
if( registerAddress == DPP::DecimationFactor ) data->SetDecimationFactor(value);
|
||||
|
||||
if( ret == 0 && isSave2MemAndFile && !AcqRun && registerAddress.GetRWType() == RW::ReadWrite ) {
|
||||
if( ch < 0 ) {
|
||||
if( registerAddress.GetAddress() < 0x8000 ){
|
||||
|
@ -790,6 +792,8 @@ uint32_t Digitizer::ReadRegister(Reg registerAddress, unsigned short ch, bool is
|
|||
SaveSettingToFile(registerAddress, returnData, ch);
|
||||
}
|
||||
|
||||
if( registerAddress == DPP::DecimationFactor ) data->SetDecimationFactor( returnData );
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::hex << registerAddress.ActualAddress(ch);
|
||||
|
||||
|
@ -995,6 +999,8 @@ void Digitizer::ProgramSettingsToBoard(){
|
|||
haha = DPP::QDC::RecordLength_W; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
|
||||
// haha = DPP::QDC::NumberEventsPerAggregate; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
|
||||
|
||||
haha = DPP::DecimationFactor; WriteRegister(haha, GetSettingFromMemory(haha), -1, false);
|
||||
|
||||
/// Channels Setting
|
||||
for( int ch = 0; ch < GetNumRegChannels(); ch ++){
|
||||
for( int p = 0; p < (int) RegisterChannelList_QDC.size(); p++){
|
||||
|
|
|
@ -548,6 +548,16 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
|
|||
return;
|
||||
}
|
||||
|
||||
if( para == DPP::DecimationFactor ){
|
||||
int deci = pow(2, sb->value());
|
||||
if( sbRecordLength[ID][0]->value() / digi[ID]->GetTick2ns() <= 2 * deci ){
|
||||
SendLogMsg("Tried to set waveform decimation to be " + QString::number(deci) + ", which make the number of trace less than 2. Abort.");
|
||||
sbSWDecimation[ID]->setValue(0);
|
||||
}else{
|
||||
SendLogMsg("Set waveform decimation to be " + QString::number(deci) + ".");
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t bit = para.GetPartialStep() == -1 ? sb->value() : sb->value() / para.GetPartialStep() / digi[ID]->GetTick2ns();
|
||||
|
||||
if( para.IsCoupled() == true && chID >= 0 ) {
|
||||
|
@ -2534,39 +2544,7 @@ void DigiSettingsPanel::SetUpBoard_QDC(){
|
|||
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);
|
||||
|
||||
|
||||
QLabel * lbSWDeci = new QLabel("SW Decimation Factor :", this);
|
||||
lbSWDeci->setAlignment(Qt::AlignRight | Qt::AlignCenter);
|
||||
bdCfgLayout[ID]->addWidget(lbSWDeci, 7, 0);
|
||||
|
||||
cbSWDecimation[ID] = new RComboBox(this);
|
||||
bdCfgLayout[ID]->addWidget(cbSWDecimation[ID], 7, 1);
|
||||
cbSWDecimation[ID]->addItem("No Deci.", 0);
|
||||
cbSWDecimation[ID]->addItem("Factor 2", 1);
|
||||
cbSWDecimation[ID]->addItem("Factor 4", 2);
|
||||
cbSWDecimation[ID]->addItem("Factor 8", 3);
|
||||
cbSWDecimation[ID]->addItem("Factor 16", 4);
|
||||
cbSWDecimation[ID]->addItem("Factor 32", 5);
|
||||
cbSWDecimation[ID]->addItem("Factor 64", 6);
|
||||
cbSWDecimation[ID]->addItem("Factor 128", 7);
|
||||
|
||||
connect(cbSWDecimation[ID], &RComboBox::currentIndexChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
|
||||
unsigned short factor = cbSWDecimation[ID]->currentData().toInt();
|
||||
|
||||
int deci = pow(2, factor);
|
||||
|
||||
int sampleSize = sbRecordLength[ID][0]->value() / digi[ID]->GetTick2ns();
|
||||
|
||||
if( sampleSize / deci <= 2 ) {
|
||||
SendLogMsg("Tried to set waveform decimation to be " + QString::number(deci) + ", which make the number of trace less than 2. Abort.");
|
||||
cbSWDecimation[ID]->setCurrentIndex(0);
|
||||
}else{
|
||||
SendLogMsg("Set waveform decimation to be " + QString::number(deci) + ".");
|
||||
digi[ID]->GetData()->SetDecimationFactor(factor);
|
||||
}
|
||||
});
|
||||
SetUpSpinBox( sbSWDecimation[ID], "SW Decimation Factor : ", bdCfgLayout[ID], 7, 0, DPP::DecimationFactor, -1, true);
|
||||
|
||||
}
|
||||
|
||||
|
@ -4039,6 +4017,8 @@ void DigiSettingsPanel::UpdateSettings_QDC(){
|
|||
|
||||
UpdateSpinBox(sbNumEventAgg[ID][0], DPP::QDC::NumberEventsPerAggregate, -1);
|
||||
|
||||
UpdateSpinBox(sbSWDecimation[ID], DPP::DecimationFactor, -1);
|
||||
|
||||
for(int grp = 0; grp < digi[ID]->GetNumRegChannels(); grp ++){
|
||||
|
||||
UpdateSpinBox(sbPreTrigger[ID][grp], DPP::QDC::PreTrigger, grp);
|
||||
|
|
|
@ -125,7 +125,8 @@ private:
|
|||
QGridLayout * bdTriggerLayout[MaxNDigitizer];
|
||||
QGridLayout * bdLVDSLayout[MaxNDigitizer];
|
||||
|
||||
RComboBox * cbSWDecimation[MaxNDigitizer]; // software decimation
|
||||
// RComboBox * cbSWDecimation[MaxNDigitizer]; // software decimation
|
||||
RSpinBox * sbSWDecimation[MaxNDigitizer];
|
||||
|
||||
QCheckBox * chkAutoDataFlush[MaxNDigitizer];
|
||||
QCheckBox * chkDecimateTrace[MaxNDigitizer];
|
||||
|
|
|
@ -171,7 +171,7 @@ const Reg FrontPanelTRGOUTEnableMask ("FrontPanelTRGOUTEnableMask" , 0x8110,
|
|||
const Reg PostTrigger ("PostTrigger" , 0x8114, RW::ReadWrite, false, {}); /// R/W
|
||||
const Reg LVDSIOData ("LVDSIOData" , 0x8118, RW::ReadWrite, false, {}); /// R/W
|
||||
const Reg FrontPanelIOControl ("FrontPanelIOControl" , 0x811C, RW::ReadWrite, false, {}); /// R/W
|
||||
const Reg RegChannelEnableMask ("RegChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W
|
||||
const Reg RegChannelEnableMask ("RegChannelEnableMask" , 0x8120, RW::ReadWrite, false, {}); /// R/W
|
||||
const Reg ROCFPGAFirmwareRevision_R ("ROCFPGAFirmwareRevision_R" , 0x8124, RW::ReadONLY , false, {}); /// R
|
||||
const Reg EventStored_R ("EventStored_R" , 0x812C, RW::ReadONLY , false, {}); /// R
|
||||
const Reg VoltageLevelModeConfig ("VoltageLevelModeConfig" , 0x8138, RW::ReadWrite, false, {}); /// R/W
|
||||
|
@ -199,7 +199,6 @@ const Reg Scratch ("Scratch" , 0xEF20,
|
|||
const Reg SoftwareReset_W ("SoftwareReset_W" , 0xEF24, RW::WriteONLY, false, {}); /// W
|
||||
const Reg SoftwareClear_W ("SoftwareClear_W" , 0xEF28, RW::WriteONLY, false, {}); /// W
|
||||
|
||||
|
||||
///====== Common for PHA and PSD
|
||||
namespace DPP {
|
||||
|
||||
|
@ -601,6 +600,9 @@ namespace DPP {
|
|||
|
||||
const Reg TriggerValidationMask_G ("TriggerValidationMask_G" , 0x8180, RW::ReadWrite, true, {}); /// R/W,
|
||||
|
||||
//& Artifical Register that not in CAEN manual
|
||||
const Reg DecimationFactor ("Decimation Factor" , 0x8044, RW::ReadWrite, false, 0x7, -1); /// R/W
|
||||
|
||||
namespace PHA {
|
||||
const Reg DataFlush_W ("DataFlush_W" , 0x103C, RW::WriteONLY, false, {}); /// W not sure
|
||||
const Reg ChannelStopAcquisition ("ChannelStopAcquisition" , 0x1040, RW::ReadWrite, false, {{"Run", 0}, {"Stop", 1}}); /// R/W not sure
|
||||
|
@ -1027,6 +1029,7 @@ const std::vector<Reg> RegisterBoardList_QDC = {
|
|||
DPP::QDC::NumberEventsPerAggregate,
|
||||
DPP::QDC::RecordLength_W,
|
||||
DPP::QDC::RecordLength_R,
|
||||
DPP::DecimationFactor,
|
||||
DPP::AcquisitionControl,
|
||||
DPP::AcquisitionStatus_R,
|
||||
DPP::SoftwareTrigger_W,
|
||||
|
|
Loading…
Reference in New Issue
Block a user