Example #1
0
/**
 *
 * @param detectorInfo A reference to the workspace's detector info
 * @param detIndex The index of the detector whose parameters should be updated
 * @param pmap A reference to the ParameterMap instance to update
 * @param l2 The new l2 value
 * @param theta The new theta value
 * @param phi The new phi value
 * @param delay The new delay time
 * @param pressure The new pressure value
 * @param thickness The new thickness value
 */
void LoadDetectorInfo::updateParameterMap(Geometry::DetectorInfo &detectorInfo,
                                          const size_t detIndex,
                                          Geometry::ParameterMap &pmap,
                                          const double l2, const double theta,
                                          const double phi, const double delay,
                                          const double pressure,
                                          const double thickness) const {

  const auto detCompID = detectorInfo.detector(detIndex).getComponentID();

  // store detector params that are different to instrument level
  if (fabs(delay - m_instDelta) > 1e-06)
    pmap.addDouble(detCompID, DELAY_PARAM, delay);
  if (fabs(pressure - m_instPressure) > 1e-06)
    pmap.addDouble(detCompID, PRESSURE_PARAM, pressure);
  if (fabs(thickness - m_instThickness) > 1e-06)
    pmap.addDouble(detCompID, THICKNESS_PARAM, thickness);

  // move
  if (m_moveDets) {
    V3D newPos;
    newPos.spherical(l2, theta, phi);
    // The sample position may not be at 0,0,0
    newPos += m_samplePos;
    detectorInfo.setPosition(detIndex, newPos);
  }
}
/**
 * Set the new detector position given the r,theta and phi.
 * @param detectorInfo :: Reference to the DetectorInfo
 * @param index :: Index into detectorInfo
 * @param l2 :: A single l2
 * @param theta :: A single theta
 * @param phi :: A single phi
 */
void UpdateInstrumentFromFile::setDetectorPosition(
    Geometry::DetectorInfo &detectorInfo, const size_t index, const float l2,
    const float theta, const float phi) {
  if (m_ignoreMonitors && detectorInfo.isMonitor(index))
    return;

  Kernel::V3D pos;
  pos.spherical(l2, theta, phi);
  detectorInfo.setPosition(index, pos);
}