bug fix for PHA single board
This commit is contained in:
parent
61b0f05bb7
commit
e01d9fe4e6
|
@ -365,7 +365,7 @@ inline void Data::DecodeBuffer(bool fastDecode, int verbose){
|
|||
int indexStart = EventIndex[ch] - NumEventsDecoded[ch] + 1;
|
||||
if( indexStart < 0 ) indexStart += MaxNData;
|
||||
|
||||
printf("%d %d| %d %d \n", EventIndex[ch], NumEventsDecoded[ch], indexStart, EventIndex[ch] );
|
||||
//printf("%d %d| %d %d \n", EventIndex[ch], NumEventsDecoded[ch], indexStart, EventIndex[ch] );
|
||||
|
||||
unsigned long long dTime = Timestamp[ch][EventIndex[ch]] - Timestamp[ch][indexStart];
|
||||
double sec = dTime * ch2ns / 1e9;
|
||||
|
|
|
@ -323,7 +323,7 @@ int Digitizer::ProgramPHABoard(){
|
|||
address = DPP::PHA::TriggerHoldOffWidth; ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x3E );
|
||||
address = DPP::PHA::RiseTimeValidationWindow;ret |= CAEN_DGTZ_WriteRegister(handle, address + 0x7000 , 0x0 );
|
||||
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::ChannelDCOffset) + 0x7000 , 0xEEEE );
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::ChannelDCOffset) + 0x7000 , 0x0CCC );
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::PreTrigger) + 0x7000 , 32 );
|
||||
ret |= CAEN_DGTZ_WriteRegister(handle, (uint32_t)(DPP::InputDynamicRange) + 0x7000 , 0x0 );
|
||||
|
||||
|
|
|
@ -40,11 +40,10 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
printf("ReadDataThread stopped.\n");
|
||||
}
|
||||
signals:
|
||||
void sendMsg(const QString &msg);
|
||||
//void endOfLastData();
|
||||
//void checkFileSize();
|
||||
private:
|
||||
Digitizer * digi;
|
||||
int ID;
|
||||
|
|
|
@ -724,6 +724,11 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
|
|||
sb->setSingleStep(para.GetPartialStep() * digi[ID]->GetCh2ns());
|
||||
}
|
||||
|
||||
if( para == DPP::DPPAlgorithmControl ) {
|
||||
sb->setSingleStep(1);
|
||||
sb->setMaximum(0x3F);
|
||||
}
|
||||
|
||||
connect(sb, &RSpinBox::valueChanged, this, [=](){
|
||||
if( !enableSignalSlot ) return;
|
||||
sb->setStyleSheet("color : blue;");
|
||||
|
@ -756,6 +761,12 @@ void DigiSettingsPanel::SetUpSpinBox(RSpinBox * &sb, QString label, QGridLayout
|
|||
return;
|
||||
}
|
||||
|
||||
if( para == DPP::DPPAlgorithmControl ){
|
||||
digi[ID]->SetBits(para, {5,0}, sb->value(), chID);
|
||||
UpdatePanelFromMemory();
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t bit = para.GetPartialStep() == -1 ? sb->value() : sb->value() / para.GetPartialStep() / digi[ID]->GetCh2ns();
|
||||
|
||||
digi[ID]->WriteRegister(para, bit, chID);
|
||||
|
@ -1366,7 +1377,7 @@ void DigiSettingsPanel::SetUpPHAChannel(){
|
|||
SetUpSpinBox(sbTrapRiseTime[ID][MaxNChannels], "Rise Time [ns] : ", trapLayout, 0, 0, DPP::PHA::TrapezoidRiseTime);
|
||||
SetUpSpinBox(sbTrapFlatTop[ID][MaxNChannels], "Flat Top [ns] : ", trapLayout, 0, 2, DPP::PHA::TrapezoidFlatTop);
|
||||
SetUpSpinBox(sbDecay[ID][MaxNChannels], "Decay [ns] : ", trapLayout, 1, 0, DPP::PHA::DecayTime);
|
||||
SetUpSpinBox(sbTrapScaling[ID][MaxNChannels], "Rescaling : ", trapLayout, 1, 2, DPP::PHA::DPPAlgorithmControl2_G);
|
||||
SetUpSpinBox(sbTrapScaling[ID][MaxNChannels], "Rescaling : ", trapLayout, 1, 2, DPP::DPPAlgorithmControl);
|
||||
SetUpSpinBox(sbPeaking[ID][MaxNChannels], "Peaking [ns] : ", trapLayout, 2, 0, DPP::PHA::PeakingTime);
|
||||
SetUpSpinBox(sbPeakingHoldOff[ID][MaxNChannels], "Peak Hold-off [ns] : ", trapLayout, 2, 2, DPP::PHA::PeakHoldOff);
|
||||
SetUpComboBoxBit(cbPeakAvg[ID][MaxNChannels], "Peak Avg. : ", trapLayout, 3, 0, DPP::Bit_DPPAlgorithmControl_PHA::ListPeakMean, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::PeakMean);
|
||||
|
@ -2554,6 +2565,11 @@ void DigiSettingsPanel::UpdateSpinBox(RSpinBox * &sb, Reg para, int ch){
|
|||
return;
|
||||
}
|
||||
|
||||
if( para == DPP::DPPAlgorithmControl ){
|
||||
sb->setValue( value & 0x3F );
|
||||
return;
|
||||
}
|
||||
|
||||
sb->setValue( pStep > 0 ? value * pStep * ch2ns : value);
|
||||
|
||||
//printf("%d, %s | %d %d %u, %f\n", para.GetNameChar(), ch, ch2ns, pStep, value, sb->value());
|
||||
|
|
16
FSUDAQ.cpp
16
FSUDAQ.cpp
|
@ -24,6 +24,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
|||
digi = nullptr;
|
||||
nDigi = 0;
|
||||
|
||||
scalar = nullptr;
|
||||
scope = nullptr;
|
||||
digiSettings = nullptr;
|
||||
|
||||
|
@ -183,7 +184,6 @@ MainWindow::~MainWindow(){
|
|||
delete scalarThread;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
|
@ -448,7 +448,6 @@ void MainWindow::WaitForDigitizersOpen(bool onOff){
|
|||
bnStopACQ->setEnabled(!onOff);
|
||||
chkSaveData->setEnabled(!onOff);
|
||||
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
|
@ -609,9 +608,11 @@ void MainWindow::StartACQ(){
|
|||
if( commentResult == false) return;
|
||||
|
||||
for( unsigned int i = 0; i < nDigi ; i++){
|
||||
if( chkSaveData->isChecked() ) {
|
||||
digi[i]->GetData()->OpenSaveFile((rawDataPath + "/" + prefix).toStdString());
|
||||
digi[i]->StartACQ();
|
||||
readDataThread[i]->SetSaveData(chkSaveData->isChecked());
|
||||
}
|
||||
digi[i]->StartACQ();
|
||||
readDataThread[i]->start();
|
||||
}
|
||||
if( chkSaveData->isChecked() ) SaveLastRunFile();
|
||||
|
@ -626,6 +627,7 @@ void MainWindow::StartACQ(){
|
|||
|
||||
bnStartACQ->setEnabled(false);
|
||||
bnStopACQ->setEnabled(true);
|
||||
bnOpenScope->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
|
@ -656,6 +658,7 @@ void MainWindow::StopACQ(){
|
|||
|
||||
bnStartACQ->setEnabled(true);
|
||||
bnStopACQ->setEnabled(false);
|
||||
bnOpenScope->setEnabled(true);
|
||||
}
|
||||
|
||||
void MainWindow::AutoRun(){
|
||||
|
@ -764,12 +767,19 @@ void MainWindow::OpenScope(){
|
|||
if( scope == nullptr ) {
|
||||
scope = new Scope(digi, nDigi, readDataThread);
|
||||
connect(scope, &Scope::SendLogMsg, this, &MainWindow::LogMsg);
|
||||
connect(scope, &Scope::CloseWindow, this, [=](){
|
||||
bnStartACQ->setEnabled(true);
|
||||
bnStopACQ->setEnabled(false);
|
||||
});
|
||||
scope->show();
|
||||
}else{
|
||||
scope->show();
|
||||
scope->activateWindow();
|
||||
}
|
||||
|
||||
bnStartACQ->setEnabled(false);
|
||||
bnStopACQ->setEnabled(false);
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************
|
||||
|
|
34
Scope.cpp
34
Scope.cpp
|
@ -236,6 +236,8 @@ void Scope::StartScope(){
|
|||
|
||||
EnableControl(false);
|
||||
|
||||
TellACQOnOff(true);
|
||||
|
||||
}
|
||||
|
||||
void Scope::StopScope(){
|
||||
|
@ -247,8 +249,9 @@ void Scope::StopScope(){
|
|||
|
||||
|
||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
||||
|
||||
digiMTX[iDigi].lock();
|
||||
digi[iDigi]->StopACQ();
|
||||
digiMTX[iDigi].unlock();
|
||||
|
||||
readDataThread[iDigi]->quit();
|
||||
readDataThread[iDigi]->wait();
|
||||
|
@ -259,6 +262,8 @@ void Scope::StopScope(){
|
|||
|
||||
EnableControl(true);
|
||||
|
||||
TellACQOnOff(false);
|
||||
|
||||
}
|
||||
|
||||
void Scope::UpdateScope(){
|
||||
|
@ -269,6 +274,7 @@ void Scope::UpdateScope(){
|
|||
|
||||
int ch = cbScopeCh->currentIndex();
|
||||
int ch2ns = digi[ID]->GetCh2ns();
|
||||
int factor = digi[ID]->IsDualTrace() ? 2 : 1;
|
||||
|
||||
Data * data = digi[ID]->GetData();
|
||||
|
||||
|
@ -285,10 +291,10 @@ void Scope::UpdateScope(){
|
|||
|
||||
QVector<QPointF> points[4];
|
||||
for( int i = 0; i < (int) (data->Waveform1[ch][index]).size() ; i++ ) {
|
||||
points[0].append(QPointF(ch2ns * i, (data->Waveform1[ch][index])[i]));
|
||||
if( i < (int) data->Waveform2[ch][index].size() ) points[1].append(QPointF(ch2ns * i, (data->Waveform2[ch][index])[i]));
|
||||
if( i < (int) data->DigiWaveform1[ch][index].size() ) points[2].append(QPointF(ch2ns * i, (data->DigiWaveform1[ch][index])[i] * 1000));
|
||||
if( i < (int) data->DigiWaveform2[ch][index].size() ) points[3].append(QPointF(ch2ns * i, (data->DigiWaveform2[ch][index])[i] * 1000 + 500));
|
||||
points[0].append(QPointF(ch2ns * i * factor, (data->Waveform1[ch][index])[i]));
|
||||
if( i < (int) data->Waveform2[ch][index].size() ) points[1].append(QPointF(ch2ns * i * factor, (data->Waveform2[ch][index])[i]));
|
||||
if( i < (int) data->DigiWaveform1[ch][index].size() ) points[2].append(QPointF(ch2ns * i * factor, (data->DigiWaveform1[ch][index])[i] * 1000));
|
||||
if( i < (int) data->DigiWaveform2[ch][index].size() ) points[3].append(QPointF(ch2ns * i * factor, (data->DigiWaveform2[ch][index])[i] * 1000 + 500));
|
||||
}
|
||||
dataTrace[0]->replace(points[0]);
|
||||
dataTrace[1]->replace(points[1]);
|
||||
|
@ -297,8 +303,7 @@ void Scope::UpdateScope(){
|
|||
}
|
||||
digiMTX[ID].unlock();
|
||||
|
||||
plot->axes(Qt::Horizontal).first()->setRange(0, ch2ns * traceLength);
|
||||
//plotView->SetHRange(0, ch2ns * traceLength);
|
||||
plot->axes(Qt::Horizontal).first()->setRange(0, ch2ns * traceLength * factor);
|
||||
|
||||
}
|
||||
|
||||
|
@ -384,7 +389,7 @@ void Scope::SetUpSpinBox(RSpinBox * &sb, QString str, int row, int col, const Re
|
|||
|
||||
uint32_t value = sb->value() / ch2ns / abs(para.GetPartialStep());
|
||||
|
||||
if( para == DPP::RecordLength_G || para == DPP::PreTrigger){
|
||||
if( para == DPP::RecordLength_G){
|
||||
int factor = digi[ID]->IsDualTrace() ? 2 : 1;
|
||||
value = value * factor;
|
||||
}
|
||||
|
@ -628,6 +633,7 @@ void Scope::UpdateSpinBox(RSpinBox * &sb, const Reg para){
|
|||
|
||||
enableSignalSlot = false;
|
||||
unsigned int haha = digi[ID]->GetSettingFromMemory(para, ch);
|
||||
|
||||
if( para.GetPartialStep() > 0 ) sb->setValue(haha * para.GetPartialStep() * ch2ns);
|
||||
if( para.GetPartialStep() == -1 ) sb->setValue(haha);
|
||||
//enableSignalSlot = true;
|
||||
|
@ -642,13 +648,13 @@ void Scope::UpdatePanelFromMomeory(){
|
|||
int ch = cbScopeCh->currentIndex();
|
||||
|
||||
unsigned int haha = digi[ID]->GetSettingFromMemory(DPP::RecordLength_G, ch);
|
||||
|
||||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||
int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace,
|
||||
sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns / factor);
|
||||
}else{
|
||||
sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns);
|
||||
}
|
||||
|
||||
// if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ){
|
||||
// int factor = digi[ID]->IsDualTrace() ? 2 : 1; // if dual trace,
|
||||
// sbReordLength->setValue(haha * DPP::RecordLength_G.GetPartialStep() * ch2ns / factor);
|
||||
// }else{
|
||||
// }
|
||||
|
||||
haha = digi[ID]->GetSettingFromMemory(DPP::ChannelDCOffset, ch);
|
||||
sbDCOffset->setValue((1.0 - haha * 1.0 / 0xFFFF) * 100 );
|
||||
|
|
8
Scope.h
8
Scope.h
|
@ -31,6 +31,12 @@ public:
|
|||
Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataThread, QMainWindow * parent = nullptr);
|
||||
~Scope();
|
||||
|
||||
void closeEvent(QCloseEvent * event){
|
||||
StopScope();
|
||||
emit CloseWindow();
|
||||
event->accept();
|
||||
}
|
||||
|
||||
private slots:
|
||||
void StartScope();
|
||||
void StopScope();
|
||||
|
@ -39,7 +45,9 @@ private slots:
|
|||
|
||||
signals:
|
||||
|
||||
void CloseWindow();
|
||||
void SendLogMsg(const QString &msg);
|
||||
void TellACQOnOff(const bool onOff);
|
||||
|
||||
private:
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user