WIP datatoutput

This commit is contained in:
maliakal_d 2019-06-06 15:04:05 +02:00
parent e4546c6121
commit bb760f3210
6 changed files with 221 additions and 398 deletions

View File

@ -48,7 +48,7 @@
<rect> <rect>
<x>14</x> <x>14</x>
<y>21</y> <y>21</y>
<width>475</width> <width>527</width>
<height>76</height> <height>76</height>
</rect> </rect>
</property> </property>
@ -56,95 +56,8 @@
<property name="verticalSpacing"> <property name="verticalSpacing">
<number>6</number> <number>6</number>
</property> </property>
<item row="1" column="3"> <item row="1" column="4" colspan="2">
<spacer name="horizontalSpacer_2"> <widget class="QSpinBox" name="spinCustomDeadTime">
<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>&lt;nobr&gt;
Directory where one saves the data.
&lt;/nobr&gt;&lt;br&gt;
#outdir#
&lt;br&gt;
</string>
</property>
<property name="text">
<string>Dead Time:</string>
</property>
</widget>
</item>
<item row="1" column="5" colspan="2">
<widget class="QSpinBox" name="spinDeadTime">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
@ -163,39 +76,28 @@ Directory where one saves the data.
<property name="maximum"> <property name="maximum">
<number>200000000</number> <number>200000000</number>
</property> </property>
<property name="value">
<number>0</number>
</property>
</widget> </widget>
</item> </item>
<item row="1" column="1" colspan="2"> <item row="1" column="1">
<widget class="QPushButton" name="btnDefaultRate"> <widget class="QRadioButton" name="radioDefaultDeadtime">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy"> <property name="text">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <string>Default Dead Time</string>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property> </property>
<property name="maximumSize"> </widget>
<size> </item>
<width>16777215</width> <item row="1" column="0">
<height>30</height> <widget class="QCheckBox" name="chkRate">
</size> <property name="enabled">
</property> <bool>false</bool>
<property name="toolTip">
<string>&lt;nobr&gt;
Directory where one saves the data.
&lt;/nobr&gt;&lt;br&gt;
#outdir#
&lt;br&gt;
</string>
</property> </property>
<property name="text"> <property name="text">
<string>Default</string> <string>Rate:</string>
</property>
<property name="icon">
<iconset resource="../include/icons.qrc">
<normaloff>:/icons/images/calculate.png</normaloff>:/icons/images/calculate.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
@ -216,6 +118,32 @@ Compression using Root. Available only for Gotthard in Expert Mode.
</property> </property>
</widget> </widget>
</item> </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> </layout>
</widget> </widget>
<widget class="QWidget" name="widgetEiger" native="true"> <widget class="QWidget" name="widgetEiger" native="true">
@ -226,7 +154,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
<rect> <rect>
<x>3</x> <x>3</x>
<y>92</y> <y>92</y>
<width>491</width> <width>547</width>
<height>72</height> <height>72</height>
</rect> </rect>
</property> </property>
@ -235,7 +163,7 @@ Compression using Root. Available only for Gotthard in Expert Mode.
<rect> <rect>
<x>11</x> <x>11</x>
<y>4</y> <y>4</y>
<width>475</width> <width>527</width>
<height>68</height> <height>68</height>
</rect> </rect>
</property> </property>

View File

