mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 16:27:13 +02:00
removed unused multi functions
This commit is contained in:
@ -67,7 +67,7 @@ Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
|
||||
}
|
||||
|
||||
Result<defs::detectorType> Detector::getDetectorType(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getDetectorTypeAsEnum, pos);
|
||||
return pimpl->Parallel(&slsDetector::getDetectorType, pos);
|
||||
}
|
||||
|
||||
int Detector::size() const { return pimpl->size(); }
|
||||
@ -173,7 +173,7 @@ Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||
auto res = pimpl->Parallel(&slsDetector::setSpeed, pos, defs::CLOCK_DIVIDER, -1,
|
||||
0);
|
||||
Result<defs::speedLevel> speedResult(res.size());
|
||||
for (size_t i = 0; i < res.size(); ++i) {
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
speedResult[i] = static_cast<defs::speedLevel>(res[i]);
|
||||
}
|
||||
return speedResult;
|
||||
@ -314,7 +314,7 @@ void Detector::stopReceiver() {
|
||||
}
|
||||
|
||||
void Detector::startDetector() {
|
||||
if (getDetectorType({}).squash() == defs::EIGER) {
|
||||
if (getDetectorType().squash() == defs::EIGER) {
|
||||
pimpl->Parallel(&slsDetector::prepareAcquisition, {});
|
||||
}
|
||||
pimpl->Parallel(&slsDetector::startAcquisition, {});
|
||||
@ -782,7 +782,9 @@ Result<int> Detector::getDynamicRange(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setDynamicRange, pos, -1);
|
||||
}
|
||||
|
||||
void Detector::setDynamicRange(int value) { pimpl->setDynamicRange(value); }
|
||||
void Detector::setDynamicRange(int value) {
|
||||
pimpl->Parallel(&slsDetector::setDynamicRange, {}, value);
|
||||
}
|
||||
|
||||
Result<ns> Detector::getSubExptime(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::setTimer, pos,
|
||||
@ -832,7 +834,7 @@ Result<bool> Detector::getRxAddGapPixels(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setRxAddGapPixels(bool enable) {
|
||||
pimpl->setGapPixelsEnable(enable, {});
|
||||
pimpl->setGapPixelsinReceiver(enable);
|
||||
}
|
||||
|
||||
Result<bool> Detector::getParallelMode(Positions pos) const {
|
||||
@ -968,7 +970,13 @@ Result<bool> Detector::getQuad(Positions pos) const {
|
||||
return pimpl->Parallel(&slsDetector::getQuad, pos);
|
||||
}
|
||||
|
||||
void Detector::setQuad(const bool value) { pimpl->setQuad(value); }
|
||||
void Detector::setQuad(const bool value) {
|
||||
if (value && size() > 1) {
|
||||
throw RuntimeError("Cannot set Quad type as it is available only for 1 "
|
||||
"Eiger Quad Half module.");
|
||||
}
|
||||
pimpl->Parallel(&slsDetector::setQuad, {}, value);
|
||||
}
|
||||
|
||||
// Jungfrau Specific
|
||||
|
||||
@ -1007,8 +1015,8 @@ Result<bool> Detector::getPowerChip(Positions pos) const {
|
||||
|
||||
void Detector::setPowerChip(bool on, Positions pos) {
|
||||
if ((pos.empty() || pos[0] == -1) && on && pimpl->size() > 3) {
|
||||
for (unsigned int i = 0; i != pimpl->size(); ++i) {
|
||||
pimpl->powerChip(static_cast<int>(on), i);
|
||||
for (int i = 0; i != pimpl->size(); ++i) {
|
||||
pimpl->Parallel(&slsDetector::powerChip, {i}, static_cast<int>(on));
|
||||
usleep(1000 * 1000);
|
||||
}
|
||||
} else {
|
||||
@ -1618,12 +1626,12 @@ Result<uint64_t> Detector::getRxCurrentFrameIndex(Positions pos) const {
|
||||
|
||||
std::vector<int> Detector::getPortNumbers(int start_port) {
|
||||
int num_sockets_per_detector = 1;
|
||||
switch (getDetectorType({}).squash()) {
|
||||
switch (getDetectorType().squash()) {
|
||||
case defs::EIGER:
|
||||
num_sockets_per_detector *= 2;
|
||||
break;
|
||||
case defs::JUNGFRAU:
|
||||
if (getNumberofUDPInterfaces({}).squash() == 2) {
|
||||
if (getNumberofUDPInterfaces().squash() == 2) {
|
||||
num_sockets_per_detector *= 2;
|
||||
}
|
||||
break;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -391,6 +391,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
shm()->rxMasterFileWrite = true;
|
||||
shm()->rxFileOverWrite = true;
|
||||
shm()->rxDbitOffset = 0;
|
||||
shm()->numUDPInterfaces = 1;
|
||||
|
||||
// get the detector parameters based on type
|
||||
detParameters parameters{type};
|
||||
@ -545,14 +546,10 @@ int slsDetector::setDetectorType(detectorType const type) {
|
||||
return retval;
|
||||
}
|
||||
|
||||
slsDetectorDefs::detectorType slsDetector::getDetectorTypeAsEnum() const {
|
||||
slsDetectorDefs::detectorType slsDetector::getDetectorType() const {
|
||||
return shm()->myDetectorType;
|
||||
}
|
||||
|
||||
std::string slsDetector::getDetectorTypeAsString() const {
|
||||
return ToString(getDetectorTypeAsEnum());
|
||||
}
|
||||
|
||||
void slsDetector::updateNumberOfChannels() {
|
||||
if (shm()->myDetectorType == CHIPTESTBOARD ||
|
||||
shm()->myDetectorType == MOENCH) {
|
||||
@ -832,6 +829,12 @@ void slsDetector::updateCachedDetectorVariables() {
|
||||
updateNumberOfChannels();
|
||||
}
|
||||
|
||||
// num udp interfaces
|
||||
if (shm()->myDetectorType == JUNGFRAU) {
|
||||
n += client.Receive(&i32, sizeof(i32));
|
||||
shm()->numUDPInterfaces = i32;
|
||||
}
|
||||
|
||||
if (n == 0) {
|
||||
FILE_LOG(logERROR) << "Could not update detector, received 0 bytes";
|
||||
}
|
||||
@ -1312,6 +1315,8 @@ int slsDetector::setSpeed(speedVariable sp, int value, int mode) {
|
||||
|
||||
int slsDetector::setDynamicRange(int n) {
|
||||
// TODO! Properly handle fail
|
||||
int prevDr = shm()->dynamicRange;
|
||||
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Setting dynamic range to " << n;
|
||||
sendToDetector(F_SET_DYNAMIC_RANGE, n, retval);
|
||||
@ -1325,11 +1330,22 @@ int slsDetector::setDynamicRange(int n) {
|
||||
sendToReceiver(F_SET_RECEIVER_DYNAMIC_RANGE, n, retval);
|
||||
FILE_LOG(logDEBUG1) << "Receiver Dynamic range: " << retval;
|
||||
}
|
||||
|
||||
// changes in dr
|
||||
int dr = shm()->dynamicRange;
|
||||
if (prevDr != dr && shm()->myDetectorType == EIGER) {
|
||||
updateRateCorrection();
|
||||
// update speed for usability
|
||||
if (dr == 32) {
|
||||
FILE_LOG(logINFO) << "Setting Clock to Quarter Speed to cope with Dynamic Range of 32"; setSpeed(CLOCK_DIVIDER, 2);
|
||||
} else if (dr == 16) {
|
||||
FILE_LOG(logINFO) << "Setting Clock to Half Speed to cope with Dynamic Range of 16"; setSpeed(CLOCK_DIVIDER, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return shm()->dynamicRange;
|
||||
}
|
||||
|
||||
int slsDetector::getDynamicRangeFromShm() { return shm()->dynamicRange; }
|
||||
|
||||
int slsDetector::setDAC(int val, dacIndex index, int mV) {
|
||||
int args[]{static_cast<int>(index), mV, val};
|
||||
int retval = -1;
|
||||
@ -1857,17 +1873,24 @@ int slsDetector::getDestinationUDPPort2() {
|
||||
void slsDetector::setNumberofUDPInterfaces(int n) {
|
||||
FILE_LOG(logDEBUG1) << "Setting number of udp interfaces to " << n;
|
||||
sendToDetector(F_SET_NUM_INTERFACES, n, nullptr);
|
||||
shm()->numUDPInterfaces = n;
|
||||
if (shm()->useReceiverFlag) {
|
||||
sendToReceiver(F_SET_RECEIVER_NUM_INTERFACES, n, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
int slsDetector::getNumberofUDPInterfacesFromShm() {
|
||||
return shm()->numUDPInterfaces;
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::getNumberofUDPInterfaces() {
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Getting number of udp interfaces";
|
||||
sendToDetector(F_GET_NUM_INTERFACES, nullptr, retval);
|
||||
FILE_LOG(logDEBUG1) << "Number of udp interfaces: " << retval;
|
||||
return retval;
|
||||
shm()->numUDPInterfaces = retval;
|
||||
return shm()->numUDPInterfaces;
|
||||
}
|
||||
|
||||
void slsDetector::selectUDPInterface(int n) {
|
||||
@ -2380,6 +2403,10 @@ int slsDetector::setAllTrimbits(int val) {
|
||||
|
||||
int slsDetector::enableGapPixels(int val) {
|
||||
if (val >= 0) {
|
||||
if (shm()->myDetectorType != EIGER) {
|
||||
throw NotImplementedError(
|
||||
"Function (enableGapPixels) not implemented for this detector");
|
||||
}
|
||||
int fnum = F_ENABLE_GAPPIXELS_IN_RECEIVER;
|
||||
int retval = -1;
|
||||
FILE_LOG(logDEBUG1) << "Sending gap pixels enable to receiver: " << val;
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "slsDetectorCommand.h"
|
||||
#include "multiSlsDetector.h"
|
||||
#include "slsDetector.h"
|
||||
#include "string_utils.h"
|
||||
|
||||
#include <cstdlib>
|
||||
@ -80,16 +81,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
|
||||
|
||||
|
||||
/*! \page test
|
||||
- <b>help</b> Returns a list of possible commands.
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "help";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdHelp;
|
||||
++i;
|
||||
|
||||
|
||||
|
||||
|
||||
/* Acquisition and status commands */
|
||||
/*! \page acquisition Acquition commands
|
||||
Commands to control the acquisition
|
||||
@ -103,28 +94,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
||||
++i;
|
||||
|
||||
|
||||
/*! \page config
|
||||
- \b free Free shared memory on the control PC
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "free";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdFree;
|
||||
++i;
|
||||
|
||||
|
||||
/*! \page config
|
||||
- <b>checkdetversion</b> Checks the version compatibility with detector server (if hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "checkdetversion";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSN;
|
||||
++i;
|
||||
|
||||
/*! \page config
|
||||
- <b>rx_checkversion</b> Checks the version compatibility with receiver server (if rx_hostname is in shared memory). Only get! Only for Eiger, Jungfrau & Gotthard. \c Returns \c ("compatible", "incompatible")
|
||||
*/
|
||||
descrToFuncMap[i].m_pFuncName = "rx_checkversion";
|
||||
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdSN;
|
||||
++i;
|
||||
|
||||
|
||||
/* settings dump/retrieve */
|
||||
|
||||
@ -182,40 +151,6 @@ std::vector<std::string> slsDetectorCommand::getAllCommands(){
|
||||
return commands;
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpLine(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
std::ostringstream os;
|
||||
|
||||
if (action == READOUT_ACTION) {
|
||||
return helpAcquire(HELP_ACTION);
|
||||
}
|
||||
|
||||
if (narg == 0) {
|
||||
os << "Command can be: " << std::endl;
|
||||
for (int i = 0; i < numberOfCommands; ++i) {
|
||||
os << descrToFuncMap[i].m_pFuncName << "\n";
|
||||
}
|
||||
os << std::endl;
|
||||
return os.str();
|
||||
}
|
||||
return executeLine(narg, args, HELP_ACTION, detPos);
|
||||
}
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdHelp(int narg, const char * const args[], int action, int detPos) {
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
|
||||
std::cout << narg << std::endl;
|
||||
|
||||
if (narg >= 1)
|
||||
return helpLine(narg - 1, args, action, detPos);
|
||||
else
|
||||
return helpLine(0, args, action, detPos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[], int action, int detPos) {
|
||||
@ -237,10 +172,11 @@ std::string slsDetectorCommand::cmdAcquire(int narg, const char * const args[],
|
||||
|
||||
if (myDet->acquire() == FAIL)
|
||||
return std::string("acquire failed");
|
||||
if (myDet->getUseReceiverFlag(detPos)) {
|
||||
char answer[100];
|
||||
sprintf(answer, "\nAcquired %d", myDet->getFramesCaughtByReceiver(detPos));
|
||||
return std::string(answer);
|
||||
if (myDet->Parallel(&slsDetector::getUseReceiverFlag, {}).squash(false)) {
|
||||
std::ostringstream os;
|
||||
os << "\nAcquired ";
|
||||
os << sls::ToString(myDet->Parallel(&slsDetector::getFramesCaughtByReceiver, {}));
|
||||
return os.str();
|
||||
}
|
||||
|
||||
return std::string();
|
||||
@ -260,61 +196,6 @@ std::string slsDetectorCommand::helpAcquire(int action) {
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdFree(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout << std::string("Executing command ") + std::string(args[0]) + std::string(" ( ") + cmd + std::string(" )\n");
|
||||
#endif
|
||||
if (action == HELP_ACTION) {
|
||||
return helpFree(HELP_ACTION);
|
||||
}
|
||||
|
||||
return ("Error: Should have been freed before creating constructor\n");
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpFree(int action) {
|
||||
return std::string("free \t frees the shared memory\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdSN(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
if (action == PUT_ACTION)
|
||||
return std::string("cannot set");
|
||||
|
||||
if (action == HELP_ACTION)
|
||||
return helpSN(action);
|
||||
|
||||
|
||||
if (cmd == "checkdetversion") {
|
||||
myDet->checkDetectorVersionCompatibility(detPos);
|
||||
return std::string("compatible");
|
||||
}
|
||||
|
||||
if (cmd == "rx_checkversion") {
|
||||
myDet->checkReceiverVersionCompatibility(detPos);
|
||||
return std::string("compatible");
|
||||
}
|
||||
|
||||
return std::string("unknown id mode ") + cmd;
|
||||
}
|
||||
|
||||
std::string slsDetectorCommand::helpSN(int action) {
|
||||
|
||||
std::ostringstream os;
|
||||
if (action == GET_ACTION || action == HELP_ACTION) {
|
||||
os << "checkdetversion \n gets the version compatibility with detector server (if hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible." << std::endl;
|
||||
os << "rx_checkversion \n gets the version compatibility with receiver server (if rx_hostname is in shared memory). Only for Eiger, Jungfrau & Gotthard. Prints compatible/ incompatible." << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
std::string slsDetectorCommand::cmdConfiguration(int narg, const char * const args[], int action, int detPos) {
|
||||
|
||||
|
Reference in New Issue
Block a user