From 3682644e1595bd942777e316f91743fbf459dd8e Mon Sep 17 00:00:00 2001 From: Dhanya Thattil <33750417+thattil@users.noreply.github.com> Date: Thu, 19 Jan 2023 11:10:05 +0100 Subject: [PATCH] incorrectly using detsize, caught and fixing it in background (#619) --- slsDetectorSoftware/src/DetectorImpl.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index fcfca99d3..3fd077cd8 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -342,28 +342,32 @@ void DetectorImpl::updateDetectorSize() { "updating detector size. "); } - int maxx = shm()->numberOfChannels.x; - int maxy = shm()->numberOfChannels.y; int nModx = 0, nMody = 0; // 1d, add modules along x axis if (modSize.y == 1) { - if (maxx == 0) { - maxx = modSize.x * size(); + int detSizeX = shm()->numberOfChannels.x; + int maxChanX = modSize.x * size(); + // user given detsizex used only within max value + if (detSizeX > 1 && detSizeX <= maxChanX) { + maxChanX = detSizeX; } - nModx = maxx / modSize.x; + nModx = maxChanX / modSize.x; nMody = size() / nModx; - if ((maxx % modSize.x) > 0) { + if ((maxChanX % modSize.x) > 0) { ++nMody; } } // 2d, add modules along y axis (due to eiger top/bottom) else { - if (maxy == 0) { - maxy = modSize.y * size(); + int detSizeY = shm()->numberOfChannels.y; + int maxChanY = modSize.y * size(); + // user given detsizey used only within max value + if (detSizeY > 1 && detSizeY <= maxChanY) { + maxChanY = detSizeY; } - nMody = maxy / modSize.y; + nMody = maxChanY / modSize.y; nModx = size() / nMody; - if ((maxy % modSize.y) > 0) { + if ((maxChanY % modSize.y) > 0) { ++nModx; } }