modified readDataThread, few bugs fixed
This commit is contained in:
parent
38c4d0d992
commit
7e12a2d6a6
|
@ -37,25 +37,6 @@ Canvas::Canvas(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent) : QM
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
QPushButton * bnAddRandom = new QPushButton("Add Random", this);
|
|
||||||
ctrlLayout->addWidget(bnAddRandom, 0, 1);
|
|
||||||
connect(bnAddRandom, &QPushButton::clicked, this, [=](){
|
|
||||||
|
|
||||||
double mean = 2000.0; // Mean of the distribution
|
|
||||||
double standardDeviation = 1000.0; // Standard deviation of the distribution
|
|
||||||
|
|
||||||
double randomNumber = QRandomGenerator::global()->generateDouble(); // Generate a random number between 0 and 1
|
|
||||||
double gaussianNumber = qSqrt(-2 * qLn(randomNumber)) * qCos(2 * M_PI * randomNumber); // Transform the number to follow a Gaussian distribution
|
|
||||||
|
|
||||||
// Scale and shift the number to match the desired mean and standard deviation
|
|
||||||
gaussianNumber = (gaussianNumber * standardDeviation) + mean;
|
|
||||||
|
|
||||||
int bd = cbDigi->currentIndex();
|
|
||||||
int ch = cbCh->currentIndex();
|
|
||||||
|
|
||||||
hist[bd][ch]->Fill(gaussianNumber);
|
|
||||||
});
|
|
||||||
|
|
||||||
cbDigi = new RComboBox(this);
|
cbDigi = new RComboBox(this);
|
||||||
for( unsigned int i = 0; i < nDigi; i++) cbDigi->addItem("Digi-" + QString::number( digi[i]->GetSerialNumber() ), i);
|
for( unsigned int i = 0; i < nDigi; i++) cbDigi->addItem("Digi-" + QString::number( digi[i]->GetSerialNumber() ), i);
|
||||||
ctrlLayout->addWidget(cbDigi, 1, 0);
|
ctrlLayout->addWidget(cbDigi, 1, 0);
|
||||||
|
@ -88,7 +69,6 @@ Canvas::Canvas(Digitizer ** digi, unsigned int nDigi, QMainWindow * parent) : QM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
histLayout->addWidget(histView[0][0], 0, 0);
|
histLayout->addWidget(histView[0][0], 0, 0);
|
||||||
oldBd = -1;
|
oldBd = -1;
|
||||||
oldCh = -1;
|
oldCh = -1;
|
||||||
|
|
|
@ -18,47 +18,70 @@ public:
|
||||||
this->ID = digiID;
|
this->ID = digiID;
|
||||||
isSaveData = false;
|
isSaveData = false;
|
||||||
isScope = false;
|
isScope = false;
|
||||||
|
readCount = 0;
|
||||||
|
stop = false;
|
||||||
}
|
}
|
||||||
|
void Stop() { this->stop = true;}
|
||||||
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
void SetSaveData(bool onOff) {this->isSaveData = onOff;}
|
||||||
void SetScopeMode(bool onOff) {this->isScope = onOff;}
|
void SetScopeMode(bool onOff) {this->isScope = onOff;}
|
||||||
void run(){
|
void run(){
|
||||||
clock_gettime(CLOCK_REALTIME, &ta);
|
clock_gettime(CLOCK_REALTIME, &ta);
|
||||||
while(true){
|
// clock_gettime(CLOCK_REALTIME, &t1);
|
||||||
|
stop = false;
|
||||||
|
do{
|
||||||
|
|
||||||
|
if( stop) break;
|
||||||
|
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
int ret = digi->ReadData();
|
int ret = digi->ReadData();
|
||||||
digiMTX[ID].unlock();
|
digiMTX[ID].unlock();
|
||||||
|
readCount ++;
|
||||||
|
|
||||||
if( ret == CAEN_DGTZ_Success ){
|
if( stop) break;
|
||||||
|
if( ret == CAEN_DGTZ_Success && !stop){
|
||||||
digiMTX[ID].lock();
|
digiMTX[ID].lock();
|
||||||
digi->GetData()->DecodeBuffer(!isScope);
|
digi->GetData()->DecodeBuffer(!isScope, 0);
|
||||||
if( isSaveData ) digi->GetData()->SaveData();
|
if( isSaveData ) digi->GetData()->SaveData();
|
||||||
digiMTX[ID].unlock();
|
digiMTX[ID].unlock();
|
||||||
|
|
||||||
|
// clock_gettime(CLOCK_REALTIME, &t2);
|
||||||
|
// if( t2.tv_sec - t1.tv_sec > 2 ) {
|
||||||
|
// printf("----Digi-%d read %ld / sec.\n", ID, readCount / 2);
|
||||||
|
// readCount = 0;
|
||||||
|
// t1 = t2;
|
||||||
|
// }
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
printf("ReadDataThread::%s------------ ret : %d \n", __func__, ret);
|
printf("ReadDataThread::%s------------ ret : %d \n", __func__, ret);
|
||||||
|
digiMTX[ID].lock();
|
||||||
digi->StopACQ();
|
digi->StopACQ();
|
||||||
|
digiMTX[ID].unlock();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isSaveData ) {
|
if( isSaveData && !stop ) {
|
||||||
clock_gettime(CLOCK_REALTIME, &tb);
|
clock_gettime(CLOCK_REALTIME, &tb);
|
||||||
if( tb.tv_sec - ta.tv_sec > 2 ) {
|
if( tb.tv_sec - ta.tv_sec > 2 ) {
|
||||||
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024.) + " MB");
|
digiMTX[ID].lock();
|
||||||
|
emit sendMsg("FileSize ("+ QString::number(digi->GetSerialNumber()) +"): " + QString::number(digi->GetData()->GetTotalFileSize()/1024./1024., 'f', 4) + " MB");
|
||||||
|
digiMTX[ID].unlock();
|
||||||
ta = tb;
|
ta = tb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}while(!stop);
|
||||||
printf("ReadDataThread stopped.\n");
|
printf("ReadDataThread stopped.\n");
|
||||||
}
|
}
|
||||||
signals:
|
signals:
|
||||||
void sendMsg(const QString &msg);
|
void sendMsg(const QString &msg);
|
||||||
private:
|
private:
|
||||||
Digitizer * digi;
|
Digitizer * digi;
|
||||||
|
bool stop;
|
||||||
int ID;
|
int ID;
|
||||||
timespec ta, tb;
|
timespec ta, tb, t1, t2;
|
||||||
bool isSaveData;
|
bool isSaveData;
|
||||||
bool isScope;
|
bool isScope;
|
||||||
|
unsigned long readCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
//^#======================================================= Timing Thread
|
//^#======================================================= Timing Thread
|
||||||
|
|
|
@ -174,6 +174,7 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
|
||||||
leSaveFilePath[iDigi] = new QLineEdit(this);
|
leSaveFilePath[iDigi] = new QLineEdit(this);
|
||||||
leSaveFilePath[iDigi]->setReadOnly(true);
|
leSaveFilePath[iDigi]->setReadOnly(true);
|
||||||
buttonLayout->addWidget(leSaveFilePath[iDigi], rowID, 1, 1, 3);
|
buttonLayout->addWidget(leSaveFilePath[iDigi], rowID, 1, 1, 3);
|
||||||
|
leSaveFilePath[iDigi]->setText(QString::fromStdString(digi[ID]->GetSettingFileName()));
|
||||||
|
|
||||||
rowID ++; //---------------------------
|
rowID ++; //---------------------------
|
||||||
bnRefreshSetting = new QPushButton("Refresh Settings", this);
|
bnRefreshSetting = new QPushButton("Refresh Settings", this);
|
||||||
|
@ -396,6 +397,14 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
|
||||||
|
|
||||||
cbBdReg->currentIndexChanged(0);
|
cbBdReg->currentIndexChanged(0);
|
||||||
|
|
||||||
|
connect(cbCh, &RComboBox::currentIndexChanged, this, [=](int index){
|
||||||
|
if( !enableSignalSlot ) return;
|
||||||
|
int regIndex = cbChReg->currentIndex();
|
||||||
|
|
||||||
|
uint32_t value = digi[ cbDigi->currentIndex() ] ->ReadRegister(chRegList[regIndex], cbCh->currentIndex(), index);
|
||||||
|
leChRegValue->setText( "0x" + QString::number(value, 16).toUpper());
|
||||||
|
});
|
||||||
|
|
||||||
connect(cbChReg, &RComboBox::currentIndexChanged, this, [=](int index){
|
connect(cbChReg, &RComboBox::currentIndexChanged, this, [=](int index){
|
||||||
if( !enableSignalSlot ) return;
|
if( !enableSignalSlot ) return;
|
||||||
|
|
||||||
|
@ -457,7 +466,8 @@ DigiSettingsPanel::DigiSettingsPanel(Digitizer ** digi, unsigned int nDigi, QStr
|
||||||
uint32_t value = std::stoul(text.toStdString(), nullptr, 16);
|
uint32_t value = std::stoul(text.toStdString(), nullptr, 16);
|
||||||
int index = cbDigi->currentIndex();
|
int index = cbDigi->currentIndex();
|
||||||
int regID = cbChReg->currentIndex();
|
int regID = cbChReg->currentIndex();
|
||||||
digi[index]->WriteRegister(chRegList[regID], value);
|
int ch = cbCh->currentIndex();
|
||||||
|
digi[index]->WriteRegister(chRegList[regID], value, ch);
|
||||||
leChRegSet->setStyleSheet("");
|
leChRegSet->setStyleSheet("");
|
||||||
|
|
||||||
cbChReg->currentIndexChanged(regID);
|
cbChReg->currentIndexChanged(regID);
|
||||||
|
@ -2092,10 +2102,10 @@ void DigiSettingsPanel::SetUpPSDChannel(){
|
||||||
QLabel * lb4 = new QLabel("Local Trig. Valid. [G]", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 9);
|
QLabel * lb4 = new QLabel("Local Trig. Valid. [G]", this); lb4->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb4, 0, 9);
|
||||||
}
|
}
|
||||||
SetUpCheckBox(chkDisableSelfTrigger[ID][ch], "Disable Self Trigger", tabLayout, ch + 1, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger, ch);
|
SetUpCheckBox(chkDisableSelfTrigger[ID][ch], "Disable Self Trigger", tabLayout, ch + 1, 1, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::DisableSelfTrigger, ch);
|
||||||
SetUpSpinBox(sbThreshold[ID][ch], "", tabLayout, ch + 1, 2, DPP::PHA::TriggerThreshold, ch);
|
SetUpSpinBox(sbThreshold[ID][ch], "", tabLayout, ch + 1, 2, DPP::PSD::TriggerThreshold, ch);
|
||||||
SetUpComboBoxBit(cbTrigMode[ID][ch], "", tabLayout, ch + 1, 4, DPP::Bit_DPPAlgorithmControl_PHA::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 1, ch);
|
SetUpComboBoxBit(cbTrigMode[ID][ch], "", tabLayout, ch + 1, 4, DPP::Bit_DPPAlgorithmControl_PHA::ListTrigMode, DPP::DPPAlgorithmControl, DPP::Bit_DPPAlgorithmControl_PHA::TriggerMode, 1, ch);
|
||||||
SetUpSpinBox(sbTriggerHoldOff[ID][ch], "", tabLayout, ch + 1, 6, DPP::PHA::TriggerHoldOffWidth, ch);
|
SetUpSpinBox(sbTriggerHoldOff[ID][ch], "", tabLayout, ch + 1, 6, DPP::PSD::TriggerHoldOffWidth, ch);
|
||||||
SetUpComboBoxBit(cbLocalTriggerValid[ID][ch], "", tabLayout, ch + 1, 8, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode, 1, ch);
|
SetUpComboBoxBit(cbLocalTriggerValid[ID][ch], "", tabLayout, ch + 1, 8, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalTrigValidMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalTrigValidMode, 1, ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i == 1 ){
|
if( i == 1 ){
|
||||||
|
@ -2105,9 +2115,8 @@ void DigiSettingsPanel::SetUpPSDChannel(){
|
||||||
QLabel * lb1 = new QLabel("Trig. Counter Flag [G]", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 6);
|
QLabel * lb1 = new QLabel("Trig. Counter Flag [G]", this); lb1->setAlignment(Qt::AlignHCenter); tabLayout->addWidget(lb1, 0, 6);
|
||||||
}
|
}
|
||||||
SetUpSpinBox(sbShapedTrigWidth[ID][ch], "", tabLayout, ch + 1, 1, DPP::PSD::ShapedTriggerWidth, ch);
|
SetUpSpinBox(sbShapedTrigWidth[ID][ch], "", tabLayout, ch + 1, 1, DPP::PSD::ShapedTriggerWidth, ch);
|
||||||
SetUpComboBoxBit(cbLocalShapedTrigger[ID][ch], "", tabLayout, ch + 1, 3, DPP::PHA::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1, ch);
|
SetUpComboBoxBit(cbLocalShapedTrigger[ID][ch], "", tabLayout, ch + 1, 3, DPP::PSD::Bit_DPPAlgorithmControl2::ListLocalShapeTrigMode, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::LocalShapeTriggerMode, 1, ch);
|
||||||
SetUpComboBoxBit(cbTrigCount[ID][ch], "", tabLayout, ch + 1, 5, DPP::PHA::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag, 1, ch);
|
SetUpComboBoxBit(cbTrigCount[ID][ch], "", tabLayout, ch + 1, 5, DPP::PSD::Bit_DPPAlgorithmControl2::ListTrigCounter, DPP::PHA::DPPAlgorithmControl2_G, DPP::PHA::Bit_DPPAlgorithmControl2::TriggerCounterFlag, 1, ch);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i == 2 ){
|
if( i == 2 ){
|
||||||
|
|
38
FSUDAQ.cpp
38
FSUDAQ.cpp
|
@ -51,7 +51,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
layout->addWidget(bnDigiSettings, 1, 1);
|
layout->addWidget(bnDigiSettings, 1, 1);
|
||||||
connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigiSettings);
|
connect(bnDigiSettings, &QPushButton::clicked, this, &MainWindow::OpenDigiSettings);
|
||||||
|
|
||||||
bnCanvas = new QPushButton("Online Histograms", this);
|
bnCanvas = new QPushButton("Online 1D Histograms", this);
|
||||||
layout->addWidget(bnCanvas, 2, 0);
|
layout->addWidget(bnCanvas, 2, 0);
|
||||||
connect(bnCanvas, &QPushButton::clicked, this, &MainWindow::OpenCanvas);
|
connect(bnCanvas, &QPushButton::clicked, this, &MainWindow::OpenCanvas);
|
||||||
|
|
||||||
|
@ -599,13 +599,15 @@ void MainWindow::UpdateScalar(){
|
||||||
|
|
||||||
lbLastUpdateTime->setText("Last update: " + QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"));
|
lbLastUpdateTime->setText("Last update: " + QDateTime::currentDateTime().toString("MM.dd hh:mm:ss"));
|
||||||
|
|
||||||
|
//printf("----------------------\n");
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi++){
|
||||||
Data * data = digi[iDigi]->GetData();
|
digiMTX[iDigi].lock();
|
||||||
|
|
||||||
for( int i = 0; i < digi[iDigi]->GetNChannels(); i++){
|
for( int i = 0; i < digi[iDigi]->GetNChannels(); i++){
|
||||||
leTrigger[iDigi][i]->setText(QString::number(data->TriggerRate[i]));
|
//printf(" %3d %2d | %7.2f %7.2f \n", digi[iDigi]->GetSerialNumber(), i, digi[iDigi]->GetData()->TriggerRate[i], digi[iDigi]->GetData()->NonPileUpRate[i]);
|
||||||
leAccept[iDigi][i]->setText(QString::number(data->NonPileUpRate[i]));
|
leTrigger[iDigi][i]->setText(QString::number(digi[iDigi]->GetData()->TriggerRate[i], 'f', 2));
|
||||||
|
leAccept[iDigi][i]->setText(QString::number(digi[iDigi]->GetData()->NonPileUpRate[i], 'f', 2));
|
||||||
}
|
}
|
||||||
|
digiMTX[iDigi].unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -621,9 +623,9 @@ void MainWindow::StartACQ(){
|
||||||
if( commentResult == false) return;
|
if( commentResult == false) return;
|
||||||
|
|
||||||
if( chkSaveData->isChecked() ) {
|
if( chkSaveData->isChecked() ) {
|
||||||
LogMsg("===================== Start a new Run-" + QString::number(runID));
|
LogMsg("<font style=\"color: orange;\">===================== <b>Start a new Run-" + QString::number(runID) + "</b></font>");
|
||||||
}else{
|
}else{
|
||||||
LogMsg("===================== Start a non-save Run");
|
LogMsg("<font style=\"color: orange;\">===================== <b>Start a non-save Run</b></font>");
|
||||||
}
|
}
|
||||||
|
|
||||||
for( unsigned int i = 0; i < nDigi ; i++){
|
for( unsigned int i = 0; i < nDigi ; i++){
|
||||||
|
@ -639,6 +641,7 @@ void MainWindow::StartACQ(){
|
||||||
readDataThread[i]->start();
|
readDataThread[i]->start();
|
||||||
}
|
}
|
||||||
if( chkSaveData->isChecked() ) SaveLastRunFile();
|
if( chkSaveData->isChecked() ) SaveLastRunFile();
|
||||||
|
|
||||||
scalarThread->start();
|
scalarThread->start();
|
||||||
|
|
||||||
if( !scalar->isVisible() ) {
|
if( !scalar->isVisible() ) {
|
||||||
|
@ -648,7 +651,7 @@ void MainWindow::StartACQ(){
|
||||||
}
|
}
|
||||||
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
lbScalarACQStatus->setText("<font style=\"color: green;\"><b>ACQ On</b></font>");
|
||||||
|
|
||||||
if( canvas != nullptr ) histThread->start();
|
//if( canvas != nullptr ) histThread->start();
|
||||||
|
|
||||||
bnStartACQ->setEnabled(false);
|
bnStartACQ->setEnabled(false);
|
||||||
bnStopACQ->setEnabled(true);
|
bnStopACQ->setEnabled(true);
|
||||||
|
@ -658,25 +661,28 @@ void MainWindow::StartACQ(){
|
||||||
void MainWindow::StopACQ(){
|
void MainWindow::StopACQ(){
|
||||||
if( digi == nullptr ) return;
|
if( digi == nullptr ) return;
|
||||||
|
|
||||||
|
bool commentResult = true;
|
||||||
|
if( chkSaveData->isChecked() ) commentResult = CommentDialog(true);
|
||||||
|
if( commentResult == false) return;
|
||||||
|
|
||||||
if( chkSaveData->isChecked() ) {
|
if( chkSaveData->isChecked() ) {
|
||||||
LogMsg("===================== Stop Run-" + QString::number(runID));
|
LogMsg("===================== Stop Run-" + QString::number(runID));
|
||||||
}else{
|
}else{
|
||||||
LogMsg("===================== Stop a non-save Run");
|
LogMsg("===================== Stop a non-save Run");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool commentResult = true;
|
|
||||||
if( chkSaveData->isChecked() ) commentResult = CommentDialog(true);
|
|
||||||
if( commentResult == false) return;
|
|
||||||
|
|
||||||
for( unsigned int i = 0; i < nDigi; i++){
|
for( unsigned int i = 0; i < nDigi; i++){
|
||||||
LogMsg("Digi-" + QString::number(digi[i]->GetSerialNumber()) + " is stoping ACQ." );
|
LogMsg("Digi-" + QString::number(digi[i]->GetSerialNumber()) + " is stoping ACQ." );
|
||||||
digi[i]->StopACQ();
|
|
||||||
if( chkSaveData->isChecked() ) digi[i]->GetData()->CloseSaveFile();
|
|
||||||
|
|
||||||
if( readDataThread[i]->isRunning() ) {
|
if( readDataThread[i]->isRunning() ) {
|
||||||
|
readDataThread[i]->Stop();
|
||||||
readDataThread[i]->quit();
|
readDataThread[i]->quit();
|
||||||
readDataThread[i]->wait();
|
readDataThread[i]->wait();
|
||||||
}
|
}
|
||||||
|
digiMTX[i].lock();
|
||||||
|
digi[i]->StopACQ();
|
||||||
|
digiMTX[i].unlock();
|
||||||
|
if( chkSaveData->isChecked() ) digi[i]->GetData()->CloseSaveFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( scalarThread->isRunning()){
|
if( scalarThread->isRunning()){
|
||||||
|
@ -698,7 +704,7 @@ void MainWindow::StopACQ(){
|
||||||
bnOpenScope->setEnabled(true);
|
bnOpenScope->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::AutoRun(){
|
void MainWindow::AutoRun(){ //TODO
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -883,6 +889,6 @@ void MainWindow::LogMsg(QString msg){
|
||||||
}
|
}
|
||||||
QScrollBar *v = logInfo->verticalScrollBar();
|
QScrollBar *v = logInfo->verticalScrollBar();
|
||||||
v->setValue(v->maximum());
|
v->setValue(v->maximum());
|
||||||
//qDebug() << msg;
|
//qDebug() << outputStr;
|
||||||
logInfo->repaint();
|
logInfo->repaint();
|
||||||
}
|
}
|
||||||
|
|
31
Scope.cpp
31
Scope.cpp
|
@ -116,10 +116,15 @@ Scope::Scope(Digitizer ** digi, unsigned int nDigi, ReadDataThread ** readDataTh
|
||||||
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHAPanel();
|
if( digi[ID]->GetDPPType() == V1730_DPP_PHA_CODE ) SetUpPHAPanel();
|
||||||
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDPanel();
|
if( digi[ID]->GetDPPType() == V1730_DPP_PSD_CODE ) SetUpPSDPanel();
|
||||||
|
|
||||||
//ReadSettingsFromBoard();
|
ReadSettingsFromBoard();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(cbScopeCh, &RComboBox::currentIndexChanged, this, [=](){
|
||||||
|
if( !enableSignalSlot ) return;
|
||||||
|
ReadSettingsFromBoard();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
bnReadSettingsFromBoard = new QPushButton("Refresh Settings", this);
|
bnReadSettingsFromBoard = new QPushButton("Refresh Settings", this);
|
||||||
layout->addWidget(bnReadSettingsFromBoard, rowID, 2);
|
layout->addWidget(bnReadSettingsFromBoard, rowID, 2);
|
||||||
|
@ -229,11 +234,14 @@ void Scope::StartScope(){
|
||||||
|
|
||||||
digi[iDigi]->StartACQ();
|
digi[iDigi]->StartACQ();
|
||||||
|
|
||||||
|
printf("----- readDataThread running ? %d.\n", readDataThread[iDigi]->isRunning());
|
||||||
|
if( readDataThread[iDigi]->isRunning() ){
|
||||||
|
readDataThread[iDigi]->quit();
|
||||||
|
readDataThread[iDigi]->wait();
|
||||||
|
}
|
||||||
readDataThread[iDigi]->SetScopeMode(true);
|
readDataThread[iDigi]->SetScopeMode(true);
|
||||||
readDataThread[iDigi]->SetSaveData(false);
|
readDataThread[iDigi]->SetSaveData(false);
|
||||||
|
|
||||||
readDataThread[iDigi]->start();
|
readDataThread[iDigi]->start();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateTraceThread->start();
|
updateTraceThread->start();
|
||||||
|
@ -250,18 +258,21 @@ void Scope::StartScope(){
|
||||||
void Scope::StopScope(){
|
void Scope::StopScope(){
|
||||||
if( !digi ) return;
|
if( !digi ) return;
|
||||||
|
|
||||||
|
// printf("------ Scope::%s \n", __func__);
|
||||||
updateTraceThread->Stop();
|
updateTraceThread->Stop();
|
||||||
updateTraceThread->quit();
|
updateTraceThread->quit();
|
||||||
updateTraceThread->exit();
|
updateTraceThread->exit();
|
||||||
|
|
||||||
|
|
||||||
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
for( unsigned int iDigi = 0; iDigi < nDigi; iDigi ++){
|
||||||
|
|
||||||
|
if( readDataThread[iDigi]->isRunning() ){
|
||||||
|
readDataThread[iDigi]->Stop();
|
||||||
|
readDataThread[iDigi]->quit();
|
||||||
|
readDataThread[iDigi]->wait();
|
||||||
|
}
|
||||||
digiMTX[iDigi].lock();
|
digiMTX[iDigi].lock();
|
||||||
digi[iDigi]->StopACQ();
|
digi[iDigi]->StopACQ();
|
||||||
digiMTX[iDigi].unlock();
|
digiMTX[iDigi].unlock();
|
||||||
|
|
||||||
readDataThread[iDigi]->quit();
|
|
||||||
readDataThread[iDigi]->wait();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bnScopeStart->setEnabled(true);
|
bnScopeStart->setEnabled(true);
|
||||||
|
@ -271,21 +282,21 @@ void Scope::StopScope(){
|
||||||
|
|
||||||
TellACQOnOff(false);
|
TellACQOnOff(false);
|
||||||
|
|
||||||
|
// printf("----- end of %s\n", __func__);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scope::UpdateScope(){
|
void Scope::UpdateScope(){
|
||||||
|
|
||||||
//printf("---- %s \n", __func__);
|
|
||||||
|
|
||||||
if( !digi ) return;
|
if( !digi ) return;
|
||||||
|
|
||||||
int ch = cbScopeCh->currentIndex();
|
int ch = cbScopeCh->currentIndex();
|
||||||
int ch2ns = digi[ID]->GetCh2ns();
|
int ch2ns = digi[ID]->GetCh2ns();
|
||||||
int factor = digi[ID]->IsDualTrace() ? 2 : 1;
|
int factor = digi[ID]->IsDualTrace() ? 2 : 1;
|
||||||
|
|
||||||
|
digiMTX[ID].lock();
|
||||||
Data * data = digi[ID]->GetData();
|
Data * data = digi[ID]->GetData();
|
||||||
|
|
||||||
digiMTX[ID].lock();
|
|
||||||
//leTriggerRate->setText(QString::number(data->TriggerRate[ch]) + " [" + QString::number(data->NumEventsDecoded[ch]) + "]");
|
//leTriggerRate->setText(QString::number(data->TriggerRate[ch]) + " [" + QString::number(data->NumEventsDecoded[ch]) + "]");
|
||||||
leTriggerRate->setText(QString::number(data->TriggerRate[ch]));
|
leTriggerRate->setText(QString::number(data->TriggerRate[ch]));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user