|
Mantid
|
Class to represent a particular goniometer setting, which is described by the rotation matrix. More...
#include <Goniometer.h>
Public Member Functions | |
| std::string | axesInfo () |
| Return information about axes. | |
| void | calcFromQSampleAndWavelength (const Mantid::Kernel::V3D &Q, double wavelength, bool flip_x=false, bool inner=false) |
| Calculate goniometer for rotation around y-asix for constant wavelength from Q Sample. | |
| const GoniometerAxis & | getAxis (const std::string &axisname) const |
| Get GoniometerAxis object using motor name. | |
| const GoniometerAxis & | getAxis (size_t axisnumber) const |
| Get GoniometerAxis obfject using motor number. | |
| std::string | getConventionFromMotorAxes () const |
| return the goniometer convention used determine from the motor axes | |
| std::vector< double > | getEulerAngles (const std::string &convention="YZX") |
| Return Euler angles acording to a convention. | |
| size_t | getNumberAxes () const |
| const Kernel::DblMatrix & | getR () const |
| Return global rotation matrix. | |
| Goniometer () | |
| Default constructor The rotation matrix is initialized to identity. | |
| Goniometer (const Goniometer &other) | |
| Add an explicit copy constructor. | |
| Goniometer (const Kernel::DblMatrix &rot) | |
| Constructor from a rotation matrix. | |
| Goniometer (Goniometer &&other) noexcept | |
| bool | isDefined () const |
| the method reports if the goniometer was defined with some parameters | |
| void | loadNexus (Nexus::File *file, const std::string &group) |
| Load the object from an open NeXus file. | |
| void | makeUniversalGoniometer () |
| Make a default universal goniometer with phi,chi,omega angles according to SNS convention. | |
| bool | operator!= (const Goniometer &other) const |
| Goniometer & | operator= (const Goniometer &other) |
| Copy assigment constructor. | |
| Goniometer & | operator= (Goniometer &&other) noexcept |
| bool | operator== (const Goniometer &other) const |
| void | pushAxis (const std::string &name, double axisx, double axisy, double axisz, double angle=0., int sense=CCW, int angUnit=angDegrees) |
| Add an additional axis to the goniometer, closer to the sample. | |
| void | saveNexus (Nexus::File *file, const std::string &group) const |
| Save the object to an open NeXus file. | |
| void | setR (Kernel::DblMatrix rot) |
| Set the new rotation matrix. | |
| void | setRotationAngle (const std::string &name, double value) |
| Set rotation angle for an axis using motor name. | |
| void | setRotationAngle (size_t axisnumber, double value) |
| Set rotation angle for an axis using motor name. | |
| virtual | ~Goniometer ()=default |
Private Member Functions | |
| void | recalculateR () |
| Private function to recalculate R when setRotationAngle is called. | |
Private Attributes | |
| bool | m_initFromR |
| Flag to specify if the goniometer is initialized from a rotation matrix. | |
| std::vector< GoniometerAxis > | m_motors |
| Motors vector contains GoniometerAxis objects, the last one is the closest to the sample. | |
| Kernel::DblMatrix | m_R |
| Global rotation matrix of the goniometer. | |
Class to represent a particular goniometer setting, which is described by the rotation matrix.
For a particular sample environment, it stores the rotation motors (names, angles, ...). If copied from one workspace to another, one might need to just change the angle value for one particular axis.
Definition at line 55 of file Goniometer.h.
| Mantid::Geometry::Goniometer::Goniometer | ( | ) |
Default constructor The rotation matrix is initialized to identity.
Definition at line 62 of file Goniometer.cpp.
| Mantid::Geometry::Goniometer::Goniometer | ( | const Kernel::DblMatrix & | rot | ) |
Constructor from a rotation matrix.
| rot | :: DblMatrix matrix that is going to be the internal rotation matrix of the goniometer. Cannot push additional axes |
Definition at line 67 of file Goniometer.cpp.
References Mantid::Kernel::Matrix< T >::isRotation(), m_initFromR, and m_R.
| Mantid::Geometry::Goniometer::Goniometer | ( | const Goniometer & | other | ) |
Add an explicit copy constructor.
Definition at line 78 of file Goniometer.cpp.
|
noexcept |
Definition at line 92 of file Goniometer.cpp.
|
virtualdefault |
| std::string Mantid::Geometry::Goniometer::axesInfo | ( | ) |
Return information about axes.
Definition at line 128 of file Goniometer.cpp.
References Mantid::Geometry::angDegrees, Mantid::Geometry::CCW, m_initFromR, m_motors, and Mantid::Geometry::rad2deg.
| void Mantid::Geometry::Goniometer::calcFromQSampleAndWavelength | ( | const Mantid::Kernel::V3D & | position, |
| double | wavelength, | ||
| bool | flip_x = false, |
||
| bool | inner = false |
||
| ) |
Calculate goniometer for rotation around y-asix for constant wavelength from Q Sample.
| position | :: Q Sample position in reciprocal space |
| wavelength | :: wavelength |
| flip_x | :: option if the q_lab x value should be negative, hence the detector of the other side of the beam |
| inner | :: whether the goniometer is the most inner (phi) or most outer (omega) |
Definition at line 224 of file Goniometer.cpp.
References getR(), Mantid::Kernel::Matrix< T >::Invert(), position, setR(), and Mantid::Geometry::X.
Referenced by Mantid::MDAlgorithms::FindPeaksMD::createPeak(), Mantid::DataObjects::PeaksWorkspace::createPeakQSample(), and Mantid::Crystal::PredictPeaks::exec().
| const GoniometerAxis & Mantid::Geometry::Goniometer::getAxis | ( | const std::string & | axisname | ) | const |
Get GoniometerAxis object using motor name.
| axisname | :: axis name |
Definition at line 279 of file Goniometer.cpp.
References m_motors.
| const GoniometerAxis & Mantid::Geometry::Goniometer::getAxis | ( | size_t | axisnumber | ) | const |
Get GoniometerAxis obfject using motor number.
| axisnumber | :: axis number (from 0) |
Definition at line 272 of file Goniometer.cpp.
References m_motors.
Referenced by Mantid::API::Run::calculateGoniometerMatrices().
| std::string Mantid::Geometry::Goniometer::getConventionFromMotorAxes | ( | ) | const |
return the goniometer convention used determine from the motor axes
Definition at line 317 of file Goniometer.cpp.
References Mantid::Geometry::g_log, m_motors, and Mantid::Kernel::Logger::warning().
Referenced by export_Goniometer().
| std::vector< double > Mantid::Geometry::Goniometer::getEulerAngles | ( | const std::string & | convention = "YZX" | ) |
Return Euler angles acording to a convention.
| convention | :: the convention used to calculate Euler Angles. The UniversalGoniometer is YZY, a triple axis goniometer at HFIR is YZX |
Definition at line 309 of file Goniometer.cpp.
References Mantid::Kernel::Quat::getEulerAngles(), and getR().
Referenced by Mantid::MDAlgorithms::FindPeaksMD::createPeak(), Mantid::DataObjects::PeaksWorkspace::createPeakQSample(), Mantid::Crystal::GoniometerAnglesFromPhiRotation::exec(), Mantid::Crystal::OptimizeCrystalPlacement::exec(), Mantid::Crystal::PredictPeaks::exec(), Mantid::Crystal::SaveIsawPeaks::exec(), Mantid::Crystal::SaveLauenorm::exec(), export_Goniometer(), Mantid::Crystal::PeakHKLErrors::functionDeriv1D(), and Mantid::DataObjects::PeaksWorkspace::peakInfo().
| size_t Mantid::Geometry::Goniometer::getNumberAxes | ( | ) | const |
Definition at line 289 of file Goniometer.cpp.
References m_motors.
Referenced by Mantid::API::Run::calculateGoniometerMatrices(), Mantid::Crystal::SetGoniometer::exec(), Mantid::DataHandling::RotateSampleShape::exec(), and export_Goniometer().
| const Kernel::DblMatrix & Mantid::Geometry::Goniometer::getR | ( | ) | const |
Return global rotation matrix.
Definition at line 107 of file Goniometer.cpp.
References m_R.
Referenced by Mantid::Crystal::LoadIsawPeaks::appendFile(), calcFromQSampleAndWavelength(), Mantid::DataHandling::SetSample::createFlatPlateXML(), Mantid::MDAlgorithms::FindPeaksMD::createPeak(), Mantid::DataObjects::PeaksWorkspace::createPeakQSample(), Mantid::Crystal::OptimizeCrystalPlacement::exec(), Mantid::Crystal::PredictPeaks::exec(), Mantid::DataHandling::RotateSampleShape::exec(), export_Goniometer(), getEulerAngles(), Mantid::Crystal::PeakHKLErrors::getRun2MatMap(), Mantid::MDAlgorithms::LoadSQW2::readSingleSPEHeader(), saveNexus(), and Mantid::DataHandling::SetSample::setSampleShape().
| bool Mantid::Geometry::Goniometer::isDefined | ( | ) | const |
the method reports if the goniometer was defined with some parameters
Function reports if the goniometer is defined.
Definition at line 118 of file Goniometer.cpp.
References m_initFromR, and m_motors.
| void Mantid::Geometry::Goniometer::loadNexus | ( | Nexus::File * | file, |
| const std::string & | group | ||
| ) |
Load the object from an open NeXus file.
| file | :: open NeXus file |
| group | :: name of the group to open |
Definition at line 393 of file Goniometer.cpp.
References group, Mantid::Geometry::GoniometerAxis::loadNexus(), m_initFromR, m_motors, recalculateR(), setR(), and Mantid::Kernel::Strings::toString().
| void Mantid::Geometry::Goniometer::makeUniversalGoniometer | ( | ) |
Make a default universal goniometer with phi,chi,omega angles according to SNS convention.
The rotations occur in this order:
Definition at line 298 of file Goniometer.cpp.
References Mantid::Geometry::angDegrees, Mantid::Geometry::CCW, m_motors, and pushAxis().
Referenced by Mantid::Crystal::LoadIsawPeaks::appendFile(), WorkspaceCreationHelper::createProcessedInelasticWS(), WorkspaceCreationHelper::createProcessedWorkspaceWithCylComplexInstrument(), Mantid::Crystal::OptimizeCrystalPlacement::exec(), Mantid::Crystal::SetGoniometer::exec(), Mantid::Crystal::PeakHKLErrors::getRun2MatMap(), Mantid::DataHandling::LoadEventNexus::runLoadNexusLogs(), Mantid::DataHandling::LoadEventNexus::runLoadNexusLogs(), and WorkspaceCreationHelper::setGoniometer().
| bool Mantid::Geometry::Goniometer::operator!= | ( | const Goniometer & | other | ) | const |
Definition at line 122 of file Goniometer.cpp.
References m_R.
| Goniometer & Mantid::Geometry::Goniometer::operator= | ( | const Goniometer & | other | ) |
Copy assigment constructor.
Definition at line 82 of file Goniometer.cpp.
References m_initFromR, m_motors, and m_R.
|
noexcept |
Definition at line 96 of file Goniometer.cpp.
| bool Mantid::Geometry::Goniometer::operator== | ( | const Goniometer & | other | ) | const |
Definition at line 120 of file Goniometer.cpp.
References m_R.
| void Mantid::Geometry::Goniometer::pushAxis | ( | const std::string & | name, |
| double | axisx, | ||
| double | axisy, | ||
| double | axisz, | ||
| double | angle = 0., |
||
| int | sense = CCW, |
||
| int | angUnit = angDegrees |
||
| ) |
Add an additional axis to the goniometer, closer to the sample.
| name | :: GoniometerAxis name |
| axisx | :: the x component of the rotation axis |
| axisy | :: the y component of the rotation axis |
| axisz | :: the z component of the rotation axis |
| angle | :: rotation angle, 0 by default |
| sense | :: rotation sense (CW or CCW), CCW by default |
| angUnit | :: units for angle of type::AngleUnit, angDegrees by default |
Definition at line 160 of file Goniometer.cpp.
References Mantid::Geometry::g_log, m_initFromR, m_motors, name, recalculateR(), and Mantid::Kernel::Logger::warning().
Referenced by Mantid::DataHandling::SetSample::createFlatPlateXML(), Mantid::Crystal::SetGoniometer::exec(), Mantid::DataHandling::LoadNXSPE::exec(), makeUniversalGoniometer(), Mantid::DataHandling::RotateSampleShape::prepareGoniometerAxes(), and Mantid::MDAlgorithms::LoadSQW2::readSingleSPEHeader().
|
private |
Private function to recalculate R when setRotationAngle is called.
Private function to recalculate the rotation matrix of the goniometer.
Definition at line 346 of file Goniometer.cpp.
References Mantid::Geometry::angRadians, Mantid::Geometry::g_log, Mantid::Kernel::Quat::getRotation(), Mantid::Kernel::Logger::information(), m_initFromR, m_motors, m_R, and Mantid::Geometry::rad2deg.
Referenced by loadNexus(), pushAxis(), setRotationAngle(), and setRotationAngle().
| void Mantid::Geometry::Goniometer::saveNexus | ( | Nexus::File * | file, |
| const std::string & | group | ||
| ) | const |
Save the object to an open NeXus file.
| file | :: open NeXus file |
| group | :: name of the group to create |
Definition at line 373 of file Goniometer.cpp.
References getR(), Mantid::Kernel::Matrix< T >::getVector(), group, m_motors, saveNexus(), and Mantid::Kernel::Strings::toString().
Referenced by saveNexus().
| void Mantid::Geometry::Goniometer::setR | ( | Kernel::DblMatrix | rot | ) |
Set the new rotation matrix.
| rot | :: DblMatrix matrix that is going to be the internal rotation matrix of the goniometer. |
Definition at line 112 of file Goniometer.cpp.
References m_initFromR, and m_R.
Referenced by calcFromQSampleAndWavelength(), and loadNexus().
| void Mantid::Geometry::Goniometer::setRotationAngle | ( | const std::string & | name, |
| double | value | ||
| ) |
Set rotation angle for an axis using motor name.
| name | :: GoniometerAxis name |
| value | :: value in the units that the axis is set |
Definition at line 188 of file Goniometer.cpp.
References m_motors, name, recalculateR(), and value.
Referenced by Mantid::Crystal::LoadIsawPeaks::appendFile(), Mantid::Crystal::OptimizeCrystalPlacement::exec(), and Mantid::Crystal::PeakHKLErrors::getRun2MatMap().
| void Mantid::Geometry::Goniometer::setRotationAngle | ( | size_t | axisnumber, |
| double | value | ||
| ) |
Set rotation angle for an axis using motor name.
| axisnumber | :: GoniometerAxis number (from 0) |
| value | :: value in the units that the axis is set |
Definition at line 207 of file Goniometer.cpp.
References m_motors, recalculateR(), and value.
|
private |
Flag to specify if the goniometer is initialized from a rotation matrix.
Definition at line 118 of file Goniometer.h.
Referenced by axesInfo(), Goniometer(), isDefined(), loadNexus(), operator=(), pushAxis(), recalculateR(), and setR().
|
private |
Motors vector contains GoniometerAxis objects, the last one is the closest to the sample.
Definition at line 116 of file Goniometer.h.
Referenced by axesInfo(), getAxis(), getAxis(), getConventionFromMotorAxes(), getNumberAxes(), isDefined(), loadNexus(), makeUniversalGoniometer(), operator=(), pushAxis(), recalculateR(), saveNexus(), setRotationAngle(), and setRotationAngle().
|
private |
Global rotation matrix of the goniometer.
Definition at line 113 of file Goniometer.h.
Referenced by getR(), Goniometer(), operator!=(), operator=(), operator==(), recalculateR(), and setR().