incorrectly using detsize, caught and fixing it in background (#619)

This commit is contained in:
Dhanya Thattil 2023-01-19 11:10:05 +01:00 committed by GitHub
parent a6aaa2c3c6
commit 3682644e15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -342,28 +342,32 @@ void DetectorImpl::updateDetectorSize() {
"updating detector size. "); "updating detector size. ");
} }
int maxx = shm()->numberOfChannels.x;
int maxy = shm()->numberOfChannels.y;
int nModx = 0, nMody = 0; int nModx = 0, nMody = 0;
// 1d, add modules along x axis // 1d, add modules along x axis
if (modSize.y == 1) { if (modSize.y == 1) {
if (maxx == 0) { int detSizeX = shm()->numberOfChannels.x;
maxx = modSize.x * size(); 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; nMody = size() / nModx;
if ((maxx % modSize.x) > 0) { if ((maxChanX % modSize.x) > 0) {
++nMody; ++nMody;
} }
} }
// 2d, add modules along y axis (due to eiger top/bottom) // 2d, add modules along y axis (due to eiger top/bottom)
else { else {
if (maxy == 0) { int detSizeY = shm()->numberOfChannels.y;
maxy = modSize.y * size(); 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; nModx = size() / nMody;
if ((maxy % modSize.y) > 0) { if ((maxChanY % modSize.y) > 0) {
++nModx; ++nModx;
} }
} }