mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-20 15:14:30 +01:00
merge from developer (mythen3 branch)
This commit is contained in:
@@ -333,6 +333,110 @@ 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 == 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 == defs::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");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::Speed(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
@@ -652,6 +756,39 @@ std::string CmdProxy::ClockDivider(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ExternalSignal(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[n_signal] [signal_type] External signal mode for trigger "
|
||||
"timing mode."
|
||||
"\n\t[Gotthard] [0] "
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge]"
|
||||
"\n\t[Mythen3] [0-7] "
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge|inversion_on|"
|
||||
"inversion_off]\n\t where 0-3 is master input signals and 4-7 is "
|
||||
"master output signals"
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
auto t = det->getExternalSignalFlags(StringTo<int>(args[0]), {det_id});
|
||||
os << args[0] << " " << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 2) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
det->setExternalSignalFlags(
|
||||
StringTo<int>(args[0]),
|
||||
StringTo<slsDetectorDefs::externalSignalFlag>(args[1]), {det_id});
|
||||
os << args[0] << " " << args[1] << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/** temperature */
|
||||
/* dacs */
|
||||
std::string CmdProxy::Dac(int action) {
|
||||
@@ -1591,6 +1728,92 @@ 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");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* 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},
|
||||
@@ -590,6 +590,7 @@ class CmdProxy {
|
||||
{"vhighvoltage", &CmdProxy::vhighvoltage},
|
||||
{"powerchip", &CmdProxy::powerchip},
|
||||
{"imagetest", &CmdProxy::imagetest},
|
||||
{"extsig", &CmdProxy::ExternalSignal},
|
||||
|
||||
/** temperature */
|
||||
{"temp_adc", &CmdProxy::temp_adc},
|
||||
@@ -784,7 +785,6 @@ class CmdProxy {
|
||||
{"roi", &CmdProxy::ROI},
|
||||
{"clearroi", &CmdProxy::ClearROI},
|
||||
{"exptimel", &CmdProxy::exptimel},
|
||||
{"extsig", &CmdProxy::extsig},
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
{"bursts", &CmdProxy::bursts},
|
||||
@@ -799,6 +799,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},
|
||||
@@ -861,6 +869,7 @@ class CmdProxy {
|
||||
{"patwaittime2", &CmdProxy::PatternWaitTime},
|
||||
{"patmask", &CmdProxy::patmask},
|
||||
{"patsetbit", &CmdProxy::patsetbit},
|
||||
{"patternstart", &CmdProxy::patternstart},
|
||||
|
||||
/* Moench */
|
||||
{"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader},
|
||||
@@ -916,6 +925,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);
|
||||
@@ -923,6 +933,7 @@ class CmdProxy {
|
||||
std::string ClockPhase(int action);
|
||||
std::string MaxClockPhaseShift(int action);
|
||||
std::string ClockDivider(int action);
|
||||
std::string ExternalSignal(int action);
|
||||
/** temperature */
|
||||
/* dacs */
|
||||
std::string Dac(int action);
|
||||
@@ -963,6 +974,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 +1067,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 +1101,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 "
|
||||
@@ -1852,11 +1860,6 @@ class CmdProxy {
|
||||
"[(optional unit) ns|us|ms|s]\n\t[Gotthard] Exposure time "
|
||||
"left for current frame. ");
|
||||
|
||||
INTEGER_COMMAND(extsig, getExternalSignalFlags, setExternalSignalFlags,
|
||||
sls::StringTo<slsDetectorDefs::externalSignalFlag>,
|
||||
"[trigger_in_rising_edge|trigger_in_falling_edge]\n\t["
|
||||
"Gotthard] External signal mode for trigger timing mode.");
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
INTEGER_COMMAND_NOID(
|
||||
bursts, getNumberOfBursts, setNumberOfBursts, StringTo<int64_t>,
|
||||
@@ -1881,6 +1884,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(
|
||||
@@ -2038,6 +2045,9 @@ class CmdProxy {
|
||||
"[64 bit mask]\n\t[Ctb][Moench][Mythen3] 64 bit values "
|
||||
"applied to the selected patmask for every pattern.");
|
||||
|
||||
EXECUTE_SET_COMMAND(patternstart, startPattern,
|
||||
"\n\t[Mythen3] Starts Pattern");
|
||||
|
||||
/* Moench */
|
||||
|
||||
INTEGER_COMMAND(framemode, getFrameMode, setFrameMode,
|
||||
|
||||
@@ -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 {
|
||||
@@ -1169,14 +1169,14 @@ Result<ns> Detector::getExptimeLeft(Positions pos) const {
|
||||
}
|
||||
|
||||
Result<defs::externalSignalFlag>
|
||||
Detector::getExternalSignalFlags(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::setExternalSignalFlags, pos,
|
||||
defs::GET_EXTERNAL_SIGNAL_FLAG);
|
||||
Detector::getExternalSignalFlags(int signalIndex, Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getExternalSignalFlags, pos, signalIndex);
|
||||
}
|
||||
|
||||
void Detector::setExternalSignalFlags(defs::externalSignalFlag value,
|
||||
void Detector::setExternalSignalFlags(int signalIndex,
|
||||
defs::externalSignalFlag value,
|
||||
Positions pos) {
|
||||
pimpl->Parallel(&Module::setExternalSignalFlags, pos, value);
|
||||
pimpl->Parallel(&Module::setExternalSignalFlags, pos, signalIndex, value);
|
||||
}
|
||||
|
||||
// Gotthard2 Specific
|
||||
@@ -1266,6 +1266,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 {
|
||||
@@ -1582,6 +1615,10 @@ void Detector::setPatternBitMask(uint64_t mask, Positions pos) {
|
||||
pimpl->Parallel(&Module::setPatternBitMask, pos, mask);
|
||||
}
|
||||
|
||||
void Detector::startPattern(Positions pos) {
|
||||
pimpl->Parallel(&Module::startPattern, pos);
|
||||
}
|
||||
|
||||
// Moench
|
||||
|
||||
Result<std::map<std::string, std::string>>
|
||||
|
||||
@@ -151,7 +151,7 @@ template <typename Ret> Ret Module::sendToDetector(int fnum) {
|
||||
<< sizeof(Ret) << "]";
|
||||
Ret retval{};
|
||||
sendToDetector(fnum, nullptr, 0, &retval, sizeof(retval));
|
||||
LOG(logDEBUG1) << "Got back: " << retval;
|
||||
LOG(logDEBUG1) << "Got back: " << ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ Ret Module::sendToDetector(int fnum, const Arg &args) {
|
||||
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]";
|
||||
Ret retval{};
|
||||
sendToDetector(fnum, &args, sizeof(args), &retval, sizeof(retval));
|
||||
LOG(logDEBUG1) << "Got back: " << retval;
|
||||
LOG(logDEBUG1) << "Got back: " << ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1027,24 +1027,64 @@ 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);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending number of gates to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_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();
|
||||
prevVal = getExptime(-1);
|
||||
}
|
||||
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);
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, args, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
std::array<time::ns, 3> Module::getExptimeForAllGates() {
|
||||
static_assert(sizeof(time::ns) == 8, "ns needs to be 64bit");
|
||||
return sendToDetector<std::array<time::ns, 3>>(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);
|
||||
if (shm()->useReceiverFlag) {
|
||||
LOG(logDEBUG1) << "Sending gate delay to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_GATE_DELAY, args, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
std::array<time::ns, 3> Module::getGateDelayForAllGates() {
|
||||
static_assert(sizeof(time::ns) == 8, "ns needs to be 64bit");
|
||||
return sendToDetector<std::array<time::ns, 3>>(F_GET_GATE_DELAY_ALL_GATES);
|
||||
}
|
||||
|
||||
int64_t Module::getPeriod() { return sendToDetector<int64_t>(F_GET_PERIOD); }
|
||||
|
||||
void Module::setPeriod(int64_t value) {
|
||||
@@ -1272,10 +1312,15 @@ int Module::getADC(dacIndex index) {
|
||||
}
|
||||
|
||||
slsDetectorDefs::externalSignalFlag
|
||||
Module::setExternalSignalFlags(externalSignalFlag pol) {
|
||||
LOG(logDEBUG1) << "Setting signal flag to " << pol;
|
||||
Module::getExternalSignalFlags(int signalIndex) {
|
||||
return sendToDetector<slsDetectorDefs::externalSignalFlag>(
|
||||
F_SET_EXTERNAL_SIGNAL_FLAG, pol);
|
||||
F_GET_EXTERNAL_SIGNAL_FLAG, signalIndex);
|
||||
}
|
||||
|
||||
void Module::setExternalSignalFlags(int signalIndex, externalSignalFlag type) {
|
||||
LOG(logDEBUG1) << "Setting signal flag (" << signalIndex << ") to " << type;
|
||||
int args[]{signalIndex, static_cast<int>(type)};
|
||||
sendToDetector(F_SET_EXTERNAL_SIGNAL_FLAG, args, nullptr);
|
||||
}
|
||||
|
||||
void Module::setParallelMode(const bool enable) {
|
||||
@@ -1439,7 +1484,14 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
<< "roi.xmin:" << retval.roi.xmin << std::endl
|
||||
<< "roi.xmax:" << retval.roi.xmax << std::endl
|
||||
<< "countermask:" << retval.countermask << std::endl
|
||||
<< "burstType:" << retval.burstType << std::endl;
|
||||
<< "burstType:" << retval.burstType << std::endl
|
||||
<< "exptime1:" << retval.expTime1Ns << std::endl
|
||||
<< "exptime2:" << retval.expTime2Ns << std::endl
|
||||
<< "exptime3:" << retval.expTime3Ns << std::endl
|
||||
<< "gateDelay1:" << retval.gateDelay1Ns << std::endl
|
||||
<< "gateDelay2:" << retval.gateDelay2Ns << std::endl
|
||||
<< "gateDelay3:" << retval.gateDelay3Ns << std::endl
|
||||
<< "gates:" << retval.gates << std::endl;
|
||||
|
||||
sls::MacAddr retvals[2];
|
||||
sendToReceiver(F_SETUP_RECEIVER, retval, retvals);
|
||||
@@ -2874,6 +2926,8 @@ uint64_t Module::getPatternBitMask() {
|
||||
return sendToDetector<uint64_t>(F_GET_PATTERN_BIT_MASK);
|
||||
}
|
||||
|
||||
void Module::startPattern() { sendToDetector(F_START_PATTERN); }
|
||||
|
||||
int Module::setLEDEnable(int enable) {
|
||||
return sendToDetector<int>(F_LED, enable);
|
||||
}
|
||||
|
||||
@@ -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<time::ns, 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<time::ns, 3> getGateDelayForAllGates();
|
||||
|
||||
int64_t getPeriod();
|
||||
|
||||
@@ -529,14 +549,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
int getADC(dacIndex index);
|
||||
|
||||
/**
|
||||
* Set/get external signal flags (to specify triggerinrising edge etc)
|
||||
* (Gotthard, Mythen)
|
||||
* @param pol external signal flag (-1 gets)
|
||||
* @returns current timing mode
|
||||
*/
|
||||
externalSignalFlag
|
||||
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG);
|
||||
externalSignalFlag getExternalSignalFlags(int signalIndex);
|
||||
void setExternalSignalFlags(int signalIndex, externalSignalFlag type);
|
||||
|
||||
/**
|
||||
* Set Parallel readout mode (Only for Eiger)
|
||||
@@ -1506,6 +1520,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
*/
|
||||
uint64_t getPatternBitMask();
|
||||
|
||||
/** [Mythen3] */
|
||||
void startPattern();
|
||||
|
||||
/**
|
||||
* Set LED Enable (Moench, CTB only)
|
||||
* @param enable 1 to switch on, 0 to switch off, -1 gets
|
||||
|
||||
Reference in New Issue
Block a user