mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-01 18:30:05 +02:00
Merge pull request #283 from slsdetectorgroup/j11udpate
Jungfrau features: 11. update
This commit is contained in:
commit
5c0dabbe4f
@ -101,11 +101,11 @@ def test_module_size(virtual_jf_detectors):
|
||||
|
||||
def test_settings(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
assert d.settings == detectorSettings.GAIN0
|
||||
|
||||
gain_list = [
|
||||
detectorSettings.DYNAMICHG0,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.GAIN0,
|
||||
detectorSettings.HIGHGAIN0,
|
||||
]
|
||||
|
||||
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
||||
@ -113,14 +113,14 @@ def test_settings(virtual_jf_detectors):
|
||||
d.settings = gain
|
||||
assert d.settings == gain
|
||||
|
||||
d.setSettings(detectorSettings.DYNAMICGAIN, [1])
|
||||
d.setSettings(detectorSettings.GAIN0, [1])
|
||||
assert d.settings == [
|
||||
detectorSettings.DYNAMICHG0,
|
||||
detectorSettings.DYNAMICGAIN,
|
||||
detectorSettings.GAIN0,
|
||||
detectorSettings.HIGHGAIN0,
|
||||
]
|
||||
|
||||
d.settings = detectorSettings.DYNAMICGAIN
|
||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||
d.settings = detectorSettings.GAIN0
|
||||
assert d.settings == detectorSettings.GAIN0
|
||||
|
||||
def test_frames(virtual_jf_detectors):
|
||||
d = ExperimentalDetector()
|
||||
@ -161,9 +161,12 @@ def test_gainmode(virtual_jf_detectors):
|
||||
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
|
||||
|
||||
gain_list = [
|
||||
gainMode.NORMAL_GAIN_MODE,
|
||||
gainMode.DYNAMIC_GAIN_MODE,
|
||||
gainMode.FORCE_SWITCH_G1,
|
||||
gainMode.FORCE_SWITCH_G2,
|
||||
gainMode.FIX_G1,
|
||||
gainMode.FIX_G2,
|
||||
gainMode.FIX_G0
|
||||
]
|
||||
|
||||
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
||||
@ -173,9 +176,12 @@ def test_gainmode(virtual_jf_detectors):
|
||||
|
||||
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
|
||||
assert d.gainMode == [
|
||||
gainMode.NORMAL_GAIN_MODE,
|
||||
gainMode.DYNAMIC_GAIN_MODE,
|
||||
gainMode.FORCE_SWITCH_G1,
|
||||
gainMode.FORCE_SWITCH_G2,
|
||||
gainMode.FIX_G1,
|
||||
gainMode.FIX_G2,
|
||||
gainMode.FIX_G0
|
||||
]
|
||||
|
||||
d.gainMode = gainMode.FORCE_SWITCH_G1
|
||||
|
@ -311,7 +311,7 @@ class Detector(CppDetectorApi):
|
||||
-----
|
||||
|
||||
[Eiger] Use threshold command to load settings
|
||||
[Jungfrau] DYNAMICGAIN, DYNAMICHG0 \n
|
||||
[Jungfrau] GAIN0, HIGHGAIN0 \n
|
||||
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n
|
||||
[Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2 \n
|
||||
[Moench] G1_HIGHGAIN, G1_LOWGAIN, G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN, G2_LOWCAP_LOWGAIN, G4_HIGHGAIN, G4_LOWGAIN \n
|
||||
@ -2201,8 +2201,8 @@ class Detector(CppDetectorApi):
|
||||
[Jungfrau] Detector gain mode. Enum: gainMode
|
||||
Note
|
||||
-----
|
||||
|
||||
[Jungfrau] NORMAL_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2
|
||||
[Jungfrau] DYNAMIC_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 \n
|
||||
CAUTION: Do not use FIX_G0 without caution, you can damage the detector!!!
|
||||
"""
|
||||
return element_if_equal(self.getGainMode())
|
||||
|
||||
|
@ -210,7 +210,7 @@ void init_enums(py::module &m) {
|
||||
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
||||
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
||||
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
||||
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
||||
.value("HIGHGAIN0", slsDetectorDefs::detectorSettings::HIGHGAIN0)
|
||||
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
||||
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||
@ -226,6 +226,7 @@ void init_enums(py::module &m) {
|
||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
||||
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
||||
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
||||
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
|
||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||
.value("UNINITIALIZED",
|
||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||
@ -307,8 +308,11 @@ void init_enums(py::module &m) {
|
||||
.export_values();
|
||||
|
||||
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
||||
.value("NORMAL_GAIN_MODE", slsDetectorDefs::gainMode::NORMAL_GAIN_MODE)
|
||||
.value("DYNAMIC_GAIN_MODE", slsDetectorDefs::gainMode::DYNAMIC_GAIN_MODE)
|
||||
.value("FORCE_SWITCH_G1", slsDetectorDefs::gainMode::FORCE_SWITCH_G1)
|
||||
.value("FORCE_SWITCH_G2", slsDetectorDefs::gainMode::FORCE_SWITCH_G2)
|
||||
.value("FIX_G1", slsDetectorDefs::gainMode::FIX_G1)
|
||||
.value("FIX_G2", slsDetectorDefs::gainMode::FIX_G2)
|
||||
.value("FIX_G0", slsDetectorDefs::gainMode::FIX_G0)
|
||||
.export_values();
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>775</width>
|
||||
<height>345</height>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -32,7 +32,7 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="3" column="3">
|
||||
<item row="4" column="3">
|
||||
<widget class="QCheckBox" name="chkCounter2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -51,7 +51,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4">
|
||||
<item row="4" column="4">
|
||||
<widget class="QCheckBox" name="chkCounter3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -70,7 +70,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" colspan="3">
|
||||
<item row="3" column="2" colspan="3">
|
||||
<widget class="QComboBox" name="comboDynamicRange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -109,7 +109,7 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="3">
|
||||
<item row="2" column="2" colspan="3">
|
||||
<widget class="QSpinBox" name="spinThreshold">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -146,7 +146,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="6">
|
||||
<item row="2" column="6">
|
||||
<widget class="QSpinBox" name="spinThreshold3">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -183,7 +183,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="lblDynamicRange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -205,7 +205,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="5" column="2">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -221,7 +221,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="8">
|
||||
<item row="2" column="8">
|
||||
<widget class="QPushButton" name="btnSetThreshold">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
@ -334,7 +334,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblThreshold">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -356,7 +356,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="5">
|
||||
<item row="2" column="5">
|
||||
<widget class="QSpinBox" name="spinThreshold2">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -393,7 +393,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="9">
|
||||
<item row="2" column="9">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -409,7 +409,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="lblCounter">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -431,7 +431,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="4" column="2">
|
||||
<widget class="QCheckBox" name="chkCounter1">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -514,7 +514,7 @@
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dynamic HG0</string>
|
||||
<string>High Gain 0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
@ -572,6 +572,11 @@
|
||||
<string>G4_LG</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Gain 0</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Undefined</string>
|
||||
@ -584,6 +589,86 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblGainMode">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>110</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Gain Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="comboGainMode">
|
||||
<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>140</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Gain Mode of the detector</p><p> #gainmode#</p><p><br/></p><p>Fix G0 is to be used with utmost caution. Can damage the detector!</p></body></html></string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Dynamic Gain</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Force Switch G1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Force Switch G2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fix G1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fix G2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fix G0</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
|
@ -10,9 +10,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
qTabSettings(QWidget *parent, sls::Detector *detector);
|
||||
~qTabSettings();
|
||||
void Refresh();
|
||||
public slots:
|
||||
void SetExportMode(bool exportMode);
|
||||
|
||||
private slots:
|
||||
void SetSettings(int index);
|
||||
void SetGainMode(int index);
|
||||
void SetDynamicRange(int index);
|
||||
void SetThresholdEnergy(int index);
|
||||
void SetThresholdEnergies();
|
||||
@ -21,9 +24,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
private:
|
||||
void SetupWidgetWindow();
|
||||
void SetupDetectorSettings();
|
||||
void SetupGainMode();
|
||||
void ShowFixG0(bool expertMode);
|
||||
void Initialization();
|
||||
|
||||
void GetSettings();
|
||||
void GetGainMode();
|
||||
void GetDynamicRange();
|
||||
void GetThresholdEnergy();
|
||||
void GetThresholdEnergies();
|
||||
@ -40,7 +46,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
LOWGAIN,
|
||||
MEDIUMGAIN,
|
||||
VERYHIGHGAIN,
|
||||
DYNAMICHG0,
|
||||
HIGHGAIN0,
|
||||
FIXGAIN1,
|
||||
FIXGAIN2,
|
||||
VERLOWGAIN,
|
||||
@ -52,9 +58,21 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
||||
G2_LOWCAP_LOWGAIN,
|
||||
G4_HIGHGAIN,
|
||||
G4_LOWGAIN,
|
||||
GAIN0,
|
||||
UNDEFINED,
|
||||
UNINITIALIZED,
|
||||
NUMSETTINGS
|
||||
};
|
||||
|
||||
enum {
|
||||
DYNAMIC_GAIN_MODE,
|
||||
FORCE_SWITCH_G1,
|
||||
FORCE_SWITCH_G2,
|
||||
FIX_G1,
|
||||
FIX_G2,
|
||||
FIX_G0
|
||||
};
|
||||
bool isVisibleFixG0{false};
|
||||
|
||||
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||
};
|
||||
|
@ -340,6 +340,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
||||
actionLoadTrimbits->setVisible(enable &&
|
||||
(detType == slsDetectorDefs::EIGER ||
|
||||
detType == slsDetectorDefs::MYTHEN3));
|
||||
tabSettings->SetExportMode(enable);
|
||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,9 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
comboDynamicRange->setEnabled(true);
|
||||
lblThreshold->setEnabled(true);
|
||||
spinThreshold->setEnabled(true);
|
||||
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
||||
lblGainMode->setEnabled(true);
|
||||
comboGainMode->setEnabled(true);
|
||||
}
|
||||
|
||||
// default settings for the disabled
|
||||
@ -83,19 +86,35 @@ void qTabSettings::SetupWidgetWindow() {
|
||||
spinThreshold2->setValue(-1);
|
||||
spinThreshold3->setValue(-1);
|
||||
}
|
||||
|
||||
// default for gain mode
|
||||
if (comboGainMode->isEnabled()) {
|
||||
SetupGainMode();
|
||||
}
|
||||
|
||||
Initialization();
|
||||
// default for the disabled
|
||||
GetDynamicRange();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void qTabSettings::SetExportMode(bool exportMode) {
|
||||
if (comboGainMode->isVisible()) {
|
||||
ShowFixG0(exportMode);
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::SetupDetectorSettings() {
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
|
||||
// enable only those available to detector
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||
const int numSettings = comboSettings->count();
|
||||
if (model) {
|
||||
QModelIndex index[NUMSETTINGS];
|
||||
QStandardItem *item[NUMSETTINGS];
|
||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
||||
std::vector<QModelIndex> index(numSettings);
|
||||
std::vector<QStandardItem *> item(numSettings);
|
||||
for (size_t i = 0; i < index.size(); ++i) {
|
||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||
comboSettings->rootModelIndex());
|
||||
item[i] = model->itemFromIndex(index[i]);
|
||||
@ -112,11 +131,38 @@ void qTabSettings::SetupDetectorSettings() {
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::SetupGainMode() {
|
||||
comboGainMode->setCurrentIndex(DYNAMIC_GAIN_MODE);
|
||||
ShowFixG0(false);
|
||||
}
|
||||
|
||||
void qTabSettings::ShowFixG0(bool expertMode) {
|
||||
LOG(logINFO) << (expertMode ? "Showing" : "Hiding") << " FIX_G0";
|
||||
|
||||
// enable.disable Fix G0
|
||||
QStandardItemModel *model =
|
||||
qobject_cast<QStandardItemModel *>(comboGainMode->model());
|
||||
const int numSettings = comboGainMode->count();
|
||||
if (model) {
|
||||
std::vector<QModelIndex> index(numSettings);
|
||||
std::vector<QStandardItem *> item(numSettings);
|
||||
index[FIX_G0] = model->index(FIX_G0, comboGainMode->modelColumn(),
|
||||
comboGainMode->rootModelIndex());
|
||||
item[FIX_G0] = model->itemFromIndex(index[FIX_G0]);
|
||||
item[FIX_G0]->setEnabled(expertMode);
|
||||
}
|
||||
isVisibleFixG0 = expertMode;
|
||||
}
|
||||
|
||||
void qTabSettings::Initialization() {
|
||||
// Settings
|
||||
if (comboSettings->isEnabled())
|
||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetSettings(int)));
|
||||
// Gain mode
|
||||
if (comboGainMode->isEnabled())
|
||||
connect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGainMode(int)));
|
||||
|
||||
// Dynamic Range
|
||||
if (comboDynamicRange->isEnabled())
|
||||
@ -160,7 +206,7 @@ void qTabSettings::GetSettings() {
|
||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||
break;
|
||||
default:
|
||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
||||
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
|
||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
@ -188,6 +234,60 @@ void qTabSettings::SetSettings(int index) {
|
||||
}
|
||||
}
|
||||
|
||||
void qTabSettings::GetGainMode() {
|
||||
LOG(logDEBUG) << "Getting gain mode";
|
||||
disconnect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGainMode(int)));
|
||||
try {
|
||||
auto retval = det->getGainMode().tsquash(
|
||||
"Inconsistent gain mode for all detectors.");
|
||||
if ((int)retval < 0 || (int)retval >= comboGainMode->count()) {
|
||||
throw sls::RuntimeError(std::string("Unknown gain mode: ") +
|
||||
std::to_string(retval));
|
||||
}
|
||||
// warning when using fix_g0 and not in export mode
|
||||
if ((int)retval == FIX_G0 && !isVisibleFixG0) {
|
||||
std::string message =
|
||||
"<nobr>You are not in Expert Mode and Gain Mode is in FIX_G0. "
|
||||
"</nobr><br><nobr>Could damage the detector when used without "
|
||||
"caution! </nobr>";
|
||||
qDefs::Message(qDefs::WARNING, message,
|
||||
"qTabSettings::GetGainMode");
|
||||
LOG(logWARNING) << message;
|
||||
}
|
||||
comboGainMode->setCurrentIndex((int)retval);
|
||||
}
|
||||
CATCH_DISPLAY("Could not get gain mode.", "qTabSettings::GetGainMode")
|
||||
connect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||
SLOT(SetGainMode(int)));
|
||||
}
|
||||
|
||||
void qTabSettings::SetGainMode(int index) {
|
||||
// warning for fix_G0 even in export mode
|
||||
if (index == FIX_G0) {
|
||||
if (qDefs::Message(
|
||||
qDefs::QUESTION,
|
||||
"<nobr>You are in Export mode, "
|
||||
"</nobr><br><nobr>but setting Gain Mode to FIX_G0 could "
|
||||
"damage the detector! </nobr><br><nobr>Proceed and set "
|
||||
"gainmode to FIX_G0 anyway?</nobr>",
|
||||
"qTabSettings::SetGainMode") == slsDetectorDefs::FAIL) {
|
||||
GetGainMode();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
LOG(logINFO) << "Setting Gain Mode to "
|
||||
<< comboGainMode->currentText().toAscii().data();
|
||||
auto val = static_cast<slsDetectorDefs::gainMode>(index);
|
||||
try {
|
||||
|
||||
det->setGainMode(val);
|
||||
}
|
||||
CATCH_HANDLE("Could not set gain mode.", "qTabSettings::SetGainMode", this,
|
||||
&qTabSettings::GetGainMode)
|
||||
}
|
||||
|
||||
void qTabSettings::GetDynamicRange() {
|
||||
LOG(logDEBUG) << "Getting dynamic range";
|
||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||
@ -360,6 +460,10 @@ void qTabSettings::Refresh() {
|
||||
GetSettings();
|
||||
}
|
||||
|
||||
if (comboGainMode->isEnabled()) {
|
||||
GetGainMode();
|
||||
}
|
||||
|
||||
if (comboDynamicRange->isEnabled()) {
|
||||
GetDynamicRange();
|
||||
}
|
||||
|
@ -351,6 +351,7 @@
|
||||
#define DAQ_CRRNT_SRC_CLMN_FIX_MSK (0x00000001 << DAQ_CRRNT_SRC_CLMN_FIX_OFST)
|
||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_OFST (20)
|
||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
|
||||
#define DAQ_GAIN_MODE_MASK (DAQ_FRCE_SWTCH_GAIN_MSK | DAQ_FIX_GAIN_MSK | DAQ_CMP_RST_MSK)
|
||||
|
||||
/** Chip Power Register */
|
||||
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||
|
@ -451,6 +451,7 @@ void setupDetector() {
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
setGainMode(DEFAULT_GAINMODE);
|
||||
|
||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||
@ -507,10 +508,10 @@ int resetToDefaultDacs(int hardReset) {
|
||||
// special dac: replace default value
|
||||
if (specialDacs[j] == i) {
|
||||
switch (oldSettings) {
|
||||
case DYNAMICGAIN:
|
||||
case GAIN0:
|
||||
value = defaultDacValue_G0[j];
|
||||
break;
|
||||
case DYNAMICHG0:
|
||||
case HIGHGAIN0:
|
||||
value = defaultDacValue_HG0[j];
|
||||
break;
|
||||
default:
|
||||
@ -541,10 +542,10 @@ int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||
if ((int)index == specialDacs[i]) {
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
case GAIN0:
|
||||
*retval = defaultDacValue_G0[i];
|
||||
return OK;
|
||||
case DYNAMICHG0:
|
||||
case HIGHGAIN0:
|
||||
*retval = defaultDacValue_HG0[i];
|
||||
return OK;
|
||||
// unknown settings
|
||||
@ -573,15 +574,14 @@ int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||
if ((int)index == specialDacs[i]) {
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
LOG(logINFO,
|
||||
("Setting Default Dac [%d - %s, dynamicgain]: %d\n",
|
||||
case GAIN0:
|
||||
LOG(logINFO, ("Setting Default Dac [%d - %s, gain0]: %d\n",
|
||||
(int)index, dac_names[index], value));
|
||||
defaultDacValue_G0[i] = value;
|
||||
return OK;
|
||||
case DYNAMICHG0:
|
||||
case HIGHGAIN0:
|
||||
LOG(logINFO,
|
||||
("Setting Default Dac [%d - %s, dynamichg0]: %d\n",
|
||||
("Setting Default Dac [%d - %s, highgain0]: %d\n",
|
||||
(int)index, dac_names[index], value));
|
||||
defaultDacValue_HG0[i] = value;
|
||||
return OK;
|
||||
@ -793,6 +793,11 @@ int selectStoragecellStart(int pos) {
|
||||
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
||||
bus_w(addr, bus_r(addr) & ~mask);
|
||||
bus_w(addr, bus_r(addr) | ((value << offset) & mask));
|
||||
// should not do a get to verify (status register does not update
|
||||
// immediately during acquisition)
|
||||
if (getChipVersion() == 11) {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
|
||||
// read value back
|
||||
@ -1045,16 +1050,16 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
int *dacVals = NULL;
|
||||
// set settings
|
||||
switch (sett) {
|
||||
case DYNAMICGAIN:
|
||||
case GAIN0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_HIGH_GAIN_MSK);
|
||||
LOG(logINFO,
|
||||
("Set settings - Dyanmic Gain [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
("Set settings - Gain 0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
dacVals = defaultDacValue_G0;
|
||||
break;
|
||||
case DYNAMICHG0:
|
||||
case HIGHGAIN0:
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_HIGH_GAIN_MSK);
|
||||
LOG(logINFO, ("Set settings - Dyanmic High Gain 0 [DAQ Reg:0x%x]\n",
|
||||
bus_r(DAQ_REG)));
|
||||
LOG(logINFO,
|
||||
("Set settings - High Gain 0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
dacVals = defaultDacValue_HG0;
|
||||
break;
|
||||
default:
|
||||
@ -1075,61 +1080,56 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
configureChip();
|
||||
}
|
||||
|
||||
return thisSettings;
|
||||
return getSettings();
|
||||
}
|
||||
|
||||
void validateSettings() {
|
||||
// if any special dac value is changed individually => undefined
|
||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||
int *specialDacValues[] = {defaultDacValue_G0, defaultDacValue_HG0};
|
||||
int settList[] = {DYNAMICGAIN, DYNAMICHG0};
|
||||
enum detectorSettings sett = UNDEFINED;
|
||||
for (int isett = 0; isett != NUMSETTINGS; ++isett) {
|
||||
|
||||
// assume it matches current setting in list
|
||||
sett = settList[isett];
|
||||
// if one value does not match, = undefined
|
||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||
if (getDAC(specialDacs[i], 0) != specialDacValues[isett][i]) {
|
||||
sett = UNDEFINED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// all values matchd a setting
|
||||
if (sett != UNDEFINED) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// update settings
|
||||
if (thisSettings != sett) {
|
||||
LOG(logINFOBLUE,
|
||||
("Validated settings to %s (%d)\n",
|
||||
(sett == DYNAMICGAIN
|
||||
? "dynamicgain"
|
||||
: (sett == DYNAMICHG0 ? "dynamichg0" : "undefined")),
|
||||
sett));
|
||||
thisSettings = sett;
|
||||
}
|
||||
enum detectorSettings getSettings() {
|
||||
if (bus_r(DAQ_REG) & DAQ_HIGH_GAIN_MSK)
|
||||
return HIGHGAIN0;
|
||||
return GAIN0;
|
||||
}
|
||||
|
||||
enum detectorSettings getSettings() { return thisSettings; }
|
||||
|
||||
enum gainMode getGainMode() {
|
||||
uint32_t retval = bus_r(DAQ_REG) & DAQ_FRCE_SWTCH_GAIN_MSK;
|
||||
uint32_t regval = bus_r(DAQ_REG);
|
||||
uint32_t retval_force = regval & DAQ_FRCE_SWTCH_GAIN_MSK;
|
||||
uint32_t retval_fix = regval & DAQ_FIX_GAIN_MSK;
|
||||
uint32_t retval_cmp_rst = regval & DAQ_CMP_RST_MSK;
|
||||
|
||||
switch (retval) {
|
||||
case DAQ_FRCE_GAIN_STG_0_VAL:
|
||||
return NORMAL_GAIN_MODE;
|
||||
// only one set should be valid
|
||||
if ((retval_force && retval_fix) || (retval_fix && retval_cmp_rst) ||
|
||||
(retval_force && retval_cmp_rst)) {
|
||||
LOG(logERROR, ("undefined gain mode. DAQ reg: 0x%x\n", regval));
|
||||
}
|
||||
|
||||
// dynamic gain, when nothing is set
|
||||
if (retval_force == 0 && retval_fix == 0 && retval_cmp_rst == 0) {
|
||||
return DYNAMIC_GAIN_MODE;
|
||||
}
|
||||
|
||||
switch (retval_force) {
|
||||
case DAQ_FRCE_GAIN_STG_1_VAL:
|
||||
return FORCE_SWITCH_G1;
|
||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
||||
return FORCE_SWITCH_G2;
|
||||
default:
|
||||
LOG(logERROR, ("This gain mode %d is not defined [DAQ reg: %d]\n",
|
||||
(retval << DAQ_FRCE_SWTCH_GAIN_OFST), retval));
|
||||
return -1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (retval_fix) {
|
||||
case DAQ_FIX_GAIN_STG_1_VAL:
|
||||
return FIX_G1;
|
||||
case DAQ_FIX_GAIN_STG_2_VAL:
|
||||
return FIX_G2;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (retval_cmp_rst) {
|
||||
return FIX_G0;
|
||||
}
|
||||
|
||||
LOG(logERROR, ("This gain mode is undefined [DAQ reg: %d]\n", regval));
|
||||
return -1;
|
||||
}
|
||||
|
||||
void setGainMode(enum gainMode mode) {
|
||||
@ -1137,26 +1137,47 @@ void setGainMode(enum gainMode mode) {
|
||||
uint32_t value = bus_r(addr);
|
||||
|
||||
switch (mode) {
|
||||
case NORMAL_GAIN_MODE:
|
||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
||||
case DYNAMIC_GAIN_MODE:
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO, ("Set gain mode - Normal Gain Mode [DAQ Reg:0x%x]\n",
|
||||
bus_r(DAQ_REG)));
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Dynamic Gain [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FORCE_SWITCH_G1:
|
||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
value |= DAQ_FRCE_GAIN_STG_1_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO, ("Set gain mode - Force Switch G1 [DAQ Reg:0x%x]\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FORCE_SWITCH_G2:
|
||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
value |= DAQ_FRCE_GAIN_STG_2_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO, ("Set gain mode - Force Switch G2 [DAQ Reg:0x%x]\n",
|
||||
bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIX_G1:
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
value |= DAQ_FIX_GAIN_STG_1_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Fix G1 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIX_G2:
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
value |= DAQ_FIX_GAIN_STG_2_VAL;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Fix G2 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
case FIX_G0:
|
||||
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||
value |= DAQ_CMP_RST_MSK;
|
||||
bus_w(addr, value);
|
||||
LOG(logINFO,
|
||||
("Set gain mode - Fix G0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||
break;
|
||||
default:
|
||||
LOG(logERROR, ("This gain mode %d is not defined\n", (int)mode));
|
||||
}
|
||||
@ -1193,12 +1214,6 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||
if ((int)ind == specialDacs[i]) {
|
||||
validateSettings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getDAC(enum DACINDEX ind, int mV) {
|
||||
|
@ -97,7 +97,8 @@ enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||
#define DEFAULT_DELAY (0)
|
||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||
#define DEFAULT_SETTINGS (GAIN0)
|
||||
#define DEFAULT_GAINMODE (DYNAMIC_GAIN_MODE)
|
||||
#define DEFAULT_TX_UDP_PORT (0x7e9a)
|
||||
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
||||
#define DEFAULT_NUM_STRG_CLLS (0)
|
||||
|
@ -297,9 +297,6 @@ int getAllTrimbits();
|
||||
#ifndef CHIPTESTBOARDD
|
||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||
#endif
|
||||
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
||||
void validateSettings();
|
||||
#endif
|
||||
enum detectorSettings getSettings();
|
||||
#ifdef JUNGFRAUD
|
||||
enum gainMode getGainMode();
|
||||
|
@ -1561,8 +1561,8 @@ void validate_settings(enum detectorSettings sett) {
|
||||
#ifdef EIGERD
|
||||
case STANDARD:
|
||||
#elif JUNGFRAUD
|
||||
case DYNAMICGAIN:
|
||||
case DYNAMICHG0:
|
||||
case GAIN0:
|
||||
case HIGHGAIN0:
|
||||
#elif GOTTHARDD
|
||||
case DYNAMICGAIN:
|
||||
case HIGHGAIN:
|
||||
@ -8560,7 +8560,7 @@ int set_default_dac(int file_des) {
|
||||
int get_gain_mode(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
enum gainMode retval = NORMAL_GAIN_MODE;
|
||||
enum gainMode retval = DYNAMIC_GAIN_MODE;
|
||||
LOG(logDEBUG1, ("Getting gain mode\n"));
|
||||
|
||||
#ifndef JUNGFRAUD
|
||||
@ -8593,9 +8593,12 @@ int set_gain_mode(int file_des) {
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
switch (gainmode) {
|
||||
case NORMAL_GAIN_MODE:
|
||||
case DYNAMIC_GAIN_MODE:
|
||||
case FORCE_SWITCH_G1:
|
||||
case FORCE_SWITCH_G2:
|
||||
case FIX_G1:
|
||||
case FIX_G2:
|
||||
case FIX_G0:
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Gain Mode Index", (int)gainmode);
|
||||
|
@ -113,7 +113,7 @@ class Detector {
|
||||
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
|
||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||
/** [Jungfrau] GAIN0, HIGHGAIN0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
|
||||
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||
@ -1179,7 +1179,9 @@ class Detector {
|
||||
/** [Jungfrau]*/
|
||||
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
|
||||
|
||||
/** [Jungfrau] Options: NORMAL_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2\n
|
||||
/** [Jungfrau] Options: DYNAMIC_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2,
|
||||
* FIX_G1, FIX_G2, FIX_G0 \n\CAUTION: Do not use FIX_G0 without caution, you
|
||||
* can damage the detector!!!\n
|
||||
*/
|
||||
void setGainMode(const defs::gainMode mode, Positions pos = {});
|
||||
|
||||
|
@ -1203,12 +1203,12 @@ class CmdProxy {
|
||||
settings, getSettings, setSettings,
|
||||
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||
"[standard, fast, highgain, dynamicgain, lowgain, "
|
||||
"mediumgain, veryhighgain, dynamichg0, "
|
||||
"mediumgain, veryhighgain, highgain0, "
|
||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
||||
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
|
||||
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg]"
|
||||
"g2_lc_hg, g2_lc_lg, g4_hg, g4_lg, gain0]"
|
||||
"\n\t Detector Settings"
|
||||
"\n\t[Jungfrau] - [dynamicgain | dynamichg0]"
|
||||
"\n\t[Jungfrau] - [ gain0 | highgain0]"
|
||||
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
|
||||
"mediumgain | veryhighgain]"
|
||||
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
|
||||
@ -1877,7 +1877,10 @@ class CmdProxy {
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
gainmode, getGainMode, setGainMode,
|
||||
sls::StringTo<slsDetectorDefs::gainMode>,
|
||||
"[forceswitchg1, forceswitchg2]\n\t[Jungfrau] Gain mode.");
|
||||
"[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t["
|
||||
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, "
|
||||
"you can "
|
||||
"damage the detector!!!");
|
||||
|
||||
/* Gotthard Specific */
|
||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
||||
|
@ -158,12 +158,11 @@ std::vector<defs::detectorSettings> Detector::getSettingsList() const {
|
||||
defs::HIGHGAIN, defs::DYNAMICGAIN, defs::LOWGAIN, defs::MEDIUMGAIN,
|
||||
defs::VERYHIGHGAIN};
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::detectorSettings>{defs::DYNAMICGAIN,
|
||||
defs::DYNAMICHG0};
|
||||
return std::vector<defs::detectorSettings>{defs::GAIN0,
|
||||
defs::HIGHGAIN0};
|
||||
case defs::GOTTHARD2:
|
||||
return std::vector<defs::detectorSettings>{
|
||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
||||
defs::FIXGAIN2};
|
||||
defs::DYNAMICGAIN, defs::FIXGAIN1, defs::FIXGAIN2};
|
||||
case defs::MOENCH:
|
||||
return std::vector<defs::detectorSettings>{
|
||||
defs::G1_HIGHGAIN, defs::G1_LOWGAIN,
|
||||
@ -1494,9 +1493,12 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::JUNGFRAU:
|
||||
return std::vector<defs::gainMode>{defs::NORMAL_GAIN_MODE,
|
||||
return std::vector<defs::gainMode>{defs::DYNAMIC_GAIN_MODE,
|
||||
defs::FORCE_SWITCH_G1,
|
||||
defs::FORCE_SWITCH_G2};
|
||||
defs::FORCE_SWITCH_G2,
|
||||
defs::FIX_G1,
|
||||
defs::FIX_G2,
|
||||
defs::FIX_G0};
|
||||
break;
|
||||
default:
|
||||
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||
|
@ -456,6 +456,11 @@ TEST_CASE("gainmode", "[.cmd]") {
|
||||
proxy.Call("gainmode", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"dynamicgain"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode dynamicgain\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
|
||||
@ -463,8 +468,18 @@ TEST_CASE("gainmode", "[.cmd]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"normal"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode normal\n");
|
||||
proxy.Call("gainmode", {"fixg1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode fixg1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"fixg2"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode fixg2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("gainmode", {"fixg0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "gainmode fixg0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setGainMode(prev_val[i], {i});
|
||||
|
@ -150,7 +150,7 @@ TEST_CASE("settings", "[.cmd]") {
|
||||
allSett.push_back("lowgain");
|
||||
allSett.push_back("mediumgain");
|
||||
allSett.push_back("veryhighgain");
|
||||
allSett.push_back("dynamichg0");
|
||||
allSett.push_back("highgain0");
|
||||
allSett.push_back("fixgain1");
|
||||
allSett.push_back("fixgain2");
|
||||
allSett.push_back("verylowgain");
|
||||
@ -164,12 +164,13 @@ TEST_CASE("settings", "[.cmd]") {
|
||||
allSett.push_back("g4_lg");
|
||||
allSett.push_back("forceswitchg1");
|
||||
allSett.push_back("forceswitchg2");
|
||||
allSett.push_back("gain0");
|
||||
|
||||
std::vector<std::string> sett;
|
||||
switch (det_type) {
|
||||
case defs::JUNGFRAU:
|
||||
sett.push_back("dynamicgain");
|
||||
sett.push_back("dynamichg0");
|
||||
sett.push_back("gain0");
|
||||
sett.push_back("highgain0");
|
||||
break;
|
||||
case defs::GOTTHARD:
|
||||
sett.push_back("highgain");
|
||||
|
@ -345,7 +345,7 @@ typedef struct {
|
||||
LOWGAIN,
|
||||
MEDIUMGAIN,
|
||||
VERYHIGHGAIN,
|
||||
DYNAMICHG0,
|
||||
HIGHGAIN0,
|
||||
FIXGAIN1,
|
||||
FIXGAIN2,
|
||||
VERYLOWGAIN,
|
||||
@ -357,6 +357,7 @@ typedef struct {
|
||||
G2_LOWCAP_LOWGAIN,
|
||||
G4_HIGHGAIN,
|
||||
G4_LOWGAIN,
|
||||
GAIN0,
|
||||
UNDEFINED = 200,
|
||||
UNINITIALIZED
|
||||
};
|
||||
@ -414,7 +415,14 @@ typedef struct {
|
||||
|
||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||
|
||||
enum gainMode { NORMAL_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2 };
|
||||
enum gainMode {
|
||||
DYNAMIC_GAIN_MODE,
|
||||
FORCE_SWITCH_G1,
|
||||
FORCE_SWITCH_G2,
|
||||
FIX_G1,
|
||||
FIX_G2,
|
||||
FIX_G0
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
@ -170,8 +170,8 @@ std::string ToString(const defs::detectorSettings s) {
|
||||
return std::string("mediumgain");
|
||||
case defs::VERYHIGHGAIN:
|
||||
return std::string("veryhighgain");
|
||||
case defs::DYNAMICHG0:
|
||||
return std::string("dynamichg0");
|
||||
case defs::HIGHGAIN0:
|
||||
return std::string("highgain0");
|
||||
case defs::FIXGAIN1:
|
||||
return std::string("fixgain1");
|
||||
case defs::FIXGAIN2:
|
||||
@ -194,6 +194,8 @@ std::string ToString(const defs::detectorSettings s) {
|
||||
return std::string("g4_hg");
|
||||
case defs::G4_LOWGAIN:
|
||||
return std::string("g4_lg");
|
||||
case defs::GAIN0:
|
||||
return std::string("gain0");
|
||||
case defs::UNDEFINED:
|
||||
return std::string("undefined");
|
||||
case defs::UNINITIALIZED:
|
||||
@ -581,12 +583,18 @@ std::string ToString(const defs::vetoAlgorithm s) {
|
||||
|
||||
std::string ToString(const defs::gainMode s) {
|
||||
switch (s) {
|
||||
case defs::NORMAL_GAIN_MODE:
|
||||
return std::string("normal");
|
||||
case defs::DYNAMIC_GAIN_MODE:
|
||||
return std::string("dynamicgain");
|
||||
case defs::FORCE_SWITCH_G1:
|
||||
return std::string("forceswitchg1");
|
||||
case defs::FORCE_SWITCH_G2:
|
||||
return std::string("forceswitchg2");
|
||||
case defs::FIX_G1:
|
||||
return std::string("fixg1");
|
||||
case defs::FIX_G2:
|
||||
return std::string("fixg2");
|
||||
case defs::FIX_G0:
|
||||
return std::string("fixg0");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
@ -627,8 +635,8 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
||||
return defs::MEDIUMGAIN;
|
||||
if (s == "veryhighgain")
|
||||
return defs::VERYHIGHGAIN;
|
||||
if (s == "dynamichg0")
|
||||
return defs::DYNAMICHG0;
|
||||
if (s == "highgain0")
|
||||
return defs::HIGHGAIN0;
|
||||
if (s == "fixgain1")
|
||||
return defs::FIXGAIN1;
|
||||
if (s == "fixgain2")
|
||||
@ -649,6 +657,8 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
||||
return defs::G2_LOWCAP_LOWGAIN;
|
||||
if (s == "g4_hg")
|
||||
return defs::G4_HIGHGAIN;
|
||||
if (s == "gain0")
|
||||
return defs::GAIN0;
|
||||
if (s == "g4_lg")
|
||||
return defs::G4_LOWGAIN;
|
||||
throw sls::RuntimeError("Unknown setting " + s);
|
||||
@ -976,12 +986,18 @@ template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
||||
}
|
||||
|
||||
template <> defs::gainMode StringTo(const std::string &s) {
|
||||
if (s == "normal")
|
||||
return defs::NORMAL_GAIN_MODE;
|
||||
if (s == "dynamicgain")
|
||||
return defs::DYNAMIC_GAIN_MODE;
|
||||
if (s == "forceswitchg1")
|
||||
return defs::FORCE_SWITCH_G1;
|
||||
if (s == "forceswitchg2")
|
||||
return defs::FORCE_SWITCH_G2;
|
||||
if (s == "fixg1")
|
||||
return defs::FIX_G1;
|
||||
if (s == "fixg2")
|
||||
return defs::FIX_G2;
|
||||
if (s == "fixg0")
|
||||
return defs::FIX_G0;
|
||||
throw sls::RuntimeError("Unknown gain mode " + s);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user