Readoutflags (#61)

* WIP

* eiger binary back wih versioning

* fixed readout flag in ctbgui, added speedLevel enum

* ctbgui: fixed a print out error

* ctb readout bug fix

* WIP

* WIP

* WIP
This commit is contained in:
Dhanya Thattil
2019-09-02 19:27:27 +02:00
committed by GitHub
parent 221bb65c0e
commit 5bcde789ac
39 changed files with 819 additions and 684 deletions

View File

@@ -114,6 +114,9 @@ class CmdProxy {
{"period", &CmdProxy::Period},
{"subexptime", &CmdProxy::SubExptime},
{"frames", &CmdProxy::frames},
{"parallel", &CmdProxy::parallel},
{"overflow", &CmdProxy::overflow},
{"storeinram", &CmdProxy::storeinram},
{"fwrite", &CmdProxy::fwrite},
{"fmaster", &CmdProxy::fmaster},
{"foverwrite", &CmdProxy::foverwrite},
@@ -144,7 +147,8 @@ class CmdProxy {
{"masterfile", "fmaster"},
{"outdir", "fpath"},
{"fileformat", "fformat"},
{"overwrite", "foverwrite"}};
{"overwrite", "foverwrite"},
{"flags", "readout"}};
void WrongNumberOfParameters(size_t expected);
@@ -193,6 +197,15 @@ class CmdProxy {
INTEGER_COMMAND(findex, getAcquisitionIndex, setAcquisitionIndex, std::stoi,
"[0, 1]\n\tFile index");
INTEGER_COMMAND(parallel, getParallelMode, setParallelMode, std::stoi,
"[0, 1]\n\tEnable or disable parallel mode. [Eiger]");
INTEGER_COMMAND(overflow, getOverFlowMode, setOverFlowMode, std::stoi,
"[0, 1]\n\tEnable or disable show overflow flag in 32 bit mode. [Eiger]");
INTEGER_COMMAND(storeinram, getStoreInRamMode, setStoreInRamMode, std::stoi,
"[0, 1]\n\tEnable or disable store in ram mode. [Eiger]");
};
} // namespace sls

View File

