esrf changes: slsDetector: fix setThresholdEnergy and slsDetectorAnalysis file read:

* slsDetector: Proper cleanup and return when no interpolation is possible
 * slsDetectorAnalysis: treat CAL DAC as irrelevant when interpolating settings for two energies(do not abort if different), also including VRS in copying
This commit is contained in:
maliakal_d 2018-04-23 13:31:05 +02:00
parent cac913831c
commit 1069bf5979
2 changed files with 14 additions and 1 deletions

View File

@ -3720,6 +3720,9 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti
if (myMod == NULL) {
printf("Could not interpolate, different dac values in files\n");
setErrorMask((getErrorMask())|(SETTINGS_NOT_SET));
deleteModule(myMod1);
deleteModule(myMod2);
return FAIL;
}
//interpolate tau
tau = linearInterpolation(e_eV, trim1, trim2, tau1, tau2);

View File

@ -150,7 +150,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
//Copy other dacs
int num_dacs_to_copy = 9;
int dacs_to_copy[] = {SVP,VTR,SVN,VTGSTV,CAL,RXB_RB,RXB_LB,VCN,VIS};
int dacs_to_copy[] = {SVP,VTR,VRS,SVN,VTGSTV,RXB_RB,RXB_LB,VCN,VIS};
for (int i = 0; i < num_dacs_to_copy; ++i) {
if(a->dacs[dacs_to_copy[i]] != b->dacs[dacs_to_copy[i]]) {
deleteModule(myMod);
@ -159,6 +159,16 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
myMod->dacs[dacs_to_copy[i]] = a->dacs[dacs_to_copy[i]];
}
//Copy irrelevant dacs (without failing): CAL
if (a->dacs[CAL] != b->dacs[CAL]) {
printf("Warning: DAC CAL differs in both energies (%d, %d)! ",
a->dacs[CAL], b->dacs[CAL]);
printf("Taking first: %d\n", a->dacs[CAL]);
}
myMod->dacs[CAL] = a->dacs[CAL];
//Interpolate vrf, vcmp, vcp
int num_dacs_to_interpolate = 7;
int dacs_to_interpolate[] = {VRF,VCMP_LL,VCMP_LR,VCMP_RL,VCMP_RR,VCP, VRS};