This commit is contained in:
2020-05-19 18:59:07 +02:00
parent cd90f09a30
commit e208d3ebe8
7 changed files with 97 additions and 71 deletions

View File

@ -381,7 +381,7 @@ std::string CmdProxy::Exptime(int action) {
WrongNumberOfParameters(1);
}
// vector of exptimes
if (gateIndex == -1 &
if (gateIndex == -1 &&
det->getDetectorType().squash() == defs::MYTHEN3) {
auto t = det->getExptimeForAllGates({det_id});
if (args.size() == 0) {
@ -410,14 +410,14 @@ std::string CmdProxy::Exptime(int action) {
std::string time_str(args[0]);
std::string unit = RemoveUnit(time_str);
auto t = StringTo<time::ns>(time_str, unit);
if (type == MYTHEN3) {
if (type == defs::MYTHEN3) {
det->setExptime(gateIndex, t, {det_id});
} else {
det->setExptime(t, {det_id});
}
} else if (args.size() == 2) {
auto t = StringTo<time::ns>(args[0], args[1]);
if (type == MYTHEN3) {
if (type == defs::MYTHEN3) {
det->setExptime(gateIndex, t, {det_id});
} else {
det->setExptime(t, {det_id});
@ -434,6 +434,7 @@ std::string CmdProxy::Exptime(int action) {
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::Speed(int action) {
@ -1777,6 +1778,7 @@ std::string CmdProxy::GateDelay(int action) {
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
/* CTB / Moench Specific */

View File

@ -1275,7 +1275,14 @@ void Detector::setExptime(int gateIndex, ns t, Positions pos) {
}
Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const {
return pimpl->Parallel(&Module::getExptimeForAllGates, pos);
auto t = pimpl->Parallel(&Module::getExptimeForAllGates, pos);
Result<std::array<ns, 3>> res(t.size());
for (unsigned int i = 0; i < t.size(); ++i) {
for (unsigned int j = 0; j != 3; ++j) {
res[i][j] = static_cast<ns>(t[i][j]);
}
}
return res;
}
Result<ns> Detector::getGateDelay(int gateIndex, Positions pos) const {
@ -1288,7 +1295,14 @@ void Detector::setGateDelay(int gateIndex, ns t, Positions pos) {
Result<std::array<ns, 3>>
Detector::getGateDelayForAllGates(Positions pos) const {
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
auto t = pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
Result<std::array<ns, 3>> res(t.size());
for (unsigned int i = 0; i < t.size(); ++i) {
for (unsigned int j = 0; j != 3; ++j) {
res[i][j] = static_cast<ns>(t[i][j]);
}
}
return res;
}
// CTB/ Moench Specific

View File

@ -1041,7 +1041,7 @@ int64_t Module::getExptime(int gateIndex) {
void Module::setExptime(int gateIndex, int64_t value) {
int64_t prevVal = value;
if (shm()->myDetectorType == EIGER) {
prevVal = getExptime();
prevVal = getExptime(-1);
}
LOG(logDEBUG1) << "Setting exptime to " << value
<< "ns (gateindex: " << gateIndex << ")";
@ -1056,8 +1056,10 @@ void Module::setExptime(int gateIndex, int64_t value) {
}
}
std::array<int, 3> Module::getExptimeForAllGates() {
return sendToDetector<int64_t>(F_GET_EXPTIME_ALL_GATES);
std::array<int64_t, 3> Module::getExptimeForAllGates() {
std::array<int64_t, 3> retval;
sendToDetector(F_GET_EXPTIME_ALL_GATES, nullptr, retval);
return retval;
}
int64_t Module::getGateDelay(int gateIndex) {
@ -1071,8 +1073,10 @@ void Module::setGateDelay(int gateIndex, int64_t value) {
sendToDetector(F_SET_GATE_DELAY, args, nullptr);
}
std::array<int, 3> Module::getGateDelayForAllGates() {
return sendToDetector<int64_t>(F_GET_GATE_DELAY_ALL_GATES);
std::array<int64_t, 3> Module::getGateDelayForAllGates() {
std::array<int64_t, 3> retval;
sendToDetector(F_GET_GATE_DELAY_ALL_GATES, nullptr, retval);
return retval;
}
int64_t Module::getPeriod() { return sendToDetector<int64_t>(F_GET_PERIOD); }

View File

@ -432,7 +432,7 @@ class Module : public virtual slsDetectorDefs {
void setExptime(int gateIndex, int64_t value);
/** [Mythen3] for all gates */
std::array<int, 3> getExptimeForAllGates();
std::array<int64_t, 3> getExptimeForAllGates();
/** [Mythen3] gatIndex: 0-2 */
int64_t getGateDelay(int gateIndex);
@ -441,7 +441,7 @@ class Module : public virtual slsDetectorDefs {
void setGateDelay(int gateIndex, int64_t value);
/** [Mythen3] for all gates */
std::array<int, 3> getGateDelayForAllGates();
std::array<int64_t, 3> getGateDelayForAllGates();
int64_t getPeriod();