Mantid
|
A set of static helper methods to perform conversions between units. More...
#include <UnitConversion.h>
Static Public Member Functions | |
static double | convertToElasticQ (const double theta, const double efixed) |
Convert to ElasticQ from Energy. More... | |
static double | run (const std::string &src, const std::string &dest, const double srcValue, const double l1, const DeltaEMode::Type emode, const UnitParametersMap ¶ms={}) |
static double | run (const std::string &src, const std::string &dest, const double srcValue, const double l1, const double l2, const double theta, const DeltaEMode::Type emode, const double efixed) |
Convert a single value between the given units (as strings) More... | |
static double | run (Unit &srcUnit, Unit &destUnit, const double srcValue, const double l1, const DeltaEMode::Type emode, const UnitParametersMap ¶ms={}) |
Convert a single value between the given units. More... | |
Static Private Member Functions | |
static double | convertQuickly (const double srcValue, const double factor, const double power) |
Perform a quick conversion. More... | |
static double | convertViaTOF (Unit &srcUnit, Unit &destUnit, const double srcValue, const double l1, const DeltaEMode::Type emode, const UnitParametersMap ¶ms) |
Convert through TOF. More... | |
A set of static helper methods to perform conversions between units.
Definition at line 24 of file UnitConversion.h.
|
staticprivate |
Perform a quick conversion.
Perform a quick conversion by raising the value to a power & multiplying by the factor.
srcValue | :: The value to convert |
factor | :: A multiplicative constant |
power | :: Raise the src value to this power |
Definition at line 82 of file UnitConversion.cpp.
Referenced by run().
|
static |
Convert to ElasticQ from Energy.
Convert a to ElasticQ.
theta | :: The scattering angle (in radians) |
efixed | :: Value of fixed energy: EI (emode=1) or EF (emode=2) (in meV) |
Definition at line 128 of file UnitConversion.cpp.
References Mantid::Kernel::efixed, and Mantid::Kernel::Unit::quickConversion().
Referenced by Mantid::Algorithms::ConvertSpectrumAxis2::createElasticQMap(), Mantid::CurveFitting::Functions::FunctionQDepends::extractQValues(), Mantid::Algorithms::GetQsInQENSData::extractQValues(), Mantid::DataHandling::SaveAscii2::populateQMetaData(), Mantid::Algorithms::populateTable(), Mantid::CurveFitting::Functions::InelasticDiffRotDiscreteCircle::setWorkspace(), and Mantid::CurveFitting::Functions::InelasticDiffSphere::setWorkspace().
|
staticprivate |
Convert through TOF.
srcUnit | :: The starting unit |
destUnit | :: The destination unit |
srcValue | :: The value to convert |
l1 | :: The source-sample distance (in metres) |
emode | :: The energy mode enumeration |
params | :: Map containing optional parameters eg The sample-detector distance (in metres) The scattering angle (in radians) Fixed energy: EI (emode=1) or EF (emode=2)(in meV) Delta (not currently used) |
Definition at line 99 of file UnitConversion.cpp.
References Mantid::Kernel::Unit::convertSingleFromTOF(), Mantid::Kernel::Unit::convertSingleToTOF(), Mantid::Kernel::DeltaEMode::Direct, Mantid::Kernel::DeltaEMode::Elastic, Mantid::Kernel::DeltaEMode::Indirect, and std::to_string().
Referenced by run().
|
static |
Definition at line 39 of file UnitConversion.cpp.
References Mantid::Kernel::SingletonHolder< T >::Instance(), and run().
|
static |
Convert a single value between the given units (as strings)
src | :: The starting unit |
dest | :: The destination unit |
srcValue | :: The value to convert |
l1 | :: The source-sample distance (in metres) |
l2 | :: The sample-detector distance (in metres) |
theta | :: The scattering angle (in radians) |
emode | :: The energy mode enumeration |
efixed | :: Value of fixed energy: EI (emode=1) or EF (emode=2) (in meV) |
Definition at line 28 of file UnitConversion.cpp.
References Mantid::Kernel::efixed, Mantid::Kernel::SingletonHolder< T >::Instance(), Mantid::Kernel::l2, run(), and Mantid::Kernel::twoTheta.
Referenced by Mantid::DataObjects::PeaksWorkspace::createPeakQSample(), deprecatedSignature(), Mantid::Algorithms::CreateEPP::exec(), export_UnitConversion(), Mantid::CurveFitting::Functions::PawleyFunction::getTransformedCenter(), Mantid::CurveFitting::Algorithms::PawleyFit::getTransformedCenter(), Mantid::Algorithms::GetEiMonDet3::minimumTOF(), and run().
|
static |
Convert a single value between the given units.
Convert a single value between the given units (overload for Unit objects)
srcUnit | :: The starting unit |
destUnit | :: The destination unit |
srcValue | :: The value to convert |
l1 | :: The source-sample distance (in metres) |
emode | :: The energy mode enumeration |
params | :: Map containing optional parameters eg The sample-detector distance (in metres) The scattering angle (in radians) Fixed energy: EI (emode=1) or EF (emode=2)(in meV) Delta (not currently used) |
Definition at line 60 of file UnitConversion.cpp.
References convertQuickly(), convertViaTOF(), and Mantid::Kernel::Unit::quickConversion().