@@ -154,12 +154,11 @@ class Detector {
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
/** [Eiger][Jungfrau] */
Result<int> getSpeed(Positions pos = {}) const;
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
/** [Eiger][Jungfrau] // TODO: create enum for speed
* Options: (0 full speed, 1 half speed, 2 quarter speed)
*/
void setSpeed(int value, Positions pos = {});
/** [Eiger][Jungfrau]
* Options: FULL_SPEED, HALF_SPEED, QUARTER_SPEED */
void setSpeed(defs::speedLevel value, Positions pos = {});
/** [Gotthard][Jungfrau][CTB] */
Result<int> getADCPhase(Positions pos = {}) const;
@@ -636,6 +635,12 @@ class Detector {
/** [Eiger] */
void setOverFlowMode(bool value, Positions pos = {});
/** [Eiger] */
Result<bool> getStoreInRamMode(Positions pos = {}) const;
/** [Eiger] */
void setStoreInRamMode(bool value, Positions pos = {});
/** [Eiger] */
Result<bool> getBottom(Positions pos = {}) const;
@@ -852,11 +857,10 @@ class Detector {
void setNumberOfDigitalSamples(int64_t value, Positions pos = {});
/** [CTB] */
Result<int> getReadoutMode(Positions pos = {}) const;
Result<defs::readoutMode> getReadoutMode(Positions pos = {}) const;
/** [CTB] Options: NORMAL_READOUT = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL
* //TODO ANALOG_ONLY, make enum = 2 */
void setReadoutMode(int value, Positions pos = {});
/** [CTB] Options: ANALOG_ONLY = 0, DIGITAL_ONLY = 1, ANALOG_AND_DIGITAL */
void setReadoutMode(defs::readoutMode value, Positions pos = {});
/** [CTB] */
Result<int> getDBITPhase(Positions pos = {}) const;

View File

@@ -778,14 +778,18 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int detPos = -1); //
/**
* Set/get readout flags (Eiger, Mythen)
* @param flag readout flag (Eiger options: parallel, nonparallel, safe
* etc.) (-1 gets)
* Set readout mode (Only for CTB and Moench)
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
* @param detPos -1 for all detectors in list or specific detector position
* @returns readout flag
*/
int setReadOutFlags(readOutFlags flag = GET_READOUT_FLAGS,
int detPos = -1); //
void setReadoutMode(const readoutMode mode, int detPos = -1);
/**
* Get readout mode(Only for CTB and Moench)
* @param detPos -1 for all detectors in list or specific detector position
* @returns readout mode
*/
readoutMode getReadoutMode(int detPos = -1);
/**
* Set Interrupt last sub frame (Only for Eiger)

View File

@@ -68,8 +68,8 @@ struct sharedSlsDetector {
/** adc enable mask */
uint32_t adcEnableMask;
/** readout flags */
slsDetectorDefs::readOutFlags roFlags;
/** readout mode */
slsDetectorDefs::readoutMode roMode;
/** detector settings (standard, fast, etc.) */
slsDetectorDefs::detectorSettings currentSettings;
@@ -629,12 +629,52 @@ class slsDetector : public virtual slsDetectorDefs {
setExternalSignalFlags(externalSignalFlag pol = GET_EXTERNAL_SIGNAL_FLAG);
/**
* Set/get readout flags (Eiger, Mythen)
* @param flag readout flag (Eiger options: parallel, nonparallel, safe
* etc.) (-1 gets)
* @returns readout flag
* Set Parallel readout mode (Only for Eiger)
* @param enable true if parallel, else false for non parallel
*/
int setReadOutFlags(readOutFlags flag = GET_READOUT_FLAGS);
void setParallelMode(const bool enable);
/**
* Get parallel mode (Only for Eiger)
* @returns parallel mode
*/
bool getParallelMode();
/**
* Set overflow readout mode in 32 bit mode (Only for Eiger)
* @param enable true if overflow, else false
*/
void setOverFlowMode(const bool enable);
/**
* Get overflow mode in 32 bit mode (Only for Eiger)
* @returns overflow mode
*/
bool getOverFlowMode();
/**
* Set store in ram readout mode (Only for Eiger)
* @param enable true if store in ram, else false
*/
void setStoreInRamMode(const bool enable);
/**
* Get store in ram mode (Only for Eiger)
* @returns store in ram mode
*/
bool getStoreInRamMode();
/**
* Set readout mode (Only for CTB and Moench)
* @param mode readout mode Options: ANALOG_ONLY, DIGITAL_ONLY, ANALOG_AND_DIGITAL
*/
void setReadoutMode(const readoutMode mode);
/**
* Get readout mode(Only for CTB and Moench)
* @returns readout mode
*/
readoutMode getReadoutMode();
/**
* Set Interrupt last sub frame (Only for Eiger)

View File

@@ -398,22 +398,20 @@ public:
/**
* Set parallel readout mode (Eiger)
* @param value readout mode (-1 gets)
* Options: slsDetectorDefs::readOutFlags
* (PARALLEL, NONPARALLEL (Default), SAFE)
* false for NonParallel (Default), true for Parallel
* @param detPos -1 for all detectors in list or specific detector position
* @returns mode register,
* result must be ANDED with PARALLEL/NONPARALLEL/SAFE to get mode
* @returns 1 for parallel, 0 for non parallel, -1 if different
*/
int setParallelMode(int value, int detPos = -1);
int setParallelMode(bool value, int detPos = -1);
/**
* Set overflow readout mode (Eiger in 32 bit)
* @param value readout mode (-1 gets)
* Options: 1(SHOW_OVERFLOW), 0(NOOVERFLOW) (Default)
* Options: true to Show overflow, false to not show overflow
* @param detPos -1 for all detectors in list or specific detector position
* @returns 1 if overflow mode else 0
* @returns 1 for overflow, 0 for no overflow, -1 if different
*/
int setOverflowMode(int value, int detPos = -1);
int setOverflowMode(bool value, int detPos = -1);
/**
* (Advanced user)

View File

@@ -1,10 +1,10 @@
#include "Detector.h"
#include "container_utils.h"
#include "detectorData.h"
#include "logger.h"
#include "multiSlsDetector.h"
#include "slsDetector.h"
#include "sls_detector_defs.h"
#include "detectorData.h"
namespace sls {
@@ -165,13 +165,19 @@ Result<ns> Detector::getDelayAfterTriggerLeft(Positions pos) const {
defs::DELAY_AFTER_TRIGGER);
}
Result<int> Detector::getSpeed(Positions pos) const {
return pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, -1,
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, -1,
0);
Result<defs::speedLevel> speedResult(res.size());
for (size_t i = 0; i < res.size(); ++i) {
speedResult[i] = static_cast<defs::speedLevel>(res[i]);
}
return speedResult;
}
void Detector::setSpeed(int value, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, value, 0);
void Detector::setSpeed(defs::speedLevel value, Positions pos) {
pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER,
static_cast<int>(value), 0);
}
Result<int> Detector::getADCPhase(Positions pos) const {
@@ -265,7 +271,7 @@ void Detector::startAcquisition() {
void Detector::stopAcquisition() {
pimpl->Parallel(&slsDetector::stopAcquisition, {});
if (getUseReceiverFlag().squash(true))
if (getUseReceiverFlag().squash(true))
pimpl->Parallel(&slsDetector::stopReceiver, {});
}
@@ -640,7 +646,8 @@ void Detector::setRxZmqDataStream(bool enable, Positions pos) {
}
Result<int> Detector::getRxZmqFrequency(Positions pos) const {
return pimpl->Parallel(&slsDetector::setReceiverStreamingFrequency, pos, -1);
return pimpl->Parallel(&slsDetector::setReceiverStreamingFrequency, pos,
-1);
}
void Detector::setRxZmqFrequency(int freq, Positions pos) {
@@ -775,33 +782,27 @@ void Detector::setRxAddGapPixels(bool enable) {
}
Result<bool> Detector::getParallelMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
Result<bool> booleanRes(res.size());
for (size_t i = 0; i < res.size(); ++i) {
booleanRes[i] = res[i] & defs::PARALLEL;
}
return booleanRes;
return pimpl->Parallel(&slsDetector::getParallelMode, pos);
}
void Detector::setParallelMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
value ? defs::PARALLEL : defs::NONPARALLEL);
pimpl->Parallel(&slsDetector::setParallelMode, pos, value);
}
Result<bool> Detector::getOverFlowMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
Result<bool> booleanRes(res.size());
for (size_t i = 0; i < res.size(); ++i) {
booleanRes[i] = res[i] & defs::SHOW_OVERFLOW;
}
return booleanRes;
return pimpl->Parallel(&slsDetector::getOverFlowMode, pos);
}
void Detector::setOverFlowMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
value ? defs::SHOW_OVERFLOW : defs::NOOVERFLOW);
pimpl->Parallel(&slsDetector::setOverFlowMode, pos, value);
}
Result<bool> Detector::getStoreInRamMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::getStoreInRamMode, pos);
}
void Detector::setStoreInRamMode(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setStoreInRamMode, pos, value);
}
Result<bool> Detector::getBottom(Positions pos) const {
@@ -1056,39 +1057,12 @@ void Detector::setNumberOfDigitalSamples(int64_t value, Positions pos) {
pimpl->Parallel(&slsDetector::setTimer, pos, defs::DIGITAL_SAMPLES, value);
}
Result<int> Detector::getReadoutMode(Positions pos) const {
auto res = pimpl->Parallel(&slsDetector::setReadOutFlags, pos,
defs::GET_READOUT_FLAGS);
for (auto &it : res) {
if (it & defs::ANALOG_AND_DIGITAL) {
it = 2;
} else if (it & defs::DIGITAL_ONLY) {
it = 1;
} else if (it == defs::NORMAL_READOUT) {
it = 0;
} else {
throw RuntimeError("Unknown Signal Type");
}
}
return res;
Result<defs::readoutMode> Detector::getReadoutMode(Positions pos) const {
return pimpl->Parallel(&slsDetector::getReadoutMode, pos);
}
void Detector::setReadoutMode(int value, Positions pos) {
defs::readOutFlags flag;
switch (value) {
case 0:
flag = defs::NORMAL_READOUT;
break;
case 1:
flag = defs::DIGITAL_ONLY;
break;
case 2:
flag = defs::ANALOG_AND_DIGITAL;
break;
default:
throw RuntimeError("Unknown Signal Type");
}
pimpl->Parallel(&slsDetector::setReadOutFlags, pos, flag);
void Detector::setReadoutMode(defs::readoutMode value, Positions pos) {
pimpl->Parallel(&slsDetector::setReadoutMode, pos, value);
}
Result<int> Detector::getDBITPhase(Positions pos) const {

View File

@@ -1154,14 +1154,24 @@ multiSlsDetector::setExternalSignalFlags(externalSignalFlag pol, int detPos) {
return sls::minusOneIfDifferent(r);
}
int multiSlsDetector::setReadOutFlags(readOutFlags flag, int detPos) {
void multiSlsDetector::setReadoutMode(const slsDetectorDefs::readoutMode mode, int detPos) {
// single
if (detPos >= 0) {
return detectors[detPos]->setReadOutFlags(flag);
detectors[detPos]->setReadoutMode(mode);
}
// multi
auto r = parallelCall(&slsDetector::setReadOutFlags, flag);
parallelCall(&slsDetector::setReadoutMode, mode);
}
slsDetectorDefs::readoutMode multiSlsDetector::getReadoutMode(int detPos) {
// single
if (detPos >= 0) {
return (detectors[detPos]->getReadoutMode());
}
// multi
auto r = parallelCall(&slsDetector::getReadoutMode);
return sls::minusOneIfDifferent(r);
}

View File

@@ -317,7 +317,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->roi.xmin = -1;
shm()->roi.xmax = -1;
shm()->adcEnableMask = BIT32_MASK;
shm()->roFlags = NORMAL_READOUT;
shm()->roMode = ANALOG_ONLY;
shm()->currentSettings = UNINITIALIZED;
shm()->currentThresholdEV = -1;
shm()->timerValue[FRAME_NUMBER] = 1;
@@ -417,7 +417,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->nGappixels.y = parameters.nGappixelsY;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags (ctb only)
updateNumberOfChannels();
}
@@ -573,8 +572,8 @@ void slsDetector::updateNumberOfChannels() {
int nachans = 0, ndchans = 0;
// analog channels (normal, analog/digital readout)
if (shm()->roFlags == slsDetectorDefs::NORMAL_READOUT ||
((shm()->roFlags & slsDetectorDefs::ANALOG_AND_DIGITAL) != 0)) {
if (shm()->roMode == slsDetectorDefs::ANALOG_ONLY ||
shm()->roMode == slsDetectorDefs::ANALOG_AND_DIGITAL) {
uint32_t mask = shm()->adcEnableMask;
if (mask == BIT32_MASK) {
nachans = 32;
@@ -589,8 +588,8 @@ void slsDetector::updateNumberOfChannels() {
// digital channels (ctb only, digital, analog/digital readout)
if (shm()->myDetectorType == CHIPTESTBOARD &&
(((shm()->roFlags & DIGITAL_ONLY) != 0) ||
((shm()->roFlags & ANALOG_AND_DIGITAL) != 0))) {
(shm()->roMode == DIGITAL_ONLY ||
shm()->roMode == ANALOG_AND_DIGITAL)) {
ndchans = 64;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
}
@@ -804,11 +803,10 @@ void slsDetector::updateCachedDetectorVariables() {
n += client.Receive(&i64, sizeof(i64));
shm()->timerValue[CYCLES_NUMBER] = i64;
// readout flags
if (shm()->myDetectorType == EIGER ||
shm()->myDetectorType == CHIPTESTBOARD) {
// readout mode
if (shm()->myDetectorType == CHIPTESTBOARD) {
n += client.Receive(&i32, sizeof(i32));
shm()->roFlags = static_cast<readOutFlags>(i32);
shm()->roMode = static_cast<readoutMode>(i32);
}
// roi
@@ -841,7 +839,6 @@ void slsDetector::updateCachedDetectorVariables() {
setAdditionalJsonParameter("adcmask", std::to_string(u32));
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
updateNumberOfChannels();
}
@@ -1350,7 +1347,6 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval;
shm()->timerValue[index] = retval;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) {
updateNumberOfChannels();
}
@@ -1491,27 +1487,80 @@ slsDetector::setExternalSignalFlags(externalSignalFlag pol) {
return retval;
}
int slsDetector::setReadOutFlags(readOutFlags flag) {
auto arg = static_cast<int>(flag);
readOutFlags retval = GET_READOUT_FLAGS;
FILE_LOG(logDEBUG1) << "Setting readout flags to " << flag;
sendToDetector(F_SET_READOUT_FLAGS, arg, retval);
FILE_LOG(logDEBUG1) << "Readout flag: " << retval;
shm()->roFlags = retval;
void slsDetector::setParallelMode(const bool enable) {
int arg = static_cast<int>(enable);
FILE_LOG(logDEBUG1) << "Setting parallel mode to " << arg;
sendToDetector(F_SET_PARALLEL_MODE, arg, nullptr);
}
bool slsDetector::getParallelMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting parallel mode";
sendToDetector(F_GET_PARALLEL_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "Parallel mode: " << retval;
return static_cast<bool>(retval);
}
void slsDetector::setOverFlowMode(const bool enable) {
int arg = static_cast<int>(enable);
FILE_LOG(logDEBUG1) << "Setting overflow mode to " << arg;
sendToDetector(F_SET_OVERFLOW_MODE, arg, nullptr);
}
bool slsDetector::getOverFlowMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting overflow mode";
sendToDetector(F_GET_OVERFLOW_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "overflow mode: " << retval;
return static_cast<bool>(retval);
}
void slsDetector::setStoreInRamMode(const bool enable) {
int arg = static_cast<int>(enable);
FILE_LOG(logDEBUG1) << "Setting store in ram mode to " << arg;
sendToDetector(F_SET_STOREINRAM_MODE, arg, nullptr);
}
bool slsDetector::getStoreInRamMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting store in ram mode";
sendToDetector(F_GET_STOREINRAM_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "store in ram mode: " << retval;
return static_cast<bool>(retval);
}
void slsDetector::setReadoutMode(const slsDetectorDefs::readoutMode mode) {
uint32_t arg = static_cast<uint32_t>(mode);
FILE_LOG(logDEBUG1) << "Setting readout mode to " << arg;
sendToDetector(F_SET_READOUT_MODE, arg, nullptr);
shm()->roMode = mode;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
if (shm()->myDetectorType == CHIPTESTBOARD) {
updateNumberOfChannels();
}
FILE_LOG(logDEBUG1) << "Setting receiver readout flags to " << arg;
if (shm()->useReceiverFlag) {
int fnum = F_RECEIVER_SET_READOUT_FLAGS;
arg = shm()->roFlags;
retval = static_cast<readOutFlags>(-1);
sendToReceiver(fnum, &arg, sizeof(arg), &retval, sizeof(retval));
FILE_LOG(logDEBUG1) << "Receiver readout flag: " << retval;
sendToReceiver(F_RECEIVER_SET_READOUT_MODE, mode, nullptr);
}
return shm()->roFlags;
}
slsDetectorDefs::readoutMode slsDetector::getReadoutMode() {
int retval = -1;
FILE_LOG(logDEBUG1) << "Getting readout mode";
sendToDetector(F_GET_READOUT_MODE, nullptr, retval);
FILE_LOG(logDEBUG1) << "Readout mode: " << retval;
readoutMode oldmode = shm()->roMode;
shm()->roMode = static_cast<readoutMode>(retval);
if (oldmode != shm()->roMode) {
// update #nchan, as it depends on #samples, adcmask,
if (shm()->myDetectorType == CHIPTESTBOARD) {
updateNumberOfChannels();
}
if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_SET_READOUT_MODE, shm()->roMode, nullptr);
}
}
return shm()->roMode;
}
void slsDetector::setInterruptSubframe(const bool enable) {
@@ -1731,7 +1780,6 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
static_cast<int>(shm()->rxPadDeactivatedModules));
enableGapPixels(shm()->gappixels);
enableTenGigabitEthernet(shm()->tenGigaEnable);
setReadOutFlags(GET_READOUT_FLAGS);
setQuad(getQuad());
break;
@@ -1739,7 +1787,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
setTimer(ANALOG_SAMPLES, shm()->timerValue[ANALOG_SAMPLES]);
setTimer(DIGITAL_SAMPLES, shm()->timerValue[DIGITAL_SAMPLES]);
enableTenGigabitEthernet(shm()->tenGigaEnable);
setReadOutFlags(GET_READOUT_FLAGS);
setReadoutMode(shm()->roMode);
setADCEnableMask(shm()->adcEnableMask);
setReceiverDbitOffset(shm()->rxDbitOffset);
setReceiverDbitList(shm()->rxDbitList);
@@ -2276,7 +2324,6 @@ void slsDetector::setADCEnableMask(uint32_t mask) {
shm()->adcEnableMask = mask;
// update #nchan, as it depends on #samples, adcmask,
// readoutflags
updateNumberOfChannels();
// send to processor

View File

@@ -351,9 +351,9 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
*/
/*! \page config
- <b>flags [flag]</b> sets/gets the readout flags to mode. Options: none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown. Used for EIGER only. \c Returns \c (string). put takes one string and \c returns concatenation of all active flags separated by spaces.
- <b>romode [b]</b> sets/gets the readout flag. Options: analog, digital, analog_digital. Used for CTB only. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "flags";
descrToFuncMap[i].m_pFuncName = "romode";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdAdvanced;
++i;
@@ -691,7 +691,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
*/
/*! \page config
- <b>clkdivider [i]</b> sets/gets the readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. Jungfrau, full speed is not implemented and overwrites adcphase to recommended default. Not for Gotthard. \c Returns \c (int)
- <b>clkdivider [i]</b> sets/gets the readout clock divider. EIGER, JUNGFRAU [0(fast speed), 1(half speed), 2(quarter speed)]. Jungfrau also overwrites adcphase to recommended default. For CTB, it is the run clock in MHz. Not for Gotthard. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName = "clkdivider";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSpeed;
@@ -4282,8 +4282,14 @@ std::string slsDetectorCommand::cmdSpeed(int narg, const char * const args[], in
if (action == PUT_ACTION) {
if (sscanf(args[1], "%d", &t))
;
else
else {
// if parameer is a string (unknown speed will throw)
if (cmd == "clkdivider") {
speedLevel lev = getSpeedLevelType(std::string(args[1]));
t = static_cast<int>(lev);
}
return std::string("cannot scan speed value ") + std::string(args[1]);
}
}
@@ -4325,72 +4331,17 @@ std::string slsDetectorCommand::helpSpeed(int action) {
std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[], int action, int detPos) {
char answer[1000] = "";
if (action == HELP_ACTION)
return helpAdvanced(action);
if (cmd == "flags") {
readOutFlags flag = GET_READOUT_FLAGS;
if (cmd == "romode") {
if (action == PUT_ACTION) {
std::string sval = std::string(args[1]);
if (sval == "none")
flag = NORMAL_READOUT;
else if (sval == "storeinram")
flag = STORE_IN_RAM;
else if (sval == "tot")
flag = TOT_MODE;
else if (sval == "continous")
flag = CONTINOUS_RO;
else if (sval == "parallel")
flag = PARALLEL;
else if (sval == "nonparallel")
flag = NONPARALLEL;
else if (sval == "digital")
flag = DIGITAL_ONLY;
else if (sval == "analog_digital")
flag = ANALOG_AND_DIGITAL;
else if (sval == "overflow")
flag = SHOW_OVERFLOW;
else if (sval == "nooverflow")
flag = NOOVERFLOW;
else
return std::string("could not scan flag ") + std::string(args[1]);
myDet->setReadoutMode(getReadoutModeType(std::string(args[1])), detPos);
}
return getReadoutModeType(myDet->getReadoutMode());
}
int retval = myDet->setReadOutFlags(flag, detPos);
// std::cout << std::hex << flag << " " << retval << std::endl;
if (retval == NORMAL_READOUT)
return std::string("none");
if (retval & STORE_IN_RAM)
strcat(answer, "storeinram ");
if (retval & TOT_MODE)
strcat(answer, "tot ");
if (retval & CONTINOUS_RO)
strcat(answer, "continous ");
if (retval & PARALLEL)
strcat(answer, "parallel ");
if (retval & NONPARALLEL)
strcat(answer, "nonparallel ");
if (retval & DIGITAL_ONLY)
strcat(answer, "digital ");
if (retval & ANALOG_AND_DIGITAL)
strcat(answer, "analog_digital ");
if (retval & SHOW_OVERFLOW)
strcat(answer, "overflow ");
if (retval & NOOVERFLOW)
strcat(answer, "nooverflow ");
if (strlen(answer))
return std::string(answer);
return std::string("unknown");
} else if (cmd=="interruptsubframe") {
else if (cmd=="interruptsubframe") {
if (action==PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
@@ -4399,7 +4350,9 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
}
return std::to_string(myDet->getInterruptSubframe());
} else if (cmd == "readnlines") {
}
else if (cmd == "readnlines") {
if (action == PUT_ACTION) {
int ival = -1;
if (!sscanf(args[1],"%d",&ival))
@@ -4408,7 +4361,9 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
}
return std::to_string(myDet->getReadNLines());
} else if (cmd == "extsig") {
}
else if (cmd == "extsig") {
externalSignalFlag flag = GET_EXTERNAL_SIGNAL_FLAG;
if (action == PUT_ACTION) {
@@ -4419,7 +4374,9 @@ std::string slsDetectorCommand::cmdAdvanced(int narg, const char * const args[],
return myDet->externalSignalType(myDet->setExternalSignalFlags(flag, detPos));
} else if (cmd == "programfpga") {
}
else if (cmd == "programfpga") {
if (action == GET_ACTION)
return std::string("cannot get");
if (strstr(args[1], ".pof") == nullptr)
@@ -4528,7 +4485,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
if (action == PUT_ACTION || action == HELP_ACTION) {
os << "extsig mode \t sets the mode of the external signal. can be trigger_out_rising_edge, trigger_out_falling_edge. Gotthard only" << std::endl;
os << "flags mode \t sets the readout flags to mode. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overlow, nooverflow, unknown." << std::endl;
os << "romode m \t sets the readout flag to m. Options: analog, digital, analog_digital. Used for CTB only." << std::endl;
os << "interruptsubframe flag \t sets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines f \t sets the number of rows to read out per half module. Options: 1 - 256 (Not all values as it depends on dynamic range and 10GbE enabled). Used for EIGER only. " << std::endl;
os << "programfpga f \t programs the fpga with file f (with .pof extension)." << std::endl;
@@ -4544,7 +4501,7 @@ std::string slsDetectorCommand::helpAdvanced(int action) {
if (action == GET_ACTION || action == HELP_ACTION) {
os << "extsig \t gets the mode of the external signal. can be trigger_in_rising_edge, trigger_in_falling_edge. Gotthard only" << std::endl;
os << "flags \t gets the readout flags. can be none, storeinram, tot, continous, parallel, nonparallel, digital, analog_digital, overflow, nooverflow, unknown" << std::endl;
os << "romode \t gets the readout flag. Options: analog, digital, analog_digital. Used for CTB only." << std::endl;
os << "interruptsubframe \t gets the interrupt subframe flag. Setting it to 1 will interrupt the last subframe at the required exposure time. By default, this is disabled and set to 0, ie. it will wait for the last sub frame to finish exposing. Used for EIGER in 32 bit mode only." << std::endl;
os << "readnlines \t gets the number of rows to read out per half module. Used for EIGER only. " << std::endl;
os << "led \t returns led status (0 off, 1 on)" << std::endl;

View File

@@ -167,23 +167,22 @@ int slsDetectorUsers::setClockDivider(int value, int detPos) {
return detector.setSpeed(slsDetectorDefs::CLOCK_DIVIDER, value, detPos);
}
int slsDetectorUsers::setParallelMode(int value, int detPos) {
if(value >= 0)
detector.setReadOutFlags(slsDetectorDefs::readOutFlags(value), detPos);
return detector.setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
int slsDetectorUsers::setParallelMode(bool value, int detPos) {
/* to be uncommented when moving to Detector.h
detector.setParallelMode(value, {detPos});
auto res = detector.getParallelMode({detPos});
if (res.equal())
return res.front();*/
return -1;
}
int slsDetectorUsers::setOverflowMode(int value, int detPos) {
if(value >= 0) {
if (value == 1)
detector.setReadOutFlags(slsDetectorDefs::SHOW_OVERFLOW, detPos);
else
detector.setReadOutFlags(slsDetectorDefs::NOOVERFLOW, detPos);
}
int ret = detector.setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
if (ret == -1)
return -1;
return ((ret & slsDetectorDefs::SHOW_OVERFLOW) ? 1 : 0);
int slsDetectorUsers::setOverflowMode(bool value, int detPos) {
/* to be uncommented when moving to Detector.h
detector.setOverFlowMode(value, {detPos});
auto res = detector.getOverFlowMode({detPos});
if (res.equal())
return res.front();*/
return -1;
}
int slsDetectorUsers::setAllTrimbits(int val, int detPos) {