diff --git a/slsDetectorGui/forms/form_tab_dataoutput.ui b/slsDetectorGui/forms/form_tab_dataoutput.ui index 3546f216d..52b88b59f 100644 --- a/slsDetectorGui/forms/form_tab_dataoutput.ui +++ b/slsDetectorGui/forms/form_tab_dataoutput.ui @@ -87,25 +87,6 @@ Directory where one saves the data. 4 - - - - <nobr> -Directory where one saves the data. -</nobr><br> - #outdir# -<br> - - - - Browse - - - - :/icons/images/browse.png:/icons/images/browse.png - - - @@ -130,21 +111,6 @@ Directory where one saves the data. - - - - Qt::StrongFocus - - - <nobr> -Directory where one saves the data. -</nobr><br> - #outdir# -<br> - - - - @@ -203,6 +169,21 @@ Directory where one saves the data. + + + + Qt::StrongFocus + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + @@ -235,6 +216,25 @@ Directory where one saves the data. + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Browse + + + + :/icons/images/browse.png:/icons/images/browse.png + + + @@ -320,24 +320,40 @@ Compression using Root. Available only for Gotthard in Expert Mode. 255 21 476 - 66 + 76 6 - - + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + false - Auto + Rate: - + false @@ -361,62 +377,7 @@ Compression using Root. Available only for Gotthard in Expert Mode. - - - - Flat field corrections. - #flatfield# filename - - - Flat Field File: - - - - - - - false - - - - 0 - 0 - - - - - 100 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 9 - - - -1.000000000000000 - - - 2000000000.000000000000000 - - - - - - - false - - - Rate: - - - - + false @@ -430,13 +391,14 @@ Compression using Root. Available only for Gotthard in Expert Mode. - - - - false + + + + Flat field corrections. + #flatfield# filename - Custom dead time: + Flat Field File: @@ -456,6 +418,120 @@ Compression using Root. Available only for Gotthard in Expert Mode. + + + + false + + + + 0 + 0 + + + + + + + + + 2 + 2 + 2 + + + + + + + + + 0 + 0 + 0 + + + + + + + + + 119 + 119 + 119 + + + + + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Dead Time: + + + + + + + + 0 + 0 + + + + ns + + + -1 + + + 200000000 + + + + + + + false + + + + 0 + 0 + + + + + 16777215 + 30 + + + + <nobr> +Directory where one saves the data. +</nobr><br> + #outdir# +<br> + + + + Default + + + + :/icons/images/calculate.png:/icons/images/calculate.png + + + @@ -623,53 +699,10 @@ Compression using Root. Available only for Gotthard in Expert Mode. - - - - 384 - 60 - 348 - 27 - - - - - - - false - - - - 0 - 0 - - - - - 100 - 0 - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - ns - - - 9 - - - -1.000000000000000 - - - 2000000000.000000000000000 - - - - - + boxOutDir + boxCorrection_2 + btnOutputBrowse dispReadOutputDir @@ -677,9 +710,6 @@ Compression using Root. Available only for Gotthard in Expert Mode. dispFlatField btnFlatField chkRate - radioAuto - radioDeadTime - spinDeadTime diff --git a/slsDetectorGui/include/qTabDataOutput.h b/slsDetectorGui/include/qTabDataOutput.h index 7fd11da7e..026c38cc5 100644 --- a/slsDetectorGui/include/qTabDataOutput.h +++ b/slsDetectorGui/include/qTabDataOutput.h @@ -110,7 +110,10 @@ void UpdateFlatFieldFromServer(); void BrowseFlatFieldPath(); /**rate correction*/ -void SetRateCorrection(); +void SetRateCorrection(int deadtime=0); + +/** default rate correction */ +void SetDefaultRateCorrection(); /** update rate correction from server */ void UpdateRateCorrectionFromServer(); diff --git a/slsDetectorGui/src/qTabDataOutput.cpp b/slsDetectorGui/src/qTabDataOutput.cpp index 584797fcc..1f4974e43 100644 --- a/slsDetectorGui/src/qTabDataOutput.cpp +++ b/slsDetectorGui/src/qTabDataOutput.cpp @@ -46,7 +46,6 @@ void qTabDataOutput::SetupWidgetWindow(){ // Detector Type detType=myDet->getDetectorsType(); widgetEiger->setVisible(false); - spinDeadTimeonly->setVisible(false); //rate correction - not for charge integrating detectors if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER)) @@ -56,12 +55,9 @@ void qTabDataOutput::SetupWidgetWindow(){ chkAngular->setEnabled(true); if(detType == slsDetectorDefs::EIGER){ + chkRate->setEnabled(true); chkTenGiga->setEnabled(true); widgetEiger->setVisible(true); - spinDeadTimeonly->setVisible(true); - radioAuto->setVisible(false); - radioDeadTime->setVisible(false); - spinDeadTime->setVisible(false); } /** error message **/ @@ -154,14 +150,10 @@ void qTabDataOutput::Initialization(){ connect(chkFlatField, SIGNAL(toggled(bool)), this, SLOT(SetFlatField())); connect(btnFlatField, SIGNAL(clicked()), this, SLOT(BrowseFlatFieldPath())); //rate correction - connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - if(detType == slsDetectorDefs::EIGER) - connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } + connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + //angular correction connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection())); //discard bad channels @@ -333,81 +325,69 @@ void qTabDataOutput::BrowseFlatFieldPath(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::SetRateCorrection(){ - if(detType == slsDetectorDefs::EIGER) - disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } +void qTabDataOutput::SetRateCorrection(int deadtime){ + disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); #ifdef VERBOSE cout << "Entering Set Rate Correction function" << endl; #endif if(chkRate->isChecked()){ - if(detType == slsDetectorDefs::EIGER){ - spinDeadTimeonly->setEnabled(true); - myDet->setRateCorrection((double)spinDeadTimeonly->value()); + if(!btnDefaultRate->isEnabled()){ + btnDefaultRate->setEnabled(true); + lblDeadTime->setEnabled(true); + spinDeadTime->setEnabled(true); } - else{ - radioAuto->setEnabled(true); - radioDeadTime->setEnabled(true); - //set auto as default if nothing selected - if(!radioAuto->isChecked()&&!radioDeadTime->isChecked()) - radioAuto->setChecked(true); - //auto mode - if(radioAuto->isChecked()){ - spinDeadTime->setEnabled(false); - myDet->setRateCorrection(-1); + + if(deadtime!=-1){ + deadtime = (double)spinDeadTime->value(); #ifdef VERBOSE - cout << "Setting rate corrections with default dead time" << endl; + cout << "Setting rate corrections with custom dead time: " << deadtime << endl; #endif - } - //custom dead time - else{ - spinDeadTime->setEnabled(true); - myDet->setRateCorrection((double)spinDeadTime->value()); + }else{; #ifdef VERBOSE - cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl; + cout << "Setting rate corrections with default dead time" << endl; #endif - } } - }//unsetting + myDet->setRateCorrection(deadtime); + + }//unsetting rate correction else{ - if(detType == slsDetectorDefs::EIGER) - spinDeadTimeonly->setEnabled(false); - else{ - radioAuto->setEnabled(false); - radioDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); - } - //Unsetting rate correction + btnDefaultRate->setEnabled(false); + lblDeadTime->setEnabled(false); + spinDeadTime->setEnabled(false); myDet->setRateCorrection(0); #ifdef VERBOSE cout << "Unsetting rate correction" << endl; #endif } - qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetRateCorrection"); //update just the value double rate = (double)myDet->getRateCorrectionTau(); - if(spinDeadTime->isEnabled()) - spinDeadTime->setValue((double)rate); - else if(spinDeadTimeonly->isEnabled()) - spinDeadTimeonly->setValue((double)rate); - - - if(detType == slsDetectorDefs::EIGER) - connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); + spinDeadTime->setValue((double)rate); + if(rate == -1){ + qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -1.","qTabDataOutput::UpdateRateCorrectionFromServer"); + QString errorTip = QString("Rate Corrections.
" + " #ratecorr# tau in seconds

