diff --git a/Device/Detector/Detector2D.cpp b/Device/Detector/Detector2D.cpp index 2f70115a63f6bef20563e93ed28275d3c4f907d7..207e3c667f3872ce26b08ade1e73d8303f5a49d4 100644 --- a/Device/Detector/Detector2D.cpp +++ b/Device/Detector/Detector2D.cpp @@ -70,12 +70,12 @@ size_t OldDetec2D::indexOfSpecular(const Beam& beam) const NewDetec2D::NewDetec2D(double phi_full_width, double alpha_full_width, size_t n_phi, size_t n_alpha, - double center_phi, double center_alpha) + double phi_center, double alpha_center) : IDetector( - new Frame(newEquiDivision("phi_f (rad)", n_phi, center_phi - phi_full_width / 2, - center_phi + phi_full_width / 2), - newEquiDivision("alpha_f (rad)", n_alpha, center_alpha - alpha_full_width / 2, - center_alpha + alpha_full_width / 2))) + new Frame(newEquiDivision("phi_f (rad)", n_phi, phi_center - phi_full_width / 2, + phi_center + phi_full_width / 2), + newEquiDivision("alpha_f (rad)", n_alpha, alpha_center - alpha_full_width / 2, + alpha_center + alpha_full_width / 2))) { ASSERT(-pi / 2 < axis(0).min() && axis(0).max() < +pi / 2); ASSERT(-pi / 2 < axis(1).min() && axis(1).max() < +pi / 2); diff --git a/Tests/Unit/Device/Detector2DTest.cpp b/Tests/Unit/Device/Detector2DTest.cpp index 092831a2925c629a28a87ecb1ac83ceab4fb5e5c..f9c901d9eb90a0139cbf4b7766761677e68d9baa 100644 --- a/Tests/Unit/Device/Detector2DTest.cpp +++ b/Tests/Unit/Device/Detector2DTest.cpp @@ -16,9 +16,9 @@ using Units::deg; // Construction of the detector via classical constructor. -TEST(OldDetec2DTest, constructionWithParameters) +TEST(Detector2DTest, constructionWithParameters) { - OldDetec2D detector(10, -1 * deg, 1 * deg, 20, 0 * deg, 2 * deg); + NewDetec2D detector(2 * deg, 2 * deg, 10, 20, 0, 1 * deg); EXPECT_EQ(10u, detector.axis(0).size()); EXPECT_EQ(-1 * deg, detector.axis(0).min()); EXPECT_EQ(1 * deg, detector.axis(0).max()); @@ -28,9 +28,9 @@ TEST(OldDetec2DTest, constructionWithParameters) } // Creation of the detector map with axes in given units -TEST(OldDetec2DTest, createDetectorMap) +TEST(Detector2DTest, createDetectorMap) { - OldDetec2D detector(10, -1 * deg, 1 * deg, 20, 0, 2 * deg); + NewDetec2D detector(2 * deg, 2 * deg, 10, 20, 0, 1 * deg); // creating map in default units, which are radians and checking axes auto data = detector.createDetectorMap(); @@ -43,9 +43,9 @@ TEST(OldDetec2DTest, createDetectorMap) } // Testing region of interest. -TEST(OldDetec2DTest, regionOfInterest) +TEST(Detector2DTest, regionOfInterest) { - OldDetec2D detector(8, -3 * deg, 5 * deg, 4, 0, 4 * deg); + NewDetec2D detector(8 * deg, 4 * deg, 6, 4, 2 * deg, 2 * deg); // creating region of interest double xlow(-2 * deg), ylow(1 * deg), xup(4 * deg), yup(3 * deg); @@ -66,9 +66,9 @@ TEST(OldDetec2DTest, regionOfInterest) } // Create detector map in the presence of region of interest. -TEST(OldDetec2DTest, regionOfInterestAndDetectorMap) +TEST(Detector2DTest, regionOfInterestAndDetectorMap) { - OldDetec2D detector(6, -1 * deg, 5 * deg, 4, 0 * deg, 4 * deg); + NewDetec2D detector(8 * deg, 4 * deg, 6, 4, 2 * deg, 2 * deg); detector.setRegionOfInterest(0.1 * deg, 1.1 * deg, 2.999 * deg, 2.9 * deg); // Creating map in default units, which are radians and checking that axes are clipped @@ -82,9 +82,9 @@ TEST(OldDetec2DTest, regionOfInterestAndDetectorMap) } // Checking clone in the presence of ROI and masks. -TEST(OldDetec2DTest, Clone) +TEST(Detector2DTest, Clone) { - OldDetec2D detector(6, -1 * deg, 5 * deg, 4, 0, 4 * deg); + NewDetec2D detector(8 * deg, 4 * deg, 6, 4, 2 * deg, 2 * deg); detector.setRegionOfInterest(0.1 * deg, 1.1 * deg, 3.9 * deg, 2.9 * deg); detector.addMask(Rectangle(-0.9 * deg, 0.1 * deg, 0.9 * deg, 1.9 * deg), true); detector.addMask(Rectangle(3.1 * deg, 2.1 * deg, 4.9 * deg, 3.9 * deg), true); @@ -93,7 +93,7 @@ TEST(OldDetec2DTest, Clone) std::vector<size_t> indexes1 = detector.activeIndices(); - std::unique_ptr<OldDetec2D> clone(detector.clone()); + std::unique_ptr<NewDetec2D> clone(detector.clone()); auto data = clone->createDetectorMap(); EXPECT_EQ(data.axis(0).size(), 4u); diff --git a/Tests/Unit/Device/RegionOfInterestTest.cpp b/Tests/Unit/Device/RegionOfInterestTest.cpp index d3d64a34655c784218fd20505777a40b5cc5ae3b..94ebd7af6898c9633afca7e338027bab7cb1f280 100644 --- a/Tests/Unit/Device/RegionOfInterestTest.cpp +++ b/Tests/Unit/Device/RegionOfInterestTest.cpp @@ -13,7 +13,7 @@ using Units::deg; TEST(RegionOfInterestTest, constructor) { - OldDetec2D detector(8, -3 * deg, 5 * deg, 4, 0, 4 * deg); + NewDetec2D detector(8 * deg, 4 * deg, 8, 4, 1 * deg, 2 * deg); // creating region of interest double xlow(-1.9 * deg), ylow(1.1 * deg), xup(2.9 * deg), yup(2.85 * deg); @@ -38,7 +38,7 @@ TEST(RegionOfInterestTest, constructor) TEST(RegionOfInterestTest, largeArea) { - OldDetec2D detector(8, -3 * deg, 5 * deg, 4, 0, 4 * deg); + NewDetec2D detector(8 * deg, 4 * deg, 8, 4, 1 * deg, 2 * deg); // creating region of interest double xlow(-3.9 * deg), ylow(-1.1 * deg), xup(6.9 * deg), yup(5.85 * deg); @@ -59,13 +59,13 @@ TEST(RegionOfInterestTest, largeArea) TEST(RegionOfInterestTest, clone) { - OldDetec2D detector(8, -3 * deg, 5 * deg, 4, 0, 4 * deg); + NewDetec2D detector(8 * deg, 4 * deg, 8, 4, 1 * deg, 2 * deg); // creating region of interest double xlow(-1.9 * deg), ylow(1.1 * deg), xup(2.9 * deg), yup(2.85 * deg); detector.setRegionOfInterest(xlow, ylow, xup, yup); - std::unique_ptr<OldDetec2D> clone(detector.clone()); + std::unique_ptr<NewDetec2D> clone(detector.clone()); EXPECT_EQ(clone->regionOfInterestBounds(0).first, xlow); EXPECT_EQ(clone->regionOfInterestBounds(0).second, xup);