Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Mantid::MDAlgorithms::MDTransfInterface Class Referenceabstract

Interface to set of sub-classes used by ConvertToMD algorithm and responsible for conversion of input workspace data into MD events. More...

#include <MDTransfInterface.h>

Inheritance diagram for Mantid::MDAlgorithms::MDTransfInterface:
Mantid::MDAlgorithms::MDTransfModQ Mantid::MDAlgorithms::MDTransfNoQ Mantid::MDAlgorithms::MDTransfQ3D

Public Member Functions

virtual bool calcGenericVariables (std::vector< coord_t > &Coord, size_t n_ws_variabes)=0
 Method deployed out of the loop and calculates all variables needed within the loop. More...
 
virtual bool calcMatrixCoord (const double &X, std::vector< coord_t > &Coord, double &signal, double &errSq) const =0
 The method to calculate all remaining coordinates, defined within the inner loop given that the input described by single value only. More...
 
virtual bool calcMatrixCoordinates (const MantidVec &X, size_t i, size_t j, std::vector< coord_t > &Coord, double &s, double &err) const
 Calculate all remaining coordinates, defined within the inner loop. More...
 
virtual bool calcYDepCoordinates (std::vector< coord_t > &Coord, size_t i)=0
 generalizes the code to calculate Y-variables within the detector's loop of the workspace More...
 
virtual MDTransfInterfaceclone () const =0
 
virtual std::vector< std::string > getDefaultDimID (Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
 when one builds MD workspace, he needs a dimension names/ID-s which can be different for different Q-transformations and in different E-mode The position of each dimID in the output vector should correspond the position of each coordinate in the Coord vector
More...
 
virtual std::vector< std::string > getEmodes () const
 MD transformation can often be used together with energy analysis mode; This function should be overloaded if the transformation indeed can do the energy analysis. More...
 
virtual std::vector< double > getExtremumPoints (const double xMin, const double xMax, size_t det_num) const =0
 method returns the vector of input coordinates values where the transformed coordinates reach its extreme values in any of its transformed directions. More...
 
virtual unsigned int getNMatrixDimensions (Kernel::DeltaEMode::Type mode, API::MatrixWorkspace_const_sptr inWS) const =0
 return the number of dimensions, calculated by the transformation from the workspace. More...
 
virtual void initialize (const MDWSDescription &)=0
 set up transformation from the class, which can provide all variables necessary for the conversion More...
 
virtual const std::string inputUnitID (Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
 returns the unit ID for the input units, the particular transformation expects. More...
 
virtual std::vector< std::string > outputUnitID (Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS) const =0
 The transformation generates output MD events in particular units. More...
 
virtual void setDisplayNormalization (Mantid::API::IMDWorkspace_sptr mdWorkspace, Mantid::API::MatrixWorkspace_sptr underlyingWorkspace) const =0
 Sets the display normalization. More...
 
virtual const std::string transfID () const =0
 The method returns the name, under which the transformation would be known to a user. More...
 
virtual ~MDTransfInterface ()=default
 

Detailed Description

Interface to set of sub-classes used by ConvertToMD algorithm and responsible for conversion of input workspace data into MD events.

See http://www.mantidproject.org/Writing_custom_ConvertTo_MD_transformation for detailed description of this class place in the algorithms hierarchy.

The interface provide information for two tasks. 1) Definition of target MD workspace properties and 2) Calculation of MD coordinates for single measurement

1) First task resolved during algorithm initialization and defines the number of dimensions, coordinate system, dimension units and ID-s etc. This information is used when creating the target MD workspace or checking if existing MD workspace can be used as target for the selected ChildAlgorithm

2) Second task performed during conversion itself. The subclass will works with input workspace and convert a single point of the input ws into the vector of MD coordinates. MD coordinates are stored in the vector of n-dimensions*

Usual transformation occurs in 4 stages

1) Initiate the transformation itself. 2) set-up, calculation and copying generic multidimensional variables which are not dependent on data (logs) 3) set-up, calculation and copying the multidimensional variables which dependent on detectors id only 4) calculation of the multidimensional variables which depend on the data along x-axis of the workspace and possibly on detectors parameters (values along y-axis)

Date
16-05-2012

Definition at line 57 of file MDTransfInterface.h.

Constructor & Destructor Documentation

◆ ~MDTransfInterface()

virtual Mantid::MDAlgorithms::MDTransfInterface::~MDTransfInterface ( )
virtualdefault

Member Function Documentation

◆ calcGenericVariables()

