Skip to content
Snippets Groups Projects
Commit 8bfdd1ec authored by Leal, Ricardo's avatar Leal, Ricardo
Browse files

Re #16540 subtract offset to flange_det_dist for back compatibility

parent e65d0563
No related branches found
No related tags found
No related merge requests found
...@@ -497,29 +497,63 @@ void LoadSpice2D::setMetadataAsRunProperties( ...@@ -497,29 +497,63 @@ void LoadSpice2D::setMetadataAsRunProperties(
/** /**
* Calculates the detector distances and sets them as Run properties * Calculates the detector distances and sets them as Run properties
* Here fog starts: * Here fog starts:
* BioSANS: distance = sample_det_dist + offset! * GPSANS: distance = sample_det_dist + offset!
* GPSANS: distance = sample_det_dist + offset + sample_to_flange! * BioSANS: distance = sample_det_dist + offset + sample_to_flange!
* Mathieu is using sample_det_dist to move the detector later * Mathieu is using sample_det_dist to move the detector later
* So I'll do the same (Ricardo) * So I'll do the same (Ricardo)
* June 14th 2016:
* New changes:
* sample_det_dist is not available
* flange_det_dist is new = old sample_det_dist + offset
* offset is not used
* GPSANS: distance = flange_det_dist! (sample_to_flange is 0 for GPSANS)
* BioSANS: distance = flange_det_dist + sample_to_flange!
* For back compatibility I'm subracting the offset to flange_det_dist
* @return : sample_detector_distance * @return : sample_detector_distance
*/ */
double double
LoadSpice2D::detectorDistance(std::map<std::string, std::string> &metadata) { LoadSpice2D::detectorDistance(std::map<std::string, std::string> &metadata) {
// sample_detector_distances
double sample_detector_distance = 0; double sample_detector_distance = 0;
from_string<double>(sample_detector_distance, double sample_detector_distance_offset, sample_si_window_distance;
metadata["Motor_Positions/sample_det_dist"], std::dec);
sample_detector_distance *= 1000.0; // check if it's the new format
addRunProperty<double>("sample-detector-distance", sample_detector_distance, if (metadata.find("Motor_Positions/sample_det_dist") != metadata.end()) {
"mm"); // Old Format
double sample_detector_distance_offset = from_string<double>(sample_detector_distance,
addRunProperty<double>(metadata, "Header/tank_internal_offset", metadata["Motor_Positions/sample_det_dist"], std::dec);
"sample-detector-distance-offset", "mm"); sample_detector_distance *= 1000.0;
addRunProperty<double>("sample-detector-distance", sample_detector_distance,
double sample_si_window_distance = addRunProperty<double>( "mm");
metadata, "Header/sample_to_flange", "sample-si-window-distance", "mm");
sample_detector_distance_offset =
addRunProperty<double>(metadata, "Header/tank_internal_offset",
"sample-detector-distance-offset", "mm");
sample_si_window_distance = addRunProperty<double>(
metadata, "Header/sample_to_flange", "sample-si-window-distance", "mm");
} else {
// New format:
from_string<double>(sample_detector_distance,
metadata["Motor_Positions/flange_det_dist"], std::dec);
sample_detector_distance *= 1000.0;
sample_detector_distance_offset =
addRunProperty<double>(metadata, "Header/tank_internal_offset",
"sample-detector-distance-offset", "mm");
sample_detector_distance -= sample_detector_distance_offset;
addRunProperty<double>("sample-detector-distance", sample_detector_distance,
"mm");
sample_si_window_distance = addRunProperty<double>(
metadata, "Header/sample_to_flange", "sample-si-window-distance", "mm");
}
// sample_detector_distances
double total_sample_detector_distance = sample_detector_distance + double total_sample_detector_distance = sample_detector_distance +
sample_detector_distance_offset + sample_detector_distance_offset +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment