|
Mantid
|
d-Spacing in Angstrom More...
Public Member Functions | |
| double | calcTofMax (const double difc, const double difa, const double tzero, const double tofmax=0.) |
| double | calcTofMin (const double difc, const double difa, const double tzero, const double tofmin=0.) |
| const std::string | caption () const override |
| The full name of the unit. | |
| Unit * | clone () const override |
| double | conversionTOFMax () const override |
| This function returns maximal TOF value still reversibly convertible into the unit. | |
| double | conversionTOFMin () const override |
| some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF value still reversibly convertible into the unit. | |
| dSpacing () | |
| Constructor. | |
| void | init () override |
| Finalize the initialization. | |
| const UnitLabel | label () const override |
| A label for the unit to be printed on axes,. | |
| double | singleFromTOF (const double tof) const override |
| DIFA * d^2 + DIFC * d + T0 - TOF = 0. | |
| double | singleToTOF (const double x) const override |
| Convert a single X value to TOF. | |
| const std::string | unitID () const override |
| "dSpacing" | |
Public Member Functions inherited from Mantid::Kernel::Unit | |
| virtual std::pair< double, double > | conversionRange () const |
| The range where conversion to TOF from given units is monotonic and reversible. | |
| double | convertSingleFromTOF (const double xvalue, const double &l1, const int &emode, const UnitParametersMap ¶ms) |
| Convert from the time-of-flight to the concrete unit. TOF is in microseconds. | |
| double | convertSingleToTOF (const double xvalue, const double &l1, const int &emode, const UnitParametersMap ¶ms) |
| Convert from the concrete unit to time-of-flight. TOF is in microseconds. | |
| void | fromTOF (std::vector< double > &xdata, std::vector< double > const &ydata, const double &_l1, const int &_emode, const UnitParametersMap ¶ms) |
| void | fromTOF (std::vector< double > &xdata, std::vector< double > const &ydata, const double &_l1, const int &_emode, std::initializer_list< std::pair< const UnitParams, double > > params) |
| Convert from time-of-flight to the concrete unit. | |
| void | initialize (const double &_l1, const int &_emode, const UnitParametersMap ¶ms) |
| Initialize the unit to perform conversion using singleToTof() and singleFromTof() | |
| virtual bool | isConvertible () const |
| Returns if the unit can be used in conversions. | |
| bool | isInitialized () const |
| bool | operator!= (const Unit &u) const |
| bool | operator== (const Unit &u) const |
| bool | quickConversion (const Unit &destination, double &factor, double &power) const |
| Is conversion by constant multiplication possible? | |
| bool | quickConversion (std::string destUnitName, double &factor, double &power) const |
| Is conversion by constant multiplication possible? | |
| void | toTOF (std::vector< double > &xdata, std::vector< double > const &ydata, const double &_l1, const int &_emode, const UnitParametersMap ¶ms) |
| void | toTOF (std::vector< double > &xdata, std::vector< double > const &ydata, const double &_l1, const int &_emode, std::initializer_list< std::pair< const UnitParams, double > > params) |
| Convert from the concrete unit to time-of-flight. | |
| Unit () | |
| (Empty) Constructor | |
| virtual | ~Unit ()=default |
| Virtual destructor. | |
Protected Member Functions | |
| void | validateUnitParams (const int emode, const UnitParametersMap ¶ms) override |
Protected Member Functions inherited from Mantid::Kernel::Unit | |
| void | addConversion (std::string to, const double &factor, const double &power=1.0) const |
| Add a 'quick conversion' from the unit class on which this method is called. | |
Protected Attributes | |
| double | difa |
| double | difc |
| std::string | toDSpacingError |
| double | tzero |
Protected Attributes inherited from Mantid::Kernel::Unit | |
| int | emode |
| emode :: The energy mode (0=elastic, 1=direct geometry, 2=indirect geometry) | |
| bool | initialized |
| The unit values have been initialized. | |
| double | l1 |
| l1 :: The source-sample distance (in metres) | |
| const UnitParametersMap * | m_params |
| additional parameters l2 :: distance from sample to detector (in metres) twoTheta :: scattering angle in radians efixed :: Value of fixed energy: EI (emode=1) or EF (emode=2) (in meV) difc :: diffractometer constant DIFC | |
| Mantid::Kernel::Units::dSpacing::dSpacing | ( | ) |
| double Mantid::Kernel::Units::dSpacing::calcTofMax | ( | const double | difc, |
| const double | difa, | ||
| const double | tzero, | ||
| const double | tofmax = 0. |
||
| ) |
Definition at line 782 of file Unit.cpp.
References conversionTOFMax(), Mantid::Kernel::difa, difa, Mantid::Kernel::difc, difc, Mantid::Kernel::Unit::initialize(), Mantid::Kernel::tzero, and tzero.
Referenced by Mantid::Algorithms::PDCalibration::getTOFminmax(), and Mantid::DataHandling::LoadDiffCal::makeCalWorkspace().
| double Mantid::Kernel::Units::dSpacing::calcTofMin | ( | const double | difc, |
| const double | difa, | ||
| const double | tzero, | ||
| const double | tofmin = 0. |
||
| ) |
Definition at line 775 of file Unit.cpp.
References conversionTOFMin(), Mantid::Kernel::difa, difa, Mantid::Kernel::difc, difc, Mantid::Kernel::Unit::initialize(), Mantid::Kernel::tzero, and tzero.
Referenced by Mantid::Algorithms::PDCalibration::getTOFminmax(), and Mantid::DataHandling::LoadDiffCal::makeCalWorkspace().
|
inlineoverridevirtual |
|
overridevirtual |
Implements Mantid::Kernel::Unit.
Definition at line 615 of file Unit.cpp.
References dSpacing().
|
overridevirtual |
This function returns maximal TOF value still reversibly convertible into the unit.
Implements Mantid::Kernel::Unit.
Definition at line 761 of file Unit.cpp.
References difa, difc, singleToTOF(), and tzero.
Referenced by calcTofMax().
|
overridevirtual |
some units can be converted from TOF only in the range of TOF ; This function returns minimal TOF value still reversibly convertible into the unit.
Implements Mantid::Kernel::Unit.
Definition at line 746 of file Unit.cpp.
References difa, difc, singleToTOF(), and tzero.
Referenced by calcTofMin().
|
overridevirtual |
Finalize the initialization.
This will be overridden by subclasses as needed.
Implements Mantid::Kernel::Unit.
Definition at line 642 of file Unit.cpp.
References Mantid::Kernel::difa, difa, Mantid::Kernel::difc, difc, Mantid::Kernel::DateAndTimeHelpers::g_log, Mantid::Kernel::Unit::l1, Mantid::Kernel::l2, Mantid::Kernel::Unit::m_params, Mantid::Kernel::Units::tofToDSpacingFactor(), Mantid::Kernel::twoTheta, Mantid::Kernel::tzero, tzero, and Mantid::Kernel::Logger::warning().
|
overridevirtual |
A label for the unit to be printed on axes,.
Implements Mantid::Kernel::Unit.
Definition at line 613 of file Unit.cpp.
References Mantid::Kernel::Units::Symbol::Angstrom.
|
overridevirtual |
DIFA * d^2 + DIFC * d + T0 - TOF = 0.
Use the citardauq formula to solve quadratic in order to minimise loss of precision. citardauq (quadratic spelled backwards) is an alternate formulation of the quadratic formula. DIFC and sqrt term are often similar and the "classic" quadratic formula involves calculating their difference in the numerator
2*(T0 - TOF) (T0 - TOF)
d = ----------------------------------------— = ------------------------------------------------— -DIFC -+ SQRT(DIFC^2 - 4*DIFA*(T0 - TOF)) 0.5 * DIFC (-1 -+ SQRT(1 - 4*DIFA*(T0 - TOF)/DIFC^2)
the variables in this formulation are the same as the quadratic formula a = difa square term b = DIFC linear term - assumed to be positive c = T0 - TOF constant term
Implements Mantid::Kernel::Unit.
Definition at line 696 of file Unit.cpp.
References difa, difc, Mantid::Kernel::Unit::isInitialized(), toDSpacingError, and tzero.
Referenced by Mantid::Algorithms::PDCalibration::exec().
|
overridevirtual |
Convert a single X value to TOF.
| x | value to convert |
Implements Mantid::Kernel::Unit.
Definition at line 670 of file Unit.cpp.
References difa, difc, Mantid::Kernel::Unit::isInitialized(), tzero, and Mantid::Geometry::x.
Referenced by conversionTOFMax(), and conversionTOFMin().
|
overridevirtual |
|
overrideprotectedvirtual |
Reimplemented from Mantid::Kernel::Unit.
Definition at line 617 of file Unit.cpp.
References Mantid::Kernel::difa, Mantid::Kernel::difc, Mantid::Kernel::l2, toDSpacingError, Mantid::Kernel::twoTheta, and unitID().
|
protected |
Definition at line 371 of file Unit.h.
Referenced by calcTofMax(), calcTofMin(), conversionTOFMax(), conversionTOFMin(), init(), singleFromTOF(), and singleToTOF().
|
protected |
Definition at line 372 of file Unit.h.
Referenced by calcTofMax(), calcTofMin(), conversionTOFMax(), conversionTOFMin(), init(), singleFromTOF(), and singleToTOF().
|
protected |
Definition at line 370 of file Unit.h.
Referenced by singleFromTOF(), and validateUnitParams().
|
protected |
Definition at line 373 of file Unit.h.
Referenced by calcTofMax(), calcTofMin(), conversionTOFMax(), conversionTOFMin(), init(), singleFromTOF(), and singleToTOF().