diff --git a/ClassDigitizer.cpp b/ClassDigitizer.cpp index a2094b0..0095098 100644 --- a/ClassDigitizer.cpp +++ b/ClassDigitizer.cpp @@ -441,7 +441,7 @@ int Digitizer::ProgramBoard_PSD(){ ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::PSD::DPPAlgorithmControl2_G) + 0x7000 , 0x00000200 ); // use fine time - ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::DPPAlgorithmControl) + 0x7000 , 0x00100000 ); // baseline 16 sample + ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::DPPAlgorithmControl) + 0x7000 , 0x00100002 ); // baseline 16 sample, 80fC ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::PSD::TriggerThreshold) + 0x7000 , 100 ); @@ -1373,7 +1373,7 @@ void Digitizer::SetOptimialAggOrg(){ printf("=================================== Setting related to Buffer\n"); printf(" agg. orgainzation (bit) : 0x%X \n", aggOrgan); - printf(" Channel Mask : %04X \n", chMask); + printf(" Channel Mask : %08X \n", chMask); printf("Max number of Agg per Readout : %u \n", AggRead); printf(" is Extra enabed : %u \n", Ex ); printf(" is Record wave : %u \n", traceOn ); diff --git a/CustomWidgets.h b/CustomWidgets.h index 6d0ccda..ff13ba5 100644 --- a/CustomWidgets.h +++ b/CustomWidgets.h @@ -130,7 +130,7 @@ protected: QAction *selectedAction = menu->exec(event->globalPosition().toPoint()); if( selectedAction == a1 ) { chart()->zoomReset(); - chart()->axes(Qt::Vertical).first()->setRange(-(0x3FFF), 0x3FFF); + // chart()->axes(Qt::Vertical).first()->setRange(-(0x3FFF), 0x3FFF); } } @@ -169,7 +169,7 @@ protected: case Qt::Key_Down: chart()->scroll(0, -10); break; case Qt::Key_R : chart()->zoomReset(); - chart()->axes(Qt::Vertical).first()->setRange(-(0x3FFF), 0x3FFF); + // chart()->axes(Qt::Vertical).first()->setRange(-(0x3FFF), 0x3FFF); break; default: QGraphicsView::keyPressEvent(event); break; } diff --git a/README.md b/README.md index aa95aaa..1aa1703 100644 --- a/README.md +++ b/README.md @@ -188,6 +188,7 @@ second, ensure the core dump file has unlimited size and set the core dump file * Sometimes, the buffer is not in time order, and make the trigger/Accept rate to be nagative. This is nothing to do with the program but the digitizer settings. Recommand reporgram the digitizer. * For 1740 QDC, RecordLenght is board setting, but readout is indivuial group. * For PHA, the trapezoid scaling and fine-gain register are calculated before ACQ start. +* For 1740D QDC, when 1st grouped channel is enabled, the 0th-channel must be enabled, otherwise, there is a ReadData error and the ACQ will stop. # Known Bugs diff --git a/Scope.cpp b/Scope.cpp index 65cde71..9a7d4a3 100644 --- a/Scope.cpp +++ b/Scope.cpp @@ -147,12 +147,39 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPanel_PSD(); if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ) SetUpPanel_QDC(); + if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) { + QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); + yaxis->setRange(-(0x1FFF), 0x1FFF); + } + if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) { + QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); + yaxis->setRange(0, 0x3FFF); + } + if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ) { + QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); + yaxis->setRange(0, 0xFFF); + } + ReadSettingsFromBoard(); if( saveACQStartStatus )StartScope(); }); + if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) { + QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); + yaxis->setRange(-(0x1FFF), 0x1FFF); + } + if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) { + QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); + yaxis->setRange(0, 0x3FFF); + } + if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ) { + QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); + yaxis->setRange(0, 0xFFF); + } + + connect(cbScopeCh, &RComboBox::currentIndexChanged, this, [=](){ if( !enableSignalSlot ) return; @@ -264,19 +291,6 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh UpdatePanelFromMomeory(); - if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) { - QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); - yaxis->setRange(-(0x1FFF), 0x1FFF); - } - if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) { - QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); - yaxis->setRange(0, 0x3FFF); - } - if( digi[ID]->GetDPPType() == V1740_DPP_QDC_CODE ) { - QValueAxis * yaxis = qobject_cast (plot->axes(Qt::Vertical).first()); - yaxis->setRange(0, 0xFFF); - } - workerThread = new QThread(this); scopeWorker = new ScopeWorker(this); scopeTimer = new QTimer(this); @@ -361,9 +375,9 @@ void Scope::StartScope(){ //save present settings, channleMap, trigger condition traceOn[ID] = digi[ID]->IsRecordTrace(); digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, 1, -1); - chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask); if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PHA_CODE ){ + chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask); dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch); dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PHA::DPPAlgorithmControl2_G, ch); @@ -378,6 +392,7 @@ void Scope::StartScope(){ } if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PSD_CODE ){ + chMask = digi[ID]->GetSettingFromMemory(DPP::RegChannelEnableMask); dppAlg = digi[ID]->GetSettingFromMemory(DPP::DPPAlgorithmControl, ch); dppAlg2 = digi[ID]->GetSettingFromMemory(DPP::PSD::DPPAlgorithmControl2_G, ch); @@ -391,10 +406,17 @@ void Scope::StartScope(){ } if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_QDC_CODE ){ + chMask = digi[ID]->GetSettingFromMemory(DPP::QDC::GroupEnableMask); + subChMask = digi[ID]->GetSettingFromMemory(DPP::QDC::SubChannelMask); dppAlg = digi[ID]->GetSettingFromMemory(DPP::QDC::DPPAlgorithmControl, ch); digi[ID]->SetBits(DPP::QDC::DPPAlgorithmControl, DPP::QDC::Bit_DPPAlgorithmControl::TriggerMode, 0, ch); //set self-triiger - digi[ID]->WriteRegister(DPP::RegChannelEnableMask, (1 << ch/8)); + digi[ID]->WriteRegister(DPP::QDC::GroupEnableMask, (1 << (ch/8))); + + uint32_t haha = (1 << (ch%8)); + if( ch/8 == 0 ) haha |= 0x1; //must include the first subchannel + + digi[ID]->WriteRegister(DPP::QDC::SubChannelMask, haha); } @@ -479,20 +501,23 @@ void Scope::StopScope(){ //restore setting digi[ID]->SetBits(DPP::BoardConfiguration, DPP::Bit_BoardConfig::RecordTrace, traceOn[ID], -1); - digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask); if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PHA_CODE ){ digi[ID]->WriteRegister(DPP::DPPAlgorithmControl, dppAlg, oldCh); digi[ID]->WriteRegister(DPP::PHA::DPPAlgorithmControl2_G, dppAlg2, oldCh); + digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask); } if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_PSD_CODE ){ digi[ID]->WriteRegister(DPP::DPPAlgorithmControl, dppAlg, oldCh); digi[ID]->WriteRegister(DPP::PSD::DPPAlgorithmControl2_G, dppAlg2, oldCh); + digi[ID]->WriteRegister(DPP::RegChannelEnableMask, chMask); } if( digi[ID]->GetDPPType() == DPPTypeCode::DPP_QDC_CODE ){ digi[ID]->WriteRegister(DPP::QDC::DPPAlgorithmControl, dppAlg, oldCh); + digi[ID]->WriteRegister(DPP::QDC::GroupEnableMask, chMask); + digi[ID]->WriteRegister(DPP::QDC::SubChannelMask, subChMask); } }else{ diff --git a/Scope.h b/Scope.h index be68607..5498a30 100644 --- a/Scope.h +++ b/Scope.h @@ -86,6 +86,7 @@ private: bool traceOn[MaxNDigitizer]; uint32_t dppAlg, dppAlg2, chMask; //for single channel run + uint32_t subChMask; // for QDC unsigned short oldCh, oldDigi; ReadDataThread ** readDataThread;