")+ + QString("" + "Dead time is inconsistent for all detectors."); + chkRate->setToolTip(errorTip); + spinDeadTime->setToolTip(errorTip); + chkRate->setPalette(red); + chkRate->setText("Rate:*"); + }else{ + QString normalTip = QString("Rate Corrections.
" + " #ratecorr# tau in seconds

"); + chkRate->setToolTip(normalTip); + spinDeadTime->setToolTip(normalTip); + chkRate->setPalette(chkDiscardBad->palette()); + chkRate->setText("Rate:"); } + connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); } @@ -415,94 +395,62 @@ void qTabDataOutput::SetRateCorrection(){ //------------------------------------------------------------------------------------------------------------------------------------------------- -void qTabDataOutput::UpdateRateCorrectionFromServer(){ - disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); +void qTabDataOutput::SetDefaultRateCorrection(){ + SetRateCorrection(-1); +} + + +//------------------------------------------------------------------------------------------------------------------------------------------------- + + +void qTabDataOutput::UpdateRateCorrectionFromServer(){ + disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - if(detType == slsDetectorDefs::EIGER) - disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } double rate; rate = (double)myDet->getRateCorrectionTau(); qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateRateCorrectionFromServer"); #ifdef VERBOSE - cout << "Getting rate correction from server:" << rate << " : "; + cout << "Getting rate correction from server: " << rate << endl; #endif if(rate==0){ -#ifdef VERBOSE - cout << "None" << endl; -#endif chkRate->setChecked(false); - if(detType == slsDetectorDefs::EIGER) - spinDeadTimeonly->setEnabled(false); - else{ - radioAuto->setEnabled(false); - radioDeadTime->setEnabled(false); - spinDeadTime->setEnabled(false); - } + btnDefaultRate->setEnabled(false); + lblDeadTime->setEnabled(false); + spinDeadTime->setEnabled(false); } else{ chkRate->setChecked(true); - - if(detType == slsDetectorDefs::EIGER){ - spinDeadTimeonly->setEnabled(true); - spinDeadTimeonly->setValue((double)rate); - } - //mythen - else{ - radioAuto->setEnabled(true); - radioDeadTime->setEnabled(true); - chkRate->setChecked(true); - if(rate == -1){ -#ifdef VERBOSE - cout << "Auto" << endl; -#endif - spinDeadTime->setEnabled(false); - radioAuto->setChecked(true); - }else{ -#ifdef VERBOSE - cout << "Custom" << endl; -#endif - radioDeadTime->setChecked(true); - spinDeadTime->setEnabled(true); - spinDeadTime->setValue((double)rate); - } - } + btnDefaultRate->setEnabled(true); + lblDeadTime->setEnabled(true); + spinDeadTime->setEnabled(true); + spinDeadTime->setValue((double)rate); } - - if(detType == slsDetectorDefs::EIGER && rate == -1){ + if(rate == -1){ qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -1.","qTabDataOutput::UpdateRateCorrectionFromServer"); QString errorTip = QString("Rate Corrections.
" " #ratecorr# tau in seconds

")+ QString("" "Dead time is inconsistent for all detectors."); chkRate->setToolTip(errorTip); - spinDeadTimeonly->setToolTip(errorTip); + spinDeadTime->setToolTip(errorTip); chkRate->setPalette(red); chkRate->setText("Rate:*"); }else{ QString normalTip = QString("Rate Corrections.
" " #ratecorr# tau in seconds

"); chkRate->setToolTip(normalTip); - spinDeadTimeonly->setToolTip(normalTip); + spinDeadTime->setToolTip(normalTip); chkRate->setPalette(chkDiscardBad->palette()); chkRate->setText("Rate:"); } - connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - - if(detType == slsDetectorDefs::EIGER) - disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - else{ - connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); - connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); - } + connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); + connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); + connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); }