mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 05:17:13 +02:00
merge conflict fix
This commit is contained in:
@ -193,6 +193,12 @@ class Detector {
|
||||
*/
|
||||
void setFlipRows(bool value, Positions pos = {});
|
||||
|
||||
/** [Eiger][Mythen3][Gotthard1] via stop server **/
|
||||
Result<bool> getMaster(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] Set half module to master and the others to slaves */
|
||||
void setMaster(bool value, int pos);
|
||||
|
||||
Result<bool> isVirtualDetectorServer(Positions pos = {}) const;
|
||||
///@}
|
||||
|
||||
@ -284,7 +290,7 @@ class Detector {
|
||||
Result<int> getDynamicRange(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* [Eiger] Options: 4, 8, 16, 32. If i is 32, also sets clkdivider to 2,
|
||||
* [Eiger] Options: 4, 8, 12, 16, 32. If i is 32, also sets clkdivider to 2,
|
||||
* else sets clkdivider to 1 \n [Mythen3] Options: 8, 16, 32 \n
|
||||
* [Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16
|
||||
*/
|
||||
@ -1151,6 +1157,12 @@ class Detector {
|
||||
void setDataStream(const defs::portPosition port, const bool enable,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Eiger] Advanced */
|
||||
Result<bool> getTop(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger] Advanced. Default is hardware default */
|
||||
void setTop(bool value, Positions pos = {});
|
||||
|
||||
///@}
|
||||
|
||||
/** @name Jungfrau Specific */
|
||||
@ -1448,9 +1460,6 @@ class Detector {
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
||||
|
||||
/** [Eiger][Mythen3][Gotthard1] via stop server **/
|
||||
Result<bool> getMaster(Positions pos = {}) const;
|
||||
|
||||
// TODO! check if we really want to expose this !!!!!
|
||||
Result<int> getChipStatusRegister(Positions pos = {}) const;
|
||||
|
||||
|
@ -784,6 +784,7 @@ class CmdProxy {
|
||||
{"trimen", &CmdProxy::TrimEnergies},
|
||||
{"gappixels", &CmdProxy::GapPixels},
|
||||
{"fliprows", &CmdProxy::fliprows},
|
||||
{"master", &CmdProxy::master},
|
||||
|
||||
/* acquisition parameters */
|
||||
{"acquire", &CmdProxy::Acquire},
|
||||
@ -942,6 +943,7 @@ class CmdProxy {
|
||||
{"pulsechip", &CmdProxy::PulseChip},
|
||||
{"quad", &CmdProxy::Quad},
|
||||
{"datastream", &CmdProxy::DataStream},
|
||||
{"top", &CmdProxy::top},
|
||||
|
||||
/* Jungfrau Specific */
|
||||
{"chipversion", &CmdProxy::chipversion},
|
||||
@ -1109,7 +1111,6 @@ class CmdProxy {
|
||||
/* acquisition parameters */
|
||||
std::string Acquire(int action);
|
||||
std::string Exptime(int action);
|
||||
std::string DynamicRange(int action);
|
||||
std::string ReadoutSpeed(int action);
|
||||
std::string Adcphase(int action);
|
||||
std::string Dbitphase(int action);
|
||||
@ -1281,6 +1282,12 @@ class CmdProxy {
|
||||
"interfaces must be set to 2. slsReceiver and slsDetectorGui "
|
||||
"does not handle.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID_GET(
|
||||
master, getMaster, setMaster, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Sets half module to master and "
|
||||
"others to slaves.\n\t[Gotthard][Gotthard2][Mythen3][Eiger] "
|
||||
"Gets if the current module/ half module is master.");
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
INTEGER_COMMAND_SET_NOID_GET_ID(
|
||||
@ -1328,7 +1335,7 @@ class CmdProxy {
|
||||
dr, getDynamicRange, setDynamicRange, StringTo<int>,
|
||||
"[value]\n\tDynamic Range or number of bits per "
|
||||
"pixel in detector.\n\t"
|
||||
"[Eiger] Options: 4, 8, 16, 32. If set to 32, also sets "
|
||||
"[Eiger] Options: 4, 8, 12, 16, 32. If set to 32, also sets "
|
||||
"clkdivider to 2, else to 0.\n\t"
|
||||
"[Mythen3] Options: 8, 16, 32\n\t"
|
||||
"[Jungfrau][Gotthard][Ctb][Moench][Mythen3][Gotthard2] 16");
|
||||
@ -1901,6 +1908,10 @@ class CmdProxy {
|
||||
"start of acquisition. 0 complete reset, 1 partial reset. Default is "
|
||||
"complete reset. Advanced function!");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
top, getTop, setTop, StringTo<int>,
|
||||
"[0, 1]\n\t[Eiger] Sets half module to top (1), else bottom.");
|
||||
|
||||
/* Jungfrau Specific */
|
||||
|
||||
GET_COMMAND(chipversion, getChipVersion,
|
||||
|
@ -298,6 +298,23 @@ void Detector::setFlipRows(bool value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setFlipRows, pos, value);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getMaster(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::isMaster, pos);
|
||||
}
|
||||
|
||||
void Detector::setMaster(bool master, int pos) {
|
||||
// multi mod, set slaves first
|
||||
if (master && size() > 1) {
|
||||
if (pos == -1) {
|
||||
throw RuntimeError("Master can be set only to a single module");
|
||||
}
|
||||
pimpl->Parallel(&Module::setMaster, {}, false);
|
||||
pimpl->Parallel(&Module::setMaster, {pos}, master);
|
||||
} else {
|
||||
pimpl->Parallel(&Module::setMaster, {pos}, master);
|
||||
}
|
||||
}
|
||||
|
||||
Result<bool> Detector::isVirtualDetectorServer(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::isVirtualDetectorServer, pos);
|
||||
}
|
||||
@ -387,7 +404,7 @@ void Detector::setDynamicRange(int value) {
|
||||
std::vector<int> Detector::getDynamicRangeList() const {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::EIGER:
|
||||
return std::vector<int>{4, 8, 16, 32};
|
||||
return std::vector<int>{4, 8, 12, 16, 32};
|
||||
case defs::MYTHEN3:
|
||||
return std::vector<int>{8, 16, 32};
|
||||
default:
|
||||
@ -1507,6 +1524,14 @@ void Detector::setDataStream(const defs::portPosition port, const bool enable,
|
||||
pimpl->Parallel(&Module::setDataStream, pos, port, enable);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getTop(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getTop, pos);
|
||||
}
|
||||
|
||||
void Detector::setTop(bool value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setTop, pos, value);
|
||||
}
|
||||
|
||||
// Jungfrau Specific
|
||||
Result<double> Detector::getChipVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getChipVersion, pos);
|
||||
@ -1826,10 +1851,6 @@ Detector::getGateDelayForAllGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getMaster(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::isMaster, pos);
|
||||
}
|
||||
|
||||
Result<int> Detector::getChipStatusRegister(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getChipStatusRegister, pos);
|
||||
}
|
||||
|
@ -509,6 +509,13 @@ void Module::setFlipRows(bool value) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
|
||||
|
||||
void Module::setMaster(const bool master) {
|
||||
sendToDetector(F_SET_MASTER, static_cast<int>(master), nullptr);
|
||||
sendToDetectorStop(F_SET_MASTER, static_cast<int>(master), nullptr);
|
||||
}
|
||||
|
||||
bool Module::isVirtualDetectorServer() const {
|
||||
return sendToDetector<int>(F_IS_VIRTUAL);
|
||||
}
|
||||
@ -1673,6 +1680,14 @@ void Module::setDataStream(const portPosition port, const bool enable) {
|
||||
}
|
||||
}
|
||||
|
||||
bool Module::getTop() const {
|
||||
return (static_cast<bool>(sendToDetector<int>(F_GET_TOP)));
|
||||
}
|
||||
|
||||
void Module::setTop(bool value) {
|
||||
sendToDetector(F_SET_TOP, static_cast<int>(value), nullptr);
|
||||
}
|
||||
|
||||
// Jungfrau Specific
|
||||
double Module::getChipVersion() const {
|
||||
return (sendToDetector<int>(F_GET_CHIP_VERSION)) / 10.00;
|
||||
@ -2197,8 +2212,6 @@ std::array<time::ns, 3> Module::getGateDelayForAllGates() const {
|
||||
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
||||
}
|
||||
|
||||
bool Module::isMaster() const { return sendToDetectorStop<int>(F_GET_MASTER); }
|
||||
|
||||
int Module::getChipStatusRegister() const {
|
||||
return sendToDetector<int>(F_GET_CSR);
|
||||
}
|
||||
|
@ -120,6 +120,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
int setTrimEn(const std::vector<int> &energies = {});
|
||||
bool getFlipRows() const;
|
||||
void setFlipRows(bool value);
|
||||
bool isMaster() const;
|
||||
void setMaster(const bool master);
|
||||
|
||||
bool isVirtualDetectorServer() const;
|
||||
|
||||
/**************************************************
|
||||
@ -184,6 +187,7 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setDBITPipeline(int value);
|
||||
int getReadNRows() const;
|
||||
void setReadNRows(const int value);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition *
|
||||
@ -365,6 +369,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setQuad(const bool enable);
|
||||
bool getDataStream(const portPosition port) const;
|
||||
void setDataStream(const portPosition port, const bool enable);
|
||||
bool getTop() const;
|
||||
void setTop(bool value);
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
@ -456,7 +462,6 @@ class Module : public virtual slsDetectorDefs {
|
||||
int64_t getGateDelay(int gateIndex) const;
|
||||
void setGateDelay(int gateIndex, int64_t value);
|
||||
std::array<time::ns, 3> getGateDelayForAllGates() const;
|
||||
bool isMaster() const;
|
||||
int getChipStatusRegister() const;
|
||||
void setGainCaps(int caps);
|
||||
int getGainCaps();
|
||||
|
@ -629,4 +629,32 @@ TEST_CASE("datastream", "[.cmd]") {
|
||||
REQUIRE_THROWS(proxy.Call("datastream", {"1"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("datastream", {"left", "1"}, -1, PUT));
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("top", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER) {
|
||||
auto prev_val = det.getTop();
|
||||
int numModulesTested = 1;
|
||||
if (det.size() > 1) {
|
||||
numModulesTested = 2;
|
||||
}
|
||||
for (int i = 0; i != numModulesTested; ++i) {
|
||||
std::ostringstream oss1, oss2, oss3;
|
||||
proxy.Call("top", {"1"}, i, PUT, oss1);
|
||||
REQUIRE(oss1.str() == "top 1\n");
|
||||
proxy.Call("top", {}, i, GET, oss2);
|
||||
REQUIRE(oss2.str() == "top 1\n");
|
||||
proxy.Call("top", {"0"}, i, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "top 0\n");
|
||||
}
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setTop(prev_val[i], {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("top", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("top", {"1"}, -1, PUT));
|
||||
}
|
||||
}
|
@ -570,6 +570,46 @@ TEST_CASE("fliprows", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("master", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::EIGER || det_type == defs::MYTHEN3 || det_type == defs::GOTTHARD || det_type == defs::GOTTHARD2) {
|
||||
REQUIRE_NOTHROW(proxy.Call("master", {}, -1, GET));
|
||||
if (det_type == defs::EIGER) {
|
||||
// get previous master
|
||||
int prevMaster = 0;
|
||||
{
|
||||
auto previous = det.getMaster();
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
if (previous[i] == 1) {
|
||||
prevMaster = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1;
|
||||
proxy.Call("master", {"0"}, 0, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "master 0\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss1;
|
||||
proxy.Call("master", {"1"}, 0, PUT, oss3);
|
||||
REQUIRE(oss3.str() == "master 1\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("master", {"1"}, -1, PUT));
|
||||
// set all to slaves, and then master
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setMaster(0, {i});
|
||||
}
|
||||
det.setMaster(1, prevMaster);
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("master", {}, -1, GET));
|
||||
}
|
||||
}
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
// acquire: not testing
|
||||
|
Reference in New Issue
Block a user