mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02:00
added counters for m3 gui
This commit is contained in:
parent
ac5dece221
commit
b9aa7bcc8e
@ -533,6 +533,61 @@ Directory where one saves the data.
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_11">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkCounter1">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Counter 1</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkCounter2">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Counter 2</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="chkCounter3">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Counter 3</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
|
@ -22,6 +22,7 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
|||||||
void SetRateCorrection();
|
void SetRateCorrection();
|
||||||
void SetSpeed(int speed);
|
void SetSpeed(int speed);
|
||||||
void SetParallel(bool enable);
|
void SetParallel(bool enable);
|
||||||
|
void SetCounterMask();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
@ -36,6 +37,7 @@ class qTabDataOutput : public QWidget, private Ui::TabDataOutputObject {
|
|||||||
void GetRateCorrection();
|
void GetRateCorrection();
|
||||||
void GetSpeed();
|
void GetSpeed();
|
||||||
void GetParallel();
|
void GetParallel();
|
||||||
|
void GetCounterMask();
|
||||||
|
|
||||||
sls::Detector *det;
|
sls::Detector *det;
|
||||||
// Button group for radiobuttons for rate
|
// Button group for radiobuttons for rate
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include "qTabDataOutput.h"
|
#include "qTabDataOutput.h"
|
||||||
#include "qDefs.h"
|
#include "qDefs.h"
|
||||||
|
#include "sls/bit_utils.h"
|
||||||
|
|
||||||
#include <QButtonGroup>
|
#include <QButtonGroup>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@ -23,6 +25,12 @@ void qTabDataOutput::SetupWidgetWindow() {
|
|||||||
btnGroupRate = new QButtonGroup(this);
|
btnGroupRate = new QButtonGroup(this);
|
||||||
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
btnGroupRate->addButton(radioDefaultDeadtime, 0);
|
||||||
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
btnGroupRate->addButton(radioCustomDeadtime, 1);
|
||||||
|
chkCounter1->setEnabled(false);
|
||||||
|
chkCounter2->setEnabled(false);
|
||||||
|
chkCounter3->setEnabled(false);
|
||||||
|
chkCounter1->hide();
|
||||||
|
chkCounter2->hide();
|
||||||
|
chkCounter3->hide();
|
||||||
|
|
||||||
// enabling according to det type
|
// enabling according to det type
|
||||||
switch (det->getDetectorType().squash()) {
|
switch (det->getDetectorType().squash()) {
|
||||||
@ -41,6 +49,12 @@ void qTabDataOutput::SetupWidgetWindow() {
|
|||||||
break;
|
break;
|
||||||
case slsDetectorDefs::MYTHEN3:
|
case slsDetectorDefs::MYTHEN3:
|
||||||
chkParallel->setEnabled(true);
|
chkParallel->setEnabled(true);
|
||||||
|
chkCounter1->setEnabled(true);
|
||||||
|
chkCounter2->setEnabled(true);
|
||||||
|
chkCounter3->setEnabled(true);
|
||||||
|
chkCounter1->show();
|
||||||
|
chkCounter2->show();
|
||||||
|
chkCounter3->show();
|
||||||
break;
|
break;
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
case slsDetectorDefs::JUNGFRAU:
|
||||||
lblClkDivider->setEnabled(true);
|
lblClkDivider->setEnabled(true);
|
||||||
@ -87,6 +101,14 @@ void qTabDataOutput::Initialization() {
|
|||||||
connect(chkParallel, SIGNAL(toggled(bool)), this,
|
connect(chkParallel, SIGNAL(toggled(bool)), this,
|
||||||
SLOT(SetParallel(bool)));
|
SLOT(SetParallel(bool)));
|
||||||
}
|
}
|
||||||
|
if (chkCounter1->isEnabled()) {
|
||||||
|
connect(chkCounter1, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetCounterMask()));
|
||||||
|
connect(chkCounter2, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetCounterMask()));
|
||||||
|
connect(chkCounter3, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetCounterMask()));
|
||||||
|
}
|
||||||
// speed
|
// speed
|
||||||
if (comboClkDivider->isEnabled()) {
|
if (comboClkDivider->isEnabled()) {
|
||||||
connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboClkDivider, SIGNAL(currentIndexChanged(int)), this,
|
||||||
@ -416,6 +438,55 @@ void qTabDataOutput::SetParallel(bool enable) {
|
|||||||
&qTabDataOutput::GetParallel)
|
&qTabDataOutput::GetParallel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabDataOutput::GetCounterMask() {
|
||||||
|
LOG(logDEBUG) << "Getting counter mask";
|
||||||
|
disconnect(chkCounter1, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetCounterMask()));
|
||||||
|
disconnect(chkCounter2, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetCounterMask()));
|
||||||
|
disconnect(chkCounter3, SIGNAL(toggled(bool)), this,
|
||||||
|
SLOT(SetCounterMask()));
|
||||||
|
try {
|
||||||
|
auto retval = sls::getSetBits(det->getCounterMask().tsquash(
|
||||||
|
"Counter mask is inconsistent for all detectors."));
|
||||||
|
std::vector<QCheckBox *> counters = {chkCounter1, chkCounter2,
|
||||||
|
chkCounter3};
|
||||||
|
for (unsigned int i = 0; i < counters.size(); ++i) {
|
||||||
|
counters[i]->setChecked(false);
|
||||||
|
}
|
||||||
|
for (unsigned int i = 0; i < retval.size(); ++i) {
|
||||||
|
if (retval[i] > 3) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
std::string("Unknown counter index : ") +
|
||||||
|
std::to_string(static_cast<int>(retval[i])));
|
||||||
|
}
|
||||||
|
counters[retval[i]]->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
CATCH_DISPLAY("Could not get parallel readout.",
|
||||||
|
"qTabDataOutput::GetParallel")
|
||||||
|
connect(chkCounter1, SIGNAL(toggled(bool)), this, SLOT(SetCounterMask()));
|
||||||
|
connect(chkCounter2, SIGNAL(toggled(bool)), this, SLOT(SetCounterMask()));
|
||||||
|
connect(chkCounter3, SIGNAL(toggled(bool)), this, SLOT(SetCounterMask()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void qTabDataOutput::SetCounterMask() {
|
||||||
|
std::vector<QCheckBox *> counters = {chkCounter1, chkCounter2, chkCounter3};
|
||||||
|
uint32_t mask = 0;
|
||||||
|
for (unsigned int i = 0; i < counters.size(); ++i) {
|
||||||
|
if (counters[i]->isChecked()) {
|
||||||
|
mask |= (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LOG(logINFO) << "Setting counter mask to " << mask;
|
||||||
|
try {
|
||||||
|
det->setCounterMask(mask);
|
||||||
|
}
|
||||||
|
CATCH_HANDLE("Could not set counter mask.",
|
||||||
|
"qTabDataOutput::SetCounterMask", this,
|
||||||
|
&qTabDataOutput::GetCounterMask)
|
||||||
|
}
|
||||||
|
|
||||||
void qTabDataOutput::Refresh() {
|
void qTabDataOutput::Refresh() {
|
||||||
LOG(logDEBUG) << "**Updating DataOutput Tab";
|
LOG(logDEBUG) << "**Updating DataOutput Tab";
|
||||||
|
|
||||||
@ -434,6 +505,9 @@ void qTabDataOutput::Refresh() {
|
|||||||
if (chkParallel->isEnabled()) {
|
if (chkParallel->isEnabled()) {
|
||||||
GetParallel();
|
GetParallel();
|
||||||
}
|
}
|
||||||
|
if (chkCounter1->isEnabled()) {
|
||||||
|
GetCounterMask();
|
||||||
|
}
|
||||||
if (comboClkDivider->isEnabled()) {
|
if (comboClkDivider->isEnabled()) {
|
||||||
GetSpeed();
|
GetSpeed();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user