Ejemplo n.º 1
0
/**
 * Getter for the masked state of the workspace.
 * @returns True if the detector/detector-group at the workspace index is
 * masked, or if there is no detector at that index.
*/
bool MatrixWorkspaceMDIterator::getIsMasked() const {
  Mantid::Geometry::IDetector_const_sptr det =
      m_ws->getDetector(m_workspaceIndex);
  if (det != nullptr) {
    return det->isMasked();
  } else {
    return true; // TODO. Check whether it's better to return true or false
                 // under these circumstances.
  }
}
Ejemplo n.º 2
0
/*
 * 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);
  }
}