本文整理汇总了C++中api::MatrixWorkspace_sptr::detectorTwoTheta方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixWorkspace_sptr::detectorTwoTheta方法的具体用法?C++ MatrixWorkspace_sptr::detectorTwoTheta怎么用?C++ MatrixWorkspace_sptr::detectorTwoTheta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api::MatrixWorkspace_sptr
的用法示例。
在下文中一共展示了MatrixWorkspace_sptr::detectorTwoTheta方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/** Convert X axis to Elastic Q representation
* @param progress :: Progress indicator
* @param targetUnit :: Target conversion unit
* @param inputWS :: Input workspace
* @param nHist :: Stores the number of histograms
*/
void ConvertSpectrumAxis2::createElasticQMap(API::Progress &progress,
const std::string &targetUnit,
API::MatrixWorkspace_sptr &inputWS,
size_t nHist) {
IComponent_const_sptr source = inputWS->getInstrument()->getSource();
IComponent_const_sptr sample = inputWS->getInstrument()->getSample();
const std::string emodeStr = getProperty("EMode");
int emode = 0;
if (emodeStr == "Direct")
emode = 1;
else if (emodeStr == "Indirect")
emode = 2;
for (size_t i = 0; i < nHist; i++) {
IDetector_const_sptr detector = inputWS->getDetector(i);
double twoTheta(0.0), efixed(0.0);
if (!detector->isMonitor()) {
twoTheta = 0.5 * inputWS->detectorTwoTheta(*detector);
efixed = getEfixed(detector, inputWS, emode); // get efixed
} else {
twoTheta = 0.0;
efixed = DBL_MIN;
}
// Convert to MomentumTransfer
double elasticQInAngstroms = Kernel::UnitConversion::run(twoTheta, efixed);
if (targetUnit == "ElasticQ") {
m_indexMap.emplace(elasticQInAngstroms, i);
} else if (targetUnit == "ElasticQSquared") {
// The QSquared value.
double elasticQSquaredInAngstroms =
elasticQInAngstroms * elasticQInAngstroms;
m_indexMap.emplace(elasticQSquaredInAngstroms, i);
}
progress.report("Converting to Elastic Q...");
}
}