Jf: Electron collection mode (#983)

* electron collection mode for jungfrau. also removing the config chip when using register command
* collectionMode: HOLE/ELECTRON (enum)
This commit is contained in:
2024-09-30 17:15:22 +02:00
committed by GitHub
parent 7fa5b5d70a
commit 5b832cb6aa
30 changed files with 32158 additions and 21441 deletions

View File

@ -1999,6 +1999,70 @@ std::string Caller::clkphase(int action) {
return os.str();
}
std::string Caller::collectionmode(int action) {
std::ostringstream os;
// print help
if (action == slsDetectorDefs::HELP_ACTION) {
os << "Command: collectionmode" << std::endl;
os << R"V0G0N([hole|electron]
[Jungfrau] Sets collection mode to hole or electron. Default is hole. )V0G0N"
<< std::endl;
return os.str();
}
// check if action and arguments are valid
if (action == slsDetectorDefs::GET_ACTION) {
if (1 && args.size() != 0) {
throw RuntimeError("Wrong number of arguments for action GET");
}
if (args.size() == 0) {
}
}
else if (action == slsDetectorDefs::PUT_ACTION) {
if (1 && args.size() != 1) {
throw RuntimeError("Wrong number of arguments for action PUT");
}
if (args.size() == 1) {
try {
StringTo<defs::collectionMode>(args[0]);
} catch (...) {
throw RuntimeError(
"Could not convert argument 0 to defs::collectionMode");
}
}
}
else {
throw RuntimeError("INTERNAL ERROR: Invalid action: supported actions "
"are ['GET', 'PUT']");
}
// generate code for each action
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() == 0) {
auto t = det->getCollectionMode(std::vector<int>{det_id});
os << OutString(t) << '\n';
}
}
if (action == slsDetectorDefs::PUT_ACTION) {
if (args.size() == 1) {
auto arg0 = StringTo<defs::collectionMode>(args[0]);
det->setCollectionMode(arg0, std::vector<int>{det_id});
os << args.front() << '\n';
}
}
return os.str();
}
std::string Caller::column(int action) {
std::ostringstream os;

View File

@ -89,6 +89,7 @@ class Caller {
std::string clkdiv(int action);
std::string clkfreq(int action);
std::string clkphase(int action);
std::string collectionmode(int action);
std::string column(int action);
std::string compdisabletime(int action);
std::string confadc(int action);
@ -436,6 +437,7 @@ class Caller {
{"clkdiv", &Caller::clkdiv},
{"clkfreq", &Caller::clkfreq},
{"clkphase", &Caller::clkphase},
{"collectionmode", &Caller::collectionmode},
{"column", &Caller::column},
{"compdisabletime", &Caller::compdisabletime},
{"confadc", &Caller::confadc},

View File

@ -1771,6 +1771,14 @@ void Detector::setPedestalMode(const defs::pedestalParameters par,
pimpl->Parallel(&Module::setPedestalMode, pos, par);
}
Result<defs::collectionMode> Detector::getCollectionMode(Positions pos) const {
return pimpl->Parallel(&Module::getCollectionMode, pos);
}
void Detector::setCollectionMode(defs::collectionMode value, Positions pos) {
pimpl->Parallel(&Module::setCollectionMode, pos, value);
}
// Gotthard Specific
Result<defs::ROI> Detector::getROI(Positions pos) const {

View File

@ -1940,6 +1940,14 @@ void Module::setPedestalMode(const defs::pedestalParameters par) {
}
}
defs::collectionMode Module::getCollectionMode() const {
return sendToDetector<defs::collectionMode>(F_GET_COLLECTION_MODE);
}
void Module::setCollectionMode(const defs::collectionMode value) {
sendToDetector(F_SET_COLLECTION_MODE, static_cast<int>(value), nullptr);
}
// Gotthard Specific
slsDetectorDefs::ROI Module::getROI() const {

View File

@ -419,6 +419,8 @@ class Module : public virtual slsDetectorDefs {
void setNumberOfFilterCells(int value);
defs::pedestalParameters getPedestalMode() const;
void setPedestalMode(defs::pedestalParameters par);
defs::collectionMode getCollectionMode() const;
void setCollectionMode(const defs::collectionMode enable);
/**************************************************
* *

View File

@ -500,6 +500,22 @@ int InferAction::clkphase() {
}
}
int InferAction::collectionmode() {
if (args.size() == 0) {
return slsDetectorDefs::GET_ACTION;
}
if (args.size() == 1) {
return slsDetectorDefs::PUT_ACTION;
}
else {
throw RuntimeError("Could not infer action: Wrong number of arguments");
}
}
int InferAction::column() {
if (args.size() == 0) {

View File

@ -44,6 +44,7 @@ class InferAction {
int clkdiv();
int clkfreq();
int clkphase();
int collectionmode();
int column();
int compdisabletime();
int confadc();
@ -379,6 +380,7 @@ class InferAction {
{"clkdiv", &InferAction::clkdiv},
{"clkfreq", &InferAction::clkfreq},
{"clkphase", &InferAction::clkphase},
{"collectionmode", &InferAction::collectionmode},
{"column", &InferAction::column},
{"compdisabletime", &InferAction::compdisabletime},
{"confadc", &InferAction::confadc},