mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
WIP
This commit is contained in:
@ -203,7 +203,9 @@ class Detector {
|
||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||
|
||||
/**
|
||||
* [Gotthard][Jungfrau][CTB][Moench] Options: AUTO_TIMING, TRIGGER_EXPOSURE
|
||||
* [Gotthard][Jungfrau][CTB][Moench][Mythen3] Options:
|
||||
* AUTO_TIMING, TRIGGER_EXPOSURE
|
||||
* [Gotthard2] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, TRIGGER_GATED
|
||||
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
|
||||
*/
|
||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||
@ -991,6 +993,36 @@ class Detector {
|
||||
/** [Mythen3] countermask bit set for each counter enabled */
|
||||
void setCounterMask(uint32_t countermask, Positions pos = {});
|
||||
|
||||
Result<int> getNumberOfGates(Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] external gates in gating or trigger_gating mode (external
|
||||
* gating) */
|
||||
void setNumberOfGates(int value, Positions pos = {});
|
||||
|
||||
/** [Mythen3] exptime for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2 */
|
||||
Result<ns> getExptime(int gateIndex, Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] exptime for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
void setExptime(int gateIndex, ns t, Positions pos = {});
|
||||
|
||||
/** [Mythen3] exptime for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
Result<std::array<ns, 3>> getExptimeForAllGates(Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2 */
|
||||
Result<ns> getGateDelay(int gateIndex, Positions pos = {}) const;
|
||||
|
||||
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
void setGateDelay(int gateIndex, ns t, Positions pos = {});
|
||||
|
||||
/** [Mythen3] gate delay for each gate signal in auto or trigger timing mode
|
||||
* (internal gating). Gate index: 0-2, -1 for all */
|
||||
Result<std::array<ns, 3>> getGateDelayForAllGates(Positions pos = {}) const;
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* CTB / Moench Specific *
|
||||
|
@ -333,6 +333,109 @@ std::string CmdProxy::DetectorSize(int action) {
|
||||
|
||||
/* acquisition parameters */
|
||||
|
||||
std::string CmdProxy::Exptime(int action) {
|
||||
int gateIndex = -1;
|
||||
if (cmd == "exptime") {
|
||||
gateIndex = -1;
|
||||
} else if (cmd == "exptime1") {
|
||||
gateIndex = 0;
|
||||
} else if (cmd == "exptime2") {
|
||||
gateIndex = 1;
|
||||
} else if (cmd == "exptime3") {
|
||||
gateIndex = 2;
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "exptime") {
|
||||
os << "[duration] [(optional unit) "
|
||||
"ns|us|ms|s]\n\t[Eiger][Jungfrau][Gotthard][Gotthard2]["
|
||||
"Moench][Ctb] Exposure time"
|
||||
"\n\t[Gotthard2] Uploaded to detector just before "
|
||||
"acquisition starts"
|
||||
"\n\t[Mythen3] Exposure time of all gate signals in auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "exptime1") {
|
||||
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 1 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "exptime2") {
|
||||
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 2 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else {
|
||||
os << "[n_value]\n\t[Mythen3] Exposure time of gate signal 3 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
}
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() > 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
// vector of exptimes
|
||||
if (gateIndex == -1 &
|
||||
det->getDetectorType().squash() == defs::MYTHEN3) {
|
||||
auto t = det->getExptimeForAllGates({det_id});
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
// single exptime
|
||||
else {
|
||||
Result<ns> t;
|
||||
if (gateIndex == -1) {
|
||||
t = det->getExptime({det_id});
|
||||
} else {
|
||||
t = det->getExptime(gateIndex, {det_id});
|
||||
}
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
defs::detectorType type = det->getDetectorType().squash();
|
||||
if (args.size() == 1) {
|
||||
std::string time_str(args[0]);
|
||||
std::string unit = RemoveUnit(time_str);
|
||||
auto t = StringTo<time::ns>(time_str, unit);
|
||||
if (type == 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) {
|
||||
det->setExptime(gateIndex, t, {det_id});
|
||||
} else {
|
||||
det->setExptime(t, {det_id});
|
||||
}
|
||||
} else {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
/* TODO: os << args << '\n'; (doesnt work for vectors in .h)*/
|
||||
if (args.size() > 1) {
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
os << args[0] << '\n';
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
}
|
||||
|
||||
std::string CmdProxy::Speed(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
@ -1591,6 +1694,91 @@ std::string CmdProxy::Counters(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::GateDelay(int action) {
|
||||
int gateIndex = -1;
|
||||
if (cmd == "gatedelay") {
|
||||
gateIndex = -1;
|
||||
} else if (cmd == "gatedelay1") {
|
||||
gateIndex = 0;
|
||||
} else if (cmd == "gatedelay2") {
|
||||
gateIndex = 1;
|
||||
} else if (cmd == "gatedelay3") {
|
||||
gateIndex = 2;
|
||||
} else {
|
||||
throw sls::RuntimeError(
|
||||
"Unknown command, use list to list all commands");
|
||||
}
|
||||
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
if (cmd == "gatedelay") {
|
||||
os << "[duration] [(optional unit) "
|
||||
"ns|us|ms|s]\n\t[Mythen3] Gate Delay of all gate signals in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "gatedelay1") {
|
||||
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 1 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else if (cmd == "gatedelay2") {
|
||||
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 2 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
} else {
|
||||
os << "[n_value]\n\t[Mythen3] Gate Delay of gate signal 3 in "
|
||||
"auto and "
|
||||
"trigger mode (internal gating)."
|
||||
<< '\n';
|
||||
}
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() > 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
// vector of gate delays
|
||||
if (gateIndex == -1) {
|
||||
auto t = det->getGateDelayForAllGates({det_id});
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
// single gate delay
|
||||
else {
|
||||
auto t = det->getGateDelay(gateIndex, {det_id});
|
||||
if (args.size() == 0) {
|
||||
os << OutString(t) << '\n';
|
||||
} else if (args.size() == 1) {
|
||||
os << OutString(t, args[0]) << '\n';
|
||||
}
|
||||
}
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() == 1) {
|
||||
std::string time_str(args[0]);
|
||||
std::string unit = RemoveUnit(time_str);
|
||||
auto t = StringTo<time::ns>(time_str, unit);
|
||||
det->setGateDelay(gateIndex, t, {det_id});
|
||||
} else if (args.size() == 2) {
|
||||
auto t = StringTo<time::ns>(args[0], args[1]);
|
||||
det->setGateDelay(gateIndex, t, {det_id});
|
||||
} else {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
/* TODO: os << args << '\n'; (doesnt work for vectors in .h)*/
|
||||
if (args.size() > 1) {
|
||||
os << args[0] << args[1] << '\n';
|
||||
} else {
|
||||
os << args[0] << '\n';
|
||||
}
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
}
|
||||
|
||||
/* CTB / Moench Specific */
|
||||
|
||||
std::string CmdProxy::Samples(int action) {
|
||||
|
@ -570,7 +570,7 @@ class CmdProxy {
|
||||
{"acquire", &CmdProxy::acquire},
|
||||
{"frames", &CmdProxy::frames},
|
||||
{"triggers", &CmdProxy::triggers},
|
||||
{"exptime", &CmdProxy::exptime},
|
||||
{"exptime", &CmdProxy::Exptime},
|
||||
{"period", &CmdProxy::period},
|
||||
{"delay", &CmdProxy::delay},
|
||||
{"framesl", &CmdProxy::framesl},
|
||||
@ -798,6 +798,14 @@ class CmdProxy {
|
||||
|
||||
/* Mythen3 Specific */
|
||||
{"counters", &CmdProxy::Counters},
|
||||
{"gates", &CmdProxy::gates},
|
||||
{"exptime1", &CmdProxy::Exptime},
|
||||
{"exptime2", &CmdProxy::Exptime},
|
||||
{"exptime3", &CmdProxy::Exptime},
|
||||
{"gatedelay", &CmdProxy::GateDelay},
|
||||
{"gatedelay1", &CmdProxy::GateDelay},
|
||||
{"gatedelay2", &CmdProxy::GateDelay},
|
||||
{"gatedelay3", &CmdProxy::GateDelay},
|
||||
|
||||
/* CTB/ Moench Specific */
|
||||
{"samples", &CmdProxy::Samples},
|
||||
@ -916,6 +924,7 @@ class CmdProxy {
|
||||
std::string DetectorSize(int action);
|
||||
/* acquisition parameters */
|
||||
std::string acquire(int action);
|
||||
std::string Exptime(int action);
|
||||
std::string Speed(int action);
|
||||
std::string Adcphase(int action);
|
||||
std::string Dbitphase(int action);
|
||||
@ -963,6 +972,7 @@ class CmdProxy {
|
||||
std::string BurstMode(int action);
|
||||
/* Mythen3 Specific */
|
||||
std::string Counters(int action);
|
||||
std::string GateDelay(int action);
|
||||
/* CTB/ Moench Specific */
|
||||
std::string Samples(int action);
|
||||
/* CTB Specific */
|
||||
@ -1055,11 +1065,6 @@ class CmdProxy {
|
||||
"[n_triggers]\n\tNumber of triggers per aquire. Use "
|
||||
"timing command to set timing mode.");
|
||||
|
||||
TIME_COMMAND(
|
||||
exptime, getExptime, setExptime,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time"
|
||||
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||
|
||||
TIME_COMMAND(
|
||||
period, getPeriod, setPeriod,
|
||||
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames"
|
||||
@ -1094,12 +1099,13 @@ class CmdProxy {
|
||||
" Period left for current frame."
|
||||
"\n\t[Gotthard2] only in continuous mode.");
|
||||
|
||||
INTEGER_COMMAND(
|
||||
timing, getTimingMode, setTimingMode,
|
||||
sls::StringTo<slsDetectorDefs::timingMode>,
|
||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
||||
"detector.\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb][Moench] "
|
||||
"[auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
||||
INTEGER_COMMAND(timing, getTimingMode, setTimingMode,
|
||||
sls::StringTo<slsDetectorDefs::timingMode>,
|
||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of "
|
||||
"detector.\n\t[Jungfrau][Gotthard][Mythen3][Ctb][Moench] "
|
||||
"[auto|trigger]\n\t[Gotthard2] "
|
||||
"[auto|trigger|gating|trigger_gating]\n\t[Eiger] "
|
||||
"[auto|trigger|gating|burst_trigger]");
|
||||
|
||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||
"\n\t[Jungfrau][CTB][Moench] Absolute maximum Phase shift of "
|
||||
@ -1875,6 +1881,10 @@ class CmdProxy {
|
||||
|
||||
/* Mythen3 Specific */
|
||||
|
||||
INTEGER_COMMAND(gates, getNumberOfGates, setNumberOfGates, StringTo<int>,
|
||||
"[n_gates]\n\t[Mythen3] Number of external gates in gating "
|
||||
"or trigger_gating mode (external gating).");
|
||||
|
||||
/* CTB/ Moench Specific */
|
||||
|
||||
INTEGER_COMMAND(
|
||||
|
@ -202,11 +202,11 @@ void Detector::setNumberOfTriggers(int64_t value) {
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExptime, pos);
|
||||
return pimpl->Parallel(&Module::getExptime, pos, -1);
|
||||
}
|
||||
|
||||
void Detector::setExptime(ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setExptime, pos, t.count());
|
||||
pimpl->Parallel(&Module::setExptime, pos, -1, t.count());
|
||||
}
|
||||
|
||||
Result<ns> Detector::getPeriod(Positions pos) const {
|
||||
@ -1258,6 +1258,39 @@ void Detector::setCounterMask(uint32_t countermask, Positions pos) {
|
||||
pimpl->Parallel(&Module::setCounterMask, pos, countermask);
|
||||
}
|
||||
|
||||
Result<int> Detector::getNumberOfGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getNumberOfGates, pos);
|
||||
}
|
||||
|
||||
void Detector::setNumberOfGates(int value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setNumberOfGates, pos, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getExptime(int gateIndex, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExptime, pos, gateIndex);
|
||||
}
|
||||
|
||||
void Detector::setExptime(int gateIndex, ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setExptime, pos, gateIndex, t.count());
|
||||
}
|
||||
|
||||
Result<std::array<ns, 3>> Detector::getExptimeForAllGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExptimeForAllGates, pos);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getGateDelay(int gateIndex, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getGateDelay, pos, gateIndex);
|
||||
}
|
||||
|
||||
void Detector::setGateDelay(int gateIndex, ns t, Positions pos) {
|
||||
pimpl->Parallel(&Module::setGateDelay, pos, gateIndex, t.count());
|
||||
}
|
||||
|
||||
Result<std::array<ns, 3>>
|
||||
Detector::getGateDelayForAllGates(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getGateDelayForAllGates, pos);
|
||||
}
|
||||
|
||||
// CTB/ Moench Specific
|
||||
|
||||
Result<int> Detector::getNumberOfAnalogSamples(Positions pos) const {
|
||||
|
@ -1027,15 +1027,26 @@ void Module::setNumberOfDigitalSamples(int value) {
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getExptime() { return sendToDetector<int64_t>(F_GET_EXPTIME); }
|
||||
int Module::getNumberOfGates() { return sendToDetector<int>(F_GET_NUM_GATES); }
|
||||
|
||||
void Module::setExptime(int64_t value) {
|
||||
void Module::setNumberOfGates(int value) {
|
||||
LOG(logDEBUG1) << "Setting number of gates to " << value;
|
||||
sendToDetector(F_SET_NUM_GATES, value, nullptr);
|
||||
}
|
||||
|
||||
int64_t Module::getExptime(int gateIndex) {
|
||||
return sendToDetector<int64_t>(F_GET_EXPTIME, gateIndex);
|
||||
}
|
||||
|
||||
void Module::setExptime(int gateIndex, int64_t value) {
|
||||
int64_t prevVal = value;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prevVal = getExptime();
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_EXPTIME, value, nullptr);
|
||||
LOG(logDEBUG1) << "Setting exptime to " << value
|
||||
<< "ns (gateindex: " << gateIndex << ")";
|
||||
int64_t args[]{static_cast<int64_t>(gateIndex), value};
|
||||
sendToDetector(F_SET_EXPTIME, args, nullptr);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
||||
@ -1045,6 +1056,25 @@ void Module::setExptime(int64_t value) {
|
||||
}
|
||||
}
|
||||
|
||||
std::array<int, 3> Module::getExptimeForAllGates() {
|
||||
return sendToDetector<int64_t>(F_GET_EXPTIME_ALL_GATES);
|
||||
}
|
||||
|
||||
int64_t Module::getGateDelay(int gateIndex) {
|
||||
return sendToDetector<int64_t>(F_GET_GATE_DELAY, gateIndex);
|
||||
}
|
||||
|
||||
void Module::setGateDelay(int gateIndex, int64_t value) {
|
||||
LOG(logDEBUG1) << "Setting gate delay to " << value
|
||||
<< "ns (gateindex: " << gateIndex << ")";
|
||||
int64_t args[]{static_cast<int64_t>(gateIndex), value};
|
||||
sendToDetector(F_SET_GATE_DELAY, args, nullptr);
|
||||
}
|
||||
|
||||
std::array<int, 3> Module::getGateDelayForAllGates() {
|
||||
return sendToDetector<int64_t>(F_GET_GATE_DELAY_ALL_GATES);
|
||||
}
|
||||
|
||||
int64_t Module::getPeriod() { return sendToDetector<int64_t>(F_GET_PERIOD); }
|
||||
|
||||
void Module::setPeriod(int64_t value) {
|
||||
|
@ -419,9 +419,29 @@ class Module : public virtual slsDetectorDefs {
|
||||
/** [CTB] */
|
||||
void setNumberOfDigitalSamples(int value);
|
||||
|
||||
int64_t getExptime();
|
||||
/** [Mythen3] */
|
||||
int getNumberOfGates();
|
||||
|
||||
void setExptime(int64_t value);
|
||||
/** [Mythen3] */
|
||||
void setNumberOfGates(int value);
|
||||
|
||||
/** [Mythen3] gatIndex: 0-2, [Others]: -1 always */
|
||||
int64_t getExptime(int gateIndex);
|
||||
|
||||
/** [Mythen3] gatIndex: -1 for all, 0-2, [Others]: -1 always */
|
||||
void setExptime(int gateIndex, int64_t value);
|
||||
|
||||
/** [Mythen3] for all gates */
|
||||
std::array<int, 3> getExptimeForAllGates();
|
||||
|
||||
/** [Mythen3] gatIndex: 0-2 */
|
||||
int64_t getGateDelay(int gateIndex);
|
||||
|
||||
/** [Mythen3] gatIndex: -1 for all, 0-2 */
|
||||
void setGateDelay(int gateIndex, int64_t value);
|
||||
|
||||
/** [Mythen3] for all gates */
|
||||
std::array<int, 3> getGateDelayForAllGates();
|
||||
|
||||
int64_t getPeriod();
|
||||
|
||||
|
Reference in New Issue
Block a user