Mantid
|
#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 |
Definition at line 36 of file UnitsConversionHelper.h.
Mantid::MDAlgorithms::UnitsConversionHelper::UnitsConversionHelper | ( | ) |
Definition at line 378 of file UnitsConversionHelper.cpp.
Mantid::MDAlgorithms::UnitsConversionHelper::UnitsConversionHelper | ( | const UnitsConversionHelper & | another | ) |
Definition at line 352 of file UnitsConversionHelper.cpp.
References m_DIFA, m_DIFC, m_Efix, m_Emode, m_Factor, m_L1, m_L2, m_pDIFAs, m_pDIFCs, m_pEfixedArray, m_pL2s, m_Power, m_pTwoThetas, m_pTZEROs, m_SourceWSUnit, m_TargetUnit, m_TwoTheta, m_TZERO, and m_UnitCnvrsn.
|
protected |
establish and initialize proper units conversion from input to output units;
establish and initialize proper units conversion from input to output units
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) |
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().
double Mantid::MDAlgorithms::UnitsConversionHelper::convertUnits | ( | double | val | ) | const |
do actual unit conversion from input to oputput data
val | – the input value which has to be converted |
Definition at line 332 of file UnitsConversionHelper.cpp.
References Mantid::MDAlgorithms::CnvrtToMD::ConvertByTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertFast, Mantid::MDAlgorithms::CnvrtToMD::ConvertFromTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertNo, m_Factor, m_Power, m_SourceWSUnit, m_TargetUnit, and m_UnitCnvrsn.
Referenced by Mantid::MDAlgorithms::ConvToMDHistoWS::conversionChunk(), Mantid::MDAlgorithms::ConvToMDEventsWS::convertEventList(), Mantid::MDAlgorithms::ConvToMDEventsWSIndexing::convertEvents(), Mantid::MDAlgorithms::SaveIsawQvector::exec(), Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues(), and 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
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().
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.
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().
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.
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.
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.
void Mantid::MDAlgorithms::UnitsConversionHelper::updateConversion | ( | size_t | i | ) |
Method updates unit conversion given the index of detector parameters in the array of detectors.
Definition at line 282 of file UnitsConversionHelper.cpp.
References Mantid::MDAlgorithms::CnvrtToMD::ConvertByTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertFast, Mantid::MDAlgorithms::CnvrtToMD::ConvertFromTOF, Mantid::MDAlgorithms::CnvrtToMD::ConvertNo, m_DIFA, m_DIFC, m_Efix, m_Emode, m_L1, m_L2, m_pEfixedArray, m_SourceWSUnit, m_TargetUnit, m_TwoTheta, m_TZERO, and m_UnitCnvrsn.
Referenced by Mantid::MDAlgorithms::ConvToMDHistoWS::conversionChunk(), Mantid::MDAlgorithms::ConvToMDEventsWS::convertEventList(), Mantid::MDAlgorithms::ConvToMDEventsWSIndexing::convertEvents(), Mantid::MDAlgorithms::ConvertToMD::copyMetaData(), Mantid::MDAlgorithms::SaveIsawQvector::exec(), and Mantid::MDAlgorithms::ConvertToMDMinMaxLocal::findMinMaxValues().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 49 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 47 of file UnitsConversionHelper.h.
Referenced by analyzeUnitsConversion(), convertUnits(), and UnitsConversionHelper().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 57 of file UnitsConversionHelper.h.
Referenced by initialize(), and UnitsConversionHelper().
|
private |
Definition at line 58 of file UnitsConversionHelper.h.
Referenced by initialize(), and UnitsConversionHelper().
|
private |
Definition at line 56 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 53 of file UnitsConversionHelper.h.
Referenced by initialize(), and UnitsConversionHelper().
|
private |
Definition at line 47 of file UnitsConversionHelper.h.
Referenced by analyzeUnitsConversion(), convertUnits(), and UnitsConversionHelper().
|
private |
Definition at line 52 of file UnitsConversionHelper.h.
Referenced by initialize(), and UnitsConversionHelper().
|
private |
Definition at line 59 of file UnitsConversionHelper.h.
Referenced by initialize(), and UnitsConversionHelper().
|
private |
Definition at line 39 of file UnitsConversionHelper.h.
Referenced by analyzeUnitsConversion(), convertUnits(), getConversionRange(), initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 41 of file UnitsConversionHelper.h.
Referenced by analyzeUnitsConversion(), convertUnits(), getConversionRange(), initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 51 of file UnitsConversionHelper.h.
Referenced by initialize(), UnitsConversionHelper(), and updateConversion().
|
private |
Definition at line 44 of file UnitsConversionHelper.h.
Referenced by convertUnits(), getConversionRange(), initialize(), isUnitConverted(), UnitsConversionHelper(), and updateConversion().