29 throw(std::invalid_argument(
"Unknow or unsupported energy conversion mode"));
71 Coord[3] =
static_cast<coord_t>(deltaE);
75 double qx{0.0}, qy{0.0}, qz{0.0};
114 double &errSq)
const {
116 double qx = -
m_ex * k0;
117 double qy = -
m_ey * k0;
118 double qz = (1 -
m_ez) * k0;
128 double kdash = k0 / (2 * M_PI);
129 double correct =
m_SinThetaSq * kdash * kdash * kdash * kdash;
131 errSq *= (correct * correct);
141 std::vector<double> rez(2);
185 convention = Kernel::ConfigService::Instance().getString(
"Q.convention");
192 throw(std::runtime_error(
"The detectors have not been preprocessed but "
193 "they have to before running initialize"));
217 throw(std::runtime_error(
"MDTransfQ3D::initialize::Unknown or "
218 "unsupported energy conversion mode"));
223 auto &TwoTheta = ConvParams.
m_PreprDetTable->getColVector<
double>(
"TwoTheta");
225 for (
size_t i = 0; i < TwoTheta.size(); i++) {
226 double sth = sin(0.5 * TwoTheta[i]);
231 throw(std::runtime_error(
"MDTransfQ3D::initialize::Uninitilized "
232 "Sin(Theta)^2 array for calculating Lorentz "
253 std::vector<std::string> default_dim_ID;
256 default_dim_ID.resize(3);
261 default_dim_ID.resize(4);
262 default_dim_ID[3] =
"DeltaE";
266 throw(std::invalid_argument(
"MDTransfQ3D::getDefaultDimID::Unknown energy conversion mode"));
268 default_dim_ID[0] =
"Q1";
269 default_dim_ID[1] =
"Q2";
270 default_dim_ID[2] =
"Q3";
272 return default_dim_ID;
288 std::string kUnits(
"MomentumTransfer");
299 std::array<coord_t, 3> coord{};
305 for (
auto i = 0; i < 3; i++) {
315 if (std::sqrt(Coord[0] * Coord[0] + Coord[1] * Coord[1] + Coord[2] * Coord[2]) <
m_AbsMin) {
324 : 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 ...
std::vector< double > m_RotMat
Kernel::V3D const * m_DetDirecton
unsigned int m_NMatrixDim
void calcMatrixCoordLinSys(double qx, double qy, double qz, std::array< coord_t, 3 > &Coord) const
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 calcMatrixCoord3DElastic(const double k0, std::vector< coord_t > &Coord, double &signal, double &errSq) const
how to transform workspace data in elastic case
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
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
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.
bool calcMatrixCoord3DInelastic(const double deltaE, std::vector< coord_t > &Coord) const
how to transform workspace data in inelastic case
bool calcMatrixCoord3D(double qx, double qy, double qz, std::vector< coord_t > &Coord) const
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,...