remove rebin settings for SingleSpectra, use rigth click
This commit is contained in:
parent
2a05e69e4e
commit
983c8b6cb5
|
@ -269,7 +269,7 @@ inline void Data::PrintStat() const{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void Data::PrintAllData(bool tableMode, unsigned int maxRowDisplay) const{
|
inline void Data::PrintAllData(bool tableMode, unsigned int maxRowDisplay) const{
|
||||||
printf("============================= Print Data\n");
|
printf("============================= Print Data Digi-%d\n", boardSN);
|
||||||
|
|
||||||
if( tableMode ){
|
if( tableMode ){
|
||||||
int entry = 0;
|
int entry = 0;
|
||||||
|
|
18
FSUDAQ.cpp
18
FSUDAQ.cpp
|
@ -222,15 +222,19 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent){
|
||||||
connect( bnStartACQ, &QPushButton::clicked, this, &MainWindow::AutoRun);
|
connect( bnStartACQ, &QPushButton::clicked, this, &MainWindow::AutoRun);
|
||||||
bnStopACQ = new QPushButton("Stop ACQ", this);
|
bnStopACQ = new QPushButton("Stop ACQ", this);
|
||||||
connect( bnStopACQ, &QPushButton::clicked, this, [=](){
|
connect( bnStopACQ, &QPushButton::clicked, this, [=](){
|
||||||
if( runTimer->isActive() ){
|
if( chkSaveData->isChecked() ){
|
||||||
runTimer->stop();
|
if( runTimer->isActive() ){
|
||||||
runTimer->disconnect(runTimerConnection);
|
runTimer->stop();
|
||||||
StopACQ();
|
runTimer->disconnect(runTimerConnection);
|
||||||
|
StopACQ();
|
||||||
|
}else{
|
||||||
|
breakAutoRepeat = true;
|
||||||
|
runTimer->disconnect(runTimerConnection);
|
||||||
|
}
|
||||||
|
needManualComment = true;
|
||||||
}else{
|
}else{
|
||||||
breakAutoRepeat = true;
|
StopACQ();
|
||||||
runTimer->disconnect(runTimerConnection);
|
|
||||||
}
|
}
|
||||||
needManualComment = true;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
layout->addWidget(lbPrefix, rowID, 0);
|
layout->addWidget(lbPrefix, rowID, 0);
|
||||||
|
|
|
@ -13,8 +13,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
||||||
this->nDigi = nDigi;
|
this->nDigi = nDigi;
|
||||||
this->rawDataPath = rawDataPath;
|
this->rawDataPath = rawDataPath;
|
||||||
|
|
||||||
enableSignalSlot = false;
|
|
||||||
|
|
||||||
setWindowTitle("1-D Histograms");
|
setWindowTitle("1-D Histograms");
|
||||||
setGeometry(0, 0, 1000, 800);
|
setGeometry(0, 0, 1000, 800);
|
||||||
//setWindowFlags( this->windowFlags() & ~Qt::WindowCloseButtonHint );
|
//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);
|
ctrlLayout->addWidget(cbCh, 0, 2, 1, 2);
|
||||||
connect( cbCh, &RComboBox::currentIndexChanged, this, &SingleSpectra::ChangeHistView);
|
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);
|
ctrlLayout->addWidget(bnClearHist, 0, 4, 1, 2);
|
||||||
connect(bnClearHist, &QPushButton::clicked, this, [=](){
|
connect(bnClearHist, &QPushButton::clicked, this, [=](){
|
||||||
for( unsigned int i = 0; i < nDigi; i++){
|
for( unsigned int i = 0; i < nDigi; i++){
|
||||||
|
@ -56,54 +54,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
||||||
chkIsFillHistogram->setChecked(false);
|
chkIsFillHistogram->setChecked(false);
|
||||||
fillHistograms = 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++){
|
for( int j = 0; j < digi[i]->GetNChannels(); j++){
|
||||||
if( i < nDigi ) {
|
if( i < nDigi ) {
|
||||||
hist[i][j] = new Histogram1D("Digi-" + QString::number(digi[i]->GetSerialNumber()) +", Ch-" + QString::number(j), "Raw Energy [ch]", nBin, xMin, xMax);
|
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{
|
}else{
|
||||||
hist[i][j] = nullptr;
|
hist[i][j] = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -137,10 +80,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
||||||
LoadSetting();
|
LoadSetting();
|
||||||
|
|
||||||
histLayout->addWidget(hist[0][0], 0, 0);
|
histLayout->addWidget(hist[0][0], 0, 0);
|
||||||
|
|
||||||
sbNBin->setValue(nBin);
|
|
||||||
sbXMin->setValue(xMin);
|
|
||||||
sbXMax->setValue(xMax);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
layout->setStretch(0, 1);
|
layout->setStretch(0, 1);
|
||||||
|
@ -156,8 +95,6 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
||||||
oldBd = -1;
|
oldBd = -1;
|
||||||
oldCh = -1;
|
oldCh = -1;
|
||||||
|
|
||||||
enableSignalSlot = true;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SingleSpectra::~SingleSpectra(){
|
SingleSpectra::~SingleSpectra(){
|
||||||
|
@ -182,18 +119,6 @@ void SingleSpectra::ChangeHistView(){
|
||||||
|
|
||||||
histLayout->addWidget(hist[bd][ch], 0, 0);
|
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;
|
oldBd = bd;
|
||||||
oldCh = ch;
|
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(){
|
void SingleSpectra::SaveSetting(){
|
||||||
|
|
||||||
QFile file(rawDataPath + "/singleSpectraSetting.txt");
|
QFile file(rawDataPath + "/singleSpectraSetting.txt");
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void FillHistograms();
|
void FillHistograms();
|
||||||
void ChangeHistView();
|
void ChangeHistView();
|
||||||
void RebinHistogram();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -49,13 +48,6 @@ private:
|
||||||
|
|
||||||
RComboBox * cbDigi;
|
RComboBox * cbDigi;
|
||||||
RComboBox * cbCh;
|
RComboBox * cbCh;
|
||||||
|
|
||||||
bool enableSignalSlot;
|
|
||||||
|
|
||||||
RSpinBox * sbNBin;
|
|
||||||
RSpinBox * sbXMin;
|
|
||||||
RSpinBox * sbXMax;
|
|
||||||
QPushButton * bnReBin;
|
|
||||||
|
|
||||||
QGroupBox * histBox;
|
QGroupBox * histBox;
|
||||||
QGridLayout * histLayout;
|
QGridLayout * histLayout;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user