mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
fixed rate correction to not include 16 bit dr
This commit is contained in:
parent
5d3e925ed4
commit
cf74f9b138
@ -399,7 +399,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
|||||||
<number>9</number>
|
<number>9</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="minimum">
|
<property name="minimum">
|
||||||
<double>-2.000000000000000</double>
|
<double>-1.000000000000000</double>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximum">
|
<property name="maximum">
|
||||||
<double>2000000000.000000000000000</double>
|
<double>2000000000.000000000000000</double>
|
||||||
@ -623,6 +623,52 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QWidget" name="horizontalLayoutWidget_2">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>384</x>
|
||||||
|
<y>60</y>
|
||||||
|
<width>348</width>
|
||||||
|
<height>27</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="spinDeadTimeonly">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> ns</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>9</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>-1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>2000000000.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
@ -46,6 +46,7 @@ void qTabDataOutput::SetupWidgetWindow(){
|
|||||||
// Detector Type
|
// Detector Type
|
||||||
detType=myDet->getDetectorsType();
|
detType=myDet->getDetectorsType();
|
||||||
widgetEiger->setVisible(false);
|
widgetEiger->setVisible(false);
|
||||||
|
spinDeadTimeonly->setVisible(false);
|
||||||
|
|
||||||
//rate correction - not for charge integrating detectors
|
//rate correction - not for charge integrating detectors
|
||||||
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
|
if((detType == slsDetectorDefs::MYTHEN)||(detType == slsDetectorDefs::EIGER))
|
||||||
@ -57,7 +58,10 @@ void qTabDataOutput::SetupWidgetWindow(){
|
|||||||
if(detType == slsDetectorDefs::EIGER){
|
if(detType == slsDetectorDefs::EIGER){
|
||||||
chkTenGiga->setEnabled(true);
|
chkTenGiga->setEnabled(true);
|
||||||
widgetEiger->setVisible(true);
|
widgetEiger->setVisible(true);
|
||||||
|
spinDeadTimeonly->setVisible(true);
|
||||||
|
radioAuto->setVisible(false);
|
||||||
|
radioDeadTime->setVisible(false);
|
||||||
|
spinDeadTime->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** error message **/
|
/** error message **/
|
||||||
@ -151,9 +155,13 @@ void qTabDataOutput::Initialization(){
|
|||||||
connect(btnFlatField, SIGNAL(clicked()), this, SLOT(BrowseFlatFieldPath()));
|
connect(btnFlatField, SIGNAL(clicked()), this, SLOT(BrowseFlatFieldPath()));
|
||||||
//rate correction
|
//rate correction
|
||||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
||||||
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
if(detType == slsDetectorDefs::EIGER)
|
||||||
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
connect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||||
connect(spinDeadTime, 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()));
|
||||||
|
}
|
||||||
//angular correction
|
//angular correction
|
||||||
connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection()));
|
connect(chkAngular, SIGNAL(toggled(bool)), this, SLOT(SetAngularCorrection()));
|
||||||
//discard bad channels
|
//discard bad channels
|
||||||
@ -326,56 +334,80 @@ void qTabDataOutput::BrowseFlatFieldPath(){
|
|||||||
|
|
||||||
|
|
||||||
void qTabDataOutput::SetRateCorrection(){
|
void qTabDataOutput::SetRateCorrection(){
|
||||||
disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
if(detType == slsDetectorDefs::EIGER)
|
||||||
disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
disconnect(spinDeadTimeonly, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||||
disconnect(spinDeadTime, 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()));
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Entering Set Rate Correction function" << endl;
|
cout << "Entering Set Rate Correction function" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(chkRate->isChecked()){
|
if(chkRate->isChecked()){
|
||||||
radioAuto->setEnabled(true);
|
if(detType == slsDetectorDefs::EIGER){
|
||||||
radioDeadTime->setEnabled(true);
|
spinDeadTimeonly->setEnabled(true);
|
||||||
//set auto as default if nothing selected
|
myDet->setRateCorrection((double)spinDeadTimeonly->value());
|
||||||
if(!radioAuto->isChecked()&&!radioDeadTime->isChecked())
|
}
|
||||||
radioAuto->setChecked(true);
|
|
||||||
//auto
|
|
||||||
if(radioAuto->isChecked()){
|
|
||||||
spinDeadTime->setEnabled(false);
|
|
||||||
myDet->setRateCorrection(-1);
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Setting rate corrections with default dead time" << endl;
|
|
||||||
#endif
|
|
||||||
}//custom dead time
|
|
||||||
else{
|
else{
|
||||||
spinDeadTime->setEnabled(true);
|
radioAuto->setEnabled(true);
|
||||||
if(spinDeadTime->value()>=-1)
|
radioDeadTime->setEnabled(true);
|
||||||
myDet->setRateCorrection((double)spinDeadTime->value());
|
//set auto as default if nothing selected
|
||||||
else
|
if(!radioAuto->isChecked()&&!radioDeadTime->isChecked())
|
||||||
qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -2.","qTabDataOutput::SetRateCorrection");
|
radioAuto->setChecked(true);
|
||||||
|
//auto mode
|
||||||
|
if(radioAuto->isChecked()){
|
||||||
|
spinDeadTime->setEnabled(false);
|
||||||
|
myDet->setRateCorrection(-1);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl;
|
cout << "Setting rate corrections with default dead time" << endl;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
//custom dead time
|
||||||
|
else{
|
||||||
|
spinDeadTime->setEnabled(true);
|
||||||
|
myDet->setRateCorrection((double)spinDeadTime->value());
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Setting rate corrections with dead time "<< spinDeadTime->value() << endl;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}//unsetting
|
}//unsetting
|
||||||
else{
|
else{
|
||||||
radioAuto->setEnabled(false);
|
if(detType == slsDetectorDefs::EIGER)
|
||||||
radioDeadTime->setEnabled(false);
|
spinDeadTimeonly->setEnabled(false);
|
||||||
spinDeadTime->setEnabled(false);
|
else{
|
||||||
|
radioAuto->setEnabled(false);
|
||||||
|
radioDeadTime->setEnabled(false);
|
||||||
|
spinDeadTime->setEnabled(false);
|
||||||
|
}
|
||||||
//Unsetting rate correction
|
//Unsetting rate correction
|
||||||
|
|
||||||
myDet->setRateCorrection(0);
|
myDet->setRateCorrection(0);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "Unsetting rate correction" << endl;
|
cout << "Unsetting rate correction" << endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
|
||||||
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
|
||||||
connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
|
||||||
|
|
||||||
qDefs::checkErrorMessage(myDet,"qTabDataOutput::SetRateCorrection");
|
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()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,10 +417,14 @@ void qTabDataOutput::SetRateCorrection(){
|
|||||||
|
|
||||||
void qTabDataOutput::UpdateRateCorrectionFromServer(){
|
void qTabDataOutput::UpdateRateCorrectionFromServer(){
|
||||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
||||||
disconnect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
|
||||||
disconnect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
|
||||||
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;
|
double rate;
|
||||||
rate = (double)myDet->getRateCorrectionTau();
|
rate = (double)myDet->getRateCorrectionTau();
|
||||||
qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateRateCorrectionFromServer");
|
qDefs::checkErrorMessage(myDet,"qTabDataOutput::UpdateRateCorrectionFromServer");
|
||||||
@ -397,58 +433,76 @@ void qTabDataOutput::UpdateRateCorrectionFromServer(){
|
|||||||
#endif
|
#endif
|
||||||
if(rate==0){
|
if(rate==0){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "None" << endl;
|
cout << "None" << endl;
|
||||||
#endif
|
#endif
|
||||||
radioAuto->setEnabled(false);
|
|
||||||
radioDeadTime->setEnabled(false);
|
|
||||||
spinDeadTime->setEnabled(false);
|
|
||||||
chkRate->setChecked(false);
|
chkRate->setChecked(false);
|
||||||
}else if(rate==-1){
|
if(detType == slsDetectorDefs::EIGER)
|
||||||
#ifdef VERBOSE
|
spinDeadTimeonly->setEnabled(false);
|
||||||
cout << "Auto" << endl;
|
else{
|
||||||
#endif
|
radioAuto->setEnabled(false);
|
||||||
radioAuto->setEnabled(true);
|
radioDeadTime->setEnabled(false);
|
||||||
radioDeadTime->setEnabled(true);
|
spinDeadTime->setEnabled(false);
|
||||||
spinDeadTime->setEnabled(false);
|
}
|
||||||
chkRate->setChecked(true);
|
|
||||||
radioAuto->setChecked(true);
|
|
||||||
}else{
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Custom" << endl;
|
|
||||||
#endif\
|
|
||||||
radioAuto->setEnabled(true);
|
|
||||||
radioDeadTime->setEnabled(true);
|
|
||||||
spinDeadTime->setEnabled(true);
|
|
||||||
chkRate->setChecked(true);
|
|
||||||
radioDeadTime->setChecked(true);
|
|
||||||
spinDeadTime->setValue((double)rate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rate == -2){
|
else{
|
||||||
qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -2.","qTabDataOutput::UpdateRateCorrectionFromServer");
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(detType == slsDetectorDefs::EIGER && rate == -1){
|
||||||
|
qDefs::Message(qDefs::WARNING,"Dead time is inconsistent for all detectors. Returned Value: -1.","qTabDataOutput::UpdateRateCorrectionFromServer");
|
||||||
QString errorTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
QString errorTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
||||||
"<nobr> #ratecorr# tau in seconds</nobr><br><br>")+
|
"<nobr> #ratecorr# tau in seconds</nobr><br><br>")+
|
||||||
QString("<nobr><font color=\"red\">"
|
QString("<nobr><font color=\"red\">"
|
||||||
"Dead time is inconsistent for all detectors.</font></nobr>");
|
"Dead time is inconsistent for all detectors.</font></nobr>");
|
||||||
chkRate->setToolTip(errorTip);
|
chkRate->setToolTip(errorTip);
|
||||||
radioDeadTime->setToolTip(errorTip);
|
spinDeadTimeonly->setToolTip(errorTip);
|
||||||
spinDeadTime->setToolTip(errorTip);
|
|
||||||
chkRate->setPalette(red);
|
chkRate->setPalette(red);
|
||||||
chkRate->setText("Rate:*");
|
chkRate->setText("Rate:*");
|
||||||
}else{
|
}else{
|
||||||
QString normalTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
QString normalTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
||||||
"<nobr> #ratecorr# tau in seconds</nobr><br><br>");
|
"<nobr> #ratecorr# tau in seconds</nobr><br><br>");
|
||||||
chkRate->setToolTip(normalTip);
|
chkRate->setToolTip(normalTip);
|
||||||
radioDeadTime->setToolTip(normalTip);
|
spinDeadTimeonly->setToolTip(normalTip);
|
||||||
spinDeadTime->setToolTip(normalTip);
|
|
||||||
chkRate->setPalette(chkDiscardBad->palette());
|
chkRate->setPalette(chkDiscardBad->palette());
|
||||||
chkRate->setText("Rate:");
|
chkRate->setText("Rate:");
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
||||||
connect(radioAuto, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
|
||||||
connect(radioDeadTime, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
if(detType == slsDetectorDefs::EIGER)
|
||||||
connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user