This commit is contained in:
Erik Frojdh
2021-03-31 16:26:36 +02:00
parent fa25340e5c
commit 01c785271f
9 changed files with 71 additions and 74 deletions

View File

@ -3203,6 +3203,9 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
throw RuntimeError("Could not open settings file: " + fname);
}
auto file_size = getFileSize(infile);
// eiger
if (shm()->myDetectorType == EIGER) {
infile.read(reinterpret_cast<char *>(myMod.dacs),
@ -3228,6 +3231,16 @@ sls_detector_module Module::readSettingsFile(const std::string &fname,
// mythen3 (dacs, trimbits)
else if (shm()->myDetectorType == MYTHEN3) {
int expected_size =
sizeof(int) * myMod.ndac + sizeof(int) * myMod.nchan + sizeof(myMod.reg);
if (file_size != expected_size) {
throw RuntimeError("The size of the settings file: " + fname +
" differs from the expected size, " +
std::to_string(file_size) + " instead of " +
std::to_string(expected_size) + " bytes");
}
infile.read(reinterpret_cast<char *>(&myMod.reg),
sizeof(myMod.reg));
infile.read(reinterpret_cast<char *>(myMod.dacs),
sizeof(int) * (myMod.ndac));
for (int i = 0; i < myMod.ndac; ++i) {