diff --git a/Code/Mantid/Framework/DataHandling/src/MoveInstrumentComponent.cpp b/Code/Mantid/Framework/DataHandling/src/MoveInstrumentComponent.cpp index 4f2b69dc37810f5be2626939f659ee8ee9292b62..a558ece135de4c7e3db918b9918ffae871566e2a 100644 --- a/Code/Mantid/Framework/DataHandling/src/MoveInstrumentComponent.cpp +++ b/Code/Mantid/Framework/DataHandling/src/MoveInstrumentComponent.cpp @@ -71,6 +71,9 @@ void MoveInstrumentComponent::exec() const double Z = getProperty("Z"); const bool RelativePosition = getProperty("RelativePosition"); + // Get the ParameterMap reference before the instrument so that + // we avoid a copy + Geometry::ParameterMap& pmap = WS->instrumentParameters(); Instrument_const_sptr inst = WS->getInstrument(); IComponent_const_sptr comp; @@ -130,8 +133,6 @@ void MoveInstrumentComponent::exec() rot.inverse(); rot.rotate(Pos); } - - Geometry::ParameterMap& pmap = WS->instrumentParameters(); // Add a parameter for the new position pmap.addV3D(comp.get(), "pos", Pos); diff --git a/Code/Mantid/Framework/DataHandling/src/RotateInstrumentComponent.cpp b/Code/Mantid/Framework/DataHandling/src/RotateInstrumentComponent.cpp index d1929b07db3759e407e76912ba61bbab056fa934..c358bca4ea80befac91db0dd00a4a328e4c5aa01 100644 --- a/Code/Mantid/Framework/DataHandling/src/RotateInstrumentComponent.cpp +++ b/Code/Mantid/Framework/DataHandling/src/RotateInstrumentComponent.cpp @@ -68,6 +68,9 @@ void RotateInstrumentComponent::exec() if (X + Y + Z == 0.0) throw std::invalid_argument("The rotation axis must not be a zero vector"); + // Get the ParameterMap reference before the instrument so that + // we avoid a copy + Geometry::ParameterMap& pmap = WS->instrumentParameters(); Instrument_const_sptr inst = WS->getInstrument(); IComponent_const_sptr comp; @@ -120,8 +123,6 @@ void RotateInstrumentComponent::exec() } } - //Need to get the address to the base instrument component - Geometry::ParameterMap& pmap = WS->instrumentParameters(); // Add a parameter for the new rotation pmap.addQuat(comp.get(), "rot", Rot);