28 throw std::runtime_error(
"L0 is negative, must be positive.");
31 const double oldL1 = componentInfo.
l1();
34 if (samplePos != newSampPos) {
38 double scalee = L0 / oldL1;
39 V3D newSourcePos = newSampPos - oldSourceToSampleDir * scalee;
60 const double detWScale,
const double detHtScale,
ComponentInfo &componentInfo) {
61 for (
const auto &bankName : bankNames) {
62 const size_t bankComponentIndex = componentInfo.
indexOfAny(bankName);
63 const size_t parentIndex = componentInfo.
parent(bankComponentIndex);
67 Quat newRot = parentRot * rot * relRot;
69 componentInfo.
setRotation(bankComponentIndex, newRot);
72 parentRot.
rotate(rotatedPos);
74 componentInfo.
setPosition(bankComponentIndex, rotatedPos + componentInfo.
position(bankComponentIndex));
76 std::vector<double> oldScalex = componentInfo.
getNumberParameter(bankComponentIndex,
"scalex",
false);
77 std::vector<double> oldScaley = componentInfo.
getNumberParameter(bankComponentIndex,
"scaley",
false);
80 if (!oldScalex.empty())
81 scalex = oldScalex[0] * detWScale;
85 if (!oldScaley.empty())
86 scaley = oldScaley[0] * detHtScale;
93 if (detWScale != 1.0 || detHtScale != 1.0)
ComponentInfo : Provides a component centric view on to the instrument.
size_t indexOfAny(const std::string &name) const
The first component with this name in a breadth-first search, as Instrument::getComponentByName() fin...
void setRotation(size_t componentIndex, const Kernel::Quat &newRotation)
size_t parent(const size_t componentIndex) const
Kernel::Quat rotation(const size_t componentIndex) const
Kernel::V3D position(const size_t componentIndex) const
std::vector< double > getNumberParameter(const size_t componentIndex, const std::string &name, bool recursive=true) const
Kernel::V3D sourcePosition() const
Kernel::Quat relativeRotation(const size_t componentIndex) const
void setPosition(size_t componentIndex, const Kernel::V3D &newPosition)
void addDouble(const size_t componentIndex, const std::string &name, double value, const std::string *const pDescription=nullptr, const std::string &pVisible="true")
Add or replace a named double parameter at a specific component index.
Kernel::V3D samplePosition() const
void rotate(V3D &) const
Rotate a vector.
MANTID_API_DLL void applyRectangularDetectorScaleToComponentInfo(Geometry::ComponentInfo &componentInfo, const size_t componentIndex, const double scaleX, const double scaleY)
Helpers for resizing RectangularDetectors.
CalibrationHelpers : This contains helper methods to move source, sample and detector positions/rotat...
MANTID_CRYSTAL_DLL void adjustUpSampleAndSourcePositions(double const L0, const Kernel::V3D &newSampPos, Geometry::ComponentInfo &componentInfo)
Updates the ComponentInfo for the workspace containing newInstrument to reflect the position of the s...
MANTID_CRYSTAL_DLL void adjustBankPositionsAndSizes(const std::vector< std::string > &bankNames, const Kernel::V3D &pos, const Kernel::Quat &rot, const double detWScale, const double detHtScale, Geometry::ComponentInfo &componentInfo)
Updates ComponentInfo to reflect the changes in the associated panel information.
adjust instrument component position and orientation
: detector size scale at y-direction