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


C++ IDetector_const_sptr::getRotation方法代码示例

本文整理汇总了C++中geometry::IDetector_const_sptr::getRotation方法的典型用法代码示例。如果您正苦于以下问题:C++ IDetector_const_sptr::getRotation方法的具体用法?C++ IDetector_const_sptr::getRotation怎么用?C++ IDetector_const_sptr::getRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在geometry::IDetector_const_sptr的用法示例。


在下文中一共展示了IDetector_const_sptr::getRotation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: detRadius

/**
 * This function calculates the exponential contribution to the He3 tube
 * efficiency.
 * @param spectraIndex :: the current index to calculate
 * @param idet :: the current detector pointer
 * @throw out_of_range if twice tube thickness is greater than tube diameter
 * @return the exponential contribution for the given detector
 */
double He3TubeEfficiency::calculateExponential(std::size_t spectraIndex, Geometry::IDetector_const_sptr idet)
{
  // Get the parameters for the current associated tube
  double pressure = this->getParameter("TubePressure", spectraIndex,
      "tube_pressure", idet);
  double tubethickness = this->getParameter("TubeThickness", spectraIndex,
      "tube_thickness", idet);
  double temperature = this->getParameter("TubeTemperature", spectraIndex,
      "tube_temperature", idet);

  double detRadius(0.0);
  Kernel::V3D detAxis;
  this->getDetectorGeometry(idet, detRadius, detAxis);
  double detDiameter = 2.0 * detRadius;
  double twiceTubeThickness = 2.0 * tubethickness;

  // now get the sin of the angle, it's the magnitude of the cross product of
  // unit vector along the detector tube axis and a unit vector directed from
  // the sample to the detector center
  Kernel::V3D vectorFromSample = idet->getPos() - this->samplePos;
  vectorFromSample.normalize();
  Kernel::Quat rot = idet->getRotation();
  // rotate the original cylinder object axis to get the detector axis in the
  // actual instrument
  rot.rotate(detAxis);
  detAxis.normalize();
  // Scalar product is quicker than cross product
  double cosTheta = detAxis.scalar_prod(vectorFromSample);
  double sinTheta = std::sqrt(1.0 - cosTheta * cosTheta);

  const double straight_path = detDiameter - twiceTubeThickness;
  if (std::fabs(straight_path - 0.0) < TOL)
  {
    throw std::out_of_range("Twice tube thickness cannot be greater than "\
        "or equal to the tube diameter");
  }

  const double pathlength = straight_path / sinTheta;
  return EXP_SCALAR_CONST * (pressure / temperature) * pathlength;
}
开发者ID:,项目名称:,代码行数:48,代码来源:


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