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. 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 GoniometerAxisgetAxis (const std::string &axisname) const
 Get GoniometerAxis object using motor name. More...
 
const GoniometerAxisgetAxis (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::DblMatrixgetR () 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< GoniometerAxismotors
 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...
 

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/2]

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

Default constructor The rotation matrix is initialized to identity.

Definition at line 62 of file Goniometer.cpp.

◆ Goniometer() [2/2]

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 >::identityMatrix(), initFromR, R, and Mantid::Kernel::Matrix< T >::Tprime().

◆ ~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 101 of file Goniometer.cpp.

References Mantid::Geometry::angDegrees, Mantid::Geometry::CCW, initFromR, 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 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().

◆ 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 252 of file Goniometer.cpp.

References 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 245 of file Goniometer.cpp.

References motors.

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

◆ getEulerAngles()

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

◆ getNumberAxes()

size_t Mantid::Geometry::Goniometer::getNumberAxes ( ) const
Returns
the number of axes

Definition at line 262 of file Goniometer.cpp.

References motors.

Referenced by Mantid::API::Run::calculateGoniometerMatrices(), and Mantid::Crystal::SetGoniometer::exec().

◆ 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 91 of file Goniometer.cpp.

References initFromR, and 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 329 of file Goniometer.cpp.

References Mantid::Geometry::GoniometerAxis::loadNexus(), motors, recalculateR(), and Mantid::Kernel::Strings::toString().

◆ makeUniversalGoniometer()

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:

  1. Closest to sample is phi, around the +Y (vertical) axis
  2. Chi, around the +Z (beam direction) axis
  3. Omega, around the +Y (vertical) axis

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

◆ operator!=()

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

Definition at line 95 of file Goniometer.cpp.

References R.

◆ operator==()

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

Definition at line 93 of file Goniometer.cpp.

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

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

◆ 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 313 of file Goniometer.cpp.

References 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 85 of file Goniometer.cpp.

References initFromR, and R.

Referenced by calcFromQSampleAndWavelength().

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

◆ 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 180 of file Goniometer.cpp.

References motors, recalculateR(), and value.

Member Data Documentation

◆ initFromR

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

◆ motors

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

◆ R

Kernel::DblMatrix Mantid::Geometry::Goniometer::R
private

Global rotation matrix of the goniometer.

Definition at line 102 of file Goniometer.h.

Referenced by getR(), Goniometer(), operator!=(), operator==(), recalculateR(), and setR().


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