mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 01:58:00 +02:00
M3threshold (#475)
* vicin default changed to 800, only setting vthx directly allows to set dac even if counter disabled, else disable counter, setallthresholdenergy if an energy is -1, get module value, fix that reg was repaced by isettings * vth3 disabled for interpolation enable, interpolation disable sets counter mask to what it was before (updating old mask whn setting counter mask except for setting all counters for interpolation enable) and enabling vth3 if counter was enabled * refactor and test for previous commit * pump probe only has vth2 enabled, handles both pump probe mode and interpolation mode as well * wip * refactored pump probe and interpolation and added to setmodule * check dacs and trimbits out of range for setmodule (not just threshold) * binaries in * m3: pump probe and interpolation mutually exclusive * minor
This commit is contained in:
@ -496,32 +496,46 @@ TEST_CASE("interpolation", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||
auto prev_val = det.getInterpolation();
|
||||
auto mask = det.getCounterMask();
|
||||
{
|
||||
proxy.Call("counters", {"0", "1"}, -1, PUT);
|
||||
std::ostringstream oss;
|
||||
proxy.Call("interpolation", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "interpolation 1\n");
|
||||
REQUIRE(det.getCounterMask().tsquash("inconsistent counter mask") ==
|
||||
7);
|
||||
}
|
||||
{
|
||||
proxy.Call("counters", {"0", "1"}, -1, PUT);
|
||||
std::ostringstream oss;
|
||||
proxy.Call("interpolation", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "interpolation 0\n");
|
||||
REQUIRE(det.getCounterMask().tsquash("inconsistent counter mask") ==
|
||||
3);
|
||||
auto prev_interpolation = det.getInterpolation();
|
||||
auto prev_mask = det.getCounterMask();
|
||||
auto prev_vth3DacVal = det.getDAC(defs::VTH3, 0, {});
|
||||
|
||||
int disabledDacValue = 2800;
|
||||
auto fixedVth3DacVal = 1000;
|
||||
det.setDAC(defs::VTH3, fixedVth3DacVal, 0, {});
|
||||
// mask with counter 3 disabled and enabled(to test vth3)
|
||||
uint32_t fixedMask[2] = {0x2, 0x4};
|
||||
for (int i = 0; i != 2; ++i) {
|
||||
det.setCounterMask(fixedMask[i]);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("interpolation", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "interpolation 1\n");
|
||||
REQUIRE(det.getCounterMask().tsquash("inconsistent counter mask") ==
|
||||
7);
|
||||
REQUIRE(det.getDAC(defs::VTH3, 0, {0}).tsquash("inconsistent vth3 dac value") == disabledDacValue);
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("interpolation", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "interpolation 0\n");
|
||||
REQUIRE(det.getCounterMask().tsquash("inconsistent counter mask") ==
|
||||
fixedMask[i]);
|
||||
uint32_t expectedVth3DacVal = (fixedMask[i] & 0x4 ? fixedVth3DacVal : disabledDacValue);
|
||||
REQUIRE(det.getDAC(defs::VTH3, 0, {0}).tsquash("inconsistent vth3 dac value") == expectedVth3DacVal);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("interpolation", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "interpolation 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setCounterMask(mask[i], {i});
|
||||
det.setInterpolation(prev_val[i], {i});
|
||||
det.setCounterMask(prev_mask[i], {i});
|
||||
det.setInterpolation(prev_interpolation[i], {i});
|
||||
det.setDAC(defs::VTH3, prev_vth3DacVal[i], 0, {i});
|
||||
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("interpolation", {}, -1, GET));
|
||||
@ -533,15 +547,43 @@ TEST_CASE("pumpprobe", "[.cmd]") {
|
||||
CmdProxy proxy(&det);
|
||||
if (det.getDetectorType().squash() == defs::MYTHEN3) {
|
||||
auto prev_val = det.getPumpProbe();
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pumpprobe", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pumpprobe 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pumpprobe", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pumpprobe 0\n");
|
||||
auto prev_interpolation = det.getInterpolation();
|
||||
auto prev_mask = det.getCounterMask();
|
||||
auto prev_vth1DacVal = det.getDAC(defs::VTH1, 0, {});
|
||||
auto prev_vth2DacVal = det.getDAC(defs::VTH2, 0, {});
|
||||
auto prev_vth3DacVal = det.getDAC(defs::VTH3, 0, {});
|
||||
|
||||
int disabledDacValue = 2800;
|
||||
auto fixedVthDacVal = 1000;
|
||||
det.setDAC(defs::VTH1, fixedVthDacVal, 0, {});
|
||||
det.setDAC(defs::VTH2, fixedVthDacVal, 0, {});
|
||||
det.setDAC(defs::VTH3, fixedVthDacVal, 0, {});
|
||||
// mask with counter 2 disabled and enabled(to test vth2)
|
||||
uint32_t fixedMask[2] = {0x4, 0x3};
|
||||
for (int i = 0; i != 2; ++i) {
|
||||
det.setCounterMask(fixedMask[i]);
|
||||
{
|
||||
// pump probe
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pumpprobe", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pumpprobe 1\n");
|
||||
REQUIRE(det.getDAC(defs::VTH1, 0, {0}).tsquash("inconsistent vth2 dac value") == disabledDacValue);
|
||||
REQUIRE(det.getDAC(defs::VTH2, 0, {0}).tsquash("inconsistent vth2 dac value") == fixedVthDacVal);
|
||||
REQUIRE(det.getDAC(defs::VTH3, 0, {0}).tsquash("inconsistent vth2 dac value") == disabledDacValue);
|
||||
}
|
||||
// interpolation and pump probe
|
||||
REQUIRE_THROWS(proxy.Call("interpolation", {"1"}, -1, PUT));
|
||||
{
|
||||
// none
|
||||
std::ostringstream oss;
|
||||
proxy.Call("pumpprobe", {"0"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "pumpprobe 0\n");
|
||||
REQUIRE(det.getCounterMask().tsquash("inconsistent counter mask") == 7);
|
||||
REQUIRE(det.getDAC(defs::VTH1, 0, {0}).tsquash("inconsistent vth1 dac value") == (fixedMask[i] & 0x1 ? fixedVthDacVal : disabledDacValue));
|
||||
REQUIRE(det.getDAC(defs::VTH2, 0, {0}).tsquash("inconsistent vth2 dac value") == (fixedMask[i] & 0x2 ? fixedVthDacVal : disabledDacValue));
|
||||
REQUIRE(det.getDAC(defs::VTH3, 0, {0}).tsquash("inconsistent vth3 dac value") == (fixedMask[i] & 0x4 ? fixedVthDacVal : disabledDacValue));
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -549,7 +591,12 @@ TEST_CASE("pumpprobe", "[.cmd]") {
|
||||
REQUIRE(oss.str() == "pumpprobe 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setCounterMask(prev_mask[i], {i});
|
||||
det.setPumpProbe(prev_val[i], {i});
|
||||
det.setInterpolation(prev_interpolation[i], {i});
|
||||
det.setDAC(defs::VTH1, prev_vth1DacVal[i], 0, {i});
|
||||
det.setDAC(defs::VTH2, prev_vth2DacVal[i], 0, {i});
|
||||
det.setDAC(defs::VTH3, prev_vth3DacVal[i], 0, {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("pumpprobe", {}, -1, GET));
|
||||
|
Reference in New Issue
Block a user