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. More... | |
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. More... | |
const GoniometerAxis & | getAxis (const std::string &axisname) const |
Get GoniometerAxis object using motor name. More... | |
const GoniometerAxis & | getAxis (size_t axisnumber) const |
Get GoniometerAxis obfject using motor number. More... | |
std::vector< double > | getEulerAngles (const std::string &convention="YZX") |
Return Euler angles acording to a convention. More... | |
size_t | getNumberAxes () const |
const Kernel::DblMatrix & | getR () const |
Return global rotation matrix. More... | |
Goniometer () | |
Default constructor The rotation matrix is initialized to identity. More... | |
Goniometer (const Kernel::DblMatrix &rot) | |
Constructor from a rotation matrix. More... | |
bool | isDefined () const |
the method reports if the goniometer was defined with some parameters More... | |
void | loadNexus (::NeXus::File *file, const std::string &group) |
Load the object from an open NeXus file. More... | |
void | makeUniversalGoniometer () |
Make a default universal goniometer with phi,chi,omega angles according to SNS convention. More... | |
bool | operator!= (const Goniometer &other) const |
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. More... | |
void | saveNexus (::NeXus::File *file, const std::string &group) const |
Save the object to an open NeXus file. More... | |
void | setR (Kernel::DblMatrix rot) |
Set the new rotation matrix. More... | |
void | setRotationAngle (const std::string &name, double value) |
Set rotation angle for an axis using motor name. More... | |
void | setRotationAngle (size_t axisnumber, double value) |
Set rotation angle for an axis using motor name. More... | |
virtual | ~Goniometer ()=default |
Private Member Functions | |
void | recalculateR () |
Private function to recalculate R when setRotationAngle is called. More... | |
Private Attributes | |
bool | initFromR |
Flag to specify if the goniometer is initialized from a rotation matrix. More... | |
std::vector< GoniometerAxis > | motors |
Motors vector contains GoniometerAxis objects, the last one is the closest to the sample. More... | |
Kernel::DblMatrix | R |
Global rotation matrix of the goniometer. More... | |
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 >::identityMatrix(), initFromR, R, and Mantid::Kernel::Matrix< T >::Tprime().
|
virtualdefault |
References std::operator!=(), and std::operator==().
std::string Mantid::Geometry::Goniometer::axesInfo | ( | ) |
Return information about axes.
Definition at line 101 of file Goniometer.cpp.
References Mantid::Geometry::angDegrees, Mantid::Geometry::CCW, initFromR, 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 197 of file Goniometer.cpp.
References getR(), Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::Kernel::Matrix< T >::Invert(), Mantid::Kernel::V3D::norm2(), 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 252 of file Goniometer.cpp.
References 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 245 of file Goniometer.cpp.
References motors.
Referenced by Mantid::API::Run::calculateGoniometerMatrices().
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 282 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 262 of file Goniometer.cpp.
References motors.
Referenced by Mantid::API::Run::calculateGoniometerMatrices(), and Mantid::Crystal::SetGoniometer::exec().
const Kernel::DblMatrix & Mantid::Geometry::Goniometer::getR | ( | ) | const |
Return global rotation matrix.
Definition at line 80 of file Goniometer.cpp.
References 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(), export_Goniometer(), getEulerAngles(), Mantid::Crystal::PeakHKLErrors::getRun2MatMap(), Mantid::MDAlgorithms::LoadSQW2::readSingleSPEHeader(), 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 91 of file Goniometer.cpp.
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 329 of file Goniometer.cpp.
References Mantid::Geometry::GoniometerAxis::loadNexus(), motors, recalculateR(), 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 271 of file Goniometer.cpp.
References Mantid::Geometry::angDegrees, Mantid::Geometry::CCW, 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(), and WorkspaceCreationHelper::setGoniometer().
bool Mantid::Geometry::Goniometer::operator!= | ( | const Goniometer & | other | ) | const |
Definition at line 95 of file Goniometer.cpp.
References R.
bool Mantid::Geometry::Goniometer::operator== | ( | const Goniometer & | other | ) | const |
Definition at line 93 of file Goniometer.cpp.
References 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 133 of file Goniometer.cpp.
References Mantid::Geometry::g_log, initFromR, motors, recalculateR(), and Mantid::Kernel::Logger::warning().
Referenced by Mantid::DataHandling::SetSample::createFlatPlateXML(), Mantid::Crystal::SetGoniometer::exec(), Mantid::DataHandling::LoadNXSPE::exec(), makeUniversalGoniometer(), 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 287 of file Goniometer.cpp.
References Mantid::Geometry::angRadians, Mantid::Geometry::g_log, Mantid::Kernel::Quat::getRotation(), initFromR, motors, R, Mantid::Geometry::rad2deg, and Mantid::Kernel::Logger::warning().
Referenced by loadNexus(), pushAxis(), 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 313 of file Goniometer.cpp.
References 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 85 of file Goniometer.cpp.
Referenced by calcFromQSampleAndWavelength().
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 161 of file Goniometer.cpp.
References motors, 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 180 of file Goniometer.cpp.
References motors, recalculateR(), and value.
|
private |
Flag to specify if the goniometer is initialized from a rotation matrix.
Definition at line 107 of file Goniometer.h.
Referenced by axesInfo(), Goniometer(), isDefined(), pushAxis(), recalculateR(), and setR().
|
private |
Motors vector contains GoniometerAxis objects, the last one is the closest to the sample.
Definition at line 105 of file Goniometer.h.
Referenced by axesInfo(), getAxis(), getNumberAxes(), isDefined(), loadNexus(), makeUniversalGoniometer(), pushAxis(), recalculateR(), saveNexus(), and setRotationAngle().
|
private |
Global rotation matrix of the goniometer.
Definition at line 102 of file Goniometer.h.
Referenced by getR(), Goniometer(), operator!=(), operator==(), recalculateR(), and setR().