virtual bool Mantid::MDAlgorithms::MDTransfInterface::calcGenericVariables ( std::vector< coord_t > &  Coord,
size_t  n_ws_variabes 
)
pure virtual

Method deployed out of the loop and calculates all variables needed within the loop.

In addition it calculates the property-dependent coordinates, which do not depend on workspace

Parameters
Coord– vector of ND-coordinates. Method calculates ChildAlgorithm specific number of variables, calculated from properties and placed into specific place of the Coord vector;
n_ws_variabes– specific number of additional variables, calculated from the workspace data
Returns
true – if all Coord are within the range requested by the conversion algorithm. false otherwise

Implemented in Mantid::MDAlgorithms::MDTransfModQ, and Mantid::MDAlgorithms::MDTransfNoQ.

Referenced by Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().

◆ calcMatrixCoord()

virtual bool Mantid::MDAlgorithms::MDTransfInterface::calcMatrixCoord ( const double &  X,
std::vector< coord_t > &  Coord,
double &  signal,
double &  errSq 
) const
pure virtual

The method to calculate all remaining coordinates, defined within the inner loop given that the input described by single value only.

Parameters
X– X workspace value
Coord– ChildAlgorithm specific number of coordinates, placed in the proper position of the Coordinate vector
signal– signal value which can change or remain unchanged depending on MD coordinates or can affect MD coordinates
errSq– squared error value which can change or remain unchanged depending on MD coordinates or can affect MD coordinates
Returns
true – if all Coord are within the range requested by algorithm. false otherwise

Implemented in Mantid::MDAlgorithms::MDTransfQ3D, Mantid::MDAlgorithms::MDTransfModQ, and Mantid::MDAlgorithms::MDTransfNoQ.

Referenced by calcMatrixCoordinates(), and Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().

◆ calcMatrixCoordinates()

virtual bool Mantid::MDAlgorithms::MDTransfInterface::calcMatrixCoordinates ( const MantidVec X,
size_t  i,
size_t  j,
std::vector< coord_t > &  Coord,
double &  s,
double &  err 
) const
inlinevirtual

Calculate all remaining coordinates, defined within the inner loop.

Parameters
X– vector of X workspace values
i– index of external loop, identifying generic y-coordinate
j– index of internal loop, identifying generic x-coordinate
Coord– ChildAlgorithm specific number of coordinates, placed in the proper position of the Coordinate vector
s– signal value which can change or remain unchanged depending on MD coordinates or can affect MD coordinates
err– error value which can change or remain unchanged depending on MD coordinates or can affect MD coordinates
Returns
true – if all Coord are within the range requested by algorithm. false otherwise

in most existing algorithms X does not depend on Y coordinate, so we can place generalization here; It should be overridden if the dependence on Y coordinate do exist.

Definition at line 117 of file MDTransfInterface.h.

References calcMatrixCoord(), UNUSED_ARG, and Mantid::Geometry::X.

◆ calcYDepCoordinates()

virtual bool Mantid::MDAlgorithms::MDTransfInterface::calcYDepCoordinates ( std::vector< coord_t > &  Coord,
size_t  i 
)
pure virtual

generalizes the code to calculate Y-variables within the detector's loop of the workspace

Parameters
Coord– current Y coordinate, placed in the position of the Coordinate vector, specific for particular ChildAlgorithm.
i– index of external loop, identifying current y-coordinate
Returns
true – if all Coord are within the range requested by algorithm. false otherwise

Implemented in Mantid::MDAlgorithms::MDTransfModQ, Mantid::MDAlgorithms::MDTransfNoQ, and Mantid::MDAlgorithms::MDTransfQ3D.

Referenced by Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().

◆ clone()

virtual MDTransfInterface * Mantid::MDAlgorithms::MDTransfInterface::clone ( ) const
pure virtual

◆ getDefaultDimID()

virtual std::vector< std::string > Mantid::MDAlgorithms::MDTransfInterface::getDefaultDimID ( Kernel::DeltaEMode::Type  dEmode,
API::MatrixWorkspace_const_sptr  inWS 
) const
pure virtual

when one builds MD workspace, he needs a dimension names/ID-s which can be different for different Q-transformations and in different E-mode The position of each dimID in the output vector should correspond the position of each coordinate in the Coord vector

Implemented in Mantid::MDAlgorithms::MDTransfModQ, Mantid::MDAlgorithms::MDTransfQ3D, and Mantid::MDAlgorithms::MDTransfNoQ.

Referenced by Mantid::MDAlgorithms::MDWSDescription::buildFromMatrixWS().

◆ getEmodes()

virtual std::vector< std::string > Mantid::MDAlgorithms::MDTransfInterface::getEmodes ( ) const
inlinevirtual

