本文整理汇总了C++中geometry::Instrument_const_sptr::getDetectorIDs方法的典型用法代码示例。如果您正苦于以下问题:C++ Instrument_const_sptr::getDetectorIDs方法的具体用法?C++ Instrument_const_sptr::getDetectorIDs怎么用?C++ Instrument_const_sptr::getDetectorIDs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geometry::Instrument_const_sptr
的用法示例。
在下文中一共展示了Instrument_const_sptr::getDetectorIDs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupDetectorCache
/**
* Setup a detector cache for randomly picking IDs from the first
* instrument in the ExperimentInfo list.
* @param ws :: The input workspace
*/
void FakeMDEventData::setupDetectorCache(const API::IMDEventWorkspace &ws) {
try {
Geometry::Instrument_const_sptr inst =
ws.getExperimentInfo(0)->getInstrument();
m_detIDs = inst->getDetectorIDs(true); // true=skip monitors
size_t max = m_detIDs.size() - 1;
m_uniformDist = boost::uniform_int<size_t>(0, max); // Includes max
} catch (std::invalid_argument &) {
g_log.information("Cannot retrieve instrument from input workspace, "
"detector information will be garbage.");
}
}
示例2:
/*
* Define edges for each instrument by masking. For CORELLI, tubes 1 and 16, and
*pixels 0 and 255.
* Get Q in the lab frame for every peak, call it C
* For every point on the edge, the trajectory in reciprocal space is a straight
*line, going through O=V3D(0,0,0).
* Calculate a point at a fixed momentum, say k=1. Q in the lab frame
*E=V3D(-k*sin(tt)*cos(ph),-k*sin(tt)*sin(ph),k-k*cos(ph)).
* Normalize E to 1: E=E*(1./E.norm())
*
* @param inst: instrument
*/
void IntegrateEllipsoids::calculateE1(Geometry::Instrument_const_sptr inst) {
std::vector<detid_t> detectorIDs = inst->getDetectorIDs();
for (auto &detectorID : detectorIDs) {
Mantid::Geometry::IDetector_const_sptr det = inst->getDetector(detectorID);
if (det->isMonitor())
continue; // skip monitor
if (!det->isMasked())
continue; // edge is masked so don't check if not masked
double tt1 = det->getTwoTheta(V3D(0, 0, 0), V3D(0, 0, 1)); // two theta
double ph1 = det->getPhi(); // phi
V3D E1 = V3D(-std::sin(tt1) * std::cos(ph1), -std::sin(tt1) * std::sin(ph1),
1. - std::cos(tt1)); // end of trajectory
E1 = E1 * (1. / E1.norm()); // normalize
E1Vec.push_back(E1);
}
}