moench: removed api that goes only to processor (future: one has to use rX_jsonaddheader or rx_jsonpara to set key and values)

This commit is contained in:
2020-09-08 12:34:56 +02:00
parent aecde086a0
commit 8e49a114db
8 changed files with 1 additions and 247 deletions

View File

@ -2389,52 +2389,6 @@ std::string CmdProxy::JsonParameter(int action) {
return os.str();
}
std::string CmdProxy::MinMaxEnergyThreshold(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
if (cmd == "emin") {
os << "[n_value]\n\t[Moench] Minimum energy threshold (soft "
"setting) for processor."
<< '\n';
} else if (cmd == "emax") {
os << "[n_value]\n\t[Moench] Maximum energy threshold (soft "
"setting) for processor."
<< '\n';
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
}
} else {
bool emax = false;
if (cmd == "emin") {
emax = false;
} else if (cmd == "emax") {
emax = true;
} else {
throw sls::RuntimeError(
"Unknown command, use list to list all commands");
}
if (action == defs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDetectorMinMaxEnergyThreshold(emax, {det_id});
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
det->setDetectorMinMaxEnergyThreshold(emax, StringTo<int>(args[0]),
{det_id});
os << args.front() << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
}
return os.str();
}
/* Advanced */
std::string CmdProxy::ProgramFpga(int action) {

View File

@ -971,10 +971,6 @@ class CmdProxy {
/* Moench */
{"rx_jsonaddheader", &CmdProxy::AdditionalJsonHeader},
{"rx_jsonpara", &CmdProxy::JsonParameter},
{"emin", &CmdProxy::MinMaxEnergyThreshold},
{"emax", &CmdProxy::MinMaxEnergyThreshold},
{"framemode", &CmdProxy::framemode},
{"detectormode", &CmdProxy::detectormode},
/* Advanced */
{"programfpga", &CmdProxy::ProgramFpga},
@ -1091,7 +1087,6 @@ class CmdProxy {
/* Moench */
std::string AdditionalJsonHeader(int action);
std::string JsonParameter(int action);
std::string MinMaxEnergyThreshold(int action);
/* Advanced */
std::string ProgramFpga(int action);
std::string CopyDetectorServer(int action);
@ -2209,17 +2204,6 @@ class CmdProxy {
"\n\t[Mythen3] Starts Pattern");
/* Moench */
INTEGER_COMMAND(framemode, getFrameMode, setFrameMode,
sls::StringTo<slsDetectorDefs::frameModeType>,
"[pedestal|newpedestal|flatfield|newflatfield]\n\t[Moench] "
"Frame mode (soft setting) in processor.");
INTEGER_COMMAND(detectormode, getDetectorMode, setDetectorMode,
sls::StringTo<slsDetectorDefs::detectorModeType>,
"[counting|interpolating|analog]\n\t[Moench] Detector mode "
"(soft setting) in processor.");
/* Advanced */
EXECUTE_SET_COMMAND(resetfpga, resetFPGA,

View File

@ -1840,71 +1840,6 @@ void Detector::setAdditionalJsonParameter(const std::string &key,
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, key, value);
}
Result<int> Detector::getDetectorMinMaxEnergyThreshold(const bool isEmax,
Positions pos) const {
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
isEmax ? "emax" : "emin");
Result<int> intResult(res.size());
try {
for (unsigned int i = 0; i < res.size(); ++i) {
intResult[i] = stoi(res[i]);
}
} catch (...) {
throw RuntimeError(
"Cannot find or convert emin/emax string to integer");
}
return intResult;
}
void Detector::setDetectorMinMaxEnergyThreshold(const bool isEmax,
const int value,
Positions pos) {
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos,
isEmax ? "emax" : "emin", std::to_string(value));
}
Result<defs::frameModeType> Detector::getFrameMode(Positions pos) const {
auto res =
pimpl->Parallel(&Module::getAdditionalJsonParameter, pos, "frameMode");
Result<defs::frameModeType> intResult(res.size());
try {
for (unsigned int i = 0; i < res.size(); ++i) {
intResult[i] =
sls::StringTo<slsDetectorDefs::frameModeType>(res[i]);
}
} catch (...) {
throw RuntimeError(
"Cannot find or convert frameMode string to integer");
}
return intResult;
}
void Detector::setFrameMode(defs::frameModeType value, Positions pos) {
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "frameMode",
sls::ToString(value));
}
Result<defs::detectorModeType> Detector::getDetectorMode(Positions pos) const {
auto res = pimpl->Parallel(&Module::getAdditionalJsonParameter, pos,
"detectorMode");
Result<defs::detectorModeType> intResult(res.size());
try {
for (unsigned int i = 0; i < res.size(); ++i) {
intResult[i] =
sls::StringTo<slsDetectorDefs::detectorModeType>(res[i]);
}
} catch (...) {
throw RuntimeError(
"Cannot find or convert detectorMode string to integer");
}
return intResult;
}
void Detector::setDetectorMode(defs::detectorModeType value, Positions pos) {
pimpl->Parallel(&Module::setAdditionalJsonParameter, pos, "detectorMode",
sls::ToString(value));
}
// Advanced
void Detector::programFPGA(const std::string &fname, Positions pos) {

View File

@ -792,13 +792,6 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
shm()->numUDPInterfaces = retval.udpInterfaces;
if (shm()->myDetectorType == MOENCH) {
setAdditionalJsonParameter("adcmask_1g",
std::to_string(retval.adcMask));
setAdditionalJsonParameter("adcmask_10g",
std::to_string(retval.adc10gMask));
}
// to use rx_hostname if empty and also update client zmqip
updateReceiverStreamingIP();
}
@ -1073,19 +1066,6 @@ void Module::setSubDeadTime(int64_t value) {
}
int Module::getThresholdEnergy() const {
// moench - get threshold energy from json header
if (shm()->myDetectorType == MOENCH) {
getAdditionalJsonHeader();
std::string result = getAdditionalJsonParameter("threshold");
// convert to integer
try {
return std::stoi(result);
}
// not found or cannot scan integer
catch (...) {
return -1;
}
}
return sendToDetector<int>(F_GET_THRESHOLD_ENERGY);
}
@ -1097,10 +1077,6 @@ void Module::setThresholdEnergy(int e_eV, detectorSettings isettings,
if (shm()->useReceiverFlag) {
sendToReceiver(F_RECEIVER_SET_THRESHOLD, e_eV, nullptr);
}
}
// moench - send threshold energy to processor
else if (shm()->myDetectorType == MOENCH) {
setAdditionalJsonParameter("threshold", std::to_string(e_eV));
} else {
throw RuntimeError(
"Set threshold energy not implemented for this detector");
@ -1789,10 +1765,6 @@ void Module::setADCEnableMask(uint32_t mask) {
// update #nchan, as it depends on #samples, adcmask,
updateNumberOfChannels();
// send to processor
if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask_1g", std::to_string(mask));
if (shm()->useReceiverFlag) {
sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK, mask);
}
@ -1806,10 +1778,6 @@ void Module::setTenGigaADCEnableMask(uint32_t mask) {
sendToDetector(F_SET_ADC_ENABLE_MASK_10G, mask, nullptr);
updateNumberOfChannels(); // depends on samples and adcmask
// send to processor
if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask_10g", std::to_string(mask));
if (shm()->useReceiverFlag) {
sendToReceiver<int>(F_RECEIVER_SET_ADC_MASK_10G, mask);
}