* added api in detector class for adcvpp, taken out of dac list
This commit is contained in:
Dhanya Thattil 2022-10-20 10:58:56 +02:00 committed by GitHub
parent af300e0276
commit b7cdfbb4d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 14 deletions

View File

@ -14,7 +14,6 @@ pycmd = dir(Detector)
# dacs are in general not included in the python commands and we expect to # dacs are in general not included in the python commands and we expect to
# set them from the specialized class or using an enum # set them from the specialized class or using an enum
dacs = [ dacs = [
'adcvpp',
'iodelay', 'iodelay',
'list', 'list',
'rxb_lb', 'rxb_lb',

View File

@ -1585,6 +1585,14 @@ class Detector {
*/ */
void setVoltage(defs::dacIndex index, int value, Positions pos = {}); void setVoltage(defs::dacIndex index, int value, Positions pos = {});
/**
* [CTB][Moench] Options: [0- 4] or [1V, 1.14V, 1.33V, 1.6V, 2V]
*/
Result<int> getADCVpp(bool mV = false, Positions pos = {}) const;
/** [CTB][Moench] */
void setADCVpp(int value, bool mV = false, Positions pos = {});
/** [CTB][Moench] */ /** [CTB][Moench] */
Result<uint32_t> getADCEnableMask(Positions pos = {}) const; Result<uint32_t> getADCEnableMask(Positions pos = {}) const;

View File

@ -2556,6 +2556,51 @@ std::string CmdProxy::Samples(int action) {
} }
/* CTB Specific */ /* CTB Specific */
std::string CmdProxy::AdcVpp(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function!\n"
<< '\n';
return os.str();
}
if (action == defs::GET_ACTION) {
bool mV = false;
if (args.size() == 1) {
if ((args[0] != "mv") && (args[0] != "mV")) {
throw RuntimeError("Unknown argument " + args[0] +
". Did you mean mV?");
}
mV = true;
} else if (args.size() > 1) {
WrongNumberOfParameters(1);
}
auto t = det->getADCVpp(mV, std::vector<int>{det_id});
os << OutString(t) << (mV ? " mV\n" : "\n");
} else if (action == defs::PUT_ACTION) {
bool mV = false;
if (args.size() == 2) {
if ((args[1] != "mv") && (args[1] != "mV")) {
throw RuntimeError("Unknown argument " + args[1] +
". Did you mean mV?");
}
mV = true;
} else if (args.size() > 2 || args.size() < 1) {
WrongNumberOfParameters(1);
}
det->setADCVpp(StringTo<int>(args[1]), mV,
std::vector<int>{det_id});
os << args[1] << (mV ? " mV\n" : "\n");
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::SlowAdc(int action) { std::string CmdProxy::SlowAdc(int action) {
std::ostringstream os; std::ostringstream os;

View File

@ -666,7 +666,6 @@ class CmdProxy {
{"vb_cs", "dac"}, {"vb_cs", "dac"},
{"vb_opa_fd", "dac"}, {"vb_opa_fd", "dac"},
{"vcom_adc2", "dac"}, {"vcom_adc2", "dac"},
{"adcvpp", "dac"},
{"vb_ds", "dac"}, {"vb_ds", "dac"},
{"vb_comp", "dac"}, {"vb_comp", "dac"},
{"vb_pixbuf", "dac"}, {"vb_pixbuf", "dac"},
@ -1018,6 +1017,7 @@ class CmdProxy {
{"dsamples", &CmdProxy::dsamples}, {"dsamples", &CmdProxy::dsamples},
{"romode", &CmdProxy::romode}, {"romode", &CmdProxy::romode},
{"dbitclk", &CmdProxy::dbitclk}, {"dbitclk", &CmdProxy::dbitclk},
{"adcvpp", &CmdProxy::AdcVpp},
{"v_a", &CmdProxy::v_a}, {"v_a", &CmdProxy::v_a},
{"v_b", &CmdProxy::v_b}, {"v_b", &CmdProxy::v_b},
{"v_c", &CmdProxy::v_c}, {"v_c", &CmdProxy::v_c},
@ -1190,6 +1190,7 @@ class CmdProxy {
/* CTB/ Moench Specific */ /* CTB/ Moench Specific */
std::string Samples(int action); std::string Samples(int action);
/* CTB Specific */ /* CTB Specific */
std::string AdcVpp(int action);
std::string SlowAdc(int action); std::string SlowAdc(int action);
std::string ReceiverDbitList(int action); std::string ReceiverDbitList(int action);
std::string DigitalIODelay(int action); std::string DigitalIODelay(int action);

View File

@ -1999,6 +1999,14 @@ void Detector::setVoltage(defs::dacIndex index, int value, Positions pos) {
pimpl->Parallel(&Module::setDAC, pos, value, index, true); pimpl->Parallel(&Module::setDAC, pos, value, index, true);
} }
Result<int> Detector::getADCVpp(bool mV, Positions pos) const {
return pimpl->Parallel(&Module::getDAC, pos, defs::ADC_VPP, mV);
}
void Detector::setADCVpp(int value, bool mV, Positions pos) {
pimpl->Parallel(&Module::setDAC, pos, value, defs::ADC_VPP, mV);
}
Result<uint32_t> Detector::getADCEnableMask(Positions pos) const { Result<uint32_t> Detector::getADCEnableMask(Positions pos) const {
return pimpl->Parallel(&Module::getADCEnableMask, pos); return pimpl->Parallel(&Module::getADCEnableMask, pos);
} }

View File

@ -253,12 +253,6 @@ std::string GetHelpDac(std::string dac) {
"[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for " "[dac or mV value][(optional unit) mV] \n\t[Gotthard2] Dac for "
"common mode voltage of ADC DAC bank 2."); "common mode voltage of ADC DAC bank 2.");
} }
if (dac == "adcvpp") {
return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> 2V. "
"\n\tAdvanced User function! ");
}
if (dac == "vb_ds") { if (dac == "vb_ds") {
return std::string( return std::string(
"[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??"); "[dac or mV value][(optional unit) mV] \n\t[Jungfrau] Dac for ??");

View File

@ -108,7 +108,7 @@ TEST_CASE("adcvpp", "[.cmd]") {
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) { if (det_type == defs::CHIPTESTBOARD || det_type == defs::MOENCH) {
auto prev_val = det.getDAC(defs::ADC_VPP, false); auto prev_val = det.getADCVpp(false);
{ {
std::ostringstream oss; std::ostringstream oss;
proxy.Call("adcvpp", {"1"}, -1, PUT, oss); proxy.Call("adcvpp", {"1"}, -1, PUT, oss);
@ -125,7 +125,7 @@ TEST_CASE("adcvpp", "[.cmd]") {
REQUIRE(oss.str() == "dac adcvpp 1140 mV\n"); REQUIRE(oss.str() == "dac adcvpp 1140 mV\n");
} }
for (int i = 0; i != det.size(); ++i) { for (int i = 0; i != det.size(); ++i) {
det.setDAC(defs::ADC_VPP, prev_val[i], false, {i}); det.setADCVpp(prev_val[i], false, {i});
} }
} else { } else {
REQUIRE_THROWS(proxy.Call("dac adcvpp", {}, -1, GET)); REQUIRE_THROWS(proxy.Call("dac adcvpp", {}, -1, GET));

View File

@ -490,8 +490,6 @@ std::string ToString(const defs::dacIndex s) {
return std::string("vipre_cds"); return std::string("vipre_cds");
case defs::IBIAS_SFP: case defs::IBIAS_SFP:
return std::string("ibias_sfp"); return std::string("ibias_sfp");
case defs::ADC_VPP:
return std::string("adcvpp");
case defs::TRIMBIT_SCAN: case defs::TRIMBIT_SCAN:
return std::string("trimbits"); return std::string("trimbits");
case defs::HIGH_VOLTAGE: case defs::HIGH_VOLTAGE:
@ -953,8 +951,6 @@ template <> defs::dacIndex StringTo(const std::string &s) {
return defs::VIPRE_CDS; return defs::VIPRE_CDS;
if (s == "ibias_sfp") if (s == "ibias_sfp")
return defs::IBIAS_SFP; return defs::IBIAS_SFP;
if (s == "adcvpp")
return defs::ADC_VPP;
if (s == "trimbits") if (s == "trimbits")
return defs::TRIMBIT_SCAN; return defs::TRIMBIT_SCAN;
if (s == "highvoltage") if (s == "highvoltage")