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):
|
def test_settings(virtual_jf_detectors):
|
||||||
d = ExperimentalDetector()
|
d = ExperimentalDetector()
|
||||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
assert d.settings == detectorSettings.GAIN0
|
||||||
|
|
||||||
gain_list = [
|
gain_list = [
|
||||||
detectorSettings.DYNAMICHG0,
|
detectorSettings.GAIN0,
|
||||||
detectorSettings.DYNAMICGAIN,
|
detectorSettings.HIGHGAIN0,
|
||||||
]
|
]
|
||||||
|
|
||||||
# Set all viable gain for Jungfrau to make sure nothing is crashing
|
# 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
|
d.settings = gain
|
||||||
assert d.settings == gain
|
assert d.settings == gain
|
||||||
|
|
||||||
d.setSettings(detectorSettings.DYNAMICGAIN, [1])
|
d.setSettings(detectorSettings.GAIN0, [1])
|
||||||
assert d.settings == [
|
assert d.settings == [
|
||||||
detectorSettings.DYNAMICHG0,
|
detectorSettings.GAIN0,
|
||||||
detectorSettings.DYNAMICGAIN,
|
detectorSettings.HIGHGAIN0,
|
||||||
]
|
]
|
||||||
|
|
||||||
d.settings = detectorSettings.DYNAMICGAIN
|
d.settings = detectorSettings.GAIN0
|
||||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
assert d.settings == detectorSettings.GAIN0
|
||||||
|
|
||||||
def test_frames(virtual_jf_detectors):
|
def test_frames(virtual_jf_detectors):
|
||||||
d = ExperimentalDetector()
|
d = ExperimentalDetector()
|
||||||
@ -161,9 +161,12 @@ def test_gainmode(virtual_jf_detectors):
|
|||||||
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
|
assert d.gainMode == gainMode.NORMAL_GAIN_MODE
|
||||||
|
|
||||||
gain_list = [
|
gain_list = [
|
||||||
gainMode.NORMAL_GAIN_MODE,
|
gainMode.DYNAMIC_GAIN_MODE,
|
||||||
gainMode.FORCE_SWITCH_G1,
|
gainMode.FORCE_SWITCH_G1,
|
||||||
gainMode.FORCE_SWITCH_G2,
|
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
|
# 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])
|
d.setGainMode(gainMode.FORCE_SWITCH_G1, [1])
|
||||||
assert d.gainMode == [
|
assert d.gainMode == [
|
||||||
gainMode.NORMAL_GAIN_MODE,
|
gainMode.DYNAMIC_GAIN_MODE,
|
||||||
gainMode.FORCE_SWITCH_G1,
|
gainMode.FORCE_SWITCH_G1,
|
||||||
gainMode.FORCE_SWITCH_G2,
|
gainMode.FORCE_SWITCH_G2,
|
||||||
|
gainMode.FIX_G1,
|
||||||
|
gainMode.FIX_G2,
|
||||||
|
gainMode.FIX_G0
|
||||||
]
|
]
|
||||||
|
|
||||||
d.gainMode = gainMode.FORCE_SWITCH_G1
|
d.gainMode = gainMode.FORCE_SWITCH_G1
|
||||||
|
@ -311,7 +311,7 @@ class Detector(CppDetectorApi):
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
[Eiger] Use threshold command to load settings
|
[Eiger] Use threshold command to load settings
|
||||||
[Jungfrau] DYNAMICGAIN, DYNAMICHG0 \n
|
[Jungfrau] GAIN0, HIGHGAIN0 \n
|
||||||
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n
|
[Gotthard] DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n
|
||||||
[Gotthard2] DYNAMICGAIN, FIXGAIN1, FIXGAIN2 \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
|
[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
|
[Jungfrau] Detector gain mode. Enum: gainMode
|
||||||
Note
|
Note
|
||||||
-----
|
-----
|
||||||
|
[Jungfrau] DYNAMIC_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2, FIX_G1, FIX_G2, FIX_G0 \n
|
||||||
[Jungfrau] NORMAL_GAIN_MODE, FORCE_SWITCH_G1, FORCE_SWITCH_G2
|
CAUTION: Do not use FIX_G0 without caution, you can damage the detector!!!
|
||||||
"""
|
"""
|
||||||
return element_if_equal(self.getGainMode())
|
return element_if_equal(self.getGainMode())
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ void init_enums(py::module &m) {
|
|||||||
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
.value("LOWGAIN", slsDetectorDefs::detectorSettings::LOWGAIN)
|
||||||
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
.value("MEDIUMGAIN", slsDetectorDefs::detectorSettings::MEDIUMGAIN)
|
||||||
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
.value("VERYHIGHGAIN", slsDetectorDefs::detectorSettings::VERYHIGHGAIN)
|
||||||
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
.value("HIGHGAIN0", slsDetectorDefs::detectorSettings::HIGHGAIN0)
|
||||||
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
||||||
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
||||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||||
@ -226,6 +226,7 @@ void init_enums(py::module &m) {
|
|||||||
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
slsDetectorDefs::detectorSettings::G2_LOWCAP_LOWGAIN)
|
||||||
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
.value("G4_HIGHGAIN", slsDetectorDefs::detectorSettings::G4_HIGHGAIN)
|
||||||
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
.value("G4_LOWGAIN", slsDetectorDefs::detectorSettings::G4_LOWGAIN)
|
||||||
|
.value("GAIN0", slsDetectorDefs::detectorSettings::GAIN0)
|
||||||
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
.value("UNDEFINED", slsDetectorDefs::detectorSettings::UNDEFINED)
|
||||||
.value("UNINITIALIZED",
|
.value("UNINITIALIZED",
|
||||||
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
slsDetectorDefs::detectorSettings::UNINITIALIZED)
|
||||||
@ -307,8 +308,11 @@ void init_enums(py::module &m) {
|
|||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::gainMode>(Defs, "gainMode")
|
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_G1", slsDetectorDefs::gainMode::FORCE_SWITCH_G1)
|
||||||
.value("FORCE_SWITCH_G2", slsDetectorDefs::gainMode::FORCE_SWITCH_G2)
|
.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();
|
.export_values();
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>775</width>
|
<width>775</width>
|
||||||
<height>345</height>
|
<height>380</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -32,7 +32,7 @@
|
|||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="3" column="3">
|
<item row="4" column="3">
|
||||||
<widget class="QCheckBox" name="chkCounter2">
|
<widget class="QCheckBox" name="chkCounter2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="4">
|
<item row="4" column="4">
|
||||||
<widget class="QCheckBox" name="chkCounter3">
|
<widget class="QCheckBox" name="chkCounter3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="3">
|
<item row="3" column="2" colspan="3">
|
||||||
<widget class="QComboBox" name="comboDynamicRange">
|
<widget class="QComboBox" name="comboDynamicRange">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -109,7 +109,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" colspan="3">
|
<item row="2" column="2" colspan="3">
|
||||||
<widget class="QSpinBox" name="spinThreshold">
|
<widget class="QSpinBox" name="spinThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -146,7 +146,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="6">
|
<item row="2" column="6">
|
||||||
<widget class="QSpinBox" name="spinThreshold3">
|
<widget class="QSpinBox" name="spinThreshold3">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -183,7 +183,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="lblDynamicRange">
|
<widget class="QLabel" name="lblDynamicRange">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -205,7 +205,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="5" column="2">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
@ -221,7 +221,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="8">
|
<item row="2" column="8">
|
||||||
<widget class="QPushButton" name="btnSetThreshold">
|
<widget class="QPushButton" name="btnSetThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
@ -334,7 +334,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="lblThreshold">
|
<widget class="QLabel" name="lblThreshold">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -356,7 +356,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="5">
|
<item row="2" column="5">
|
||||||
<widget class="QSpinBox" name="spinThreshold2">
|
<widget class="QSpinBox" name="spinThreshold2">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -393,7 +393,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="9">
|
<item row="2" column="9">
|
||||||
<spacer name="horizontalSpacer_2">
|
<spacer name="horizontalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
@ -409,7 +409,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="lblCounter">
|
<widget class="QLabel" name="lblCounter">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -431,7 +431,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QCheckBox" name="chkCounter1">
|
<widget class="QCheckBox" name="chkCounter1">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -514,7 +514,7 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Dynamic HG0</string>
|
<string>High Gain 0</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -572,6 +572,11 @@
|
|||||||
<string>G4_LG</string>
|
<string>G4_LG</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Gain 0</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Undefined</string>
|
<string>Undefined</string>
|
||||||
@ -584,6 +589,86 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
|
@ -10,9 +10,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
qTabSettings(QWidget *parent, sls::Detector *detector);
|
qTabSettings(QWidget *parent, sls::Detector *detector);
|
||||||
~qTabSettings();
|
~qTabSettings();
|
||||||
void Refresh();
|
void Refresh();
|
||||||
|
public slots:
|
||||||
|
void SetExportMode(bool exportMode);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void SetSettings(int index);
|
void SetSettings(int index);
|
||||||
|
void SetGainMode(int index);
|
||||||
void SetDynamicRange(int index);
|
void SetDynamicRange(int index);
|
||||||
void SetThresholdEnergy(int index);
|
void SetThresholdEnergy(int index);
|
||||||
void SetThresholdEnergies();
|
void SetThresholdEnergies();
|
||||||
@ -21,9 +24,12 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
private:
|
private:
|
||||||
void SetupWidgetWindow();
|
void SetupWidgetWindow();
|
||||||
void SetupDetectorSettings();
|
void SetupDetectorSettings();
|
||||||
|
void SetupGainMode();
|
||||||
|
void ShowFixG0(bool expertMode);
|
||||||
void Initialization();
|
void Initialization();
|
||||||
|
|
||||||
void GetSettings();
|
void GetSettings();
|
||||||
|
void GetGainMode();
|
||||||
void GetDynamicRange();
|
void GetDynamicRange();
|
||||||
void GetThresholdEnergy();
|
void GetThresholdEnergy();
|
||||||
void GetThresholdEnergies();
|
void GetThresholdEnergies();
|
||||||
@ -40,7 +46,7 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
LOWGAIN,
|
LOWGAIN,
|
||||||
MEDIUMGAIN,
|
MEDIUMGAIN,
|
||||||
VERYHIGHGAIN,
|
VERYHIGHGAIN,
|
||||||
DYNAMICHG0,
|
HIGHGAIN0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
VERLOWGAIN,
|
VERLOWGAIN,
|
||||||
@ -52,9 +58,21 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
G2_LOWCAP_LOWGAIN,
|
G2_LOWCAP_LOWGAIN,
|
||||||
G4_HIGHGAIN,
|
G4_HIGHGAIN,
|
||||||
G4_LOWGAIN,
|
G4_LOWGAIN,
|
||||||
|
GAIN0,
|
||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
UNINITIALIZED,
|
UNINITIALIZED,
|
||||||
NUMSETTINGS
|
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 };
|
enum { DYNAMICRANGE_32, DYNAMICRANGE_16, DYNAMICRANGE_8, DYNAMICRANGE_4 };
|
||||||
};
|
};
|
||||||
|
@ -340,6 +340,7 @@ void qDetectorMain::EnableModes(QAction *action) {
|
|||||||
actionLoadTrimbits->setVisible(enable &&
|
actionLoadTrimbits->setVisible(enable &&
|
||||||
(detType == slsDetectorDefs::EIGER ||
|
(detType == slsDetectorDefs::EIGER ||
|
||||||
detType == slsDetectorDefs::MYTHEN3));
|
detType == slsDetectorDefs::MYTHEN3));
|
||||||
|
tabSettings->SetExportMode(enable);
|
||||||
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
LOG(logINFO) << "Expert Mode: " << qDefs::stringEnable(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,6 +71,9 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
comboDynamicRange->setEnabled(true);
|
comboDynamicRange->setEnabled(true);
|
||||||
lblThreshold->setEnabled(true);
|
lblThreshold->setEnabled(true);
|
||||||
spinThreshold->setEnabled(true);
|
spinThreshold->setEnabled(true);
|
||||||
|
} else if (detType == slsDetectorDefs::JUNGFRAU) {
|
||||||
|
lblGainMode->setEnabled(true);
|
||||||
|
comboGainMode->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// default settings for the disabled
|
// default settings for the disabled
|
||||||
@ -83,19 +86,35 @@ void qTabSettings::SetupWidgetWindow() {
|
|||||||
spinThreshold2->setValue(-1);
|
spinThreshold2->setValue(-1);
|
||||||
spinThreshold3->setValue(-1);
|
spinThreshold3->setValue(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default for gain mode
|
||||||
|
if (comboGainMode->isEnabled()) {
|
||||||
|
SetupGainMode();
|
||||||
|
}
|
||||||
|
|
||||||
Initialization();
|
Initialization();
|
||||||
// default for the disabled
|
// default for the disabled
|
||||||
GetDynamicRange();
|
GetDynamicRange();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qTabSettings::SetExportMode(bool exportMode) {
|
||||||
|
if (comboGainMode->isVisible()) {
|
||||||
|
ShowFixG0(exportMode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void qTabSettings::SetupDetectorSettings() {
|
void qTabSettings::SetupDetectorSettings() {
|
||||||
|
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||||
|
|
||||||
|
// enable only those available to detector
|
||||||
QStandardItemModel *model =
|
QStandardItemModel *model =
|
||||||
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
qobject_cast<QStandardItemModel *>(comboSettings->model());
|
||||||
|
const int numSettings = comboSettings->count();
|
||||||
if (model) {
|
if (model) {
|
||||||
QModelIndex index[NUMSETTINGS];
|
std::vector<QModelIndex> index(numSettings);
|
||||||
QStandardItem *item[NUMSETTINGS];
|
std::vector<QStandardItem *> item(numSettings);
|
||||||
for (int i = 0; i < NUMSETTINGS; ++i) {
|
for (size_t i = 0; i < index.size(); ++i) {
|
||||||
index[i] = model->index(i, comboSettings->modelColumn(),
|
index[i] = model->index(i, comboSettings->modelColumn(),
|
||||||
comboSettings->rootModelIndex());
|
comboSettings->rootModelIndex());
|
||||||
item[i] = model->itemFromIndex(index[i]);
|
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() {
|
void qTabSettings::Initialization() {
|
||||||
// Settings
|
// Settings
|
||||||
if (comboSettings->isEnabled())
|
if (comboSettings->isEnabled())
|
||||||
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
connect(comboSettings, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(SetSettings(int)));
|
SLOT(SetSettings(int)));
|
||||||
|
// Gain mode
|
||||||
|
if (comboGainMode->isEnabled())
|
||||||
|
connect(comboGainMode, SIGNAL(currentIndexChanged(int)), this,
|
||||||
|
SLOT(SetGainMode(int)));
|
||||||
|
|
||||||
// Dynamic Range
|
// Dynamic Range
|
||||||
if (comboDynamicRange->isEnabled())
|
if (comboDynamicRange->isEnabled())
|
||||||
@ -160,7 +206,7 @@ void qTabSettings::GetSettings() {
|
|||||||
comboSettings->setCurrentIndex(UNINITIALIZED);
|
comboSettings->setCurrentIndex(UNINITIALIZED);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if ((int)retval < -1 || (int)retval >= NUMSETTINGS) {
|
if ((int)retval < -1 || (int)retval >= comboSettings->count()) {
|
||||||
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
throw sls::RuntimeError(std::string("Unknown settings: ") +
|
||||||
std::to_string(retval));
|
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() {
|
void qTabSettings::GetDynamicRange() {
|
||||||
LOG(logDEBUG) << "Getting dynamic range";
|
LOG(logDEBUG) << "Getting dynamic range";
|
||||||
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
disconnect(comboDynamicRange, SIGNAL(activated(int)), this,
|
||||||
@ -360,6 +460,10 @@ void qTabSettings::Refresh() {
|
|||||||
GetSettings();
|
GetSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (comboGainMode->isEnabled()) {
|
||||||
|
GetGainMode();
|
||||||
|
}
|
||||||
|
|
||||||
if (comboDynamicRange->isEnabled()) {
|
if (comboDynamicRange->isEnabled()) {
|
||||||
GetDynamicRange();
|
GetDynamicRange();
|
||||||
}
|
}
|
||||||
|
@ -351,6 +351,7 @@
|
|||||||
#define DAQ_CRRNT_SRC_CLMN_FIX_MSK (0x00000001 << DAQ_CRRNT_SRC_CLMN_FIX_OFST)
|
#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_OFST (20)
|
||||||
#define DAQ_CRRNT_SRC_CLMN_SLCT_MSK (0x0000003F << DAQ_CRRNT_SRC_CLMN_SLCT_OFST)
|
#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 */
|
/** Chip Power Register */
|
||||||
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
#define CHIP_POWER_REG (0x5E << MEM_MAP_SHIFT)
|
||||||
|
@ -451,6 +451,7 @@ void setupDetector() {
|
|||||||
|
|
||||||
// Initialization of acquistion parameters
|
// Initialization of acquistion parameters
|
||||||
setSettings(DEFAULT_SETTINGS);
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
setGainMode(DEFAULT_GAINMODE);
|
||||||
|
|
||||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||||
@ -507,10 +508,10 @@ int resetToDefaultDacs(int hardReset) {
|
|||||||
// special dac: replace default value
|
// special dac: replace default value
|
||||||
if (specialDacs[j] == i) {
|
if (specialDacs[j] == i) {
|
||||||
switch (oldSettings) {
|
switch (oldSettings) {
|
||||||
case DYNAMICGAIN:
|
case GAIN0:
|
||||||
value = defaultDacValue_G0[j];
|
value = defaultDacValue_G0[j];
|
||||||
break;
|
break;
|
||||||
case DYNAMICHG0:
|
case HIGHGAIN0:
|
||||||
value = defaultDacValue_HG0[j];
|
value = defaultDacValue_HG0[j];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -541,10 +542,10 @@ int getDefaultDac(enum DACINDEX index, enum detectorSettings sett,
|
|||||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
if ((int)index == specialDacs[i]) {
|
if ((int)index == specialDacs[i]) {
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case DYNAMICGAIN:
|
case GAIN0:
|
||||||
*retval = defaultDacValue_G0[i];
|
*retval = defaultDacValue_G0[i];
|
||||||
return OK;
|
return OK;
|
||||||
case DYNAMICHG0:
|
case HIGHGAIN0:
|
||||||
*retval = defaultDacValue_HG0[i];
|
*retval = defaultDacValue_HG0[i];
|
||||||
return OK;
|
return OK;
|
||||||
// unknown settings
|
// unknown settings
|
||||||
@ -573,15 +574,14 @@ int setDefaultDac(enum DACINDEX index, enum detectorSettings sett, int value) {
|
|||||||
for (int i = 0; i < NSPECIALDACS; ++i) {
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
if ((int)index == specialDacs[i]) {
|
if ((int)index == specialDacs[i]) {
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case DYNAMICGAIN:
|
case GAIN0:
|
||||||
LOG(logINFO,
|
LOG(logINFO, ("Setting Default Dac [%d - %s, gain0]: %d\n",
|
||||||
("Setting Default Dac [%d - %s, dynamicgain]: %d\n",
|
(int)index, dac_names[index], value));
|
||||||
(int)index, dac_names[index], value));
|
|
||||||
defaultDacValue_G0[i] = value;
|
defaultDacValue_G0[i] = value;
|
||||||
return OK;
|
return OK;
|
||||||
case DYNAMICHG0:
|
case HIGHGAIN0:
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Setting Default Dac [%d - %s, dynamichg0]: %d\n",
|
("Setting Default Dac [%d - %s, highgain0]: %d\n",
|
||||||
(int)index, dac_names[index], value));
|
(int)index, dac_names[index], value));
|
||||||
defaultDacValue_HG0[i] = value;
|
defaultDacValue_HG0[i] = value;
|
||||||
return OK;
|
return OK;
|
||||||
@ -793,6 +793,11 @@ int selectStoragecellStart(int pos) {
|
|||||||
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
LOG(logINFO, ("Setting storage cell start: %d\n", pos));
|
||||||
bus_w(addr, bus_r(addr) & ~mask);
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
bus_w(addr, bus_r(addr) | ((value << offset) & 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
|
// read value back
|
||||||
@ -1045,16 +1050,16 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
int *dacVals = NULL;
|
int *dacVals = NULL;
|
||||||
// set settings
|
// set settings
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case DYNAMICGAIN:
|
case GAIN0:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_HIGH_GAIN_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_HIGH_GAIN_MSK);
|
||||||
LOG(logINFO,
|
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;
|
dacVals = defaultDacValue_G0;
|
||||||
break;
|
break;
|
||||||
case DYNAMICHG0:
|
case HIGHGAIN0:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_HIGH_GAIN_MSK);
|
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",
|
LOG(logINFO,
|
||||||
bus_r(DAQ_REG)));
|
("Set settings - High Gain 0 [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
dacVals = defaultDacValue_HG0;
|
dacVals = defaultDacValue_HG0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -1075,61 +1080,56 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
configureChip();
|
configureChip();
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisSettings;
|
return getSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void validateSettings() {
|
enum detectorSettings getSettings() {
|
||||||
// if any special dac value is changed individually => undefined
|
if (bus_r(DAQ_REG) & DAQ_HIGH_GAIN_MSK)
|
||||||
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
return HIGHGAIN0;
|
||||||
int *specialDacValues[] = {defaultDacValue_G0, defaultDacValue_HG0};
|
return GAIN0;
|
||||||
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() { return thisSettings; }
|
|
||||||
|
|
||||||
enum gainMode getGainMode() {
|
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) {
|
// only one set should be valid
|
||||||
case DAQ_FRCE_GAIN_STG_0_VAL:
|
if ((retval_force && retval_fix) || (retval_fix && retval_cmp_rst) ||
|
||||||
return NORMAL_GAIN_MODE;
|
(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:
|
case DAQ_FRCE_GAIN_STG_1_VAL:
|
||||||
return FORCE_SWITCH_G1;
|
return FORCE_SWITCH_G1;
|
||||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
case DAQ_FRCE_GAIN_STG_2_VAL:
|
||||||
return FORCE_SWITCH_G2;
|
return FORCE_SWITCH_G2;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR, ("This gain mode %d is not defined [DAQ reg: %d]\n",
|
break;
|
||||||
(retval << DAQ_FRCE_SWTCH_GAIN_OFST), retval));
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
void setGainMode(enum gainMode mode) {
|
||||||
@ -1137,26 +1137,47 @@ void setGainMode(enum gainMode mode) {
|
|||||||
uint32_t value = bus_r(addr);
|
uint32_t value = bus_r(addr);
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case NORMAL_GAIN_MODE:
|
case DYNAMIC_GAIN_MODE:
|
||||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
bus_w(addr, value);
|
bus_w(addr, value);
|
||||||
LOG(logINFO, ("Set gain mode - Normal Gain Mode [DAQ Reg:0x%x]\n",
|
LOG(logINFO,
|
||||||
bus_r(DAQ_REG)));
|
("Set gain mode - Dynamic Gain [DAQ Reg:0x%x]\n", bus_r(DAQ_REG)));
|
||||||
break;
|
break;
|
||||||
case FORCE_SWITCH_G1:
|
case FORCE_SWITCH_G1:
|
||||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
value |= DAQ_FRCE_GAIN_STG_1_VAL;
|
value |= DAQ_FRCE_GAIN_STG_1_VAL;
|
||||||
bus_w(addr, value);
|
bus_w(addr, value);
|
||||||
LOG(logINFO, ("Set gain mode - Force Switch G1 [DAQ Reg:0x%x]\n",
|
LOG(logINFO, ("Set gain mode - Force Switch G1 [DAQ Reg:0x%x]\n",
|
||||||
bus_r(DAQ_REG)));
|
bus_r(DAQ_REG)));
|
||||||
break;
|
break;
|
||||||
case FORCE_SWITCH_G2:
|
case FORCE_SWITCH_G2:
|
||||||
value &= ~(DAQ_FRCE_SWTCH_GAIN_MSK);
|
value &= ~(DAQ_GAIN_MODE_MASK);
|
||||||
value |= DAQ_FRCE_GAIN_STG_2_VAL;
|
value |= DAQ_FRCE_GAIN_STG_2_VAL;
|
||||||
bus_w(addr, value);
|
bus_w(addr, value);
|
||||||
LOG(logINFO, ("Set gain mode - Force Switch G2 [DAQ Reg:0x%x]\n",
|
LOG(logINFO, ("Set gain mode - Force Switch G2 [DAQ Reg:0x%x]\n",
|
||||||
bus_r(DAQ_REG)));
|
bus_r(DAQ_REG)));
|
||||||
break;
|
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:
|
default:
|
||||||
LOG(logERROR, ("This gain mode %d is not defined\n", (int)mode));
|
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
|
#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) {
|
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_DELAY (0)
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
#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_TX_UDP_PORT (0x7e9a)
|
||||||
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
#define DEFAULT_TMP_THRSHLD (65 * 1000) // milli degree Celsius
|
||||||
#define DEFAULT_NUM_STRG_CLLS (0)
|
#define DEFAULT_NUM_STRG_CLLS (0)
|
||||||
|
@ -297,9 +297,6 @@ int getAllTrimbits();
|
|||||||
#ifndef CHIPTESTBOARDD
|
#ifndef CHIPTESTBOARDD
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||||
#endif
|
#endif
|
||||||
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
|
||||||
void validateSettings();
|
|
||||||
#endif
|
|
||||||
enum detectorSettings getSettings();
|
enum detectorSettings getSettings();
|
||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
enum gainMode getGainMode();
|
enum gainMode getGainMode();
|
||||||
|
@ -1561,8 +1561,8 @@ void validate_settings(enum detectorSettings sett) {
|
|||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
case STANDARD:
|
case STANDARD:
|
||||||
#elif JUNGFRAUD
|
#elif JUNGFRAUD
|
||||||
case DYNAMICGAIN:
|
case GAIN0:
|
||||||
case DYNAMICHG0:
|
case HIGHGAIN0:
|
||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
case HIGHGAIN:
|
case HIGHGAIN:
|
||||||
@ -8560,7 +8560,7 @@ int set_default_dac(int file_des) {
|
|||||||
int get_gain_mode(int file_des) {
|
int get_gain_mode(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum gainMode retval = NORMAL_GAIN_MODE;
|
enum gainMode retval = DYNAMIC_GAIN_MODE;
|
||||||
LOG(logDEBUG1, ("Getting gain mode\n"));
|
LOG(logDEBUG1, ("Getting gain mode\n"));
|
||||||
|
|
||||||
#ifndef JUNGFRAUD
|
#ifndef JUNGFRAUD
|
||||||
@ -8593,9 +8593,12 @@ int set_gain_mode(int file_des) {
|
|||||||
// only set
|
// only set
|
||||||
if (Server_VerifyLock() == OK) {
|
if (Server_VerifyLock() == OK) {
|
||||||
switch (gainmode) {
|
switch (gainmode) {
|
||||||
case NORMAL_GAIN_MODE:
|
case DYNAMIC_GAIN_MODE:
|
||||||
case FORCE_SWITCH_G1:
|
case FORCE_SWITCH_G1:
|
||||||
case FORCE_SWITCH_G2:
|
case FORCE_SWITCH_G2:
|
||||||
|
case FIX_G1:
|
||||||
|
case FIX_G2:
|
||||||
|
case FIX_G0:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
modeNotImplemented("Gain Mode Index", (int)gainmode);
|
modeNotImplemented("Gain Mode Index", (int)gainmode);
|
||||||
|
@ -113,7 +113,7 @@ class Detector {
|
|||||||
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
|
/** [Jungfrau][Gotthard][Gotthard2][Mythen3] */
|
||||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
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,
|
* LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN \n [Gotthard2] DYNAMICGAIN,
|
||||||
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
* FIXGAIN1, FIXGAIN2 \n [Moench] G1_HIGHGAIN, G1_LOWGAIN,
|
||||||
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
* G2_HIGHCAP_HIGHGAIN, G2_HIGHCAP_LOWGAIN, G2_LOWCAP_HIGHGAIN,
|
||||||
@ -1179,7 +1179,9 @@ class Detector {
|
|||||||
/** [Jungfrau]*/
|
/** [Jungfrau]*/
|
||||||
Result<defs::gainMode> getGainMode(Positions pos = {}) const;
|
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 = {});
|
void setGainMode(const defs::gainMode mode, Positions pos = {});
|
||||||
|
|
||||||
|
@ -1203,12 +1203,12 @@ class CmdProxy {
|
|||||||
settings, getSettings, setSettings,
|
settings, getSettings, setSettings,
|
||||||
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||||
"[standard, fast, highgain, dynamicgain, lowgain, "
|
"[standard, fast, highgain, dynamicgain, lowgain, "
|
||||||
"mediumgain, veryhighgain, dynamichg0, "
|
"mediumgain, veryhighgain, highgain0, "
|
||||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
"fixgain1, fixgain2, forceswitchg1, forceswitchg2, "
|
||||||
"verylowgain, g1_hg, g1_lg, g2_hc_hg, g2_hc_lg, "
|
"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 Detector Settings"
|
||||||
"\n\t[Jungfrau] - [dynamicgain | dynamichg0]"
|
"\n\t[Jungfrau] - [ gain0 | highgain0]"
|
||||||
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
|
"\n\t[Gotthard] - [dynamicgain | highgain | lowgain | "
|
||||||
"mediumgain | veryhighgain]"
|
"mediumgain | veryhighgain]"
|
||||||
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
|
"\n\t[Gotthard2] - [dynamicgain | fixgain1 | fixgain2]"
|
||||||
@ -1877,7 +1877,10 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND_VEC_ID(
|
INTEGER_COMMAND_VEC_ID(
|
||||||
gainmode, getGainMode, setGainMode,
|
gainmode, getGainMode, setGainMode,
|
||||||
sls::StringTo<slsDetectorDefs::gainMode>,
|
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 */
|
/* Gotthard Specific */
|
||||||
TIME_GET_COMMAND(exptimel, getExptimeLeft,
|
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::HIGHGAIN, defs::DYNAMICGAIN, defs::LOWGAIN, defs::MEDIUMGAIN,
|
||||||
defs::VERYHIGHGAIN};
|
defs::VERYHIGHGAIN};
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
return std::vector<defs::detectorSettings>{defs::DYNAMICGAIN,
|
return std::vector<defs::detectorSettings>{defs::GAIN0,
|
||||||
defs::DYNAMICHG0};
|
defs::HIGHGAIN0};
|
||||||
case defs::GOTTHARD2:
|
case defs::GOTTHARD2:
|
||||||
return std::vector<defs::detectorSettings>{
|
return std::vector<defs::detectorSettings>{
|
||||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
defs::DYNAMICGAIN, defs::FIXGAIN1, defs::FIXGAIN2};
|
||||||
defs::FIXGAIN2};
|
|
||||||
case defs::MOENCH:
|
case defs::MOENCH:
|
||||||
return std::vector<defs::detectorSettings>{
|
return std::vector<defs::detectorSettings>{
|
||||||
defs::G1_HIGHGAIN, defs::G1_LOWGAIN,
|
defs::G1_HIGHGAIN, defs::G1_LOWGAIN,
|
||||||
@ -1494,9 +1493,12 @@ void Detector::setStorageCellDelay(ns value, Positions pos) {
|
|||||||
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
std::vector<defs::gainMode> Detector::getGainModeList() const {
|
||||||
switch (getDetectorType().squash()) {
|
switch (getDetectorType().squash()) {
|
||||||
case defs::JUNGFRAU:
|
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_G1,
|
||||||
defs::FORCE_SWITCH_G2};
|
defs::FORCE_SWITCH_G2,
|
||||||
|
defs::FIX_G1,
|
||||||
|
defs::FIX_G2,
|
||||||
|
defs::FIX_G0};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Gain mode is not implemented for this detector.");
|
throw RuntimeError("Gain mode is not implemented for this detector.");
|
||||||
|
@ -456,6 +456,11 @@ TEST_CASE("gainmode", "[.cmd]") {
|
|||||||
proxy.Call("gainmode", {}, -1, GET, oss);
|
proxy.Call("gainmode", {}, -1, GET, oss);
|
||||||
REQUIRE(oss.str() == "gainmode forceswitchg1\n");
|
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;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
|
proxy.Call("gainmode", {"forceswitchg2"}, -1, PUT, oss);
|
||||||
@ -463,8 +468,18 @@ TEST_CASE("gainmode", "[.cmd]") {
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
proxy.Call("gainmode", {"normal"}, -1, PUT, oss);
|
proxy.Call("gainmode", {"fixg1"}, -1, PUT, oss);
|
||||||
REQUIRE(oss.str() == "gainmode normal\n");
|
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) {
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
det.setGainMode(prev_val[i], {i});
|
det.setGainMode(prev_val[i], {i});
|
||||||
|
@ -150,7 +150,7 @@ TEST_CASE("settings", "[.cmd]") {
|
|||||||
allSett.push_back("lowgain");
|
allSett.push_back("lowgain");
|
||||||
allSett.push_back("mediumgain");
|
allSett.push_back("mediumgain");
|
||||||
allSett.push_back("veryhighgain");
|
allSett.push_back("veryhighgain");
|
||||||
allSett.push_back("dynamichg0");
|
allSett.push_back("highgain0");
|
||||||
allSett.push_back("fixgain1");
|
allSett.push_back("fixgain1");
|
||||||
allSett.push_back("fixgain2");
|
allSett.push_back("fixgain2");
|
||||||
allSett.push_back("verylowgain");
|
allSett.push_back("verylowgain");
|
||||||
@ -164,12 +164,13 @@ TEST_CASE("settings", "[.cmd]") {
|
|||||||
allSett.push_back("g4_lg");
|
allSett.push_back("g4_lg");
|
||||||
allSett.push_back("forceswitchg1");
|
allSett.push_back("forceswitchg1");
|
||||||
allSett.push_back("forceswitchg2");
|
allSett.push_back("forceswitchg2");
|
||||||
|
allSett.push_back("gain0");
|
||||||
|
|
||||||
std::vector<std::string> sett;
|
std::vector<std::string> sett;
|
||||||
switch (det_type) {
|
switch (det_type) {
|
||||||
case defs::JUNGFRAU:
|
case defs::JUNGFRAU:
|
||||||
sett.push_back("dynamicgain");
|
sett.push_back("gain0");
|
||||||
sett.push_back("dynamichg0");
|
sett.push_back("highgain0");
|
||||||
break;
|
break;
|
||||||
case defs::GOTTHARD:
|
case defs::GOTTHARD:
|
||||||
sett.push_back("highgain");
|
sett.push_back("highgain");
|
||||||
|
@ -345,7 +345,7 @@ typedef struct {
|
|||||||
LOWGAIN,
|
LOWGAIN,
|
||||||
MEDIUMGAIN,
|
MEDIUMGAIN,
|
||||||
VERYHIGHGAIN,
|
VERYHIGHGAIN,
|
||||||
DYNAMICHG0,
|
HIGHGAIN0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
VERYLOWGAIN,
|
VERYLOWGAIN,
|
||||||
@ -357,6 +357,7 @@ typedef struct {
|
|||||||
G2_LOWCAP_LOWGAIN,
|
G2_LOWCAP_LOWGAIN,
|
||||||
G4_HIGHGAIN,
|
G4_HIGHGAIN,
|
||||||
G4_LOWGAIN,
|
G4_LOWGAIN,
|
||||||
|
GAIN0,
|
||||||
UNDEFINED = 200,
|
UNDEFINED = 200,
|
||||||
UNINITIALIZED
|
UNINITIALIZED
|
||||||
};
|
};
|
||||||
@ -414,7 +415,14 @@ typedef struct {
|
|||||||
|
|
||||||
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
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
|
#ifdef __cplusplus
|
||||||
|
|
||||||
|
@ -170,8 +170,8 @@ std::string ToString(const defs::detectorSettings s) {
|
|||||||
return std::string("mediumgain");
|
return std::string("mediumgain");
|
||||||
case defs::VERYHIGHGAIN:
|
case defs::VERYHIGHGAIN:
|
||||||
return std::string("veryhighgain");
|
return std::string("veryhighgain");
|
||||||
case defs::DYNAMICHG0:
|
case defs::HIGHGAIN0:
|
||||||
return std::string("dynamichg0");
|
return std::string("highgain0");
|
||||||
case defs::FIXGAIN1:
|
case defs::FIXGAIN1:
|
||||||
return std::string("fixgain1");
|
return std::string("fixgain1");
|
||||||
case defs::FIXGAIN2:
|
case defs::FIXGAIN2:
|
||||||
@ -194,6 +194,8 @@ std::string ToString(const defs::detectorSettings s) {
|
|||||||
return std::string("g4_hg");
|
return std::string("g4_hg");
|
||||||
case defs::G4_LOWGAIN:
|
case defs::G4_LOWGAIN:
|
||||||
return std::string("g4_lg");
|
return std::string("g4_lg");
|
||||||
|
case defs::GAIN0:
|
||||||
|
return std::string("gain0");
|
||||||
case defs::UNDEFINED:
|
case defs::UNDEFINED:
|
||||||
return std::string("undefined");
|
return std::string("undefined");
|
||||||
case defs::UNINITIALIZED:
|
case defs::UNINITIALIZED:
|
||||||
@ -581,12 +583,18 @@ std::string ToString(const defs::vetoAlgorithm s) {
|
|||||||
|
|
||||||
std::string ToString(const defs::gainMode s) {
|
std::string ToString(const defs::gainMode s) {
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::NORMAL_GAIN_MODE:
|
case defs::DYNAMIC_GAIN_MODE:
|
||||||
return std::string("normal");
|
return std::string("dynamicgain");
|
||||||
case defs::FORCE_SWITCH_G1:
|
case defs::FORCE_SWITCH_G1:
|
||||||
return std::string("forceswitchg1");
|
return std::string("forceswitchg1");
|
||||||
case defs::FORCE_SWITCH_G2:
|
case defs::FORCE_SWITCH_G2:
|
||||||
return std::string("forceswitchg2");
|
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:
|
default:
|
||||||
return std::string("Unknown");
|
return std::string("Unknown");
|
||||||
}
|
}
|
||||||
@ -627,8 +635,8 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
|||||||
return defs::MEDIUMGAIN;
|
return defs::MEDIUMGAIN;
|
||||||
if (s == "veryhighgain")
|
if (s == "veryhighgain")
|
||||||
return defs::VERYHIGHGAIN;
|
return defs::VERYHIGHGAIN;
|
||||||
if (s == "dynamichg0")
|
if (s == "highgain0")
|
||||||
return defs::DYNAMICHG0;
|
return defs::HIGHGAIN0;
|
||||||
if (s == "fixgain1")
|
if (s == "fixgain1")
|
||||||
return defs::FIXGAIN1;
|
return defs::FIXGAIN1;
|
||||||
if (s == "fixgain2")
|
if (s == "fixgain2")
|
||||||
@ -649,6 +657,8 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
|||||||
return defs::G2_LOWCAP_LOWGAIN;
|
return defs::G2_LOWCAP_LOWGAIN;
|
||||||
if (s == "g4_hg")
|
if (s == "g4_hg")
|
||||||
return defs::G4_HIGHGAIN;
|
return defs::G4_HIGHGAIN;
|
||||||
|
if (s == "gain0")
|
||||||
|
return defs::GAIN0;
|
||||||
if (s == "g4_lg")
|
if (s == "g4_lg")
|
||||||
return defs::G4_LOWGAIN;
|
return defs::G4_LOWGAIN;
|
||||||
throw sls::RuntimeError("Unknown setting " + s);
|
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) {
|
template <> defs::gainMode StringTo(const std::string &s) {
|
||||||
if (s == "normal")
|
if (s == "dynamicgain")
|
||||||
return defs::NORMAL_GAIN_MODE;
|
return defs::DYNAMIC_GAIN_MODE;
|
||||||
if (s == "forceswitchg1")
|
if (s == "forceswitchg1")
|
||||||
return defs::FORCE_SWITCH_G1;
|
return defs::FORCE_SWITCH_G1;
|
||||||
if (s == "forceswitchg2")
|
if (s == "forceswitchg2")
|
||||||
return defs::FORCE_SWITCH_G2;
|
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);
|
throw sls::RuntimeError("Unknown gain mode " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user