mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 06:50:02 +02:00
pr fixes
This commit is contained in:
parent
c1902c713d
commit
2e75f36fa0
@ -3569,30 +3569,16 @@ sls_detector_module Module::readSettingsFile(const std::string &fname, int tb) {
|
|||||||
|
|
||||||
// eiger
|
// eiger
|
||||||
if (shm()->myDetectorType == EIGER) {
|
if (shm()->myDetectorType == EIGER) {
|
||||||
bool allread = false;
|
|
||||||
infile.read(reinterpret_cast<char *>(myMod.dacs),
|
infile.read(reinterpret_cast<char *>(myMod.dacs),
|
||||||
sizeof(int) * (myMod.ndac));
|
sizeof(int) * (myMod.ndac));
|
||||||
if (infile.good()) {
|
infile.read(reinterpret_cast<char *>(&myMod.iodelay),
|
||||||
infile.read(reinterpret_cast<char *>(&myMod.iodelay),
|
sizeof(myMod.iodelay));
|
||||||
sizeof(myMod.iodelay));
|
infile.read(reinterpret_cast<char *>(&myMod.tau), sizeof(myMod.tau));
|
||||||
if (infile.good()) {
|
if (tb != 0) {
|
||||||
infile.read(reinterpret_cast<char *>(&myMod.tau),
|
infile.read(reinterpret_cast<char *>(myMod.chanregs),
|
||||||
sizeof(myMod.tau));
|
sizeof(int) * (myMod.nchan));
|
||||||
if (tb != 0) {
|
|
||||||
if (infile.good()) {
|
|
||||||
infile.read(reinterpret_cast<char *>(myMod.chanregs),
|
|
||||||
sizeof(int) * (myMod.nchan));
|
|
||||||
if (infile) {
|
|
||||||
allread = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (infile) {
|
|
||||||
allread = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!allread) {
|
if (!infile) {
|
||||||
infile.close();
|
|
||||||
throw RuntimeError("readSettingsFile: Could not load all values "
|
throw RuntimeError("readSettingsFile: Could not load all values "
|
||||||
"for settings for " +
|
"for settings for " +
|
||||||
fname);
|
fname);
|
||||||
@ -3606,18 +3592,12 @@ sls_detector_module Module::readSettingsFile(const std::string &fname, int tb) {
|
|||||||
|
|
||||||
// mythen3 (dacs, trimbits)
|
// mythen3 (dacs, trimbits)
|
||||||
else if (shm()->myDetectorType == MYTHEN3) {
|
else if (shm()->myDetectorType == MYTHEN3) {
|
||||||
bool allread = false;
|
|
||||||
infile.read(reinterpret_cast<char *>(myMod.dacs),
|
infile.read(reinterpret_cast<char *>(myMod.dacs),
|
||||||
sizeof(int) * (myMod.ndac));
|
sizeof(int) * (myMod.ndac));
|
||||||
if (infile.good()) {
|
infile.read(reinterpret_cast<char *>(myMod.chanregs),
|
||||||
infile.read(reinterpret_cast<char *>(myMod.chanregs),
|
sizeof(int) * (myMod.nchan));
|
||||||
sizeof(int) * (myMod.nchan));
|
|
||||||
if (infile) {
|
if (!infile) {
|
||||||
allread = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!allread) {
|
|
||||||
infile.close();
|
|
||||||
throw RuntimeError("readSettingsFile: Could not load all values "
|
throw RuntimeError("readSettingsFile: Could not load all values "
|
||||||
"for settings for " +
|
"for settings for " +
|
||||||
fname);
|
fname);
|
||||||
@ -3653,18 +3633,15 @@ sls_detector_module Module::readSettingsFile(const std::string &fname, int tb) {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
throw RuntimeError("readSettingsFile: Unknown dac: " +
|
throw RuntimeError("readSettingsFile: Unknown dac: " +
|
||||||
sargname);
|
sargname);
|
||||||
infile.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// not all read
|
// not all read
|
||||||
if (idac != names.size()) {
|
if (idac != names.size()) {
|
||||||
infile.close();
|
|
||||||
throw RuntimeError("Could read only " + std::to_string(idac) +
|
throw RuntimeError("Could read only " + std::to_string(idac) +
|
||||||
" dacs. Expected " +
|
" dacs. Expected " +
|
||||||
std::to_string(names.size()) + " dacs");
|
std::to_string(names.size()) + " dacs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
infile.close();
|
|
||||||
LOG(logINFO) << "Settings file loaded: " << fname.c_str();
|
LOG(logINFO) << "Settings file loaded: " << fname.c_str();
|
||||||
return myMod;
|
return myMod;
|
||||||
}
|
}
|
||||||
@ -3705,7 +3682,6 @@ void Module::writeSettingsFile(const std::string &fname,
|
|||||||
outfile << names[i] << " " << mod.dacs[i] << std::endl;
|
outfile << names[i] << " " << mod.dacs[i] << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
outfile.close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> Module::getSettingsFileDacNames() {
|
std::vector<std::string> Module::getSettingsFileDacNames() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user