moduleid for eiger m3 and g2, but set only for g2

This commit is contained in:
2021-09-01 17:06:34 +02:00
parent 25d03f949e
commit a51deda2a4
22 changed files with 180 additions and 95 deletions

View File

@ -1200,12 +1200,14 @@ class CmdProxy {
"\n\tReceiver version in format [0xYYMMDD].");
GET_COMMAND_HEX(serialnumber, getSerialNumber,
"\n\tSerial number of detector.");
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
"Serial number of detector.");
INTEGER_COMMAND_HEX(
moduleid, getModuleId, setModuleId, StringTo<int>,
"[value]\n\t[Gotthard2] 16 bit value (ideally unique) that is "
"streamed out in the UDP header of the detector. Default is 0.");
"[value]\n\t[Gotthard2][Eiger][Mythen3] 16 bit value (ideally unique) "
"that is streamed out in the UDP header of the detector. "
"\n\t[Gotthard2] Can set it too.");
GET_COMMAND(type, getDetectorType,
"\n\tReturns detector type. Can be Eiger, Jungfrau, Gotthard, "

View File

@ -416,14 +416,14 @@ void Module::loadSettingsFile(const std::string &fname) {
if (shm()->myDetectorType == EIGER || shm()->myDetectorType == MYTHEN3) {
std::ostringstream ostfn;
ostfn << fname;
int serialNumberWidth = 3;
int moduleIdWidth = 3;
if (shm()->myDetectorType == MYTHEN3) {
serialNumberWidth = 4;
moduleIdWidth = 4;
}
if ((fname.find(".sn") == std::string::npos) &&
(fname.find(".trim") == std::string::npos)) {
ostfn << ".sn" << std::setfill('0') << std::setw(serialNumberWidth)
<< std::dec << getSerialNumber();
ostfn << ".sn" << std::setfill('0') << std::setw(moduleIdWidth)
<< std::dec << getModuleId();
}
auto myMod = readSettingsFile(ostfn.str());
setModule(myMod);
@ -3326,12 +3326,12 @@ std::string Module::getTrimbitFilename(detectorSettings s, int e_eV) {
throw RuntimeError(
"Settings or trimbit files not defined for this detector.");
}
int serialNumberWidth = 3;
int moduleIdWidth = 3;
if (shm()->myDetectorType == MYTHEN3) {
serialNumberWidth = 4;
moduleIdWidth = 4;
}
ostfn << std::setfill('0') << std::setw(serialNumberWidth) << std::dec
<< getSerialNumber() << std::setbase(10);
ostfn << std::setfill('0') << std::setw(moduleIdWidth) << std::dec
<< getModuleId() << std::setbase(10);
return ostfn.str();
}