Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
Mantid::MDAlgorithms::UnitsConversionHelper Class Reference

#include <UnitsConversionHelper.h>

Public Member Functions

double convertUnits (double val) const
 do actual unit conversion from input to oputput data More...
 
std::pair< double, double > getConversionRange (double x1, double x2) const
 Method verify if the Units transformation is well defined in the range provided and if not returns the range where the transformation is well defined. More...
 
void initialize (const MDWSDescription &targetWSDescr, const std::string &unitsTo, bool forceViaTOF=false)
 Initialize unit conversion helper This method is interface to internal initialize method, which actually takes all parameters UnitConversion helper needs from targetWSDescr class. More...
 
void initialize (const std::string &unitsFrom, const std::string &unitsTo, const DataObjects::TableWorkspace_const_sptr &DetWS, int Emode, bool forceViaTOF=false)
 Initialize unit conversion helper. More...
 
bool isUnitConverted () const
 Test and check if units conversion really occurs. More...
 
 UnitsConversionHelper ()
 
 UnitsConversionHelper (const UnitsConversionHelper &another)
 
void updateConversion (size_t i)
 Method updates unit conversion given the index of detector parameters in the array of detectors. More...
 

Protected Member Functions

CnvrtToMD::ConvertUnits analyzeUnitsConversion (const std::string &UnitsFrom, const std::string &UnitsTo, bool forceViaTOF=false)
 establish and initialize proper units conversion from input to output units; More...
 

Private Attributes

double m_DIFA
 
double m_DIFC
 
double m_Efix
 
int m_Emode
 
double m_Factor
 
double m_L1
 
double m_L2
 
std::vector< double > const * m_pDIFAs
 
std::vector< double > const * m_pDIFCs
 
float * m_pEfixedArray
 
std::vector< double > const * m_pL2s
 
double m_Power
 
std::vector< double > const * m_pTwoThetas
 
std::vector< double > const * m_pTZEROs
 
Kernel::Unit_sptr m_SourceWSUnit
 
Kernel::Unit_sptr m_TargetUnit
 
double m_TwoTheta
 
double m_TZERO
 
CnvrtToMD::ConvertUnits m_UnitCnvrsn
 

Detailed Description

Definition at line 36 of file UnitsConversionHelper.h.

Constructor & Destructor Documentation

◆ UnitsConversionHelper() [1/2]

Mantid::MDAlgorithms::UnitsConversionHelper::UnitsConversionHelper ( )

Definition at line 378 of file UnitsConversionHelper.cpp.

◆ UnitsConversionHelper() [2/2]

Mantid::MDAlgorithms::UnitsConversionHelper::UnitsConversionHelper ( const UnitsConversionHelper another)

Member Function Documentation

◆ analyzeUnitsConversion()

CnvrtToMD::ConvertUnits Mantid::MDAlgorithms::UnitsConversionHelper::analyzeUnitsConversion ( const std::string &  UnitsFrom,
const std::string &  UnitsTo,
bool  forceViaTOF = false 
)
protected

establish and initialize proper units conversion from input to output units;

establish and initialize proper units conversion from input to output units

