55 if (!CalTable && !PosTable) {
56 throw std::runtime_error(
"Either CalibrationTable or PositionTable must be supplied");
58 if (PosTable && !CalTable) {
59 logger.notice(
"Property 'PositionTable' has been deprecated. Please use "
60 "'CalibrationTable' in its place\n");
65 std::vector<std::string> columnNames = CalTable->getColumnNames();
66 size_t numDetector = CalTable->rowCount();
70 if (std::find(columnNames.begin(), columnNames.end(),
"Detector Position") != columnNames.end()) {
71 auto &detectorInfo = inputWS->mutableDetectorInfo();
74 for (
size_t i = 0; i < numDetector; ++i) {
75 const auto index = detectorInfo.indexOf(detectorID[i]);
76 detectorInfo.setPosition(
index, detPos[i]);
81 if (std::find(columnNames.begin(), columnNames.end(),
"Detector Y Coordinate") != columnNames.end()) {
84 auto &detectorInfo = inputWS->mutableDetectorInfo();
87 for (
size_t i = 0; i < numDetector; ++i) {
88 const auto index = detectorInfo.indexOf(detectorID[i]);
89 V3D xyz = detectorInfo.position(
index);
90 detectorInfo.setPosition(
index,
V3D(xyz.
X(), yCoordinate[i], xyz.
Z()));
95 if (std::find(columnNames.begin(), columnNames.end(),
"Detector Width") != columnNames.end()) {
96 auto &detectorInfo = inputWS->detectorInfo();
97 auto &componentInfo = inputWS->mutableComponentInfo();
100 for (
size_t i = 0; i < numDetector; ++i) {
101 const auto index = detectorInfo.indexOf(detectorID[i]);
102 double nominalWidth = componentInfo.shape(
index).getBoundingBox().width().X();
103 V3D oldScaleFactor = componentInfo.scaleFactor(
index);
104 componentInfo.setScaleFactor(
index,
V3D(widths[i] / nominalWidth, oldScaleFactor.
Y(), oldScaleFactor.
Z()));
109 if (std::find(columnNames.begin(), columnNames.end(),
"Detector Height") != columnNames.end()) {
112 auto &detectorInfo = inputWS->mutableDetectorInfo();
113 auto &componentInfo = inputWS->mutableComponentInfo();
116 for (
size_t i = 0; i < numDetector; ++i) {
117 const auto index = detectorInfo.indexOf(detectorID[i]);
119 double nominalHeight = componentInfo.shape(
index).getBoundingBox().width().Y();
120 V3D oldScaleFactor = componentInfo.scaleFactor(
index);
121 componentInfo.setScaleFactor(
index,
V3D(oldScaleFactor.
X(),
height[i] / nominalHeight, oldScaleFactor.
Z()));