Skip to content
Snippets Groups Projects
Commit 0e239718 authored by Lamar Moore's avatar Lamar Moore
Browse files

Fix error in MoveInstrumentComponent #23073

parent aa5ee14e
No related branches found
No related tags found
No related merge requests found
......@@ -58,14 +58,17 @@ void MoveInstrumentComponent::exec() {
boost::dynamic_pointer_cast<DataObjects::PeaksWorkspace>(ws);
// Get some stuff from the input workspace
const Mantid::Geometry::ComponentInfo *componentInfo;
Instrument_const_sptr inst;
if (inputW) {
inst = inputW->getInstrument();
componentInfo = &inputW->componentInfo();
if (!inst)
throw std::runtime_error("Could not get a valid instrument from the "
"MatrixWorkspace provided as input");
} else if (inputP) {
inst = inputP->getInstrument();
componentInfo = &inputP->componentInfo();
if (!inst)
throw std::runtime_error("Could not get a valid instrument from the "
"PeaksWorkspace provided as input");
......@@ -106,17 +109,14 @@ void MoveInstrumentComponent::exec() {
throw std::invalid_argument("DetectorID or ComponentName must be given.");
}
const auto &componentInfo = inputW->componentInfo();
auto compIndex = componentInfo.indexOf(comp->getComponentID());
auto parent = componentInfo.parent(compIndex);
auto grandParent = componentInfo.parent(parent);
if (componentInfo.isDetector(compIndex) &&
(componentInfo.componentType(grandParent) ==
Mantid::Beamline::ComponentType::Grid ||
componentInfo.componentType(grandParent) ==
Mantid::Beamline::ComponentType::Rectangular ||
componentInfo.componentType(grandParent) ==
Mantid::Beamline::ComponentType::Structured)) {
auto compIndex = componentInfo->indexOf(comp->getComponentID());
auto parent = componentInfo->parent(compIndex);
auto grandParent = componentInfo->parent(parent);
auto grandParentType = componentInfo->componentType(grandParent);
if (componentInfo->isDetector(compIndex) &&
(grandParentType == Mantid::Beamline::ComponentType::Grid ||
grandParentType == Mantid::Beamline::ComponentType::Rectangular ||
grandParentType == Mantid::Beamline::ComponentType::Structured)) {
// DetectorInfo makes changing positions possible but we keep the old
// behavior of ignoring position changes for GridDetectorPixel.
g_log.warning("Component is fixed within a structured bank, moving is not "
......
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