29 throw std::runtime_error(
"L0 is negative, must be positive.");
32 const double oldL1 = componentInfo.
l1();
35 if (samplePos != newSampPos) {
39 double scalee = L0 / oldL1;
40 V3D newSourcePos = newSampPos - oldSourceToSampleDir * scalee;
64 const V3D &pos,
const Quat &rot,
const double detWScale,
const double detHtScale,
68 for (
const auto &bankName : bankNames) {
69 const size_t bankComponentIndex = componentInfo.
indexOfAny(bankName);
70 const size_t parentIndex = componentInfo.
parent(bankComponentIndex);
74 Quat newRot = parentRot * rot * relRot;
76 componentInfo.
setRotation(bankComponentIndex, newRot);
79 parentRot.
rotate(rotatedPos);
81 componentInfo.
setPosition(bankComponentIndex, rotatedPos + componentInfo.
position(bankComponentIndex));
83 const std::string &resolvedBankName = componentInfo.
name(bankComponentIndex);
84 std::vector<double> oldScalex =
pmap->getDouble(resolvedBankName, std::string(
"scalex"));
85 std::vector<double> oldScaley =
pmap->getDouble(resolvedBankName, std::string(
"scaley"));
88 if (!oldScalex.empty())
89 scalex = oldScalex[0] * detWScale;
93 if (!oldScaley.empty())
94 scaley = oldScaley[0] * detHtScale;
99 pmap->addDouble(bankComponentID, std::string(
"scalex"),
scalex);
100 pmap->addDouble(bankComponentID, std::string(
"scaley"),
scaley);
102 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
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
const IComponent * componentID(const size_t componentIndex) const
Kernel::V3D sourcePosition() const
const std::string & name(const size_t componentIndex) const
Kernel::Quat relativeRotation(const size_t componentIndex) const
void setPosition(size_t componentIndex, const Kernel::V3D &newPosition)
Kernel::V3D samplePosition() const
base class for Geometric IComponent
std::shared_ptr< ParameterMap > getParameterMap() const
Pointer to the NOT const ParameterMap holding the parameters of the modified instrument components.
void rotate(V3D &) const
Rotate a vector.
MANTID_API_DLL void applyRectangularDetectorScaleToComponentInfo(Geometry::ComponentInfo &componentInfo, Geometry::IComponent *componentId, 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 Geometry::Instrument &newInstrument, const Kernel::V3D &pos, const Kernel::Quat &rot, const double detWScale, const double detHtScale, Geometry::ComponentInfo &componentInfo)
Updates ComponentInfo for newInstrument to reflect the changes in the associated panel information.
Generate a tableworkspace to store the calibration results.
adjust instrument component position and orientation
: detector size scale at y-direction