diff --git a/Device/Detector/RectangularDetector.cpp b/Device/Detector/RectangularDetector.cpp index a5389d996939e4f8a36edf8c8d1231f71bbbb555..1f27c1f56e8071531492e32f70d68df36c7732c1 100644 --- a/Device/Detector/RectangularDetector.cpp +++ b/Device/Detector/RectangularDetector.cpp @@ -57,19 +57,19 @@ void RectangularDetector::setDetectorNormal(const R3& k) void RectangularDetector::setPerpendicularToSampleX(double distance, double u0, double v0) { - m_detector_arrangement = PERPENDICULAR_TO_SAMPLE; + m_detector_arrangement = X; setDistanceAndOffset(distance, u0, v0); } void RectangularDetector::setPerpendicularToDirectBeam(double distance, double u0, double v0) { - m_detector_arrangement = PERPENDICULAR_TO_DIRECT_BEAM; + m_detector_arrangement = T; setDistanceAndOffset(distance, u0, v0); } void RectangularDetector::setPerpendicularToReflectedBeam(double distance, double u0, double v0) { - m_detector_arrangement = PERPENDICULAR_TO_REFLECTED_BEAM; + m_detector_arrangement = R; setDistanceAndOffset(distance, u0, v0); } @@ -192,13 +192,13 @@ void RectangularDetector::initNormalVector(const R3 central_k) { R3 central_k_unit = central_k.unit_or_throw(); - if (m_detector_arrangement == PERPENDICULAR_TO_SAMPLE) + if (m_detector_arrangement == X) m_normal_to_detector = R3(m_distance, 0.0, 0.0); - else if (m_detector_arrangement == PERPENDICULAR_TO_DIRECT_BEAM) + else if (m_detector_arrangement == T) m_normal_to_detector = m_distance * central_k_unit; - else if (m_detector_arrangement == PERPENDICULAR_TO_REFLECTED_BEAM) { + else if (m_detector_arrangement == R) { m_normal_to_detector = m_distance * central_k_unit; m_normal_to_detector.setZ(-m_normal_to_detector.z()); } diff --git a/Device/Detector/RectangularDetector.h b/Device/Detector/RectangularDetector.h index 67070092cd68ec58cf1d1de45883c533c1c3769b..2c8fc43408388eaff027687d021b7d6c3e3c7c44 100644 --- a/Device/Detector/RectangularDetector.h +++ b/Device/Detector/RectangularDetector.h @@ -24,13 +24,7 @@ class RectangularPixel; class RectangularDetector : public IDetector { public: - enum DetectorPlacement { - GENERIC, - PERPENDICULAR_TO_SAMPLE, - PERPENDICULAR_TO_DIRECT_BEAM, - PERPENDICULAR_TO_REFLECTED_BEAM - }; - + enum DetectorPlacement { GENERIC, X, T, R }; //! Rectangular detector constructor //! @param nxbins Number of bins (pixels) in x-direction diff --git a/GUI/Model/Detector/RectangularDetectorItem.cpp b/GUI/Model/Detector/RectangularDetectorItem.cpp index 6ac64fe1a99685cea116c6013df3d5cd85dfa545..71d58cbecfa5d83522779e4d406085eba34eadfb 100644 --- a/GUI/Model/Detector/RectangularDetectorItem.cpp +++ b/GUI/Model/Detector/RectangularDetectorItem.cpp @@ -39,9 +39,9 @@ const double default_detector_distance = 1000.0; //! Holds the alignments as expected on the UI (map is sorted by keys) const QMap<RectangularDetector::DetectorPlacement, QString> alignment_names_map = { - {RectangularDetector::PERPENDICULAR_TO_SAMPLE, "Perpendicular to sample x-axis"}, - {RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM, "Perpendicular to direct beam"}, - {RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM, "Perpendicular to reflected beam"}}; + {RectangularDetector::X, "Perpendicular to sample x-axis"}, + {RectangularDetector::T, "Perpendicular to direct beam"}, + {RectangularDetector::R, "Perpendicular to reflected beam"}}; void initResolutionFunction(ResolutionFunctionItem* newFunc, const ResolutionFunctionItem*) { @@ -79,8 +79,7 @@ RectangularDetectorItem::RectangularDetectorItem() default_detector_distance, "mm", "distance"); m_detectorAlignment = ComboProperty::fromList( - alignment_names_map.values(), - alignment_names_map.value(RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM)); + alignment_names_map.values(), alignment_names_map.value(RectangularDetector::T)); updateTooltips(); } @@ -258,13 +257,13 @@ std::unique_ptr<IDetector> RectangularDetectorItem::createDomainDetector() const // distance and alignment switch (detectorAlignment()) { - case RectangularDetector::PERPENDICULAR_TO_SAMPLE: + case RectangularDetector::X: result->setPerpendicularToSampleX(m_distance, m_u0, m_v0); break; - case RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM: + case RectangularDetector::T: result->setPerpendicularToDirectBeam(m_distance, m_u0, m_v0); break; - case RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM: + case RectangularDetector::R: result->setPerpendicularToReflectedBeam(m_distance, m_u0, m_v0); break; default: @@ -277,15 +276,15 @@ std::unique_ptr<IDetector> RectangularDetectorItem::createDomainDetector() const void RectangularDetectorItem::updateTooltips() { switch (detectorAlignment()) { - case RectangularDetector::PERPENDICULAR_TO_SAMPLE: + case RectangularDetector::X: m_u0.setTooltip("u-coordinate of point where sample x-axis crosses the detector"); m_v0.setTooltip("v-coordinate of point where sample x-axis crosses the detector"); break; - case RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM: + case RectangularDetector::R: m_u0.setTooltip("u-coordinate of point where reflected beam hits the detector"); m_v0.setTooltip("v-coordinate of point where reflected beam hits the detector"); break; - case RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM: // fall-through! + case RectangularDetector::T: // fall-through! m_u0.setTooltip("u-coordinate of point where direct beam hits the detector"); m_v0.setTooltip("v-coordinate of point where direct beam hits the detector"); break; diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp index b3df13a43ce1f927ceee284de2d797eaceff0253..247861b582da325c098e88fda4b81031a3762f7c 100644 --- a/GUI/Model/FromCore/ItemizeSimulation.cpp +++ b/GUI/Model/FromCore/ItemizeSimulation.cpp @@ -263,17 +263,15 @@ void setRectangularDetector(RectangularDetectorItem* detectorItem, detectorItem->setV0(detector.getV0()); } - else if (detector.getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_SAMPLE) { + else if (detector.getDetectorArrangment() == RectangularDetector::X) { detectorItem->setDistance(detector.getDistance()); detectorItem->setU0(detector.getU0()); detectorItem->setV0(detector.getV0()); - } else if (detector.getDetectorArrangment() - == RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM) { + } else if (detector.getDetectorArrangment() == RectangularDetector::T) { detectorItem->setDistance(detector.getDistance()); detectorItem->setU0(detector.getU0()); detectorItem->setV0(detector.getV0()); - } else if (detector.getDetectorArrangment() - == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM) { + } else if (detector.getDetectorArrangment() == RectangularDetector::R) { detectorItem->setDistance(detector.getDistance()); detectorItem->setU0(detector.getU0()); detectorItem->setV0(detector.getV0()); diff --git a/GUI/View/Device/DetectorAlignmentForm.cpp b/GUI/View/Device/DetectorAlignmentForm.cpp index 8f9fd59a77bf837c250d76da0344c58e33c0fdcc..9399481ac06a69b448606dcc6d63697058ec46b3 100644 --- a/GUI/View/Device/DetectorAlignmentForm.cpp +++ b/GUI/View/Device/DetectorAlignmentForm.cpp @@ -22,11 +22,11 @@ namespace { QString alignmentDescription(RectangularDetector::DetectorPlacement a) { switch (a) { - case RectangularDetector::PERPENDICULAR_TO_SAMPLE: + case RectangularDetector::X: return "Intersection of sample x-axis and detector"; - case RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM: + case RectangularDetector::T: return "Intersection of direct beam and detector"; - case RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM: + case RectangularDetector::R: return "Intersection of reflected beam and detector"; default: ASSERT(false); diff --git a/Sim/Export/SimulationToPython.cpp b/Sim/Export/SimulationToPython.cpp index 70ec647e470c7dd7c2ecd77164e639418107ef3c..3b8de53c780ff71e98d63c81f4d7421c06c48deb 100644 --- a/Sim/Export/SimulationToPython.cpp +++ b/Sim/Export/SimulationToPython.cpp @@ -151,19 +151,17 @@ std::string defineDetector(const IDetector& detector) result << indent() << "detector = ba.RectangularDetector(" << det->xSize() << ", " << Py::Fmt::printDouble(det->width()) << ", " << det->ySize() << ", " << Py::Fmt::printDouble(det->height()) << ")\n"; - if (det->getDetectorArrangment() == RectangularDetector::PERPENDICULAR_TO_SAMPLE) { + if (det->getDetectorArrangment() == RectangularDetector::X) { result << indent() << "detector.setPerpendicularToSampleX(" << Py::Fmt::printDouble(det->getDistance()) << ", " << Py::Fmt::printDouble(det->getU0()) << ", " << Py::Fmt::printDouble(det->getV0()) << ")\n"; - } else if (det->getDetectorArrangment() - == RectangularDetector::PERPENDICULAR_TO_DIRECT_BEAM) { + } else if (det->getDetectorArrangment() == RectangularDetector::T) { result << indent() << "detector.setPerpendicularToDirectBeam(" << Py::Fmt::printDouble(det->getDistance()) << ", " << Py::Fmt::printDouble(det->getU0()) << ", " << Py::Fmt::printDouble(det->getV0()) << ")\n"; - } else if (det->getDetectorArrangment() - == RectangularDetector::PERPENDICULAR_TO_REFLECTED_BEAM) { + } else if (det->getDetectorArrangment() == RectangularDetector::R) { result << indent() << "detector.setPerpendicularToReflectedBeam(" << Py::Fmt::printDouble(det->getDistance()) << ", " << Py::Fmt::printDouble(det->getU0()) << ", "