Parameters
UnitsFrom– the ID of the units, which have to be converted from
UnitsTo– the ID of the units to converted to
forceViaTOF– force to perform unit conversion via TOF even if quick conversion exist (by default, false)
Returns
kind of the initiated conversion, e.g. no conversion (unitsFrom == UnitsTo, fastConversion, convFromTOF or convViaTOF. See ConvertUnits for the details of this transformations

if necessary, also sets up the proper units converter pointers which do the actual conversion.

Definition at line 30 of file UnitsConversionHelper.cpp.

References Mantid::MDAlgorithms::CnvrtToMD::ConvertByTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertFast, Mantid::MDAlgorithms::CnvrtToMD::ConvertFromTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertNo, Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::Kernel::Strings::isMember(), m_Factor, m_Power, m_SourceWSUnit, and m_TargetUnit.

Referenced by initialize().

◆ convertUnits()

double Mantid::MDAlgorithms::UnitsConversionHelper::convertUnits ( double  val) const

◆ getConversionRange()

std::pair< double, double > Mantid::MDAlgorithms::UnitsConversionHelper::getConversionRange ( double  x1,
double  x2 
) const

Method verify if the Units transformation is well defined in the range provided and if not returns the range where the transformation is well defined.

It is assumed that the points beyond of this range will be filtered in some other way

Parameters
x1– the initial point of the units conversion range to verify
x2– the final point of the units conversion range to verify

Definition at line 119 of file UnitsConversionHelper.cpp.

References Mantid::MDAlgorithms::CnvrtToMD::ConvertByTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertFast, Mantid::MDAlgorithms::CnvrtToMD::ConvertFromTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertNo, convertUnits(), Mantid::MDAlgorithms::inRange(), m_SourceWSUnit, m_TargetUnit, and m_UnitCnvrsn.

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

◆ initialize() [1/2]

void Mantid::MDAlgorithms::UnitsConversionHelper::initialize ( const MDWSDescription targetWSDescr,
const std::string &  unitsTo,
bool  forceViaTOF = false 
)

Initialize unit conversion helper This method is interface to internal initialize method, which actually takes all parameters UnitConversion helper needs from targetWSDescr class.

Parameters
targetWSDescr– the class which contains all information about target workspace including energy transfer mode, number of dimensions, input workspace etc.
unitsTo– the ID of the units conversion helper would help to convert to
forceViaTOF– force to perform unit conversion via TOF even if quick conversion exist (by default, false)

Definition at line 78 of file UnitsConversionHelper.cpp.

References Mantid::MDAlgorithms::MDWSDescription::getEMode(), Mantid::MDAlgorithms::MDWSDescription::getInWS(), initialize(), Mantid::MDAlgorithms::MDWSDescription::m_PreprDetTable, and Mantid::API::Axis::unit().

Referenced by Mantid::MDAlgorithms::SaveIsawQvector::exec(), Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues(), initialize(), Mantid::MDAlgorithms::ConvToMDBase::initialize(), Mantid::MDAlgorithms::IntegrateEllipsoidsTwoStep::qListFromEventWS(), Mantid::MDAlgorithms::IntegrateEllipsoidsV1::qListFromEventWS(), Mantid::MDAlgorithms::IntegrateEllipsoidsV2::qListFromEventWS(), Mantid::MDAlgorithms::IntegrateEllipsoidsTwoStep::qListFromHistoWS(), Mantid::MDAlgorithms::IntegrateEllipsoidsV1::qListFromHistoWS(), and Mantid::MDAlgorithms::IntegrateEllipsoidsV2::qListFromHistoWS().

◆ initialize() [2/2]

void Mantid::MDAlgorithms::UnitsConversionHelper::initialize ( const std::string &  unitsFrom,
const std::string &  unitsTo,
const DataObjects::TableWorkspace_const_sptr DetWS,
int  Emode,
bool  forceViaTOF = false 
)

Initialize unit conversion helper.

Parameters
unitsFrom– the ID of the unit, which should be converted from
unitsTo– the ID of the units conversion helper helps to convert to
DetWS– table workspace with preprocessed detectors information. See MDAlgorithms::PreprocessDetectorsToMD for the info what this workspace contains
Emode– energy transfer mode (integer value used by Kernel::ConvertUnits to indetify energy transfer mode
forceViaTOF– force to perform unit conversion via TOF even if quick conversion exist (by default, false)

Definition at line 218 of file UnitsConversionHelper.cpp.

References analyzeUnitsConversion(), Mantid::Kernel::DeltaEMode::Indirect, Mantid::Kernel::SingletonHolder< T >::Instance(), m_DIFA, m_DIFC, m_Efix, m_Emode, m_L1, m_L2, m_pDIFAs, m_pDIFCs, m_pEfixedArray, m_pL2s, m_pTwoThetas, m_pTZEROs, m_SourceWSUnit, m_TargetUnit, m_TwoTheta, m_TZERO, and m_UnitCnvrsn.

◆ isUnitConverted()

bool Mantid::MDAlgorithms::UnitsConversionHelper::isUnitConverted ( ) const

Test and check if units conversion really occurs.

Return true if unit conversion happens or false if noConversion mode is selected

Definition at line 62 of file UnitsConversionHelper.cpp.

References Mantid::MDAlgorithms::CnvrtToMD::ConvertNo, and m_UnitCnvrsn.

◆ updateConversion()

void Mantid::MDAlgorithms::UnitsConversionHelper::updateConversion ( size_t  i)

Member Data Documentation

◆ m_DIFA

double Mantid::MDAlgorithms::UnitsConversionHelper::m_DIFA
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_DIFC

double Mantid::MDAlgorithms::UnitsConversionHelper::m_DIFC
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_Efix

double Mantid::MDAlgorithms::UnitsConversionHelper::m_Efix
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_Emode

int Mantid::MDAlgorithms::UnitsConversionHelper::m_Emode
private

Definition at line 49 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_Factor

double Mantid::MDAlgorithms::UnitsConversionHelper::m_Factor
private

◆ m_L1

double Mantid::MDAlgorithms::UnitsConversionHelper::m_L1
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_L2

double Mantid::MDAlgorithms::UnitsConversionHelper::m_L2
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_pDIFAs

std::vector<double> const* Mantid::MDAlgorithms::UnitsConversionHelper::m_pDIFAs
private

Definition at line 57 of file UnitsConversionHelper.h.

Referenced by initialize(), and UnitsConversionHelper().

◆ m_pDIFCs

std::vector<double> const* Mantid::MDAlgorithms::UnitsConversionHelper::m_pDIFCs
private

Definition at line 58 of file UnitsConversionHelper.h.

Referenced by initialize(), and UnitsConversionHelper().

◆ m_pEfixedArray

float* Mantid::MDAlgorithms::UnitsConversionHelper::m_pEfixedArray
private

Definition at line 56 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_pL2s

std::vector<double> const* Mantid::MDAlgorithms::UnitsConversionHelper::m_pL2s
private

Definition at line 53 of file UnitsConversionHelper.h.

Referenced by initialize(), and UnitsConversionHelper().

◆ m_Power

double Mantid::MDAlgorithms::UnitsConversionHelper::m_Power
private

◆ m_pTwoThetas

std::vector<double> const* Mantid::MDAlgorithms::UnitsConversionHelper::m_pTwoThetas
private

Definition at line 52 of file UnitsConversionHelper.h.

Referenced by initialize(), and UnitsConversionHelper().

◆ m_pTZEROs

std::vector<double> const* Mantid::MDAlgorithms::UnitsConversionHelper::m_pTZEROs
private

Definition at line 59 of file UnitsConversionHelper.h.

Referenced by initialize(), and UnitsConversionHelper().

◆ m_SourceWSUnit

Kernel::Unit_sptr Mantid::MDAlgorithms::UnitsConversionHelper::m_SourceWSUnit
private

◆ m_TargetUnit

Kernel::Unit_sptr Mantid::MDAlgorithms::UnitsConversionHelper::m_TargetUnit
private

◆ m_TwoTheta

double Mantid::MDAlgorithms::UnitsConversionHelper::m_TwoTheta
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_TZERO

double Mantid::MDAlgorithms::UnitsConversionHelper::m_TZERO
private

Definition at line 51 of file UnitsConversionHelper.h.

Referenced by initialize(), UnitsConversionHelper(), and updateConversion().

◆ m_UnitCnvrsn

CnvrtToMD::ConvertUnits Mantid::MDAlgorithms::UnitsConversionHelper::m_UnitCnvrsn
private

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