mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-16 05:08:06 +01:00
Merge pull request #269 from slsdetectorgroup/j3settings
Jungfrau features: 3. settings
This commit is contained in:
@@ -104,10 +104,6 @@ def test_settings(virtual_jf_detectors):
|
|||||||
assert d.settings == detectorSettings.DYNAMICGAIN
|
assert d.settings == detectorSettings.DYNAMICGAIN
|
||||||
|
|
||||||
gain_list = [
|
gain_list = [
|
||||||
detectorSettings.FIXGAIN1,
|
|
||||||
detectorSettings.FIXGAIN2,
|
|
||||||
detectorSettings.FORCESWITCHG1,
|
|
||||||
detectorSettings.FORCESWITCHG2,
|
|
||||||
detectorSettings.DYNAMICHG0,
|
detectorSettings.DYNAMICHG0,
|
||||||
detectorSettings.DYNAMICGAIN,
|
detectorSettings.DYNAMICGAIN,
|
||||||
]
|
]
|
||||||
@@ -117,10 +113,9 @@ def test_settings(virtual_jf_detectors):
|
|||||||
d.settings = gain
|
d.settings = gain
|
||||||
assert d.settings == gain
|
assert d.settings == gain
|
||||||
|
|
||||||
d.setSettings(detectorSettings.FORCESWITCHG1, [1])
|
d.setSettings(detectorSettings.DYNAMICGAIN, [1])
|
||||||
assert d.settings == [
|
assert d.settings == [
|
||||||
detectorSettings.DYNAMICGAIN,
|
detectorSettings.DYNAMICHG0,
|
||||||
detectorSettings.FORCESWITCHG1,
|
|
||||||
detectorSettings.DYNAMICGAIN,
|
detectorSettings.DYNAMICGAIN,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ class Detector(CppDetectorApi):
|
|||||||
-----
|
-----
|
||||||
|
|
||||||
[Eiger] Use threshold command to load settings
|
[Eiger] Use threshold command to load settings
|
||||||
[Jungfrau] DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2 \n
|
[Jungfrau] DYNAMICGAIN, DYNAMICHG0 \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
|
||||||
|
|||||||
@@ -213,10 +213,6 @@ void init_enums(py::module &m) {
|
|||||||
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
.value("DYNAMICHG0", slsDetectorDefs::detectorSettings::DYNAMICHG0)
|
||||||
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
.value("FIXGAIN1", slsDetectorDefs::detectorSettings::FIXGAIN1)
|
||||||
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
.value("FIXGAIN2", slsDetectorDefs::detectorSettings::FIXGAIN2)
|
||||||
.value("FORCESWITCHG1",
|
|
||||||
slsDetectorDefs::detectorSettings::FORCESWITCHG1)
|
|
||||||
.value("FORCESWITCHG2",
|
|
||||||
slsDetectorDefs::detectorSettings::FORCESWITCHG2)
|
|
||||||
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
.value("VERYLOWGAIN", slsDetectorDefs::detectorSettings::VERYLOWGAIN)
|
||||||
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
.value("G1_HIGHGAIN", slsDetectorDefs::detectorSettings::G1_HIGHGAIN)
|
||||||
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
.value("G1_LOWGAIN", slsDetectorDefs::detectorSettings::G1_LOWGAIN)
|
||||||
|
|||||||
@@ -527,16 +527,6 @@
|
|||||||
<string>Fix Gain 2</string>
|
<string>Fix Gain 2</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Force Switch G1</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Force Switch G2</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Very Low Gain</string>
|
<string>Very Low Gain</string>
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ class qTabSettings : public QWidget, private Ui::TabSettingsObject {
|
|||||||
DYNAMICHG0,
|
DYNAMICHG0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
FORCESWITCHG1,
|
|
||||||
FORCESWITCHG2,
|
|
||||||
VERLOWGAIN,
|
VERLOWGAIN,
|
||||||
G1_HIGHGAIN,
|
G1_HIGHGAIN,
|
||||||
G1_LOWGAIN,
|
G1_LOWGAIN,
|
||||||
|
|||||||
@@ -213,23 +213,16 @@ void qTabMeasurement::SetupTimingMode() {
|
|||||||
index[i] = model->index(i, comboTimingMode->modelColumn(),
|
index[i] = model->index(i, comboTimingMode->modelColumn(),
|
||||||
comboTimingMode->rootModelIndex());
|
comboTimingMode->rootModelIndex());
|
||||||
item[i] = model->itemFromIndex(index[i]);
|
item[i] = model->itemFromIndex(index[i]);
|
||||||
|
item[i]->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
item[(int)GATED]->setEnabled(false);
|
auto res = det->getTimingModeList();
|
||||||
item[(int)BURST_TRIGGER]->setEnabled(false);
|
for (auto it : res) {
|
||||||
item[(int)TRIGGER_GATED]->setEnabled(false);
|
item[(int)it]->setEnabled(true);
|
||||||
switch (det->getDetectorType().squash()) {
|
}
|
||||||
case slsDetectorDefs::EIGER:
|
|
||||||
item[(int)GATED]->setEnabled(true);
|
|
||||||
item[(int)BURST_TRIGGER]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::MYTHEN3:
|
|
||||||
item[(int)GATED]->setEnabled(true);
|
|
||||||
item[(int)TRIGGER_GATED]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not setup timing mode"),
|
||||||
|
"qTabMeasurement::SetupTimingMode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -101,56 +101,14 @@ void qTabSettings::SetupDetectorSettings() {
|
|||||||
item[i] = model->itemFromIndex(index[i]);
|
item[i] = model->itemFromIndex(index[i]);
|
||||||
item[i]->setEnabled(false);
|
item[i]->setEnabled(false);
|
||||||
}
|
}
|
||||||
switch (det->getDetectorType().squash()) {
|
try {
|
||||||
case slsDetectorDefs::EIGER:
|
auto res = det->getSettingsList();
|
||||||
item[(int)STANDARD]->setEnabled(true);
|
for (auto it : res) {
|
||||||
item[(int)HIGHGAIN]->setEnabled(true);
|
item[(int)it]->setEnabled(true);
|
||||||
item[(int)LOWGAIN]->setEnabled(true);
|
}
|
||||||
item[(int)VERYHIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)VERLOWGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::GOTTHARD:
|
|
||||||
item[(int)HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
|
||||||
item[(int)LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)MEDIUMGAIN]->setEnabled(true);
|
|
||||||
item[(int)VERYHIGHGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::JUNGFRAU:
|
|
||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
|
||||||
item[(int)DYNAMICHG0]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN1]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN2]->setEnabled(true);
|
|
||||||
item[(int)FORCESWITCHG1]->setEnabled(true);
|
|
||||||
item[(int)FORCESWITCHG2]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::GOTTHARD2:
|
|
||||||
item[(int)DYNAMICGAIN]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN1]->setEnabled(true);
|
|
||||||
item[(int)FIXGAIN2]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::MOENCH:
|
|
||||||
item[(int)G1_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G1_LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_HIGHCAP_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_HIGHCAP_LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_LOWCAP_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G2_LOWCAP_LOWGAIN]->setEnabled(true);
|
|
||||||
item[(int)G4_HIGHGAIN]->setEnabled(true);
|
|
||||||
item[(int)G4_LOWGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case slsDetectorDefs::MYTHEN3:
|
|
||||||
item[(int)STANDARD]->setEnabled(true);
|
|
||||||
item[(int)FAST]->setEnabled(true);
|
|
||||||
item[(int)HIGHGAIN]->setEnabled(true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
LOG(logDEBUG) << "Unknown detector type. Exiting GUI.";
|
|
||||||
qDefs::Message(qDefs::CRITICAL,
|
|
||||||
"Unknown detector type. Exiting GUI.",
|
|
||||||
"qTabSettings::SetupDetectorSettings");
|
|
||||||
exit(-1);
|
|
||||||
}
|
}
|
||||||
|
CATCH_DISPLAY(std::string("Could not setup settings"),
|
||||||
|
"qTabSettings::SetupDetectorSettings")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -884,42 +884,23 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
if (sett == UNINITIALIZED)
|
if (sett == UNINITIALIZED)
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
|
|
||||||
|
int G0DacVals[] = SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS;
|
||||||
|
int HG0DacVals[] = SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS;
|
||||||
|
int *dacVals = NULL;
|
||||||
// set settings
|
// set settings
|
||||||
switch (sett) {
|
switch (sett) {
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||||
LOG(logINFO,
|
LOG(logINFO,
|
||||||
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
("Set settings - Dyanmic Gain, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
||||||
|
dacVals = G0DacVals;
|
||||||
break;
|
break;
|
||||||
case DYNAMICHG0:
|
case DYNAMICHG0:
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_HIGHGAIN_VAL);
|
||||||
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
LOG(logINFO, ("Set settings - Dyanmic High Gain 0, DAQ Reg: 0x%x\n",
|
||||||
bus_r(DAQ_REG)));
|
bus_r(DAQ_REG)));
|
||||||
break;
|
dacVals = HG0DacVals;
|
||||||
case FIXGAIN1:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_1_VAL);
|
|
||||||
LOG(logINFO,
|
|
||||||
("Set settings - Fix Gain 1, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
|
||||||
break;
|
|
||||||
case FIXGAIN2:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FIX_GAIN_STG_2_VAL);
|
|
||||||
LOG(logINFO,
|
|
||||||
("Set settings - Fix Gain 2, DAQ Reg: 0x%x\n", bus_r(DAQ_REG)));
|
|
||||||
break;
|
|
||||||
case FORCESWITCHG1:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_1_VAL);
|
|
||||||
LOG(logINFO, ("Set settings - Force Switch Gain 1, DAQ Reg: 0x%x\n",
|
|
||||||
bus_r(DAQ_REG)));
|
|
||||||
break;
|
|
||||||
case FORCESWITCHG2:
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_SETTINGS_MSK);
|
|
||||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_FRCE_GAIN_STG_2_VAL);
|
|
||||||
LOG(logINFO, ("Set settings - Force Switch Gain 2, DAQ Reg: 0x%x\n",
|
|
||||||
bus_r(DAQ_REG)));
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG(logERROR,
|
LOG(logERROR,
|
||||||
@@ -929,63 +910,68 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
|||||||
|
|
||||||
thisSettings = sett;
|
thisSettings = sett;
|
||||||
|
|
||||||
return getSettings();
|
// set special dacs
|
||||||
}
|
const int specialDacs[] = SPECIALDACINDEX;
|
||||||
|
for (int i = 0; i < NSPECIALDACS; ++i) {
|
||||||
|
setDAC(specialDacs[i], dacVals[i], 0);
|
||||||
|
}
|
||||||
|
|
||||||
enum detectorSettings getSettings() {
|
// if chip 1.1, and power chip on, configure chip
|
||||||
|
if (getChipVersion() == 11 && powerChip(-1)) {
|
||||||
uint32_t regval = bus_r(DAQ_REG);
|
configureChip();
|
||||||
uint32_t val = regval & DAQ_SETTINGS_MSK;
|
|
||||||
LOG(logDEBUG1, ("Getting Settings\n Reading DAQ Register :0x%x\n", val));
|
|
||||||
|
|
||||||
switch (val) {
|
|
||||||
case DAQ_FIX_GAIN_DYNMC_VAL:
|
|
||||||
thisSettings = DYNAMICGAIN;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Dynamic Gain. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FIX_GAIN_HIGHGAIN_VAL:
|
|
||||||
thisSettings = DYNAMICHG0;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Dynamig High Gain. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FIX_GAIN_STG_1_VAL:
|
|
||||||
thisSettings = FIXGAIN1;
|
|
||||||
LOG(logDEBUG1, ("Settings read: Fix Gain 1. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FIX_GAIN_STG_2_VAL:
|
|
||||||
thisSettings = FIXGAIN2;
|
|
||||||
LOG(logDEBUG1, ("Settings read: Fix Gain 2. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FRCE_GAIN_STG_1_VAL:
|
|
||||||
thisSettings = FORCESWITCHG1;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Force Switch Gain 1. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
case DAQ_FRCE_GAIN_STG_2_VAL:
|
|
||||||
thisSettings = FORCESWITCHG2;
|
|
||||||
LOG(logDEBUG1,
|
|
||||||
("Settings read: Force Switch Gain 2. DAQ Reg: 0x%x\n", regval));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
thisSettings = UNDEFINED;
|
|
||||||
LOG(logERROR, ("Settings read: Undefined. DAQ Reg: 0x%x\n", regval));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return thisSettings;
|
return thisSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void validateSettings() {
|
||||||
|
// if any special dac value is changed individually => undefined
|
||||||
|
const int specialDacs[NSPECIALDACS] = SPECIALDACINDEX;
|
||||||
|
int specialDacValues[NUMSETTINGS][NSPECIALDACS] = {
|
||||||
|
SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS,
|
||||||
|
SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS};
|
||||||
|
int settList[NUMSETTINGS] = {DYNAMICGAIN, DYNAMICHG0};
|
||||||
|
|
||||||
|
enum detectorSettings sett = UNDEFINED;
|
||||||
|
for (int isett = 0; isett != NUMSETTINGS; ++isett) {
|
||||||
|
// dont overwrite if settings is correct
|
||||||
|
if (sett != UNDEFINED) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// assume it matches current setting in list
|
||||||
|
sett = settList[isett];
|
||||||
|
for (int ival = 0; ival < NSPECIALDACS; ++ival) {
|
||||||
|
// if one value does not match, undefined
|
||||||
|
if (getDAC(specialDacs[ival], 0) != specialDacValues[isett][ival]) {
|
||||||
|
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; }
|
||||||
|
|
||||||
/* parameters - dac, adc, hv */
|
/* parameters - dac, adc, hv */
|
||||||
void setDAC(enum DACINDEX ind, int val, int mV) {
|
void setDAC(enum DACINDEX ind, int val, int mV) {
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *dac_names[] = {DAC_NAMES};
|
char *dac_names[] = {DAC_NAMES};
|
||||||
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
|
||||||
LOG(logDEBUG1, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
|
||||||
val, (mV ? "mV" : "dac units")));
|
|
||||||
int dacval = val;
|
int dacval = val;
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
|
LOG(logINFO, ("Setting dac[%d - %s]: %d %s \n", (int)ind, dac_names[ind],
|
||||||
|
val, (mV ? "mV" : "dac units")));
|
||||||
if (!mV) {
|
if (!mV) {
|
||||||
dacValues[ind] = val;
|
dacValues[ind] = val;
|
||||||
}
|
}
|
||||||
@@ -994,6 +980,7 @@ void setDAC(enum DACINDEX ind, int val, int mV) {
|
|||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
LOG(logINFO, ("Setting DAC %s\n", dac_names[ind]));
|
||||||
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
if (LTC2620_SetDACValue((int)ind, val, mV, &dacval) == OK) {
|
||||||
dacValues[ind] = dacval;
|
dacValues[ind] = dacval;
|
||||||
if (ind == J_VREF_COMP &&
|
if (ind == J_VREF_COMP &&
|
||||||
@@ -1006,6 +993,12 @@ 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) {
|
||||||
|
|||||||
@@ -62,6 +62,15 @@ enum DACINDEX {
|
|||||||
480, /* J_VREF_DS */ \
|
480, /* J_VREF_DS */ \
|
||||||
420 /* J_VREF_COMP */ \
|
420 /* J_VREF_COMP */ \
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NUMSETTINGS (2)
|
||||||
|
#define NSPECIALDACS (3)
|
||||||
|
#define SPECIALDACINDEX {J_VB_COMP, J_VREF_DS, J_VREF_COMP};
|
||||||
|
#define SPECIAL_DEFAULT_DYNAMIC_GAIN_VALS \
|
||||||
|
{ 1000, 500, 400 }
|
||||||
|
#define SPECIAL_DEFAULT_DYNAMICHG0_GAIN_VALS \
|
||||||
|
{ 1500, 550, 450 }
|
||||||
|
|
||||||
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
enum NETWORKINDEX { TXN_FRAME, FLOWCTRL_10G };
|
||||||
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
enum CLKINDEX { RUN_CLK, ADC_CLK, DBIT_CLK, NUM_CLOCKS };
|
||||||
#define CLK_NAMES "run", "adc", "dbit"
|
#define CLK_NAMES "run", "adc", "dbit"
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ int getAllTrimbits();
|
|||||||
#ifndef CHIPTESTBOARDD
|
#ifndef CHIPTESTBOARDD
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||||
#endif
|
#endif
|
||||||
#ifdef MYTHEN3D
|
#if defined(MYTHEN3D) || defined(JUNGFRAUD)
|
||||||
void validateSettings();
|
void validateSettings();
|
||||||
#endif
|
#endif
|
||||||
enum detectorSettings getSettings();
|
enum detectorSettings getSettings();
|
||||||
|
|||||||
@@ -1537,10 +1537,6 @@ int set_module(int file_des) {
|
|||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
case DYNAMICHG0:
|
case DYNAMICHG0:
|
||||||
case FIXGAIN1:
|
|
||||||
case FIXGAIN2:
|
|
||||||
case FORCESWITCHG1:
|
|
||||||
case FORCESWITCHG2:
|
|
||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
case HIGHGAIN:
|
case HIGHGAIN:
|
||||||
@@ -1592,10 +1588,6 @@ int set_settings(int file_des) {
|
|||||||
#ifdef JUNGFRAUD
|
#ifdef JUNGFRAUD
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
case DYNAMICHG0:
|
case DYNAMICHG0:
|
||||||
case FIXGAIN1:
|
|
||||||
case FIXGAIN2:
|
|
||||||
case FORCESWITCHG1:
|
|
||||||
case FORCESWITCHG2:
|
|
||||||
#elif GOTTHARDD
|
#elif GOTTHARDD
|
||||||
case DYNAMICGAIN:
|
case DYNAMICGAIN:
|
||||||
case HIGHGAIN:
|
case HIGHGAIN:
|
||||||
|
|||||||
@@ -113,8 +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, FIXGAIN1, FIXGAIN2,
|
/** [Jungfrau] DYNAMICGAIN, DYNAMICHG0 \n [Gotthard] DYNAMICGAIN, HIGHGAIN,
|
||||||
* FORCESWITCHG1, FORCESWITCHG2 \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,
|
||||||
|
|||||||
@@ -1201,8 +1201,7 @@ class CmdProxy {
|
|||||||
"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]"
|
||||||
"\n\t Detector Settings"
|
"\n\t Detector Settings"
|
||||||
"\n\t[Jungfrau] - [dynamicgain | dynamichg0 | fixgain1 | "
|
"\n\t[Jungfrau] - [dynamicgain | dynamichg0]"
|
||||||
"fixgain2 | forceswitchg1 | forceswitchg2]"
|
|
||||||
"\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]"
|
||||||
|
|||||||
@@ -158,9 +158,8 @@ 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>{
|
return std::vector<defs::detectorSettings>{defs::DYNAMICGAIN,
|
||||||
defs::DYNAMICGAIN, defs::DYNAMICHG0, defs::FIXGAIN1,
|
defs::DYNAMICHG0};
|
||||||
defs::FIXGAIN2, defs::FORCESWITCHG1, defs::FORCESWITCHG2};
|
|
||||||
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::DYNAMICHG0, defs::FIXGAIN1,
|
||||||
|
|||||||
@@ -142,15 +142,34 @@ TEST_CASE("settings", "[.cmd]") {
|
|||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
auto det_type = det.getDetectorType().squash();
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
std::vector<std::string> allSett;
|
||||||
|
allSett.push_back("standard");
|
||||||
|
allSett.push_back("fast");
|
||||||
|
allSett.push_back("highgain");
|
||||||
|
allSett.push_back("dynamicgain");
|
||||||
|
allSett.push_back("lowgain");
|
||||||
|
allSett.push_back("mediumgain");
|
||||||
|
allSett.push_back("veryhighgain");
|
||||||
|
allSett.push_back("dynamichg0");
|
||||||
|
allSett.push_back("fixgain1");
|
||||||
|
allSett.push_back("fixgain2");
|
||||||
|
allSett.push_back("verylowgain");
|
||||||
|
allSett.push_back("g1_hg");
|
||||||
|
allSett.push_back("g1_lg");
|
||||||
|
allSett.push_back("g2_hc_hg");
|
||||||
|
allSett.push_back("g2_hc_lg");
|
||||||
|
allSett.push_back("g2_lc_hg");
|
||||||
|
allSett.push_back("g2_lc_lg");
|
||||||
|
allSett.push_back("g4_hg");
|
||||||
|
allSett.push_back("g4_lg");
|
||||||
|
allSett.push_back("forceswitchg1");
|
||||||
|
allSett.push_back("forceswitchg2");
|
||||||
|
|
||||||
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("dynamicgain");
|
||||||
sett.push_back("dynamichg0");
|
sett.push_back("dynamichg0");
|
||||||
sett.push_back("fixgain1");
|
|
||||||
sett.push_back("fixgain2");
|
|
||||||
sett.push_back("forceswitchg1");
|
|
||||||
sett.push_back("forceswitchg2");
|
|
||||||
break;
|
break;
|
||||||
case defs::GOTTHARD:
|
case defs::GOTTHARD:
|
||||||
sett.push_back("highgain");
|
sett.push_back("highgain");
|
||||||
@@ -203,10 +222,9 @@ TEST_CASE("settings", "[.cmd]") {
|
|||||||
REQUIRE(oss.str() == "settings " + it + "\n");
|
REQUIRE(oss.str() == "settings " + it + "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i != det.size(); ++i) {
|
for (auto &it : allSett) {
|
||||||
if (prev_val[i] != defs::UNDEFINED &&
|
if (std::find(sett.begin(), sett.end(), it) == sett.end()) {
|
||||||
prev_val[i] != defs::UNINITIALIZED) {
|
REQUIRE_THROWS(proxy.Call("settings", {it}, -1, PUT));
|
||||||
det.setSettings(prev_val[i], {i});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -348,8 +348,6 @@ typedef struct {
|
|||||||
DYNAMICHG0,
|
DYNAMICHG0,
|
||||||
FIXGAIN1,
|
FIXGAIN1,
|
||||||
FIXGAIN2,
|
FIXGAIN2,
|
||||||
FORCESWITCHG1,
|
|
||||||
FORCESWITCHG2,
|
|
||||||
VERYLOWGAIN,
|
VERYLOWGAIN,
|
||||||
G1_HIGHGAIN,
|
G1_HIGHGAIN,
|
||||||
G1_LOWGAIN,
|
G1_LOWGAIN,
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
#define APIMYTHEN3 0x210727
|
#define APIMYTHEN3 0x210727
|
||||||
#define APIMOENCH 0x210727
|
#define APIMOENCH 0x210727
|
||||||
#define APIEIGER 0x210727
|
#define APIEIGER 0x210727
|
||||||
#define APIJUNGFRAU 0x210727
|
#define APIJUNGFRAU 0x210729
|
||||||
|
|||||||
@@ -176,10 +176,6 @@ std::string ToString(const defs::detectorSettings s) {
|
|||||||
return std::string("fixgain1");
|
return std::string("fixgain1");
|
||||||
case defs::FIXGAIN2:
|
case defs::FIXGAIN2:
|
||||||
return std::string("fixgain2");
|
return std::string("fixgain2");
|
||||||
case defs::FORCESWITCHG1:
|
|
||||||
return std::string("forceswitchg1");
|
|
||||||
case defs::FORCESWITCHG2:
|
|
||||||
return std::string("forceswitchg2");
|
|
||||||
case defs::VERYLOWGAIN:
|
case defs::VERYLOWGAIN:
|
||||||
return std::string("verylowgain");
|
return std::string("verylowgain");
|
||||||
case defs::G1_HIGHGAIN:
|
case defs::G1_HIGHGAIN:
|
||||||
@@ -624,10 +620,6 @@ template <> defs::detectorSettings StringTo(const std::string &s) {
|
|||||||
return defs::FIXGAIN1;
|
return defs::FIXGAIN1;
|
||||||
if (s == "fixgain2")
|
if (s == "fixgain2")
|
||||||
return defs::FIXGAIN2;
|
return defs::FIXGAIN2;
|
||||||
if (s == "forceswitchg1")
|
|
||||||
return defs::FORCESWITCHG1;
|
|
||||||
if (s == "forceswitchg2")
|
|
||||||
return defs::FORCESWITCHG2;
|
|
||||||
if (s == "verylowgain")
|
if (s == "verylowgain")
|
||||||
return defs::VERYLOWGAIN;
|
return defs::VERYLOWGAIN;
|
||||||
if (s == "g1_hg")
|
if (s == "g1_hg")
|
||||||
|
|||||||
Reference in New Issue
Block a user