34 throw(std::invalid_argument(
" MDTransfModQ::inputUnitID: this class "
35 "supports only conversion in Elastic and "
36 "Inelastic energy transfer modes"));
57 throw(std::invalid_argument(
"Unknown or unsupported energy conversion mode"));
77 double &ErrSq)
const {
102 " not equal to number of workspace dimensions: " +
std::to_string(nd);
103 throw(std::invalid_argument(ERR));
164 Coord[1] =
static_cast<coord_t>(deltaE);
167 double qx{0.0}, qy{0.0}, qz{0.0};
186 double Qsq = Qx * Qx + Qy * Qy + Qz * Qz;
189 Coord[0] =
static_cast<coord_t>(sqrt(Qsq));
209 double qx = -
m_ex * k0;
210 double qy = -
m_ey * k0;
211 double qz = (1 -
m_ez) * k0;
218 double Qsq = Qx * Qx + Qy * Qy + Qz * Qz;
221 Coord[0] =
static_cast<coord_t>(sqrt(Qsq));
235 std::vector<double> rez(2);
249 double eps_extr = ei * (1 - ez * ez);
250 if (eps_extr > eMin && eps_extr < eMax) {
262 throw std::invalid_argument(
"Undefined or unsupported energy conversion mode ");
277 throw(std::runtime_error(
"The detectors have not been preprocessed but "
278 "they have to before running initialize"));
298 "ModQ coordinate transformation: Min Q^2 value: " + boost::lexical_cast<std::string>(
m_DimMin[0]) +
299 " is more or equal then Max Q^2 value: " + boost::lexical_cast<std::string>(
m_DimMax[0]);
300 throw(std::invalid_argument(ERR));
309 volatile auto Ei = ConvParams.
m_PreprDetTable->getLogs()->getPropertyValueAsType<
double>(
"Ei");
326 throw(std::invalid_argument(
"MDTransfModQ::initialize::Unknown energy conversion mode"));
344 std::vector<std::string> default_dim_ID;
347 default_dim_ID.resize(1);
352 default_dim_ID.resize(2);
353 default_dim_ID[1] =
"DeltaE";
357 throw(std::invalid_argument(
"MDTransfModQ::getDefaultDimID::Unknown energy conversion mode"));
359 default_dim_ID[0] =
"|Q|";
361 return default_dim_ID;
377 UnitID[0] =
"Momentum";
379 UnitID[0] =
"MomentumTransfer";
386 : m_ex(0), m_ey(0), m_ez(1), m_DetDirecton(nullptr),
389 m_kFixed(1.), m_eFixed(1.), m_pEfixedArray(nullptr), m_pDetMasks(nullptr) {}
402 setter(mdWorkspace, underlyingWorkspace, isQ,
m_Emode);
#define DECLARE_MD_TRANSFID(classname, regID)
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
DisplayNormalizationSetter: Sets the displaynormalization on a workspace based on several parameters ...
Class responsible for conversion of input workspace data into proper number of output dimensions for ...
void setDisplayNormalization(Mantid::API::IMDWorkspace_sptr mdWorkspace, Mantid::API::MatrixWorkspace_sptr underlyingWorkspace) const override
Set the display normalization for Q.
bool calcGenericVariables(std::vector< coord_t > &Coord, size_t nd) override
Method fills-in all additional properties requested by user and not defined by matrix workspace itsel...
MDTransfModQ()
constructor;
std::vector< double > m_RotMat
Kernel::V3D const * m_DetDirecton
unsigned int m_NMatrixDim
bool calcMatrixCoord(const double &deltaEOrK0, std::vector< coord_t > &Coord, double &signal, double &ErrSq) const override
Convert single point of matrix workspace into reciprocal space and (optionally) modify signal and err...
std::vector< double > m_DimMin
unsigned int getNMatrixDimensions(Kernel::DeltaEMode::Type mode, API::MatrixWorkspace_const_sptr inWS=API::MatrixWorkspace_const_sptr()) const override
return the number of dimensions, calculated by the transformation from the workspace.
std::vector< double > m_DimMax
Kernel::DeltaEMode::Type m_Emode
bool calcMatrixCoordElastic(const double &k0, std::vector< coord_t > &Coord) const
how to transform workspace data in elastic case
std::vector< std::string > getEmodes() const override
energy conversion modes supported by this class; The class supports three standard energy conversion ...
std::vector< std::string > outputUnitID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS=API::MatrixWorkspace_const_sptr()) const override
function returns units ID-s which this transformation prodiuces its ouptut.
std::vector< coord_t > m_AddDimCoordinates
the vector of the additional coordinates which define additional MD dimensions.
std::vector< std::string > getDefaultDimID(Kernel::DeltaEMode::Type dEmode, API::MatrixWorkspace_const_sptr inWS=API::MatrixWorkspace_const_sptr()) const override
the default dimID-s in ModQ mode are |Q| and dE if necessary
void initialize(const MDWSDescription &ConvParams) override
function initializes all variables necessary for converting workspace variables into MD variables in ...
std::vector< double > getExtremumPoints(const double eMin, const double eMax, size_t det_num) const override
method returns the vector of input coordinates values where the transformed coordinates reach its ext...
bool calcMatrixCoordInelastic(const double &deltaE, std::vector< coord_t > &Coord) const
how to transform workspace data in inelastic case
bool calcYDepCoordinates(std::vector< coord_t > &Coord, size_t i) override
Method updates the value of pre-processed detector coordinates in Q-space, used by other functions.
helper class describes the properties of target MD workspace, which should be obtained as the result ...
Kernel::DeltaEMode::Type getEMode() const
std::vector< coord_t > getAddCoord() const
void getMinMax(std::vector< double > &min, std::vector< double > &max) const
get vector of minimal and maximal values from the class
DataObjects::TableWorkspace_const_sptr m_PreprDetTable
std::vector< double > getTransfMatrix() const
std::shared_ptr< const MatrixWorkspace > MatrixWorkspace_const_sptr
shared pointer to the matrix workspace base class (const version)
std::shared_ptr< IMDWorkspace > IMDWorkspace_sptr
Shared pointer to the IMDWorkspace base class.
std::shared_ptr< MatrixWorkspace > MatrixWorkspace_sptr
shared pointer to the matrix workspace base class
static constexpr double E_mev_toNeutronWavenumberSq
Transformation coefficient to transform neutron energy into neutron wavevector: K-neutron[m^-10] = sq...
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
std::string to_string(const wide_integer< Bits, Signed > &n)
Defines the possible energy transfer modes:
static const std::vector< std::string > availableTypes()
Returns the string list of available modes.
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...