mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
gotthard2: bursttype to burstmode
This commit is contained in:
@ -916,16 +916,10 @@ class Detector {
|
||||
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<bool> getBurstMode(Positions pos = {});
|
||||
Result<defs::burstMode> getBurstMode(Positions pos = {});
|
||||
|
||||
/** [Gotthard2] true = burst mode or false = continuous mode */
|
||||
void setBurstMode(bool enable, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::burstModeType> getBurstType(Positions pos = {});
|
||||
|
||||
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
|
||||
void setBurstType(defs::burstModeType val, Positions pos = {});
|
||||
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||
void setBurstMode(defs::burstMode value, Positions pos = {});
|
||||
|
||||
/**************************************************
|
||||
* *
|
||||
|
@ -1225,6 +1225,51 @@ std::string CmdProxy::VetoReference(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::BurstMode(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[off or 0, internal or 1, external or 2]\n\t[Gotthard2] Default is burst internal type"
|
||||
<< '\n';
|
||||
} else {
|
||||
if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getBurstMode({det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.size() != 1) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
defs::burstMode t;
|
||||
try {
|
||||
int ival = std::stoi(args[0]);
|
||||
switch (ival) {
|
||||
case 0:
|
||||
t = defs::BURST_OFF;
|
||||
break;
|
||||
case 1:
|
||||
t = defs::BURST_INTERNAL;
|
||||
break;
|
||||
case 2:
|
||||
t = defs::BURST_EXTERNAL;
|
||||
break;
|
||||
default:
|
||||
throw sls::RuntimeError("Unknown burst mode " + args[0]);
|
||||
}
|
||||
} catch (...) {
|
||||
t = sls::StringTo<defs::burstMode>(args[0]);
|
||||
}
|
||||
det->setBurstMode(t, {det_id});
|
||||
os << sls::ToString(t) << '\n'; // no args to convert 0,1,2 as well
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
/* Mythen3 Specific */
|
||||
|
||||
std::string CmdProxy::Counters(int action) {
|
||||
|
@ -787,8 +787,7 @@ class CmdProxy {
|
||||
{"inj_ch", &CmdProxy::InjectChannel},
|
||||
{"vetophoton", &CmdProxy::VetoPhoton},
|
||||
{"vetoref", &CmdProxy::VetoReference},
|
||||
{"burstmode", &CmdProxy::burstmode},
|
||||
{"bursttype", &CmdProxy::bursttype},
|
||||
{"burstmode", &CmdProxy::BurstMode},
|
||||
|
||||
/* Mythen3 Specific */
|
||||
{"counters", &CmdProxy::Counters},
|
||||
@ -948,6 +947,7 @@ class CmdProxy {
|
||||
std::string InjectChannel(int action);
|
||||
std::string VetoPhoton(int action);
|
||||
std::string VetoReference(int action);
|
||||
std::string BurstMode(int action);
|
||||
/* Mythen3 Specific */
|
||||
std::string Counters(int action);
|
||||
/* CTB Specific */
|
||||
@ -1554,12 +1554,6 @@ class CmdProxy {
|
||||
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated values when taking an acquisition. Default is 0.");
|
||||
|
||||
/* Gotthard2 Specific */
|
||||
INTEGER_COMMAND(burstmode, getBurstMode, setBurstMode, std::stoi,
|
||||
"[0, 1]\n\t[Gotthard2] 1 sets to burst mode. 0 sets to continuous mode. Default is burst mode.");
|
||||
|
||||
INTEGER_COMMAND(bursttype, getBurstType, setBurstType, sls::StringTo<slsDetectorDefs::burstModeType>,
|
||||
"[internal, external]\n\t[Gotthard2] Default is internal type.");
|
||||
|
||||
/* Mythen3 Specific */
|
||||
|
||||
/* CTB Specific */
|
||||
|
@ -1180,20 +1180,12 @@ void Detector::setVetoReference(const int gainIndex, const int value, Positions
|
||||
pimpl->Parallel(&slsDetector::setVetoReference, pos, gainIndex, value);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getBurstMode(Positions pos) {
|
||||
Result<defs::burstMode> Detector::getBurstMode(Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
|
||||
}
|
||||
|
||||
void Detector::setBurstMode(bool enable, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setBurstMode, pos, enable);
|
||||
}
|
||||
|
||||
Result<defs::burstModeType> Detector::getBurstType(Positions pos) {
|
||||
return pimpl->Parallel(&slsDetector::getBurstType, pos);
|
||||
}
|
||||
|
||||
void Detector::setBurstType(defs::burstModeType value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setBurstType, pos, value);
|
||||
void Detector::setBurstMode(defs::burstMode value, Positions pos) {
|
||||
pimpl->Parallel(&slsDetector::setBurstMode, pos, value);
|
||||
}
|
||||
|
||||
// Mythen3 Specific
|
||||
|
@ -2476,32 +2476,19 @@ void slsDetector::setVetoReference(const int gainIndex, const int value) {
|
||||
sendToDetector(F_SET_VETO_REFERENCE, args, nullptr);
|
||||
}
|
||||
|
||||
bool slsDetector::getBurstMode() {
|
||||
slsDetectorDefs::burstMode slsDetector::getBurstMode() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_BURST_MODE, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
||||
return static_cast<bool>(retval);
|
||||
return static_cast<slsDetectorDefs::burstMode>(retval);
|
||||
}
|
||||
|
||||
void slsDetector::setBurstMode(bool enable) {
|
||||
int arg = static_cast<int>(enable);
|
||||
void slsDetector::setBurstMode(slsDetectorDefs::burstMode value) {
|
||||
int arg = static_cast<int>(value);
|
||||
FILE_LOG(logDEBUG1) << "Setting burst mode to " << arg;
|
||||
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
||||
}
|
||||
|
||||
slsDetectorDefs::burstModeType slsDetector::getBurstType() {
|
||||
int retval = -1;
|
||||
sendToDetector(F_GET_BURST_TYPE, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
||||
return static_cast<burstModeType>(retval);
|
||||
}
|
||||
|
||||
void slsDetector::setBurstType (burstModeType val) {
|
||||
int arg = static_cast<int>(val);
|
||||
FILE_LOG(logDEBUG1) << "Setting burst type to " << ToString(val);
|
||||
sendToDetector(F_SET_BURST_TYPE, arg, nullptr);
|
||||
}
|
||||
|
||||
int slsDetector::setCounterBit(int cb) {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
||||
|
@ -1131,17 +1131,11 @@ class slsDetector : public virtual slsDetectorDefs {
|
||||
void setVetoReference(const int gainIndex, const int value);
|
||||
|
||||
/** [Gotthard2] */
|
||||
bool getBurstMode();
|
||||
burstMode getBurstMode();
|
||||
|
||||
/** [Gotthard2] true = burst mode or false = continuous mode */
|
||||
void setBurstMode(bool enable);
|
||||
|
||||
/** [Gotthard2] */
|
||||
burstModeType getBurstType();
|
||||
|
||||
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
|
||||
void setBurstType(burstModeType val);
|
||||
|
||||
/** [Gotthard2] BURST_OFF, BURST_INTERNAL (default), BURST_EXTERNAL */
|
||||
void setBurstMode(burstMode value);
|
||||
|
||||
/**
|
||||
* Set/get counter bit in detector (Gotthard)
|
||||
* @param i is -1 to get, 0 to reset and any other value to set the counter
|
||||
|
Reference in New Issue
Block a user