From 983c8b6cb5d6be72697a9a3491a24c80883fa9ec Mon Sep 17 00:00:00 2001 From: splitPoleDAQ Date: Tue, 11 Jul 2023 18:29:38 -0400 Subject: [PATCH] remove rebin settings for SingleSpectra, use rigth click --- ClassData.h | 2 +- FSUDAQ.cpp | 18 +++++---- SingleSpectra.cpp | 93 +---------------------------------------------- SingleSpectra.h | 8 ---- 4 files changed, 13 insertions(+), 108 deletions(-) diff --git a/ClassData.h b/ClassData.h index 7278478..ae145b4 100644 --- a/ClassData.h +++ b/ClassData.h @@ -269,7 +269,7 @@ inline void Data::PrintStat() const{ } inline void Data::PrintAllData(bool tableMode, unsigned int maxRowDisplay) const{ - printf("============================= Print Data\n"); + printf("============================= Print Data Digi-%d\n", boardSN); if( tableMode ){ int entry = 0; diff --git a/FSUDAQ.cpp b/FSUDAQ.cpp index cf1b2b5..bb9559f 100644 --- a/FSUDAQ.cpp +++ b/FSUDAQ.cpp @@ -222,15 +222,19 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){ connect( bnStartACQ, &QPushButton::clicked, this, &MainWindow::AutoRun); bnStopACQ = new QPushButton("Stop ACQ", this); connect( bnStopACQ, &QPushButton::clicked, this, [=](){ - if( runTimer->isActive() ){ - runTimer->stop(); - runTimer->disconnect(runTimerConnection); - StopACQ(); + if( chkSaveData->isChecked() ){ + if( runTimer->isActive() ){ + runTimer->stop(); + runTimer->disconnect(runTimerConnection); + StopACQ(); + }else{ + breakAutoRepeat = true; + runTimer->disconnect(runTimerConnection); + } + needManualComment = true; }else{ - breakAutoRepeat = true; - runTimer->disconnect(runTimerConnection); + StopACQ(); } - needManualComment = true; }); layout->addWidget(lbPrefix, rowID, 0); diff --git a/SingleSpectra.cpp b/SingleSpectra.cpp index ef5c488..deffa13 100644 --- a/SingleSpectra.cpp +++ b/SingleSpectra.cpp @@ -13,8 +13,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD this->nDigi = nDigi; this->rawDataPath = rawDataPath; - enableSignalSlot = false; - setWindowTitle("1-D Histograms"); setGeometry(0, 0, 1000, 800); //setWindowFlags( this->windowFlags() & ~Qt::WindowCloseButtonHint ); @@ -40,7 +38,7 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD ctrlLayout->addWidget(cbCh, 0, 2, 1, 2); connect( cbCh, &RComboBox::currentIndexChanged, this, &SingleSpectra::ChangeHistView); - QPushButton * bnClearHist = new QPushButton("Clear Hist.", this); + QPushButton * bnClearHist = new QPushButton("Clear All Hist.", this); ctrlLayout->addWidget(bnClearHist, 0, 4, 1, 2); connect(bnClearHist, &QPushButton::clicked, this, [=](){ for( unsigned int i = 0; i < nDigi; i++){ @@ -56,54 +54,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD chkIsFillHistogram->setChecked(false); fillHistograms = false; - QLabel * lbNBin = new QLabel("#Bin:", this); - lbNBin->setAlignment(Qt::AlignRight | Qt::AlignCenter ); - ctrlLayout->addWidget(lbNBin, 1, 0); - sbNBin = new RSpinBox(this); - sbNBin->setMinimum(0); - sbNBin->setMaximum(500); - ctrlLayout->addWidget(sbNBin, 1, 1); - connect(sbNBin, &RSpinBox::valueChanged, this, [=](){ - if( !enableSignalSlot ) return; - sbNBin->setStyleSheet("color : blue;"); - bnReBin->setEnabled(true); - }); - - QLabel * lbXMin = new QLabel("X-Min:", this); - lbXMin->setAlignment(Qt::AlignRight | Qt::AlignCenter ); - ctrlLayout->addWidget(lbXMin, 1, 2); - sbXMin = new RSpinBox(this); - sbXMin->setMinimum(-0x3FFF); - sbXMin->setMaximum(0x3FFF); - ctrlLayout->addWidget(sbXMin, 1, 3); - connect(sbXMin, &RSpinBox::valueChanged, this, [=](){ - if( !enableSignalSlot ) return; - sbXMin->setStyleSheet("color : blue;"); - bnReBin->setEnabled(true); - }); - - QLabel * lbXMax = new QLabel("X-Max:", this); - lbXMax->setAlignment(Qt::AlignRight | Qt::AlignCenter ); - ctrlLayout->addWidget(lbXMax, 1, 4); - sbXMax = new RSpinBox(this); - sbXMax->setMinimum(-0x3FFF); - sbXMax->setMaximum(0x3FFF); - ctrlLayout->addWidget(sbXMax, 1, 5); - connect(sbXMax, &RSpinBox::valueChanged, this, [=](){ - if( !enableSignalSlot ) return; - sbXMax->setStyleSheet("color : blue;"); - bnReBin->setEnabled(true); - }); - - connect(sbNBin, &RSpinBox::returnPressed, this, &SingleSpectra::RebinHistogram); - connect(sbXMin, &RSpinBox::returnPressed, this, &SingleSpectra::RebinHistogram); - connect(sbXMax, &RSpinBox::returnPressed, this, &SingleSpectra::RebinHistogram); - - bnReBin = new QPushButton("Rebin and Clear Histogram", this); - ctrlLayout->addWidget(bnReBin, 1, 6); - bnReBin->setEnabled(false); - connect(bnReBin, &QPushButton::clicked, this, &SingleSpectra::RebinHistogram); - } {//^======================== @@ -121,13 +71,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD for( int j = 0; j < digi[i]->GetNChannels(); j++){ if( i < nDigi ) { hist[i][j] = new Histogram1D("Digi-" + QString::number(digi[i]->GetSerialNumber()) +", Ch-" + QString::number(j), "Raw Energy [ch]", nBin, xMin, xMax); - connect(hist[i][j], &Histogram1D::ReBinned , this, [=](){ - enableSignalSlot = false; - sbNBin->setValue(hist[i][j]->GetNBin()); - sbXMin->setValue(hist[i][j]->GetXMin()); - sbXMax->setValue(hist[i][j]->GetXMax()); - enableSignalSlot = true; - }); }else{ hist[i][j] = nullptr; } @@ -137,10 +80,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD LoadSetting(); histLayout->addWidget(hist[0][0], 0, 0); - - sbNBin->setValue(nBin); - sbXMin->setValue(xMin); - sbXMax->setValue(xMax); } layout->setStretch(0, 1); @@ -156,8 +95,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD oldBd = -1; oldCh = -1; - enableSignalSlot = true; - } SingleSpectra::~SingleSpectra(){ @@ -182,18 +119,6 @@ void SingleSpectra::ChangeHistView(){ histLayout->addWidget(hist[bd][ch], 0, 0); - if( enableSignalSlot ){ - sbNBin->setValue(hist[bd][ch]->GetNBin()); - sbXMin->setValue(hist[bd][ch]->GetXMin()); - sbXMax->setValue(hist[bd][ch]->GetXMax()); - - sbNBin->setStyleSheet(""); - sbXMin->setStyleSheet(""); - sbXMax->setStyleSheet(""); - } - - bnReBin->setEnabled(false); - oldBd = bd; oldCh = ch; } @@ -231,22 +156,6 @@ void SingleSpectra::FillHistograms(){ } } -void SingleSpectra::RebinHistogram(){ - - if( !enableSignalSlot ) return; - int bd = cbDigi->currentIndex(); - int ch = cbCh->currentIndex(); - hist[bd][ch]->Rebin( sbNBin->value(), sbXMin->value(), sbXMax->value()); - - sbNBin->setStyleSheet(""); - sbXMin->setStyleSheet(""); - sbXMax->setStyleSheet(""); - bnReBin->setEnabled(false); - - hist[bd][ch]->UpdatePlot(); - -} - void SingleSpectra::SaveSetting(){ QFile file(rawDataPath + "/singleSpectraSetting.txt"); diff --git a/SingleSpectra.h b/SingleSpectra.h index 3910495..02b3e86 100644 --- a/SingleSpectra.h +++ b/SingleSpectra.h @@ -36,7 +36,6 @@ public: public slots: void FillHistograms(); void ChangeHistView(); - void RebinHistogram(); private: @@ -49,13 +48,6 @@ private: RComboBox * cbDigi; RComboBox * cbCh; - - bool enableSignalSlot; - - RSpinBox * sbNBin; - RSpinBox * sbXMin; - RSpinBox * sbXMax; - QPushButton * bnReBin; QGroupBox * histBox; QGridLayout * histLayout;