本文整理汇总了C++中MDWSDescription::getTransfMatrix方法的典型用法代码示例。如果您正苦于以下问题:C++ MDWSDescription::getTransfMatrix方法的具体用法?C++ MDWSDescription::getTransfMatrix怎么用?C++ MDWSDescription::getTransfMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDWSDescription
的用法示例。
在下文中一共展示了MDWSDescription::getTransfMatrix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: throw
/** function initalizes all variables necessary for converting workspace
* variables into MD variables in ModQ (elastic/inelastic) cases */
void MDTransfQ3D::initialize(const MDWSDescription &ConvParams) {
m_pEfixedArray = NULL;
m_pDetMasks = NULL;
//********** Generic part of initialization, common for elastic and inelastic
// modes:
// get transformation matrix (needed for CrystalAsPoder mode)
m_RotMat = ConvParams.getTransfMatrix();
if (!ConvParams.m_PreprDetTable)
throw(std::runtime_error("The detectors have not been preprocessed but "
"they have to before running initialize"));
// get pointer to the positions of the preprocessed detectors
std::vector<Kernel::V3D> const &DetDir =
ConvParams.m_PreprDetTable->getColVector<Kernel::V3D>("DetDirections");
m_DetDirecton = &DetDir[0]; //
// get min and max values defined by the algorithm.
ConvParams.getMinMax(m_DimMin, m_DimMax);
// get additional coordinates which are
m_AddDimCoordinates = ConvParams.getAddCoord();
//************ specific part of the initialization, dependent on emode:
m_Emode = ConvParams.getEMode();
m_NMatrixDim = getNMatrixDimensions(m_Emode);
if (m_Emode == Kernel::DeltaEMode::Direct ||
m_Emode == Kernel::DeltaEMode::Indirect) {
// energy needed in inelastic case
m_Ei =
ConvParams.m_PreprDetTable->getLogs()->getPropertyValueAsType<double>(
"Ei");
// the wave vector of incident neutrons;
m_Ki = sqrt(m_Ei / PhysicalConstants::E_mev_toNeutronWavenumberSq);
m_pEfixedArray = NULL;
if (m_Emode == (int)Kernel::DeltaEMode::Indirect)
m_pEfixedArray =
ConvParams.m_PreprDetTable->getColDataArray<float>("eFixed");
} else {
if (m_Emode != Kernel::DeltaEMode::Elastic)
throw(std::runtime_error("MDTransfQ3D::initialize::Unknown or "
"unsupported energy conversion mode"));
// check if we need to calculate Lorentz corrections and if we do, prepare
// values for their precalculation:
m_isLorentzCorrected = ConvParams.isLorentsCorrections();
if (m_isLorentzCorrected) {
auto &TwoTheta =
ConvParams.m_PreprDetTable->getColVector<double>("TwoTheta");
SinThetaSq.resize(TwoTheta.size());
for (size_t i = 0; i < TwoTheta.size(); i++) {
double sth = sin(0.5 * TwoTheta[i]);
SinThetaSq[i] = sth * sth;
}
m_SinThetaSqArray = &SinThetaSq[0];
if (!m_SinThetaSqArray)
throw(std::runtime_error("MDTransfQ3D::initialize::Uninitilized "
"Sin(Theta)^2 array for calculating Lorentz "
"corrections"));
}
}
// use detectors masks untill signals are masked by 0 instead of NaN
m_pDetMasks = ConvParams.m_PreprDetTable->getColDataArray<int>("detMask");
}
示例2: initialize
/** function initializes all variables necessary for converting workspace
* variables into MD variables in ModQ (elastic/inelastic) cases */
void MDTransfModQ::initialize(const MDWSDescription &ConvParams) {
//********** Generic part of initialization, common for elastic and inelastic
// modes:
// pHost = &Conv;
// get transformation matrix (needed for CrystalAsPoder mode)
m_RotMat = ConvParams.getTransfMatrix();
m_pEfixedArray = nullptr;
if (!ConvParams.m_PreprDetTable)
throw(std::runtime_error("The detectors have not been preprocessed but "
"they have to before running initialize"));
// get pointer to the positions of the detectors
std::vector<Kernel::V3D> const &DetDir =
ConvParams.m_PreprDetTable->getColVector<Kernel::V3D>("DetDirections");
m_DetDirecton = &DetDir[0]; //
// get min and max values defined by the algorithm.
ConvParams.getMinMax(m_DimMin, m_DimMax);
// m_DimMin/max here are momentums and they are verified on momentum squared
// base
if (m_DimMin[0] < 0)
m_DimMin[0] = 0;
if (m_DimMax[0] < 0)
m_DimMax[0] = 0;
// m_DimMin here is a momentum and it is verified on momentum squared base
m_DimMin[0] *= m_DimMin[0];
m_DimMax[0] *= m_DimMax[0];
if (std::fabs(m_DimMin[0] - m_DimMax[0]) < FLT_EPSILON ||
m_DimMax[0] < m_DimMin[0]) {
std::string ERR = "ModQ coordinate transformation: Min Q^2 value: " +
boost::lexical_cast<std::string>(m_DimMin[0]) +
" is more or equal then Max Q^2 value: " +
boost::lexical_cast<std::string>(m_DimMax[0]);
throw(std::invalid_argument(ERR));
}
m_AddDimCoordinates = ConvParams.getAddCoord();
//************ specific part of the initialization, dependent on emode:
m_Emode = ConvParams.getEMode();
m_NMatrixDim = getNMatrixDimensions(m_Emode);
if (m_Emode == Kernel::DeltaEMode::Direct ||
m_Emode == Kernel::DeltaEMode::Indirect) {
// energy needed in inelastic case
volatile double Ei =
ConvParams.m_PreprDetTable->getLogs()->getPropertyValueAsType<double>(
"Ei");
m_Ei = Ei;
if (Ei !=
m_Ei) // Ei is NaN, try Efixed, but the value should be overridden later
{
try {
m_Ei = ConvParams.m_PreprDetTable->getLogs()
->getPropertyValueAsType<double>("eFixed");
} catch (...) {
}
}
// the wave vector of incident neutrons;
m_Ki = sqrt(m_Ei / PhysicalConstants::E_mev_toNeutronWavenumberSq);
m_pEfixedArray = nullptr;
if (m_Emode == static_cast<int>(Kernel::DeltaEMode::Indirect))
m_pEfixedArray =
ConvParams.m_PreprDetTable->getColDataArray<float>("eFixed");
} else if (m_Emode != Kernel::DeltaEMode::Elastic)
throw(std::invalid_argument(
"MDTransfModQ::initialize::Unknown energy conversion mode"));
m_pDetMasks = ConvParams.m_PreprDetTable->getColDataArray<int>("detMask");
}