Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Mantid::Geometry::Goniometer Class Reference

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 GoniometerAxisgetAxis (const std::string &axisname) const
 Get GoniometerAxis object using motor name.
 
const GoniometerAxisgetAxis (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::DblMatrixgetR () 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
 
Goniometeroperator= (const Goniometer &other)
 Copy assigment constructor.
 
Goniometeroperator= (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< GoniometerAxism_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.
 

Detailed Description

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.

Author
Andrei Savici, SNS, ORNL
Date
04/13/2011

Definition at line 55 of file Goniometer.h.

Constructor & Destructor Documentation

◆ Goniometer() [1/4]

Mantid::Geometry::Goniometer::Goniometer ( )

Default constructor The rotation matrix is initialized to identity.

Definition at line 62 of file Goniometer.cpp.

◆ Goniometer() [2/4]

Mantid::Geometry::Goniometer::Goniometer ( const Kernel::DblMatrix rot)

Constructor from a rotation matrix.

Parameters
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.

◆ Goniometer() [3/4]

Mantid::Geometry::Goniometer::Goniometer ( const Goniometer other)

Add an explicit copy constructor.

Definition at line 78 of file Goniometer.cpp.

◆ Goniometer() [4/4]

Mantid::Geometry::Goniometer::Goniometer ( Goniometer &&  other)
noexcept

Definition at line 92 of file Goniometer.cpp.

◆ ~Goniometer()

virtual Mantid::Geometry::Goniometer::~Goniometer ( )
virtualdefault

Member Function Documentation

◆ axesInfo()

std::string Mantid::Geometry::Goniometer::axesInfo ( )

Return information about axes.

Returns
str :: string that contains on each line one motor information (axis name, direction, sense, angle) The angle units shown is degrees

Definition at line 128 of file Goniometer.cpp.

References Mantid::Geometry::angDegrees, Mantid::Geometry::CCW, m_initFromR, m_motors, and Mantid::Geometry::rad2deg.

◆ calcFromQSampleAndWavelength()

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.

Parameters
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().

◆ getAxis() [1/2]

const GoniometerAxis & Mantid::Geometry::Goniometer::getAxis ( const std::string &  axisname) const

Get GoniometerAxis object using motor name.

Parameters
axisname:: axis name

Definition at line 279 of file Goniometer.cpp.

References m_motors.

◆ getAxis() [2/2]

const GoniometerAxis & Mantid::Geometry::Goniometer::getAxis ( size_t  axisnumber) const

Get GoniometerAxis obfject using motor number.

Parameters
axisnumber:: axis number (from 0)

Definition at line 272 of file Goniometer.cpp.

References m_motors.

Referenced by Mantid::API::Run::calculateGoniometerMatrices().

◆ getConventionFromMotorAxes()

std::string Mantid::Geometry::Goniometer::getConventionFromMotorAxes ( ) const

return the goniometer convention used determine from the motor axes

Returns
string with the convention

Definition at line 317 of file Goniometer.cpp.

References Mantid::Geometry::g_log, m_motors, and Mantid::Kernel::Logger::warning().

Referenced by export_Goniometer().

◆ getEulerAngles()

std::vector< double > Mantid::Geometry::Goniometer::getEulerAngles ( const std::string &  convention = "YZX")

◆ getNumberAxes()

size_t Mantid::Geometry::Goniometer::getNumberAxes ( ) const

◆ getR()

const Kernel::DblMatrix & Mantid::Geometry::Goniometer::getR ( ) const

◆ isDefined()

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.

◆ loadNexus()

void Mantid::Geometry::Goniometer::loadNexus ( Nexus::File *  file,
const std::string &  group 
)

Load the object from an open NeXus file.

Parameters
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().

◆ makeUniversalGoniometer()

void Mantid::Geometry::Goniometer::makeUniversalGoniometer ( )

◆ operator!=()

bool Mantid::Geometry::Goniometer::operator!= ( const Goniometer other) const

Definition at line 122 of file Goniometer.cpp.

References m_R.

◆ operator=() [1/2]

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.

◆ operator=() [2/2]

Goniometer & Mantid::Geometry::Goniometer::operator= ( Goniometer &&  other)
noexcept

Definition at line 96 of file Goniometer.cpp.

◆ operator==()

bool Mantid::Geometry::Goniometer::operator== ( const Goniometer other) const

Definition at line 120 of file Goniometer.cpp.

References m_R.

◆ pushAxis()

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.

Parameters
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().

◆ recalculateR()

void Mantid::Geometry::Goniometer::recalculateR ( )
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().

◆ saveNexus()

void Mantid::Geometry::Goniometer::saveNexus ( Nexus::File *  file,
const std::string &  group 
) const

Save the object to an open NeXus file.

Parameters
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().

◆ setR()

void Mantid::Geometry::Goniometer::setR ( Kernel::DblMatrix  rot)

Set the new rotation matrix.

Parameters
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().

◆ setRotationAngle() [1/2]

void Mantid::Geometry::Goniometer::setRotationAngle ( const std::string &  name,
double  value 
)

Set rotation angle for an axis using motor name.

Parameters
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().

◆ setRotationAngle() [2/2]

void Mantid::Geometry::Goniometer::setRotationAngle ( size_t  axisnumber,
double  value 
)

Set rotation angle for an axis using motor name.

Parameters
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.

Member Data Documentation

◆ m_initFromR

bool Mantid::Geometry::Goniometer::m_initFromR
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().

◆ m_motors

std::vector<GoniometerAxis> Mantid::Geometry::Goniometer::m_motors
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().

◆ m_R

Kernel::DblMatrix Mantid::Geometry::Goniometer::m_R
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().


The documentation for this class was generated from the following files: