remove rebin settings for SingleSpectra, use rigth click

This commit is contained in:
splitPoleDAQ 2023-07-11 18:29:38 -04:00
parent 2a05e69e4e
commit 983c8b6cb5
4 changed files with 13 additions and 108 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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");

View File

@ -36,7 +36,6 @@ public:
public slots:
void FillHistograms();
void ChangeHistView();
void RebinHistogram();
private:
@ -50,13 +49,6 @@ private:
RComboBox * cbDigi;
RComboBox * cbCh;
bool enableSignalSlot;
RSpinBox * sbNBin;
RSpinBox * sbXMin;
RSpinBox * sbXMax;
QPushButton * bnReBin;
QGroupBox * histBox;
QGridLayout * histLayout;
int oldBd, oldCh;