remove some printf, remove Rebin button in SingleSpatra class
This commit is contained in:
parent
0a751eaab1
commit
fbd98067da
|
@ -1289,7 +1289,7 @@ void FSUDAQ::StopACQ(){
|
|||
// bnDigiSettings->setEnabled(true);
|
||||
|
||||
repaint();
|
||||
printf("================ end of %s \n", __func__);
|
||||
// printf("================ end of %s \n", __func__);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -81,98 +81,8 @@ SingleSpectra::SingleSpectra(Digitizer ** digi, unsigned int nDigi, QString rawD
|
|||
}
|
||||
});
|
||||
|
||||
QPushButton * bnRebinDigi = new QPushButton("Rebin Energy", this);
|
||||
ctrlLayout->addWidget(bnRebinDigi, 0, 6, 1, 2);
|
||||
connect(bnRebinDigi, &QPushButton::clicked, this, [=](){
|
||||
int ID = cbDigi->currentIndex();
|
||||
int ch = cbCh->currentIndex();
|
||||
|
||||
int a_Bin;
|
||||
float a_Min, a_Max;
|
||||
|
||||
if( ch >= 0 ){
|
||||
a_Bin = hist[ID][ch]->GetNBin();
|
||||
a_Min = hist[ID][ch]->GetXMin();
|
||||
a_Max = hist[ID][ch]->GetXMax();
|
||||
}else{
|
||||
a_Bin = hist2D[ID]->GetYNBin();
|
||||
a_Min = hist2D[ID]->GetYMin();
|
||||
a_Max = hist2D[ID]->GetYMax();
|
||||
}
|
||||
|
||||
//pop up a dialog for nBin and ranhe
|
||||
|
||||
QDialog dialog(this);
|
||||
dialog.setWindowTitle("Rebin histograms");
|
||||
|
||||
QFormLayout layout(&dialog);
|
||||
|
||||
QLabel * info = new QLabel(&dialog);
|
||||
info->setStyleSheet("color:red;");
|
||||
info->setText("This will also clear histogram!!");
|
||||
layout.addRow(info);
|
||||
|
||||
QStringList nameList = {"Num. Bin", "x-Min", "x-Max"};
|
||||
QLineEdit* lineEdit[3];
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
lineEdit[i] = new QLineEdit(&dialog);
|
||||
layout.addRow(nameList[i] + " : ", lineEdit[i]);
|
||||
}
|
||||
lineEdit[0]->setText(QString::number(a_Bin));
|
||||
lineEdit[1]->setText(QString::number(a_Min));
|
||||
lineEdit[2]->setText(QString::number(a_Max));
|
||||
|
||||
QLabel * msg = new QLabel(&dialog);
|
||||
msg->setStyleSheet("color:red;");
|
||||
layout.addRow(msg);
|
||||
|
||||
QDialogButtonBox buttonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog);
|
||||
layout.addRow(&buttonBox);
|
||||
|
||||
double number[3];
|
||||
|
||||
QObject::connect(&buttonBox, &QDialogButtonBox::accepted, [&]() {
|
||||
int OKcount = 0;
|
||||
bool conversionOk = true;
|
||||
for( int i = 0; i < 3; i++ ){
|
||||
number[i] = lineEdit[i]->text().toDouble(&conversionOk);
|
||||
if( conversionOk ){
|
||||
OKcount++;
|
||||
}else{
|
||||
msg->setText(nameList[i] + " is invalid.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if( OKcount == 3 ) {
|
||||
if( number[2] > number[1] ) {
|
||||
dialog.accept();
|
||||
}else{
|
||||
msg->setText(nameList[2] + " is smaller than " + nameList[1]);
|
||||
}
|
||||
}
|
||||
});
|
||||
QObject::connect(&buttonBox, &QDialogButtonBox::rejected, [&]() { dialog.reject();});
|
||||
|
||||
if( dialog.exec() == QDialog::Accepted ){
|
||||
if( hist2D[ID] ) {
|
||||
hist2D[ID]->RebinY((int)number[0], number[1], number[2]);
|
||||
hist2D[ID]->rescaleAxes();
|
||||
hist2D[ID]->UpdatePlot();
|
||||
}
|
||||
for( int j = 0; j < digi[ID]->GetNumInputCh(); j++){
|
||||
if( hist[ID][j] ) {
|
||||
hist[ID][j]->Rebin((int)number[0], number[1], number[2]);
|
||||
hist[ID][j]->UpdatePlot();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
chkIsFillHistogram = new QCheckBox("Fill Histograms", this);
|
||||
ctrlLayout->addWidget(chkIsFillHistogram, 0, 8);
|
||||
ctrlLayout->addWidget(chkIsFillHistogram, 0, 6, 1, 2);
|
||||
chkIsFillHistogram->setChecked(false);
|
||||
isFillingHistograms = false;
|
||||
|
||||
|
|
|
@ -59,11 +59,11 @@ public:
|
|||
unsigned short nDigi;
|
||||
|
||||
void startWork(){
|
||||
printf("timer start\n");
|
||||
// printf("timer start\n");
|
||||
timer->start(maxFillTimeinMilliSec);
|
||||
}
|
||||
void stopWork(){
|
||||
printf("timer stop\n");
|
||||
// printf("timer stop\n");
|
||||
timer->stop();
|
||||
ClearInternalDataCount();
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public slots:
|
|||
int ch = randomChList[k];
|
||||
int lastIndex = SS->digi[ID]->GetData()->GetDataIndex(ch);
|
||||
if( lastIndex < 0 ) continue;
|
||||
printf("--- ch %2d | last index %d \n", ch, lastIndex);
|
||||
// printf("--- ch %2d | last index %d \n", ch, lastIndex);
|
||||
|
||||
int loopIndex = SS->digi[ID]->GetData()->GetLoopIndex(ch);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user