28 throw(std::invalid_argument(
"Unknow or unsupported energy conversion mode"));
70 Coord[3] =
static_cast<coord_t>(deltaE);
75 double qx{0.0}, qy{0.0}, qz{0.0};
105 if (std::sqrt(Coord[0] * Coord[0] + Coord[1] * Coord[1] + Coord[2] * Coord[2]) <
m_AbsMin)
128 double &errSq)
const {
130 double qx = -
m_ex * k0;
131 double qy = -
m_ey * k0;
132 double qz = (1 -
m_ez) * k0;
153 if (std::sqrt(Coord[0] * Coord[0] + Coord[1] * Coord[1] + Coord[2] * Coord[2]) <
m_AbsMin)
158 double kdash = k0 / (2 * M_PI);
159 double correct =
m_SinThetaSq * kdash * kdash * kdash * kdash;
161 errSq *= (correct * correct);
170 std::vector<double> rez(2);
220 throw(std::runtime_error(
"The detectors have not been preprocessed but "
221 "they have to before running initialize"));
245 throw(std::runtime_error(
"MDTransfQ3D::initialize::Unknown or "
246 "unsupported energy conversion mode"));
251 auto &TwoTheta = ConvParams.
m_PreprDetTable->getColVector<
double>(
"TwoTheta");
253 for (
size_t i = 0; i < TwoTheta.size(); i++) {
254 double sth = sin(0.5 * TwoTheta[i]);
259 throw(std::runtime_error(
"MDTransfQ3D::initialize::Uninitilized "
260 "Sin(Theta)^2 array for calculating Lorentz "
281 std::vector<std::string> default_dim_ID;
284 default_dim_ID.resize(3);
289 default_dim_ID.resize(4);
290 default_dim_ID[3] =
"DeltaE";
294 throw(std::invalid_argument(
"MDTransfQ3D::getDefaultDimID::Unknown energy conversion mode"));
296 default_dim_ID[0] =
"Q1";
297 default_dim_ID[1] =
"Q2";
298 default_dim_ID[2] =
"Q3";
300 return default_dim_ID;
316 std::string kUnits(
"MomentumTransfer");
328 : m_isLorentzCorrected(false), m_SinThetaSqArray(nullptr), SinThetaSq(), m_SinThetaSq(0.), m_AbsMin(0.) {}
#define DECLARE_MD_TRANSFID(classname, regID)
#define UNUSED_ARG(x)
Function arguments are sometimes unused in certain implmentations but are required for documentation ...
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
std::vector< double > m_RotMat
Kernel::V3D const * m_DetDirecton
unsigned int m_NMatrixDim
std::vector< double > m_DimMin
std::vector< double > m_DimMax
Kernel::DeltaEMode::Type m_Emode
std::vector< coord_t > m_AddDimCoordinates
the vector of the additional coordinates which define additional MD dimensions.
Class responsible for conversion of input workspace data into proper number of output dimensions for ...
MDTransfQ3D()
constructor;
bool calcMatrixCoord(const double &deltaEOrK0, std::vector< coord_t > &Coord, double &s, double &err) const override
Calculates 3D transformation of the variable coordinates and (if applicable) signal and error dependi...
bool m_isLorentzCorrected
std::vector< double > SinThetaSq
bool calcMatrixCoord3DElastic(const double &k0, std::vector< coord_t > &Coord, double &signal, double &errSq) const
how to transform workspace data in elastic case
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 Q3D mode are Q1,Q2,Q3 and dE if necessary
double const * m_SinThetaSqArray
bool calcMatrixCoord3DInelastic(const double &deltaE, std::vector< coord_t > &Coord) const
how to transform workspace data in inelastic case
void initialize(const MDWSDescription &ConvParams) override
function initalizes all variables necessary for converting workspace variables into MD variables in M...
std::vector< double > getExtremumPoints(const double xMin, const double xMax, size_t det_num) const override
method returns the vector of input coordinates values where the transformed coordinates reach its ext...
bool calcYDepCoordinates(std::vector< coord_t > &Coord, size_t i) override
Method updates the value of preprocessed detector coordinates in Q-space, used by other functions.
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.
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.
helper class describes the properties of target MD workspace, which should be obtained as the result ...
bool isLorentsCorrections() const
check if one needs to perform Lorentz corrections
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)
const std::string Q3D("Q3D")
Only convert to Q-vector.
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,...
Defines the possible energy transfer modes:
Type
Define the available energy transfer modes It is important to assign enums proper numbers,...