@ -246,7 +246,7 @@ class qDefs : public QWidget {
// executing multiSlsDetector funtion and using return value to set QWidget function // executing multiSlsDetector funtion and using return value to set QWidget function
// (handling -1 for comboboxes) // (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, static void IgnoreNonCriticalExceptionsandMinus1(multiSlsDetector* det,
const std::string message, const std::string source, const std::string message, const std::string source,
W* wid, void (W::*someQfunc)(WRT), W* wid, void (W::*someQfunc)(WRT),
@ -265,7 +265,7 @@ class qDefs : public QWidget {
ExceptionMessage(message, e.what(), source); ExceptionMessage(message, e.what(), source);
} }
}; };
*/
// executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1) // executing multiSlsDetector funtion and returning its value (integers, where value cannot be -1)
/* can easily get out of hand /* can easily get out of hand

View File

@ -7,7 +7,7 @@
class multiSlsDetector; class multiSlsDetector;
#include <QString> #include <QString>
#include <QButtonGroup>
/** /**
*@short sets up the DataOutput parameters *@short sets up the DataOutput parameters
@ -69,20 +69,20 @@ public:
void SetTenGigaEnable(bool enable); void SetTenGigaEnable(bool enable);
/** /**
* Set rate correction * Enable rate correction
* @param deadtime dead time
*/ */
void SetRateCorrection(int deadtime = 0); void EnableRateCorrection();
/** /**
* Set default rate correction * Set rate correction
*/ */
void SetDefaultRateCorrection(); void SetRateCorrection();
/** /**
* Set speed * Set speed
* @param speed speed chosen
*/ */
void SetSpeed(); void SetSpeed(int speed);
/** /**
* Set flags * Set flags
@ -144,15 +144,14 @@ public:
/** The sls detector object */ /** The sls detector object */
multiSlsDetector *myDet; multiSlsDetector *myDet;
/** Palette */ /** Button group for radiobuttons for rate*/
QPalette red; QButtonGroup *btnGroupRate;
/** enum for the Eiger clock divider */ /** enum for the Eiger clock divider */
enum { enum {
FULLSPEED, FULLSPEED,
HALFSPEED, HALFSPEED,
QUARTERSPEED, QUARTERSPEED,
SUPERSLOWSPEED,
NUMBEROFSPEEDS NUMBEROFSPEEDS
}; };

View File

