当前位置: 首页>>代码示例>>C++>>正文


C++ Instrument_const_sptr::getDetectorIDs方法代码示例

本文整理汇总了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.");
  }
}
开发者ID:mkoennecke,项目名称:mantid,代码行数:17,代码来源:FakeMDEventData.cpp

示例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);
  }
}
开发者ID:mcvine,项目名称:mantid,代码行数:29,代码来源:IntegrateEllipsoids.cpp


注:本文中的geometry::Instrument_const_sptr::getDetectorIDs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。