mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
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:
parent
aecde086a0
commit
8e49a114db
@ -1396,7 +1396,7 @@ class Detector {
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Moench *
|
||||
* Moench specific *
|
||||
* *
|
||||
* ************************************************/
|
||||
|
||||
@ -1423,29 +1423,6 @@ class Detector {
|
||||
const std::string &value,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Moench] TODO! How do we do this best??? Can be refactored to something
|
||||
* else? Use a generic zmq message passing system...
|
||||
* For now limiting to all detectors working the same*/
|
||||
/** [Moench: -1 if not found or cannot convert to int] */
|
||||
Result<int> getDetectorMinMaxEnergyThreshold(const bool isEmax,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/** [Moench] */
|
||||
void setDetectorMinMaxEnergyThreshold(const bool isEmax, const int value,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Moench: -1 if unknown mode] */
|
||||
Result<defs::frameModeType> getFrameMode(Positions pos = {}) const;
|
||||
|
||||
/** [Moench] */
|
||||
void setFrameMode(defs::frameModeType value, Positions pos = {});
|
||||
|
||||
/** [Moench: -1 if unknown mode] */
|
||||
Result<defs::detectorModeType> getDetectorMode(Positions pos = {}) const;
|
||||
|
||||
/** [Moench] */
|
||||
void setDetectorMode(defs::detectorModeType value, Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
* Advanced *
|
||||
|
@ -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) {
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -32,8 +32,6 @@ std::string ToString(const defs::frameDiscardPolicy s);
|
||||
std::string ToString(const defs::fileFormat s);
|
||||
std::string ToString(const defs::externalSignalFlag s);
|
||||
std::string ToString(const defs::readoutMode s);
|
||||
std::string ToString(const defs::frameModeType s);
|
||||
std::string ToString(const defs::detectorModeType s);
|
||||
std::string ToString(const defs::dacIndex s);
|
||||
std::string ToString(const std::vector<defs::dacIndex> &vec);
|
||||
std::string ToString(const defs::burstMode s);
|
||||
@ -283,8 +281,6 @@ template <> defs::frameDiscardPolicy StringTo(const std::string &s);
|
||||
template <> defs::fileFormat StringTo(const std::string &s);
|
||||
template <> defs::externalSignalFlag StringTo(const std::string &s);
|
||||
template <> defs::readoutMode StringTo(const std::string &s);
|
||||
template <> defs::frameModeType StringTo(const std::string &s);
|
||||
template <> defs::detectorModeType StringTo(const std::string &s);
|
||||
template <> defs::dacIndex StringTo(const std::string &s);
|
||||
template <> defs::burstMode StringTo(const std::string &s);
|
||||
template <> defs::timingSourceType StringTo(const std::string &s);
|
||||
|
@ -377,16 +377,6 @@ typedef struct {
|
||||
/** hierarchy in multi-detector structure, if any */
|
||||
enum masterFlags { NO_MASTER, IS_MASTER, IS_SLAVE };
|
||||
|
||||
/**
|
||||
* frame mode for processor
|
||||
*/
|
||||
enum frameModeType { PEDESTAL, NEW_PEDESTAL, FLATFIELD, NEW_FLATFIELD };
|
||||
|
||||
/**
|
||||
* detector mode for processor
|
||||
*/
|
||||
enum detectorModeType { COUNTING, INTERPOLATING, ANALOG };
|
||||
|
||||
/**
|
||||
* burst mode for gotthard2
|
||||
*/
|
||||
|
@ -325,34 +325,6 @@ std::string ToString(const defs::readoutMode s) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::frameModeType s) {
|
||||
switch (s) {
|
||||
case defs::PEDESTAL:
|
||||
return std::string("pedestal");
|
||||
case defs::NEW_PEDESTAL:
|
||||
return std::string("newpedestal");
|
||||
case defs::FLATFIELD:
|
||||
return std::string("flatfield");
|
||||
case defs::NEW_FLATFIELD:
|
||||
return std::string("newflatfield");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::detectorModeType s) {
|
||||
switch (s) {
|
||||
case defs::COUNTING:
|
||||
return std::string("counting");
|
||||
case defs::INTERPOLATING:
|
||||
return std::string("interpolating");
|
||||
case defs::ANALOG:
|
||||
return std::string("analog");
|
||||
default:
|
||||
return std::string("Unknown");
|
||||
}
|
||||
}
|
||||
|
||||
std::string ToString(const defs::dacIndex s) {
|
||||
switch (s) {
|
||||
case defs::DAC_0:
|
||||
@ -713,28 +685,6 @@ template <> defs::readoutMode StringTo(const std::string &s) {
|
||||
throw sls::RuntimeError("Unknown readout mode " + s);
|
||||
}
|
||||
|
||||
template <> defs::frameModeType StringTo(const std::string &s) {
|
||||
if (s == "pedestal")
|
||||
return defs::PEDESTAL;
|
||||
if (s == "newpedestal")
|
||||
return defs::NEW_PEDESTAL;
|
||||
if (s == "flatfield")
|
||||
return defs::FLATFIELD;
|
||||
if (s == "newflatfield")
|
||||
return defs::NEW_FLATFIELD;
|
||||
throw sls::RuntimeError("Unknown frame mode " + s);
|
||||
}
|
||||
|
||||
template <> defs::detectorModeType StringTo(const std::string &s) {
|
||||
if (s == "counting")
|
||||
return defs::COUNTING;
|
||||
if (s == "interpolating")
|
||||
return defs::INTERPOLATING;
|
||||
if (s == "analog")
|
||||
return defs::ANALOG;
|
||||
throw sls::RuntimeError("Unknown detector mode " + s);
|
||||
}
|
||||
|
||||
template <> defs::dacIndex StringTo(const std::string &s) {
|
||||
if (s == "dac 0")
|
||||
return defs::DAC_0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user