@ -20,15 +20,19 @@ qTabDataOutput::~qTabDataOutput() {}
void qTabDataOutput::SetupWidgetWindow() { void qTabDataOutput::SetupWidgetWindow() {
// palette // button group for rate
red = QPalette(); btnGroupRate = new QButtonGroup(this);
red.setColor(QPalette::Active, QPalette::WindowText, Qt::red); btnGroupRate->addButton(radioDefaultDeadtime, 0);
btnGroupRate->addButton(radioCustomDeadtime, 1);
// enabling according to det type // enabling according to det type
switch((int)myDet->getDetectorTypeAsEnum()) { switch((int)myDet->getDetectorTypeAsEnum()) {
case slsDetectorDefs::EIGER: case slsDetectorDefs::EIGER:
chkTenGiga->setEnabled(true); chkTenGiga->setEnabled(true);
chkRate->setEnabled(true); chkRate->setEnabled(true);
radioDefaultDeadtime->setEnabled(true);
radioCustomDeadtime->setEnabled(true);
widgetEiger->setVisible(true); widgetEiger->setVisible(true);
widgetEiger->setEnabled(true); widgetEiger->setEnabled(true);
break; break;
@ -39,22 +43,9 @@ void qTabDataOutput::SetupWidgetWindow() {
break; break;
} }
PopulateDetectors(); PopulateDetectors();
EnableBrowse();
Initialization(); Initialization();
GetOutputDir();
GetFileOverwrite();
GetFileFormat();
if (chkRate->isEnabled()) {
GetRateCorrection();
}
if (chkTenGiga->isEnabled()) {
GetTenGigaEnable();
}
if (widgetEiger->isEnabled()) {
GetSpeed();
GetFlags();
}
Refresh(); Refresh();
} }
@ -68,12 +59,12 @@ void qTabDataOutput::Initialization() {
connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool))); connect(chkTenGiga, SIGNAL(toggled(bool)), this, SLOT(SetTenGigaEnable(bool)));
} }
if (chkRate->isEnabled()) { if (chkRate->isEnabled()) {
connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
connect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
connect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
} }
if (widgetEiger->isEnabled()) { 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(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
connect(comboEigerFlags2, 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"; FILE_LOG(logDEBUG) << "Getting File Format";
disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int))); disconnect(comboFileFormat, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFileFormat(int)));
qDefs::IgnoreNonCriticalExceptionsandMinus1<QComboBox>( try {
myDet, auto retval = myDet->getFileFormat();
"Could not get file format.", switch(retval) {
"qTabDataOutput::GetFileFormat", case slsDetectorDefs::GET_FILE_FORMAT:
comboFileFormat, qDefs::Message(qDefs::WARNING, "File Format is inconsistent for all detectors.", "qTabDataOutput::GetFileFormat");
&QComboBox::setCurrentIndex, break;
&multiSlsDetector::getFileFormat, -1); 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))); 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() { void qTabDataOutput::GetRateCorrection() {
disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(SetRateCorrection())); FILE_LOG(logDEBUG) << "Getting Rate Correction";
disconnect(btnDefaultRate, SIGNAL(clicked()), this, SLOT(SetDefaultRateCorrection())); disconnect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
disconnect(spinDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection())); disconnect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
disconnect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
double rate; try {
rate = (double)myDet->getRateCorrection(); int64_t retval = myDet->getRateCorrection();
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetRateCorrection"); if (retval == -1) {
FILE_LOG(logDEBUG) << "Getting rate correction from server: " << rate << '\n'; qDefs::Message(qDefs::WARNING, "Rate correction (enable/tau) is inconsistent for all detectors.", "qTabDataOutput::GetRateCorrection");
if (rate == 0) { spinCustomDeadTime->setValue(-1);
chkRate->setChecked(false); } else {
btnDefaultRate->setEnabled(false); chkRate->setChecked(retval == 0 ? false : true);
lblDeadTime->setEnabled(false); if (retval != 0)
spinDeadTime->setEnabled(false); spinCustomDeadTime->setValue(retval);
} }
} catch (const sls::NonCriticalError &e) {
qDefs::ExceptionMessage("Could not get rate correction.", e.what(), "qTabDataOutput::GetRateCorrection");
}
else { connect(chkRate, SIGNAL(toggled(bool)), this, SLOT(EnableRateCorrection()));
chkRate->setChecked(true); connect(btnGroupRate, SIGNAL(buttonClicked(int)), this, SLOT(SetRateCorrection()));
btnDefaultRate->setEnabled(true); connect(spinCustomDeadTime, SIGNAL(editingFinished()), this, SLOT(SetRateCorrection()));
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()));
} }
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() { void qTabDataOutput::GetSpeed() {
int ret; FILE_LOG(logDEBUG) << "Getting Speed";
if (widgetEiger->isVisible()) { disconnect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
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 connect(comboEigerClkDivider, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSpeed()));
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()));
}
} }
void qTabDataOutput::SetSpeed(int speed) {
void qTabDataOutput::SetSpeed() { FILE_LOG(logINFO) << "Setting Speed to " << ((speed = FULLSPEED) ? "full" : ((speed == HALFSPEED) ? "half" : "quarter")) << " speed";
FILE_LOG(logINFO) << "Setting Speed"; try {
myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, comboEigerClkDivider->currentIndex()); myDet->setSpeed(slsDetectorDefs::CLOCK_DIVIDER, speed);
qDefs::checkErrorMessage(myDet, "qTabDataOutput::SetSpeed"); } catch (const sls::NonCriticalError &e) {
GetSpeed(); qDefs::ExceptionMessage("Could not set speed.", e.what(), "qTabDataOutput::SetSpeed");
GetSpeed();
}
} }
void qTabDataOutput::GetFlags() { void qTabDataOutput::GetFlags() {
int ret; FILE_LOG(logDEBUG) << "Getting readout flags";
if (widgetEiger->isVisible()) { disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
disconnect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
disconnect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags()));
//get speed try {
ret = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS); int retval = myDet->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS);
qDefs::checkErrorMessage(myDet, "qTabDataOutput::GetFlags"); if (retval == -1) {
qDefs::Message(qDefs::WARNING, "Readout flags are inconsistent for all detectors.", "qTabDataOutput::GetFlags");
//invalid flags } else {
if (ret == -1) { // store in ram or continuous
qDefs::Message(qDefs::WARNING, "Inconsistent value for readout flags.\n" if (retval & slsDetectorDefs::STORE_IN_RAM)
"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)
comboEigerFlags1->setCurrentIndex(STOREINRAM); comboEigerFlags1->setCurrentIndex(STOREINRAM);
else if (ret & slsDetectorDefs::CONTINOUS_RO) else if (retval & slsDetectorDefs::CONTINOUS_RO)
comboEigerFlags1->setCurrentIndex(CONTINUOUS); comboEigerFlags1->setCurrentIndex(CONTINUOUS);
if (ret & slsDetectorDefs::PARALLEL) else {
comboEigerFlags2->setCurrentIndex(PARALLEL); qDefs::Message(qDefs::WARNING, std::string("Unknown flag (Not Store in ram or Continous).") + std::to_string(retval), "qTabDataOutput::GetFlags");
else if (ret & slsDetectorDefs::NONPARALLEL) }
comboEigerFlags2->setCurrentIndex(NONPARALLEL);
else if (ret & slsDetectorDefs::SAFE)
comboEigerFlags2->setCurrentIndex(SAFE);
}
connect(comboEigerFlags1, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); // parallel or non parallel
connect(comboEigerFlags2, SIGNAL(currentIndexChanged(int)), this, SLOT(SetFlags())); 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() { void qTabDataOutput::SetFlags() {
FILE_LOG(logINFO) << "Setting Readout Flags"; auto flag1 = slsDetectorDefs::GET_READOUT_FLAGS;
slsDetectorDefs::readOutFlags val = slsDetectorDefs::GET_READOUT_FLAGS; auto flag2 = slsDetectorDefs::GET_READOUT_FLAGS;
//set to continous or storeinram //set to continous or storeinram
switch (comboEigerFlags1->currentIndex()) { switch (comboEigerFlags1->currentIndex()) {
case STOREINRAM: case STOREINRAM:
val = slsDetectorDefs::STORE_IN_RAM; FILE_LOG(logINFO) << "Setting Readout Flags to Store in Ram";
flag1 = slsDetectorDefs::STORE_IN_RAM;
break; break;
default: default:
val = slsDetectorDefs::CONTINOUS_RO; FILE_LOG(logINFO) << "Setting Readout Flags to Continuous";
flag1 = slsDetectorDefs::CONTINOUS_RO;
break; break;
} }
myDet->setReadOutFlags(val);
qDefs::checkErrorMessage(myDet, "qTabDataOutput::setFlags");
//set to parallel, nonparallel or safe //set to parallel, nonparallel or safe
switch (comboEigerFlags2->currentIndex()) { switch (comboEigerFlags2->currentIndex()) {
case PARALLEL: case PARALLEL:
val = slsDetectorDefs::PARALLEL; FILE_LOG(logINFO) << "Setting Readout Flags to Parallel";
break; flag2 = slsDetectorDefs::PARALLEL;
case SAFE:
val = slsDetectorDefs::SAFE;
break; break;
default: default:
val = slsDetectorDefs::NONPARALLEL; FILE_LOG(logINFO) << "Setting Readout Flags to Non Parallel";
flag2 = slsDetectorDefs::NONPARALLEL;
break; 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"; FILE_LOG(logDEBUG) << "**Updating DataOutput Tab";
EnableBrowse(); 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())); dispFileName->setText(QString(myDet->getFileName().c_str()));
GetOutputDir();
// rate correction GetFileOverwrite();
GetFileFormat();
if (chkRate->isEnabled()) { if (chkRate->isEnabled()) {
GetRateCorrection(); 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()) { if (chkTenGiga->isEnabled()) {
GetTenGigaEnable(-1, 1); GetTenGigaEnable();
} }
if (widgetEiger->isEnabled()) {
//Eiger specific
if (widgetEiger->isVisible()) {
//speed
GetSpeed(); GetSpeed();
//flags
GetFlags(); GetFlags();
} }
FILE_LOG(logDEBUG) << "**Updated DataOutput Tab"; FILE_LOG(logDEBUG) << "**Updated DataOutput Tab";
qDefs::checkErrorMessage(myDet, "qTabDataOutput::Refresh");
} }

View File

@ -773,6 +773,7 @@ class multiSlsDetector : public virtual slsDetectorDefs {
* adcphase for Gotthard, others for CTB & Moench) * adcphase for Gotthard, others for CTB & Moench)
* @param value (clkdivider 0,1,2 for full, half and quarter speed). Other * @param value (clkdivider 0,1,2 for full, half and quarter speed). Other
* values check manual * 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 * @param detPos -1 for all detectors in list or specific detector position
* @returns value of speed set * @returns value of speed set
*/ */

View File

@ -763,6 +763,7 @@ class slsDetector : public virtual slsDetectorDefs{
* @param sp speed type (clkdivider option for Jungfrau and Eiger, * @param sp speed type (clkdivider option for Jungfrau and Eiger,
* adcphase for Gotthard, others for CTB & Moench) * adcphase for Gotthard, others for CTB & Moench)
* @param value (clkdivider 0,1,2 for full, half and quarter speed). Other values check manual * @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 * @returns value of speed set
*/ */
int setSpeed(speedVariable sp, int value = -1, int mode = 0); int setSpeed(speedVariable sp, int value = -1, int mode = 0);