MD transformation can often be used together with energy analysis mode; This function should be overloaded if the transformation indeed can do the energy analysis.

Reimplemented in Mantid::MDAlgorithms::MDTransfModQ.

Definition at line 65 of file MDTransfInterface.h.

◆ getExtremumPoints()

virtual std::vector< double > Mantid::MDAlgorithms::MDTransfInterface::getExtremumPoints ( const double  xMin,
const double  xMax,
size_t  det_num 
) const
pure virtual

method returns the vector of input coordinates values where the transformed coordinates reach its extreme values in any of its transformed directions.

Parameters
xMin– minimal value of input coordinate
xMax– maximal value of input coordinate These coordinates are always an extreme points and are included into output
det_num– number of the instrument detector – some transformations extreme point depend on a detector number (e.g. inelastic |Q| transformation)

Implemented in Mantid::MDAlgorithms::MDTransfModQ, Mantid::MDAlgorithms::MDTransfNoQ, and Mantid::MDAlgorithms::MDTransfQ3D.

Referenced by Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().

◆ getNMatrixDimensions()

virtual unsigned int Mantid::MDAlgorithms::MDTransfInterface::getNMatrixDimensions ( Kernel::DeltaEMode::Type  mode,
API::MatrixWorkspace_const_sptr  inWS 
) const
pure virtual

return the number of dimensions, calculated by the transformation from the workspace.

This number is usually varies from 1 to 4 and depends on emode and possibly on some WS parameters.

Implemented in Mantid::MDAlgorithms::MDTransfNoQ, Mantid::MDAlgorithms::MDTransfModQ, and Mantid::MDAlgorithms::MDTransfQ3D.

Referenced by Mantid::MDAlgorithms::MDWSDescription::buildFromMatrixWS(), Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::exec(), and Mantid::MDAlgorithms::ConvertToMD::findMinMax().

◆ initialize()

virtual void Mantid::MDAlgorithms::MDTransfInterface::initialize ( const MDWSDescription )
pure virtual

set up transformation from the class, which can provide all variables necessary for the conversion

Implemented in Mantid::MDAlgorithms::MDTransfModQ, Mantid::MDAlgorithms::MDTransfNoQ, and Mantid::MDAlgorithms::MDTransfQ3D.

Referenced by Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().

◆ inputUnitID()

virtual const std::string Mantid::MDAlgorithms::MDTransfInterface::inputUnitID ( Kernel::DeltaEMode::Type  dEmode,
API::MatrixWorkspace_const_sptr  inWS 
) const
pure virtual

returns the unit ID for the input units, the particular transformation expects.

if one wants the transformation to be meaningful, the X-coordinates of input workspace used by the transformation have to be expressed in the units with ID, returned by this method

Implemented in Mantid::MDAlgorithms::MDTransfModQ, and Mantid::MDAlgorithms::MDTransfNoQ.

Referenced by Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().

◆ outputUnitID()

virtual std::vector< std::string > Mantid::MDAlgorithms::MDTransfInterface::outputUnitID ( Kernel::DeltaEMode::Type  dEmode,
API::MatrixWorkspace_const_sptr  inWS 
) const
pure virtual

The transformation generates output MD events in particular units.

This method returns these Units ID-s

Implemented in Mantid::MDAlgorithms::MDTransfModQ, Mantid::MDAlgorithms::MDTransfQ3D, and Mantid::MDAlgorithms::MDTransfNoQ.

Referenced by Mantid::MDAlgorithms::MDWSDescription::buildFromMatrixWS().

◆ setDisplayNormalization()

virtual void Mantid::MDAlgorithms::MDTransfInterface::setDisplayNormalization ( Mantid::API::IMDWorkspace_sptr  mdWorkspace,
Mantid::API::MatrixWorkspace_sptr  underlyingWorkspace 
) const
pure virtual

Sets the display normalization.

Parameters
mdWorkspacethe workspace on which the display normalizations should
underlyingWorkspacethe original workspace be set

Implemented in Mantid::MDAlgorithms::MDTransfModQ, and Mantid::MDAlgorithms::MDTransfNoQ.

◆ transfID()

virtual const std::string Mantid::MDAlgorithms::MDTransfInterface::transfID ( ) const
pure virtual

The method returns the name, under which the transformation would be known to a user.

Its overloaded and implemented in subscriptions

Implemented in Mantid::MDAlgorithms::MDTransfModQ, Mantid::MDAlgorithms::MDTransfNoQ, and Mantid::MDAlgorithms::MDTransfQ3D.


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