From 2cf539c16ef1856f0caa84010a480e0a1a7652bb Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 9 Feb 2022 11:53:18 +0100 Subject: [PATCH 1/3] reg for m3 is reserved only for gaincaps and not settings. Fixed in set threshold and setall threshold --- slsDetectorSoftware/src/Module.cpp | 33 ++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index ef2c1633c..32e75100a 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -214,9 +214,21 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings, myMod.iodelay = myMod1.iodelay; myMod.tau = linearInterpolation(e_eV, trim1, trim2, myMod1.tau, myMod2.tau); + // m3, reg is used for gaincaps + if (shm->detType == Mythen3) { + if (myMod1.reg != myMod2.reg) { + throw RuntimeError( + "setThresholdEnergyAndSettings: gaincaps do not " + "match between files"); + } + myMod.reg = myMod1.reg; + } + } + // m3, reg is used for gaincaps + if (shm->detType != Mythen3) { + myMod.reg = isettings; } - myMod.reg = isettings; myMod.eV[0] = e_eV; setModule(myMod, trimbits); if (getSettings() != isettings) { @@ -231,6 +243,7 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings, void Module::setAllThresholdEnergy(std::array e_eV, detectorSettings isettings, bool trimbits) { + // only mythen3 if (shm()->trimEnergies.empty()) { throw RuntimeError( "Trim energies have not been defined for this module yet!"); @@ -311,6 +324,13 @@ void Module::setAllThresholdEnergy(std::array e_eV, myMods[i] = interpolateTrim(&myMod1, &myMod2, energy[i], trim1, trim2, trimbits); + // gaincaps + if (myMod1.reg != myMod2.reg) { + throw RuntimeError("setAllThresholdEnergy: gaincaps do not " + "match between files for energy (eV) " + + to_string(energy[i])); + } + myMods[i].reg = myMod1.reg; } } @@ -357,6 +377,11 @@ void Module::setAllThresholdEnergy(std::array e_eV, for (int i = 0; i < myMod.nchan; ++i) { myMod.chanregs[i] = myMods[i % 3].chanregs[i]; } + // gain caps + if (myMods[0].reg != myMods[1].reg || myMods[1].reg != myMods[2].reg) { + throw RuntimeError("setAllThresholdEnergy: gaincaps do not " + "match between files for all energies"); + } } myMod.reg = isettings; @@ -3330,9 +3355,9 @@ sls_detector_module Module::interpolateTrim(sls_detector_module *a, dacs_to_copy.end(), {E_SVP, E_SVN, E_VTGSTV, E_RXB_RB, E_RXB_LB, E_VCN, E_VIS}); // interpolate vrf, vcmp, vcp - dacs_to_interpolate.insert( - dacs_to_interpolate.end(), - {E_VTR, E_VRF, E_VCMP_LL, E_VCMP_LR, E_VCMP_RL, E_VCMP_RR, E_VCP, E_VRS}); + dacs_to_interpolate.insert(dacs_to_interpolate.end(), + {E_VTR, E_VRF, E_VCMP_LL, E_VCMP_LR, + E_VCMP_RL, E_VCMP_RR, E_VCP, E_VRS}); } else { dacs_to_copy.insert(dacs_to_copy.end(), {M_VCASSH, M_VRSHAPER, M_VRSHAPER_N, M_VIPRE_OUT, From dc1fbb8ce486578b49bf9c2c37e13f9290f08956 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 9 Feb 2022 11:54:29 +0100 Subject: [PATCH 2/3] updated release notes --- RELEASE.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE.txt b/RELEASE.txt index 07682d45c..ce989bf9b 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -33,6 +33,7 @@ This document describes the differences between v6.1.0 and v6.0.0. - fixed datastream disabling for eiger. Its only available in 10g mode. - m3 server crash (vthrehsold) - allow vtrim to be interpolated for Eiger settings +- m3 setThresholdEnergy and setAllThresholdEnergy was overwriting gaincaps with settings enum 2. Resolved Issues From e8ededc1d1dc5f1d7e7da97cc5575777e7e7bbce Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 9 Feb 2022 11:56:57 +0100 Subject: [PATCH 3/3] fixes --- slsDetectorSoftware/src/Module.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 32e75100a..517535279 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -215,7 +215,7 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings, myMod.tau = linearInterpolation(e_eV, trim1, trim2, myMod1.tau, myMod2.tau); // m3, reg is used for gaincaps - if (shm->detType == Mythen3) { + if (shm()->detType == MYTHEN3) { if (myMod1.reg != myMod2.reg) { throw RuntimeError( "setThresholdEnergyAndSettings: gaincaps do not " @@ -225,7 +225,7 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings, } } // m3, reg is used for gaincaps - if (shm->detType != Mythen3) { + if (shm()->detType != MYTHEN3) { myMod.reg = isettings; } @@ -328,7 +328,7 @@ void Module::setAllThresholdEnergy(std::array e_eV, if (myMod1.reg != myMod2.reg) { throw RuntimeError("setAllThresholdEnergy: gaincaps do not " "match between files for energy (eV) " + - to_string(energy[i])); + std::to_string(energy[i])); } myMods[i].reg = myMod1.reg; }