本文整理汇总了C++中MDWSDescription::getGoniometerMatr方法的典型用法代码示例。如果您正苦于以下问题:C++ MDWSDescription::getGoniometerMatr方法的具体用法?C++ MDWSDescription::getGoniometerMatr怎么用?C++ MDWSDescription::getGoniometerMatr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDWSDescription
的用法示例。
在下文中一共展示了MDWSDescription::getGoniometerMatr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: has_lattice
/** The matrix to convert neutron momentums into the target coordinate system */
std::vector<double>
MDWSTransform::getTransfMatrix(MDWSDescription &TargWSDescription,
CnvrtToMD::TargetFrame FrameID,
CoordScaling &ScaleID) const {
Kernel::Matrix<double> mat(3, 3, true);
bool powderMode = TargWSDescription.isPowder();
bool has_lattice(true);
if (!TargWSDescription.hasLattice())
has_lattice = false;
if (!(powderMode || has_lattice)) {
std::string inWsName = TargWSDescription.getWSName();
// notice about 3D case without lattice
g_Log.notice()
<< "Can not obtain transformation matrix from the input workspace: "
<< inWsName << " as no oriented lattice has been defined. \n"
"Will use unit transformation matrix.\n";
}
// set the frame ID to the values, requested by properties
CnvrtToMD::TargetFrame CoordFrameID(FrameID);
if (FrameID == AutoSelect || powderMode) // if this value is auto-select, find
// appropriate frame from workspace
// properties
CoordFrameID = findTargetFrame(TargWSDescription);
else // if not, and specific target frame requested, verify if everything is
// available on the workspace for this frame
checkTargetFrame(
TargWSDescription,
CoordFrameID); // throw, if the information is not available
switch (CoordFrameID) {
case (CnvrtToMD::LabFrame): {
ScaleID = NoScaling;
TargWSDescription.m_Wtransf =
buildQTrahsf(TargWSDescription, ScaleID, true);
// ignore goniometer
mat = TargWSDescription.m_Wtransf;
break;
}
case (CnvrtToMD::SampleFrame): {
ScaleID = NoScaling;
TargWSDescription.m_Wtransf =
buildQTrahsf(TargWSDescription, ScaleID, true);
// Obtain the transformation matrix to Cartesian related to Crystal
mat = TargWSDescription.getGoniometerMatr() * TargWSDescription.m_Wtransf;
break;
}
case (CnvrtToMD::HKLFrame): {
TargWSDescription.m_Wtransf =
buildQTrahsf(TargWSDescription, ScaleID, false);
// Obtain the transformation matrix to Cartesian related to Crystal
if (TargWSDescription.hasGoniometer())
mat = TargWSDescription.getGoniometerMatr() * TargWSDescription.m_Wtransf;
else
mat = TargWSDescription.m_Wtransf;
break;
}
default:
throw(std::invalid_argument(" Unknown or undefined Target Frame ID"));
}
//
// and this is the transformation matrix to notional
mat.Invert();
std::vector<double> rotMat = mat.getVector();
g_Log.debug()
<< " *********** Q-transformation matrix ***********************\n";
g_Log.debug()
<< "*** *qx ! *qy ! *qz !\n";
g_Log.debug() << "q1= " << rotMat[0] << " ! " << rotMat[1] << " ! "
<< rotMat[2] << " !\n";
g_Log.debug() << "q2= " << rotMat[3] << " ! " << rotMat[4] << " ! "
<< rotMat[5] << " !\n";
g_Log.debug() << "q3= " << rotMat[6] << " ! " << rotMat[7] << " ! "
<< rotMat[8] << " !\n";
g_Log.debug()
<< " *********** *********************** ***********************\n";
return rotMat;
}