mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-30 01:40:04 +02:00
WIP
This commit is contained in:
parent
8d0146949c
commit
9ee2d389fb
@ -234,12 +234,13 @@ Result<ns> Detector::getExptime(Positions pos) const {
|
||||
void Detector::setExptime(ns t, Positions pos) {
|
||||
bool change = false;
|
||||
if (getDetectorType().squash() == defs::EIGER) {
|
||||
ns prevVal = getPeriod(pos).squash();
|
||||
if (prevVal != t) {
|
||||
ns prevVal = getExptime(pos).squash();
|
||||
if (getExptime(pos).squash() != t) {
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
pimpl->Parallel(&Module::setExptime, pos, t.count());
|
||||
pimpl->Parallel3(&Receiver::setExptime, t.count());
|
||||
if (change) {
|
||||
pimpl->Parallel(&Module::updateRateCorrection, pos);
|
||||
}
|
||||
@ -283,6 +284,7 @@ Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
|
||||
|
||||
void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setTimingMode, pos, value);
|
||||
pimpl->Parallel3(&Receiver::setTimingMode, value);
|
||||
}
|
||||
|
||||
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||
@ -1028,7 +1030,29 @@ Result<int> Detector::getDynamicRange(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setDynamicRange(int value) {
|
||||
bool change = false;
|
||||
int prevVal = value;
|
||||
if (getDetectorType().squash() == defs::EIGER) {
|
||||
prevVal = getDynamicRange().squash();
|
||||
if (prevVal != value) {
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
pimpl->Parallel(&Module::setDynamicRange, {}, value);
|
||||
pimpl->Parallel3(&Receiver::setDynamicRange, value);
|
||||
if (change) {
|
||||
// update speed for usability
|
||||
if (value == 32) {
|
||||
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
|
||||
"Dynamic Range of 32";
|
||||
setSpeed(defs::QUARTER_SPEED);
|
||||
} else if (prevVal == 32) {
|
||||
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range "
|
||||
"of " << value;
|
||||
setSpeed(defs::FULL_SPEED);
|
||||
}
|
||||
pimpl->Parallel(&Module::updateRateCorrection, {});
|
||||
}
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
@ -1036,7 +1060,18 @@ Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setSubExptime(ns t, Positions pos) {
|
||||
bool change = false;
|
||||
if (getDetectorType().squash() == defs::EIGER) {
|
||||
ns prevVal = getSubExptime(pos).squash();
|
||||
if (prevVal != t) {
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
pimpl->Parallel(&Module::setSubExptime, pos, t.count());
|
||||
pimpl->Parallel3(&Receiver::setSubExptime, t.count());
|
||||
if (change) {
|
||||
pimpl->Parallel(&Module::updateRateCorrection, pos);
|
||||
}
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubDeadTime(Positions pos) const {
|
||||
@ -1045,6 +1080,7 @@ Result<ns> Detector::getSubDeadTime(Positions pos) const {
|
||||
|
||||
void Detector::setSubDeadTime(ns value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setSubDeadTime, pos, value.count());
|
||||
pimpl->Parallel3(&Receiver::setSubDeadTime, value.count());
|
||||
}
|
||||
|
||||
Result<int> Detector::getThresholdEnergy(Positions pos) const {
|
||||
@ -1494,6 +1530,7 @@ Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
|
||||
|
||||
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
|
||||
pimpl->Parallel(&Module::setReadoutMode, pos, value);
|
||||
pimpl->Parallel3(&Receiver::setReadoutMode, value);
|
||||
}
|
||||
|
||||
Result<int> Detector::getDBITClock(Positions pos) const {
|
||||
|
@ -1106,19 +1106,8 @@ int64_t Module::getSubExptime() {
|
||||
}
|
||||
|
||||
void Module::setSubExptime(int64_t value) {
|
||||
int64_t prevVal = value;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prevVal = getSubExptime();
|
||||
}
|
||||
LOG(logDEBUG1) << "Setting sub exptime to " << value << "ns";
|
||||
sendToDetector(F_SET_SUB_EXPTIME, value, nullptr);
|
||||
if (shm()->useReceiver) {
|
||||
LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||
}
|
||||
if (prevVal != value) {
|
||||
updateRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getSubDeadTime() {
|
||||
@ -1128,10 +1117,6 @@ int64_t Module::getSubDeadTime() {
|
||||
void Module::setSubDeadTime(int64_t value) {
|
||||
LOG(logDEBUG1) << "Setting sub deadtime to " << value << "ns";
|
||||
sendToDetector(F_SET_SUB_DEADTIME, value, nullptr);
|
||||
if (shm()->useReceiver) {
|
||||
LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t Module::getStorageCellDelay() {
|
||||
@ -1228,10 +1213,6 @@ void Module::setTimingMode(timingMode value) {
|
||||
timingMode retval = GET_TIMING_MODE;
|
||||
LOG(logDEBUG1) << "Setting timing mode to " << value;
|
||||
sendToDetector(F_SET_TIMING_MODE, static_cast<int>(value), retval);
|
||||
if (shm()->useReceiver) {
|
||||
LOG(logDEBUG1) << "Sending timing mode to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int Module::getDynamicRange() {
|
||||
@ -1243,36 +1224,10 @@ int Module::getDynamicRange() {
|
||||
}
|
||||
|
||||
void Module::setDynamicRange(int n) {
|
||||
int prev_val = n;
|
||||
if (shm()->myDetectorType == EIGER) {
|
||||
prev_val = getDynamicRange();
|
||||
}
|
||||
|
||||
int retval = -1;
|
||||
LOG(logDEBUG1) << "Setting dynamic range to " << n;
|
||||
sendToDetector(F_SET_DYNAMIC_RANGE, n, retval);
|
||||
LOG(logDEBUG1) << "Dynamic Range: " << retval;
|
||||
|
||||
if (shm()->useReceiver) {
|
||||
int arg = retval;
|
||||
retval = -1;
|
||||
LOG(logDEBUG1) << "Sending dynamic range to receiver: " << arg;
|
||||
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, arg, retval);
|
||||
LOG(logDEBUG1) << "Receiver Dynamic range: " << retval;
|
||||
}
|
||||
|
||||
// changes in dr
|
||||
if (n != prev_val) {
|
||||
// update speed for usability
|
||||
if (n == 32) {
|
||||
LOG(logINFO) << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32";
|
||||
setClockDivider(RUN_CLOCK, 2);
|
||||
} else if (prev_val == 32) {
|
||||
LOG(logINFO) << "Setting Clock to Full Speed for Dynamic Range of " << n;
|
||||
setClockDivider(RUN_CLOCK, 0);
|
||||
}
|
||||
updateRateCorrection();
|
||||
}
|
||||
}
|
||||
|
||||
int Module::setDAC(int val, dacIndex index, int mV) {
|
||||
@ -1368,9 +1323,6 @@ void Module::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD) {
|
||||
updateNumberOfChannels();
|
||||
}
|
||||
if (shm()->useReceiver) {
|
||||
sendToReceiver(F_RECEIVER_SET_READOUT_MODE, mode, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
slsDetectorDefs::readoutMode Module::getReadoutMode() {
|
||||
|
@ -322,7 +322,48 @@ int64_t Receiver::getSoftwareVersion() const {
|
||||
return sendToReceiver<int64_t>(F_GET_RECEIVER_VERSION);
|
||||
}
|
||||
|
||||
/** Acquisition Parameters */
|
||||
/** Acquisition */
|
||||
|
||||
void Receiver::start() {
|
||||
LOG(logDEBUG1) << "Starting Receiver";
|
||||
shm()->stoppedFlag = false;
|
||||
sendToReceiver(F_START_RECEIVER, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void Receiver::stop() {
|
||||
LOG(logDEBUG1) << "Stopping Receiver";
|
||||
int arg = static_cast<int>(shm()->stoppedFlag);
|
||||
sendToReceiver(F_STOP_RECEIVER, arg, nullptr);
|
||||
}
|
||||
|
||||
slsDetectorDefs::runStatus Receiver::getStatus() const {
|
||||
runStatus retval = ERROR;
|
||||
LOG(logDEBUG1) << "Getting Receiver Status";
|
||||
sendToReceiver(F_GET_RECEIVER_STATUS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "Receiver Status: " << ToString(retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
int Receiver::getProgress() const {
|
||||
int retval = -1;
|
||||
sendToReceiver(F_GET_RECEIVER_PROGRESS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "Current Progress of Receiver: " << retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Receiver::setStoppedFlag() {
|
||||
shm()->stoppedFlag = true;
|
||||
}
|
||||
|
||||
void Receiver::restreamStop() {
|
||||
LOG(logDEBUG1) << "Restream stop dummy from Receiver via zmq";
|
||||
sendToReceiver(F_RESTREAM_STOP_FROM_RECEIVER, nullptr, nullptr);
|
||||
}
|
||||
|
||||
/** Network Configuration (Detector<->Receiver) */
|
||||
|
||||
|
||||
/** Detector Parameters */
|
||||
void Receiver::setNumberOfFrames(int64_t value) {
|
||||
LOG(logDEBUG1) << "Sending number of frames to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_NUM_FRAMES, value, nullptr);
|
||||
@ -353,47 +394,31 @@ void Receiver::setExptime(int64_t value) {
|
||||
sendToReceiver(F_RECEIVER_SET_EXPTIME, value, nullptr);
|
||||
}
|
||||
|
||||
/** Acquisition */
|
||||
|
||||
void Receiver::start() {
|
||||
LOG(logDEBUG1) << "Starting Receiver";
|
||||
shm()->stoppedFlag = false;
|
||||
sendToReceiver(F_START_RECEIVER, nullptr, nullptr);
|
||||
void Receiver::setSubExptime(int64_t value) {
|
||||
LOG(logDEBUG1) << "Sending sub exptime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_EXPTIME, value, nullptr);
|
||||
}
|
||||
|
||||
void Receiver::stop() {
|
||||
LOG(logDEBUG1) << "Stopping Receiver";
|
||||
int arg = static_cast<int>(shm()->stoppedFlag);
|
||||
sendToReceiver(F_STOP_RECEIVER, arg, nullptr);
|
||||
void Receiver::setSubDeadTime(int64_t value) {
|
||||
LOG(logDEBUG1) << "Sending sub deadtime to Receiver: " << value;
|
||||
sendToReceiver(F_RECEIVER_SET_SUB_DEADTIME, value, nullptr);
|
||||
}
|
||||
|
||||
slsDetectorDefs::runStatus Receiver::getStatus() const {
|
||||
runStatus retval = ERROR;
|
||||
LOG(logDEBUG1) << "Getting Receiver Status";
|
||||
sendToReceiver(F_GET_RECEIVER_STATUS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "Receiver Status: " << ToString(retval);
|
||||
return retval;
|
||||
void Receiver::setTimingMode(timingMode value) {
|
||||
LOG(logDEBUG1) << "Sending timing mode to Receiver: " << value;
|
||||
sendToReceiver(F_SET_RECEIVER_TIMING_MODE, value, nullptr);
|
||||
}
|
||||
|
||||
|
||||
int Receiver::getProgress() const {
|
||||
void Receiver::setDynamicRange(int n) {
|
||||
int retval = -1;
|
||||
sendToReceiver(F_GET_RECEIVER_PROGRESS, nullptr, retval);
|
||||
LOG(logDEBUG1) << "Current Progress of Receiver: " << retval;
|
||||
return retval;
|
||||
LOG(logDEBUG1) << "Sending dynamic range to receiver: " << n;
|
||||
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, n, retval);
|
||||
}
|
||||
|
||||
void Receiver::setStoppedFlag() {
|
||||
shm()->stoppedFlag = true;
|
||||
void Receiver::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
|
||||
sendToReceiver(F_RECEIVER_SET_READOUT_MODE, mode, nullptr);
|
||||
}
|
||||
|
||||
void Receiver::restreamStop() {
|
||||
LOG(logDEBUG1) << "Restream stop dummy from Receiver via zmq";
|
||||
sendToReceiver(F_RESTREAM_STOP_FROM_RECEIVER, nullptr, nullptr);
|
||||
}
|
||||
|
||||
/** Detector Specific */
|
||||
// Eiger
|
||||
void Receiver::setQuad(const bool enable) {
|
||||
int value = enable ? 1 : 0;
|
||||
LOG(logDEBUG1) << "Setting Quad type to " << value << " in Receiver";
|
||||
@ -406,8 +431,6 @@ void Receiver::setReadNLines(const int value) {
|
||||
sendToReceiver(F_SET_RECEIVER_READ_N_LINES, value, nullptr);
|
||||
}
|
||||
|
||||
// Moench
|
||||
|
||||
void Receiver::setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader) {
|
||||
for (auto &it : jsonHeader) {
|
||||
if (it.first.empty() || it.first.length() > SHORT_STR_LENGTH ||
|
||||
|
@ -59,20 +59,6 @@ namespace sls {
|
||||
std::string printConfiguration();
|
||||
int64_t getSoftwareVersion() const;
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition Parameters *
|
||||
* *
|
||||
* ************************************************/
|
||||
void setNumberOfFrames(int64_t value);
|
||||
void setNumberOfTriggers(int64_t value);
|
||||
void setNumberOfBursts(int64_t value);
|
||||
void setNumberOfAnalogSamples(int value);
|
||||
void setNumberOfDigitalSamples(int value);
|
||||
void setExptime(int64_t value);
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Acquisition *
|
||||
@ -91,6 +77,39 @@ namespace sls {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Detector Parameters *
|
||||
* *
|
||||
* ************************************************/
|
||||
void setNumberOfFrames(int64_t value);
|
||||
void setNumberOfTriggers(int64_t value);
|
||||
void setNumberOfBursts(int64_t value);
|
||||
void setNumberOfAnalogSamples(int value);
|
||||
void setNumberOfDigitalSamples(int value);
|
||||
void setExptime(int64_t value);
|
||||
void setSubExptime(int64_t value);
|
||||
void setSubDeadTime(int64_t value);
|
||||
void setTimingMode(timingMode value);
|
||||
void setDynamicRange(int n);
|
||||
void setReadoutMode(const readoutMode mode);
|
||||
void setQuad(const bool enable);
|
||||
void setReadNLines(const int value);
|
||||
/** empty vector deletes entire additional json header */
|
||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader);
|
||||
std::map<std::string, std::string> getAdditionalJsonHeader();
|
||||
/** Sets the value for the additional json header parameter key if found,
|
||||
else append it. If value empty, then deletes parameter */
|
||||
void setAdditionalJsonParameter(const std::string &key, const std::string &value);
|
||||
std::string getAdditionalJsonParameter(const std::string &key);
|
||||
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Receiver Parameters *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* File *
|
||||
@ -102,26 +121,6 @@ namespace sls {
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Detector Specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
// Eiger
|
||||
void setQuad(const bool enable);
|
||||
void setReadNLines(const int value);
|
||||
|
||||
// Moench
|
||||
/** empty vector deletes entire additional json header */
|
||||
void setAdditionalJsonHeader(const std::map<std::string, std::string> &jsonHeader);
|
||||
std::map<std::string, std::string> getAdditionalJsonHeader();
|
||||
|
||||
/** Sets the value for the additional json header parameter key if found,
|
||||
else append it. If value empty, then deletes parameter */
|
||||
void setAdditionalJsonParameter(const std::string &key, const std::string &value);
|
||||
std::string getAdditionalJsonParameter(const std::string &key);
|
||||
|
||||
|
||||
private:
|
||||
void sendToReceiver(int fnum, const void *args, size_t args_size,
|
||||
void *retval, size_t retval_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user