mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
WIP datatoutput
This commit is contained in:
parent
e4546c6121
commit
bb760f3210
@ -48,7 +48,7 @@
|
||||
<rect>
|
||||
<x>14</x>
|
||||
<y>21</y>
|
||||
<width>475</width>
|
||||
<width>527</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -56,95 +56,8 @@
|
||||
<property name="verticalSpacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkRate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QLabel" name="lblDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>2</red>
|
||||
<green>2</green>
|
||||
<blue>2</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>119</red>
|
||||
<green>119</green>
|
||||
<blue>119</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dead Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5" colspan="2">
|
||||
<widget class="QSpinBox" name="spinDeadTime">
|
||||
<item row="1" column="4" colspan="2">
|
||||
<widget class="QSpinBox" name="spinCustomDeadTime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
@ -163,39 +76,28 @@ Directory where one saves the data.
|
||||
<property name="maximum">
|
||||
<number>200000000</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<widget class="QPushButton" name="btnDefaultRate">
|
||||
<item row="1" column="1">
|
||||
<widget class="QRadioButton" name="radioDefaultDeadtime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
<property name="text">
|
||||
<string>Default Dead Time</string>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><nobr>
|
||||
Directory where one saves the data.
|
||||
</nobr><br>
|
||||
#outdir#
|
||||
<br>
|
||||
</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="chkRate">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../include/icons.qrc">
|
||||
<normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
|
||||
<string>Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -216,6 +118,32 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QRadioButton" name="radioCustomDeadtime">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom Dead Time:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="widgetEiger" native="true">
|
||||
@ -226,7 +154,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
<rect>
|
||||
<x>3</x>
|
||||
<y>92</y>
|
||||
<width>491</width>
|
||||
<width>547</width>
|
||||
<height>72</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -235,7 +163,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
|
||||
<rect>
|
||||
<x>11</x>
|
||||
<y>4</y>
|
||||
<width>475</width>
|
||||
<width>527</width>
|
||||
<height>68</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -246,7 +246,7 @@ class qDefs : public QWidget {
|
||||
|
||||
// executing multiSlsDetector funtion and using return value to set QWidget function
|
||||
// (handling -1 for comboboxes)
|
||||
template <class W, typename WRT, typename RT, typename... CT>
|
||||
/*template <class W, typename WRT, typename RT, typename... CT>
|
||||
static void IgnoreNonCriticalExceptionsandMinus1(multiSlsDetector* det,
|
||||
const std::string message, const std::string source,
|
||||
W* wid, void (W::*someQfunc)(WRT),
|
||||
@ -265,7 +265,7 @@ class qDefs : public QWidget {
|
||||
ExceptionMessage(message, e.what(), source);
|
||||
}
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
|
||||
/* can easily get out of hand
|
||||
|
@ -7,7 +7,7 @@
|
||||
class multiSlsDetector;
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <QButtonGroup>
|
||||
|
||||
/**
|
||||
*@short sets up the DataOutput parameters
|
||||
@ -69,20 +69,20 @@ public:
|
||||
void SetTenGigaEnable(bool enable);
|
||||
|
||||
/**
|
||||
* Set rate correction
|
||||
* @param deadtime dead time
|
||||
* Enable rate correction
|
||||
*/
|
||||
void SetRateCorrection(int deadtime = 0);
|
||||
void EnableRateCorrection();
|
||||
|
||||
/**
|
||||
* Set default rate correction
|
||||
* Set rate correction
|
||||
*/
|
||||
void SetDefaultRateCorrection();
|
||||
void SetRateCorrection();
|
||||
|
||||
/**
|
||||
* Set speed
|
||||
* @param speed speed chosen
|
||||
*/
|
||||
void SetSpeed();
|
||||
void SetSpeed(int speed);
|
||||
|
||||
/**
|
||||
* Set flags
|
||||
@ -144,15 +144,14 @@ public:
|
||||
/** The sls detector object */
|
||||
multiSlsDetector *myDet;
|
||||
|
||||
/** Palette */
|
||||
QPalette red;
|
||||
/** Button group for radiobuttons for rate*/
|
||||
QButtonGroup *btnGroupRate;
|
||||
|
||||
/** enum for the Eiger clock divider */
|
||||
enum {
|
||||
FULLSPEED,
|
||||
HALFSPEED,
|
||||
QUARTERSPEED,
|
||||
SUPERSLOWSPEED,
|
||||
NUMBEROFSPEEDS
|
||||
};
|
||||
|
||||
|
@ -20,15 +20,19 @@ qTabDataOutput::~qTabDataOutput() {}
|
||||
|
||||
|
||||
void qTabDataOutput::SetupWidgetWindow() {
|
||||
// palette
|
||||
red = QPalette();
|
||||
red.setColor(QPalette::Active, QPalette::WindowText, Qt::red);
|
||||
// button group for rate
|
||||
btnGroupRate = new QButtonGroup(this);
|
||||
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
||||
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
||||
|
||||
|
||||
// enabling according to det type
|
||||
switch((int)myDet->getDetectorTypeAsEnum()) {
|
||||
case slsDetectorDefs::EIGER:
|
||||
chkTenGiga->setEnabled(true);
|
||||
chkRate->setEnabled(true);
|
||||
radioDefaultDeadtime->setEnabled(true);
|
||||
radioCustomDeadtime->setEnabled(true);
|
||||
widgetEiger->setVisible(true);
|
||||
widgetEiger->setEnabled(true);
|
||||
break;
|
||||
@ -39,22 +43,9 @@ void qTabDataOutput::SetupWidgetWindow() {
|
||||
break;
|
||||
}
|
||||
PopulateDetectors();
|
||||
EnableBrowse();
|
||||
|
||||
Initialization();
|
||||
|
||||
GetOutputDir();
|
||||
GetFileOverwrite();
|
||||
GetFileFormat();
|
||||
if (chkRate->isEnabled()) {
|
||||
GetRateCorrection();
|
||||
}
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
GetTenGigaEnable();
|
||||
}
|
||||
if (widgetEiger->isEnabled()) {
|
||||
GetSpeed();
|
||||
GetFlags();
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
|
||||
@ -68,12 +59,12 @@ void qTabDataOutput::Initialization() {
|
||||
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
|
||||
}
|
||||
if (chkRate->isEnabled()) {
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
||||
connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection()));
|
||||
connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
}
|
||||
if (widgetEiger->isEnabled()) {
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed(int)));
|
||||
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
@ -168,13 +159,23 @@ void qTabDataOutput::GetFileFormat() {
|
||||
FILE_LOG(logDEBUG) << "Getting File Format";
|
||||
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
|
||||
qDefs::IgnoreNonCriticalExceptionsandMinus1<QComboBox>(
|
||||
myDet,
|
||||
"Could not get file format.",
|
||||
"qTabDataOutput::GetFileFormat",
|
||||
comboFileFormat,
|
||||
&QComboBox::setCurrentIndex,
|
||||
&multiSlsDetector::getFileFormat, -1);
|
||||
try {
|
||||
auto retval = myDet->getFileFormat();
|
||||
switch(retval) {
|
||||
case slsDetectorDefs::GET_FILE_FORMAT:
|
||||
qDefs::Message(qDefs::WARNING, "File Format is inconsistent for all detectors.", "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
case slsDetectorDefs::BINARY:
|
||||
case slsDetectorDefs::HDF5:
|
||||
comboFileFormat->setCurrentIndex(static_cast<int>(retval));
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown file format.") + std::to_string(static_cast<int>(retval)), "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get file format.", e.what(), "qTabDataOutput::GetFileFormat");
|
||||
}
|
||||
|
||||
connect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
|
||||
}
|
||||
@ -247,250 +248,175 @@ void qTabDataOutput::SetTenGigaEnable(bool enable) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::SetRateCorrection(int deadtime) {
|
||||
disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection()));
|
||||
disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
|
||||
FILE_LOG(logDEBUG) << "Entering Set Rate Correction function";
|
||||
|
||||
if (chkRate->isChecked()) {
|
||||
if (!btnDefaultRate->isEnabled()) {
|
||||
btnDefaultRate->setEnabled(true);
|
||||
lblDeadTime->setEnabled(true);
|
||||
spinDeadTime->setEnabled(true);
|
||||
}
|
||||
|
||||
if (deadtime != -1) {
|
||||
deadtime = (double)spinDeadTime->value();
|
||||
FILE_LOG(logINFO) << "Setting rate corrections with custom dead time: " << deadtime << '\n';
|
||||
} else {
|
||||
FILE_LOG(logINFO) << "Setting rate corrections with default dead time" << '\n';
|
||||
}
|
||||
myDet->setRateCorrection(deadtime);
|
||||
|
||||
} //unsetting rate correction
|
||||
else {
|
||||
btnDefaultRate->setEnabled(false);
|
||||
lblDeadTime->setEnabled(false);
|
||||
spinDeadTime->setEnabled(false);
|
||||
myDet->setRateCorrection(0);
|
||||
FILE_LOG(logINFO) << "Unsetting rate correction";
|
||||
}
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetRateCorrection");
|
||||
|
||||
//update just the value
|
||||
double rate = (double)myDet->getRateCorrection();
|
||||
spinDeadTime->setValue((double)rate);
|
||||
if (rate == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Dead time is inconsistent for all detectors. Returned Value: -1.", "qTabDataOutput::GetRateCorrection");
|
||||
QString errorTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
||||
"<nobr> #ratecorr# tau in seconds</nobr><br><br>") +
|
||||
QString("<nobr><font color=\"red\">"
|
||||
"Dead time is inconsistent for all detectors.</font></nobr>");
|
||||
chkRate->setToolTip(errorTip);
|
||||
spinDeadTime->setToolTip(errorTip);
|
||||
chkRate->setPalette(red);
|
||||
chkRate->setText("Rate:*");
|
||||
} else {
|
||||
QString normalTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
||||
"<nobr> #ratecorr# tau in seconds</nobr><br><br>");
|
||||
chkRate->setToolTip(normalTip);
|
||||
spinDeadTime->setToolTip(normalTip);
|
||||
chkRate->setPalette(lblDeadTime->palette());
|
||||
chkRate->setText("Rate:");
|
||||
}
|
||||
|
||||
connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection()));
|
||||
connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetDefaultRateCorrection() {
|
||||
SetRateCorrection(-1);
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::GetRateCorrection() {
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
||||
disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection()));
|
||||
disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
FILE_LOG(logDEBUG) << "Getting Rate Correction";
|
||||
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
|
||||
double rate;
|
||||
rate = (double)myDet->getRateCorrection();
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetRateCorrection");
|
||||
FILE_LOG(logDEBUG) << "Getting rate correction from server: " << rate << '\n';
|
||||
if (rate == 0) {
|
||||
chkRate->setChecked(false);
|
||||
btnDefaultRate->setEnabled(false);
|
||||
lblDeadTime->setEnabled(false);
|
||||
spinDeadTime->setEnabled(false);
|
||||
}
|
||||
try {
|
||||
int64_t retval = myDet->getRateCorrection();
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Rate correction (enable/tau) is inconsistent for all detectors.", "qTabDataOutput::GetRateCorrection");
|
||||
spinCustomDeadTime->setValue(-1);
|
||||
} else {
|
||||
chkRate->setChecked(retval == 0 ? false : true);
|
||||
if (retval != 0)
|
||||
spinCustomDeadTime->setValue(retval);
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get rate correction.", e.what(), "qTabDataOutput::GetRateCorrection");
|
||||
}
|
||||
|
||||
else {
|
||||
chkRate->setChecked(true);
|
||||
btnDefaultRate->setEnabled(true);
|
||||
lblDeadTime->setEnabled(true);
|
||||
spinDeadTime->setEnabled(true);
|
||||
spinDeadTime->setValue((double)rate);
|
||||
}
|
||||
|
||||
if (rate == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Dead time is inconsistent for all detectors. Returned Value: -1.", "qTabDataOutput::GetRateCorrection");
|
||||
FILE_LOG(logWARNING) << "Dead time is inconsistent for all detectors.";
|
||||
QString errorTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
||||
"<nobr> #ratecorr# tau in seconds</nobr><br><br>") +
|
||||
QString("<nobr><font color=\"red\">"
|
||||
"Dead time is inconsistent for all detectors.</font></nobr>");
|
||||
chkRate->setToolTip(errorTip);
|
||||
spinDeadTime->setToolTip(errorTip);
|
||||
chkRate->setPalette(red);
|
||||
chkRate->setText("Rate:*");
|
||||
} else {
|
||||
QString normalTip = QString("<nobr>Rate Corrections.</nobr><br>"
|
||||
"<nobr> #ratecorr# tau in seconds</nobr><br><br>");
|
||||
chkRate->setToolTip(normalTip);
|
||||
spinDeadTime->setToolTip(normalTip);
|
||||
chkRate->setPalette(chkDiscardBad->palette());
|
||||
chkRate->setText("Rate:");
|
||||
}
|
||||
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection()));
|
||||
connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection()));
|
||||
connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
|
||||
connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
|
||||
connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
|
||||
}
|
||||
|
||||
void qTabDataOutput::EnableRateCorrection() {
|
||||
// enable
|
||||
if (chkRate->isChecked()) {
|
||||
SetRateCorrection();
|
||||
return;
|
||||
}
|
||||
FILE_LOG(logINFO) << "Disabling Rate correction";
|
||||
// disable
|
||||
try {
|
||||
myDet->setRateCorrection(0);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not switch off rate correction.", e.what(), "qTabDataOutput::EnableRateCorrection");
|
||||
GetRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::SetRateCorrection() {
|
||||
// do nothing if rate correction is disabled
|
||||
if (!chkRate->isChecked()) {
|
||||
return;
|
||||
}
|
||||
// get default or custom value
|
||||
int64_t deadtime = -1;
|
||||
if (radioCustomDeadtime->isChecked()) {
|
||||
deadtime = spinCustomDeadTime->value();
|
||||
}
|
||||
FILE_LOG(logINFO) << "Setting Rate Correction with dead time: " << deadtime;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
try {
|
||||
myDet->setRateCorrection(deadtime);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set rate correction.", e.what(), "qTabDataOutput::SetRateCorrection");
|
||||
GetRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
void qTabDataOutput::GetSpeed() {
|
||||
int ret;
|
||||
if (widgetEiger->isVisible()) {
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
|
||||
FILE_LOG(logDEBUG) << "Getting Speed";
|
||||
disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
|
||||
|
||||
try {
|
||||
int retval = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER);
|
||||
switch(retval) {
|
||||
case -1:
|
||||
qDefs::Message(qDefs::WARNING, "Speed is inconsistent for all detectors.", "qTabDataOutput::GetSpeed");
|
||||
break;
|
||||
case FULLSPEED:
|
||||
case HALFSPEED:
|
||||
case QUARTERSPEED:
|
||||
comboEigerClkDivider->setCurrentIndex(retval);
|
||||
break;
|
||||
default:
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown speed.") + std::to_string(retval), "qTabDataOutput::GetFileFormat");
|
||||
break;
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed");
|
||||
}
|
||||
|
||||
//get speed
|
||||
ret = myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, -1);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetSpeed");
|
||||
|
||||
//valid speed
|
||||
if (ret >= 0 && ret < NUMBEROFSPEEDS)
|
||||
comboEigerClkDivider->setCurrentIndex(ret);
|
||||
|
||||
//invalid speed
|
||||
else {
|
||||
qDefs::Message(qDefs::WARNING, "Inconsistent value from clock divider.\n"
|
||||
"Setting it for all detectors involved to half speed.",
|
||||
"qTabDataOutput::GetSpeed");
|
||||
FILE_LOG(logWARNING) << "Inconsistent value from clock divider.";
|
||||
//set to default
|
||||
comboEigerClkDivider->setCurrentIndex(HALFSPEED);
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, HALFSPEED);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetSpeed");
|
||||
}
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
|
||||
}
|
||||
connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetSpeed() {
|
||||
FILE_LOG(logINFO) << "Setting Speed";
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, comboEigerClkDivider->currentIndex());
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetSpeed");
|
||||
GetSpeed();
|
||||
void qTabDataOutput::SetSpeed(int speed) {
|
||||
FILE_LOG(logINFO) << "Setting Speed to " << ((speed = FULLSPEED) ? "full" : ((speed == HALFSPEED) ? "half" : "quarter")) << " speed";
|
||||
try {
|
||||
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set speed.", e.what(), "qTabDataOutput::SetSpeed");
|
||||
GetSpeed();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void qTabDataOutput::GetFlags() {
|
||||
int ret;
|
||||
if (widgetEiger->isVisible()) {
|
||||
disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
FILE_LOG(logDEBUG) << "Getting readout flags";
|
||||
disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
|
||||
//get speed
|
||||
ret = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags");
|
||||
|
||||
//invalid flags
|
||||
if (ret == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Inconsistent value for readout flags.\n"
|
||||
"Setting it for all detectors involved to continous nonparallel mode.",
|
||||
"qTabDataOutput::GetFlags");
|
||||
FILE_LOG(logWARNING) << "Inconsistent value for readout flags.";
|
||||
//set to default
|
||||
comboEigerFlags1->setCurrentIndex(CONTINUOUS);
|
||||
myDet->setReadOutFlags(slsDetectorDefs::CONTINOUS_RO);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags");
|
||||
comboEigerFlags2->setCurrentIndex(NONPARALLEL);
|
||||
myDet->setReadOutFlags(slsDetectorDefs::NONPARALLEL);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags");
|
||||
}
|
||||
|
||||
//valid flags
|
||||
else {
|
||||
if (ret & slsDetectorDefs::STORE_IN_RAM)
|
||||
try {
|
||||
int retval = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS);
|
||||
if (retval == -1) {
|
||||
qDefs::Message(qDefs::WARNING, "Readout flags are inconsistent for all detectors.", "qTabDataOutput::GetFlags");
|
||||
} else {
|
||||
// store in ram or continuous
|
||||
if (retval & slsDetectorDefs::STORE_IN_RAM)
|
||||
comboEigerFlags1->setCurrentIndex(STOREINRAM);
|
||||
else if (ret & slsDetectorDefs::CONTINOUS_RO)
|
||||
else if (retval & slsDetectorDefs::CONTINOUS_RO)
|
||||
comboEigerFlags1->setCurrentIndex(CONTINUOUS);
|
||||
if (ret & slsDetectorDefs::PARALLEL)
|
||||
comboEigerFlags2->setCurrentIndex(PARALLEL);
|
||||
else if (ret & slsDetectorDefs::NONPARALLEL)
|
||||
comboEigerFlags2->setCurrentIndex(NONPARALLEL);
|
||||
else if (ret & slsDetectorDefs::SAFE)
|
||||
comboEigerFlags2->setCurrentIndex(SAFE);
|
||||
}
|
||||
else {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Store in ram or Continous).") + std::to_string(retval), "qTabDataOutput::GetFlags");
|
||||
}
|
||||
|
||||
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
// parallel or non parallel
|
||||
if (retval & slsDetectorDefs::PARALLEL)
|
||||
comboEigerFlags2->setCurrentIndex(PARALLEL);
|
||||
else if (retval & slsDetectorDefs::NONPARALLEL)
|
||||
comboEigerFlags2->setCurrentIndex(NONPARALLEL);
|
||||
else {
|
||||
qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Parallel or Non Parallel).") + std::to_string(retval), "qTabDataOutput::GetFlags");
|
||||
}
|
||||
}
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not get speed.", e.what(), "qTabDataOutput::GetSpeed");
|
||||
}
|
||||
|
||||
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
|
||||
}
|
||||
|
||||
|
||||
void qTabDataOutput::SetFlags() {
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags";
|
||||
slsDetectorDefs::readOutFlags val = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
auto flag1 = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
auto flag2 = slsDetectorDefs::GET_READOUT_FLAGS;
|
||||
|
||||
//set to continous or storeinram
|
||||
switch (comboEigerFlags1->currentIndex()) {
|
||||
case STOREINRAM:
|
||||
val = slsDetectorDefs::STORE_IN_RAM;
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Store in Ram";
|
||||
flag1 = slsDetectorDefs::STORE_IN_RAM;
|
||||
break;
|
||||
default:
|
||||
val = slsDetectorDefs::CONTINOUS_RO;
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Continuous";
|
||||
flag1 = slsDetectorDefs::CONTINOUS_RO;
|
||||
break;
|
||||
}
|
||||
myDet->setReadOutFlags(val);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::setFlags");
|
||||
|
||||
//set to parallel, nonparallel or safe
|
||||
switch (comboEigerFlags2->currentIndex()) {
|
||||
case PARALLEL:
|
||||
val = slsDetectorDefs::PARALLEL;
|
||||
break;
|
||||
case SAFE:
|
||||
val = slsDetectorDefs::SAFE;
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Parallel";
|
||||
flag2 = slsDetectorDefs::PARALLEL;
|
||||
break;
|
||||
default:
|
||||
val = slsDetectorDefs::NONPARALLEL;
|
||||
FILE_LOG(logINFO) << "Setting Readout Flags to Non Parallel";
|
||||
flag2 = slsDetectorDefs::NONPARALLEL;
|
||||
break;
|
||||
}
|
||||
myDet->setReadOutFlags(val);
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::setFlags");
|
||||
|
||||
//update flags
|
||||
GetFlags();
|
||||
|
||||
try {
|
||||
myDet->setReadOutFlags(flag1);
|
||||
myDet->setReadOutFlags(flag2);
|
||||
} catch (const sls::NonCriticalError &e) {
|
||||
qDefs::ExceptionMessage("Could not set readout flags.", e.what(), "qTabDataOutput::SetFlags");
|
||||
GetFlags();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -503,52 +429,20 @@ void qTabDataOutput::Refresh() {
|
||||
FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||
|
||||
EnableBrowse();
|
||||
if (!myDet->enableWriteToFile())
|
||||
boxFileWriteEnabled->setEnabled(false);
|
||||
else
|
||||
boxFileWriteEnabled->setEnabled(true);
|
||||
|
||||
// output dir
|
||||
GetOutputDir();
|
||||
|
||||
//overwrite
|
||||
GetFileOverwrite();
|
||||
|
||||
//file format
|
||||
GetFileFormat();
|
||||
|
||||
//file name
|
||||
dispFileName->setText(QString(myDet->getFileName().c_str()));
|
||||
|
||||
// rate correction
|
||||
GetOutputDir();
|
||||
GetFileOverwrite();
|
||||
GetFileFormat();
|
||||
if (chkRate->isEnabled()) {
|
||||
GetRateCorrection();
|
||||
}
|
||||
|
||||
if (myDet->setReceiverOnline() == slsDetectorDefs::ONLINE_FLAG) {
|
||||
btnOutputBrowse->setEnabled(false);
|
||||
btnOutputBrowse->setToolTip("<font color=\"red\">This button is disabled as receiver PC is different from "
|
||||
"client PC and hence different directory structures.</font><br><br>" +
|
||||
dispOutputDir->toolTip());
|
||||
} else {
|
||||
btnOutputBrowse->setEnabled(true);
|
||||
btnOutputBrowse->setToolTip(dispOutputDir->toolTip());
|
||||
}
|
||||
|
||||
// 10GbE
|
||||
if (chkTenGiga->isEnabled()) {
|
||||
GetTenGigaEnable(-1, 1);
|
||||
GetTenGigaEnable();
|
||||
}
|
||||
|
||||
//Eiger specific
|
||||
if (widgetEiger->isVisible()) {
|
||||
//speed
|
||||
if (widgetEiger->isEnabled()) {
|
||||
GetSpeed();
|
||||
//flags
|
||||
GetFlags();
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG) << "**Updated DataOutput Tab";
|
||||
|
||||
qDefs::checkErrorMessage(myDet, "qTabDataOutput::Refresh");
|
||||
}
|
||||
|
@ -773,6 +773,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
|
||||
* adcphase for Gotthard, others for CTB & Moench)
|
||||
* @param value (clkdivider 0,1,2 for full, half and quarter speed). Other
|
||||
* values check manual
|
||||
* @param mode 0 for shift, 1 for degrees. relevant only for speed type adcphase and dbit phase
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns value of speed set
|
||||
*/
|
||||
|
@ -763,6 +763,7 @@ class slsDetector : public virtual slsDetectorDefs{
|
||||
* @param sp speed type (clkdivider option for Jungfrau and Eiger,
|
||||
* adcphase for Gotthard, others for CTB & Moench)
|
||||
* @param value (clkdivider 0,1,2 for full, half and quarter speed). Other values check manual
|
||||
* @param mode 0 for shift, 1 for degrees. relevant only for speed type adcphase and dbit phase
|
||||
* @returns value of speed set
|
||||
*/
|
||||
int setSpeed(speedVariable sp, int value = -1, int mode = 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user