v1.0.0-rc.103 #8

Merged
leonarski_f merged 12 commits from 2511-rc.103 into main 2025-11-19 09:40:50 +01:00
3 changed files with 48 additions and 16 deletions
Showing only changes of commit 7548c0f7f3 - Show all commits

View File

@@ -39,19 +39,33 @@ DetectorModuleGeometry::DetectorModuleGeometry(int64_t in_x0, int64_t in_y0,
int64_t DetectorModuleGeometry::GetMaxX() const {
if (fast == Direction::Xpos)
return x0 + fast_pixels - 1;
else if (slow == Direction::Xpos)
if (slow == Direction::Xpos)
return x0 + slow_pixels - 1;
else
return x0;
return x0;
}
int64_t DetectorModuleGeometry::GetMaxY() const {
if (fast == Direction::Ypos)
return y0 + fast_pixels - 1;
else if (slow == Direction::Ypos)
if (slow == Direction::Ypos)
return y0 + slow_pixels - 1;
else
return y0;
return y0;
}
int64_t DetectorModuleGeometry::GetMinX() const {
if (fast == Direction::Xneg)
return x0 - fast_pixels + 1;
if (slow == Direction::Xneg)
return x0 - slow_pixels + 1;
return x0;
}
int64_t DetectorModuleGeometry::GetMinY() const {
if (fast == Direction::Yneg)
return y0 - fast_pixels + 1;
if (slow == Direction::Yneg)
return y0 - slow_pixels + 1;
return y0;
}
int64_t DetectorModuleGeometry::GetPixel0_X() const {
@@ -86,3 +100,8 @@ void DetectorModuleGeometry::VerticalFlip(std::size_t detector_height) {
y0 = detector_height - y0 - 1;
}
void DetectorModuleGeometry::Translate(int64_t in_x, int64_t in_y) {
x0 += in_x;
y0 += in_y;
}

View File

@@ -24,12 +24,15 @@ public:
DetectorModuleGeometry(int64_t x0, int64_t y0, Direction fast, Direction slow);
[[nodiscard]] int64_t GetMaxX() const;
[[nodiscard]] int64_t GetMaxY() const;
[[nodiscard]] int64_t GetMinX() const;
[[nodiscard]] int64_t GetMinY() const;
[[nodiscard]] int64_t GetPixel0_X() const;
[[nodiscard]] int64_t GetPixel0_Y() const;
[[nodiscard]] Direction GetSlowAxis() const;
[[nodiscard]] Direction GetFastAxis() const;
void Translate(int64_t x, int64_t y);
void VerticalFlip(size_t detector_height);
};

View File

@@ -150,37 +150,47 @@ TEST_CASE("DetectorModuleGeometry_GetMaxX_GetMaxY", "[DetectorGeometry]") {
REQUIRE_NOTHROW(geometry = std::make_unique<DetectorModuleGeometry>(0,0,
DetectorModuleGeometry::Direction::Xpos,
DetectorModuleGeometry::Direction::Ypos));
CHECK(geometry->GetMinX() == 0);
CHECK(geometry->GetMaxX() == 1029);
REQUIRE(geometry->GetMaxX() == 1029);
REQUIRE(geometry->GetMaxY() == 513);
CHECK(geometry->GetMinY() == 0);
CHECK(geometry->GetMaxY() == 513);
REQUIRE_NOTHROW(geometry = std::make_unique<DetectorModuleGeometry>(2029,1513,
DetectorModuleGeometry::Direction::Xneg,
DetectorModuleGeometry::Direction::Yneg));
CHECK(geometry->GetMinX() == 2029 - 1029);
CHECK(geometry->GetMaxX() == 2029);
REQUIRE(geometry->GetMaxX() == 2029);
REQUIRE(geometry->GetMaxY() == 1513);
CHECK(geometry->GetMinY() == 1513 - 513);
CHECK(geometry->GetMaxY() == 1513);
REQUIRE_NOTHROW(geometry = std::make_unique<DetectorModuleGeometry>(2029,1513,
DetectorModuleGeometry::Direction::Yneg,
DetectorModuleGeometry::Direction::Xneg));
CHECK(geometry->GetMinX() == 2029 - 513);
CHECK(geometry->GetMaxX() == 2029);
REQUIRE(geometry->GetMaxX() == 2029);
REQUIRE(geometry->GetMaxY() == 1513);
CHECK(geometry->GetMinY() == 1513 - 1029);
CHECK(geometry->GetMaxY() == 1513);
REQUIRE_NOTHROW(geometry = std::make_unique<DetectorModuleGeometry>(2029,1513,
DetectorModuleGeometry::Direction::Yneg,
DetectorModuleGeometry::Direction::Xpos));
CHECK(geometry->GetMinX() == 2029);
CHECK(geometry->GetMaxX() == 2029 + 513);
REQUIRE(geometry->GetMaxX() == 2029 + 513);
REQUIRE(geometry->GetMaxY() == 1513);
CHECK(geometry->GetMinY() == 1513 - 1029);
CHECK(geometry->GetMaxY() == 1513);
REQUIRE_NOTHROW(geometry = std::make_unique<DetectorModuleGeometry>(2029,1513,
DetectorModuleGeometry::Direction::Ypos,
DetectorModuleGeometry::Direction::Xneg));
CHECK(geometry->GetMinX() == 2029 - 513);
CHECK(geometry->GetMaxX() == 2029);
REQUIRE(geometry->GetMaxX() == 2029);
REQUIRE(geometry->GetMaxY() == 1513 + 1029);
CHECK(geometry->GetMinY() == 1513);
CHECK(geometry->GetMaxY() == 1513 + 1029);
}
TEST_CASE("DetectorGeometryModular_Custom", "[DetectorGeometry]") {