new getDetectorType functions

This commit is contained in:
Erik Frojdh 2019-01-18 10:53:49 +01:00
parent 13d6d3f866
commit 10539f8533
10 changed files with 74 additions and 95 deletions

View File

@ -292,7 +292,7 @@ std::string multiSlsDetector::getUserDetails() {
sstream << "\nHostname: " << getHostname(); sstream << "\nHostname: " << getHostname();
sstream << "\nType: "; sstream << "\nType: ";
for (auto &d : detectors) for (auto &d : detectors)
sstream << d->sgetDetectorsType() << "+"; sstream << d->getDetectorTypeAsString() << "+";
sstream << "\nPID: " << thisMultiDetector->lastPID sstream << "\nPID: " << thisMultiDetector->lastPID
<< "\nUser: " << thisMultiDetector->lastUser << "\nUser: " << thisMultiDetector->lastUser
@ -475,7 +475,7 @@ void multiSlsDetector::addSlsDetector(const std::string& hostname) {
// slsdetector in initsharedmemory // slsdetector in initsharedmemory
// get type by connecting // get type by connecting
detectorType type = slsDetector::getDetectorType(hostname.c_str(), DEFAULT_PORTNO); detectorType type = slsDetector::getDetectorTypeAsEnum(hostname.c_str(), DEFAULT_PORTNO);
if (type == GENERIC) { if (type == GENERIC) {
FILE_LOG(logERROR) << "Could not connect to Detector " << hostname FILE_LOG(logERROR) << "Could not connect to Detector " << hostname
<< " to determine the type!"; << " to determine the type!";
@ -495,39 +495,38 @@ void multiSlsDetector::addSlsDetector(const std::string& hostname) {
detectors[pos]->getTotalNumberOfChannels(); detectors[pos]->getTotalNumberOfChannels();
} }
slsDetectorDefs::detectorType multiSlsDetector::getDetectorsType(int detPos) { slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getDetectorsType(); return detectors[detPos]->getDetectorTypeAsEnum();
} }
// multi // multi
auto r = serialCall(&slsDetector::getDetectorsType); auto r = serialCall(&slsDetector::getDetectorTypeAsEnum);
return (detectorType)sls::minusOneIfDifferent(r); return (detectorType)sls::minusOneIfDifferent(r);
} }
std::string multiSlsDetector::sgetDetectorsType(int detPos) { std::string multiSlsDetector::getDetectorTypeAsString(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->sgetDetectorsType(); return detectors[detPos]->getDetectorTypeAsString();
} }
// multi // multi
auto r = serialCall(&slsDetector::sgetDetectorsType); auto r = serialCall(&slsDetector::getDetectorTypeAsString);
return sls::concatenateIfDifferent(r); return sls::concatenateIfDifferent(r);
} }
std::string multiSlsDetector::getDetectorType(int detPos) {
return sgetDetectorsType(detPos); int multiSlsDetector::getNumberOfDetectors() const {
return detectors.size();
} }
int multiSlsDetector::getNumberOfDetectors() { return detectors.size(); } int multiSlsDetector::getNumberOfDetectors(dimension d) const {
int multiSlsDetector::getNumberOfDetectors(dimension d) {
return thisMultiDetector->numberOfDetector[d]; return thisMultiDetector->numberOfDetector[d];
} }
void multiSlsDetector::getNumberOfDetectors(int &nx, int &ny) { void multiSlsDetector::getNumberOfDetectors(int &nx, int &ny) const {
nx = thisMultiDetector->numberOfDetector[X]; nx = thisMultiDetector->numberOfDetector[X];
ny = thisMultiDetector->numberOfDetector[Y]; ny = thisMultiDetector->numberOfDetector[Y];
} }
@ -1036,7 +1035,7 @@ int multiSlsDetector::prepareAcquisition(int detPos) {
int multiSlsDetector::startAcquisition(int detPos) { int multiSlsDetector::startAcquisition(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
if (detectors[detPos]->getDetectorsType() == EIGER) { if (detectors[detPos]->getDetectorTypeAsEnum() == EIGER) {
if (detectors[detPos]->prepareAcquisition() == FAIL) if (detectors[detPos]->prepareAcquisition() == FAIL)
return FAIL; return FAIL;
} }
@ -1044,7 +1043,7 @@ int multiSlsDetector::startAcquisition(int detPos) {
} }
// multi // multi
if (getDetectorsType() == EIGER) { if (getDetectorTypeAsEnum() == EIGER) {
if (prepareAcquisition() == FAIL) if (prepareAcquisition() == FAIL)
return FAIL; return FAIL;
} }
@ -1083,7 +1082,7 @@ int multiSlsDetector::sendSoftwareTrigger(int detPos) {
int multiSlsDetector::startAndReadAll(int detPos) { int multiSlsDetector::startAndReadAll(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
if (detectors[detPos]->getDetectorsType() == EIGER) { if (detectors[detPos]->getDetectorTypeAsEnum() == EIGER) {
if (detectors[detPos]->prepareAcquisition() == FAIL) if (detectors[detPos]->prepareAcquisition() == FAIL)
return FAIL; return FAIL;
} }
@ -1091,7 +1090,7 @@ int multiSlsDetector::startAndReadAll(int detPos) {
} }
// multi // multi
if (getDetectorsType() == EIGER) { if (getDetectorTypeAsEnum() == EIGER) {
if (prepareAcquisition() == FAIL) if (prepareAcquisition() == FAIL)
return FAIL; return FAIL;
} }
@ -1344,7 +1343,7 @@ int multiSlsDetector::setDynamicRange(int p, int detPos) {
} }
// for usability // for usability
if (getDetectorsType() == EIGER) { if (getDetectorTypeAsEnum() == EIGER) {
switch (p) { switch (p) {
case 32: case 32:
FILE_LOG(logINFO) << "Setting Clock to Quarter Speed to cope with " FILE_LOG(logINFO) << "Setting Clock to Quarter Speed to cope with "
@ -1389,7 +1388,7 @@ int multiSlsDetector::setDAC(int val, dacIndex idac, int mV, int detPos) {
// multi // multi
auto r = parallelCall(&slsDetector::setDAC, val, idac, mV); auto r = parallelCall(&slsDetector::setDAC, val, idac, mV);
if (getDetectorsType() != EIGER || idac != HIGH_VOLTAGE) if (getDetectorTypeAsEnum() != EIGER || idac != HIGH_VOLTAGE)
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
// ignore slave values for hv (-999) // ignore slave values for hv (-999)
@ -1690,7 +1689,7 @@ void multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
else { else {
// calculate ports individually // calculate ports individually
int firstPort = i; int firstPort = i;
int numSockets = (getDetectorsType() == EIGER) ? 2 : 1; int numSockets = (getDetectorTypeAsEnum() == EIGER) ? 2 : 1;
for (size_t idet = 0; idet < detectors.size(); ++idet) { for (size_t idet = 0; idet < detectors.size(); ++idet) {
auto port = firstPort + (idet * numSockets); auto port = firstPort + (idet * numSockets);
@ -1728,7 +1727,7 @@ void multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
else { else {
// calculate ports individually // calculate ports individually
int firstPort = i; int firstPort = i;
int numSockets = (getDetectorsType() == EIGER) ? 2 : 1; int numSockets = (getDetectorTypeAsEnum() == EIGER) ? 2 : 1;
for (size_t idet = 0; idet < detectors.size(); ++idet) { for (size_t idet = 0; idet < detectors.size(); ++idet) {
auto port = firstPort + (idet * numSockets); auto port = firstPort + (idet * numSockets);
@ -2338,7 +2337,7 @@ int multiSlsDetector::setAllTrimbits(int val, int detPos) {
} }
int multiSlsDetector::enableGapPixels(int val, int detPos) { int multiSlsDetector::enableGapPixels(int val, int detPos) {
if (getDetectorsType() != EIGER) { if (getDetectorTypeAsEnum() != EIGER) {
if (val >= 0) { if (val >= 0) {
FILE_LOG(logERROR) << "Function (enableGapPixels) not implemented " FILE_LOG(logERROR) << "Function (enableGapPixels) not implemented "
"for this detector"; "for this detector";
@ -2872,7 +2871,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
size_t numSockets = detectors.size(); size_t numSockets = detectors.size();
size_t numSocketsPerDetector = 1; size_t numSocketsPerDetector = 1;
if (getDetectorsType() == EIGER) { if (getDetectorTypeAsEnum() == EIGER) {
numSocketsPerDetector = 2; numSocketsPerDetector = 2;
} }
numSockets *= numSocketsPerDetector; numSockets *= numSocketsPerDetector;
@ -2909,7 +2908,7 @@ void multiSlsDetector::readFrameFromReceiver() {
->numberOfDetector[Y]; // for eiger, to reverse the data ->numberOfDetector[Y]; // for eiger, to reverse the data
bool gappixelsenable = false; bool gappixelsenable = false;
bool eiger = false; bool eiger = false;
if (getDetectorsType() == EIGER) { if (getDetectorTypeAsEnum() == EIGER) {
eiger = true; eiger = true;
nX *= 2; nX *= 2;
gappixelsenable = detectors[0]->enableGapPixels(-1) >= 1 ? true : false; gappixelsenable = detectors[0]->enableGapPixels(-1) >= 1 ? true : false;
@ -3497,7 +3496,7 @@ int multiSlsDetector::retrieveDetectorSetup(const std::string &fname1,
} }
int multiSlsDetector::dumpDetectorSetup(const std::string &fname, int level) { int multiSlsDetector::dumpDetectorSetup(const std::string &fname, int level) {
detectorType type = getDetectorsType(); detectorType type = getDetectorTypeAsEnum();
// std::string names[100]; // std::string names[100];
std::vector<std::string> names; std::vector<std::string> names;
// int nvar = 0; // int nvar = 0;

View File

@ -280,14 +280,13 @@ class multiSlsDetector : public virtual slsDetectorDefs,
*/ */
void addMultipleDetectors(const char *name); void addMultipleDetectors(const char *name);
using slsDetectorDefs::getDetectorType;
/** /**
* Get Detector type for a particular sls detector or get the first one * Get Detector type for a particular sls detector or get the first one
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns detector type of sls detector in position pos, if -1, returns * @returns detector type of sls detector in position pos, if -1, returns
* the first det type * the first det type
*/ */
detectorType getDetectorsType(int detPos = -1); detectorType getDetectorTypeAsEnum(int detPos = -1);
/** /**
* Concatenates string types of all sls detectors or * Concatenates string types of all sls detectors or
@ -296,35 +295,27 @@ class multiSlsDetector : public virtual slsDetectorDefs,
* @returns detector type of sls detector in position pos, if -1, * @returns detector type of sls detector in position pos, if -1,
* concatenates * concatenates
*/ */
std::string sgetDetectorsType(int detPos = -1); std::string getDetectorTypeAsString(int detPos = -1);
/**
* Gets Detector type (concatenates if different)
* @param detPos -1 for all detectors in list or specific detector position
* @returns detector type of sls detector in position pos, if -1,
* concatenates
*/
std::string getDetectorType(int detPos = -1);
/** /**
* Returns the number of detectors in the multidetector structure * Returns the number of detectors in the multidetector structure
* @returns number of detectors * @returns number of detectors
*/ */
int getNumberOfDetectors(); int getNumberOfDetectors() const;
/** /**
* Returns number of detectors in dimension d * Returns number of detectors in dimension d
* @param d dimension d * @param d dimension d
* @returns number of detectors in dimension d * @returns number of detectors in dimension d
*/ */
int getNumberOfDetectors(dimension d); int getNumberOfDetectors(dimension d) const;
/** /**
* Returns the number of detectors in each direction * Returns the number of detectors in each direction
@param nx number of detectors in x direction @param nx number of detectors in x direction
@param ny number of detectors in y direction @param ny number of detectors in y direction
*/ */
void getNumberOfDetectors(int &nx, int &ny); void getNumberOfDetectors(int &nx, int &ny) const;
/** /**
* Returns the total number of channels of all sls detectors from shared * Returns the total number of channels of all sls detectors from shared

View File

@ -49,7 +49,7 @@ slsDetector::slsDetector(int multiId, int id, bool verify)
/* called from multi constructor to populate structure, /* called from multi constructor to populate structure,
* so sls shared memory will be opened, not created */ * so sls shared memory will be opened, not created */
// getDetectorType Froom shm will check if it was already existing // getDetectorType From shm will check if it was already existing
detectorType type = getDetectorTypeFromShm(multiId, verify); detectorType type = getDetectorTypeFromShm(multiId, verify);
initSharedMemory(false, type, multiId, verify); initSharedMemory(false, type, multiId, verify);
@ -752,16 +752,16 @@ slsDetectorDefs::detectorType slsDetector::getDetectorTypeFromShm(int multiId, b
// static function // static function
slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int cport) { slsDetectorDefs::detectorType slsDetector::getDetectorTypeAsEnum(const std::string& hostname, int cport) {
int fnum = F_GET_DETECTOR_TYPE; int fnum = F_GET_DETECTOR_TYPE;
int ret = FAIL; int ret = FAIL;
detectorType retval = GENERIC; detectorType retval = GENERIC;
MySocketTCP* mySocket = nullptr; MySocketTCP* mySocket = nullptr;
try { try {
mySocket = new MySocketTCP(name, cport); mySocket = new MySocketTCP(hostname.c_str(), cport);
} catch(...) { } catch(...) {
FILE_LOG(logERROR) << "Cannot create socket to control server " << name FILE_LOG(logERROR) << "Cannot create socket to control server " << hostname
<< " over port " << cport; << " over port " << cport;
return retval; return retval;
} }
@ -773,7 +773,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int
mySocket->ReceiveDataOnly(&retval,sizeof(retval)); mySocket->ReceiveDataOnly(&retval,sizeof(retval));
mySocket->Disconnect(); mySocket->Disconnect();
} else { } else {
FILE_LOG(logERROR) << "Cannot connect to server " << name << " over port " << cport; FILE_LOG(logERROR) << "Cannot connect to server " << hostname << " over port " << cport;
} }
if (ret != FAIL) { if (ret != FAIL) {
FILE_LOG(logDEBUG1) << "Detector type is " << retval; FILE_LOG(logDEBUG1) << "Detector type is " << retval;
@ -838,23 +838,20 @@ int slsDetector::setDetectorType(detectorType const type) {
int slsDetector::setDetectorType(const std::string& detector_type) { // int slsDetector::setDetectorType(const std::string& detector_type) {
return setDetectorType(getDetectorType(detector_type)); // return setDetectorType(getDetectorType(detector_type));
} // }
slsDetectorDefs::detectorType slsDetector::getDetectorsType() { slsDetectorDefs::detectorType slsDetector::getDetectorTypeAsEnum() {
return thisDetector->myDetectorType; return thisDetector->myDetectorType;
} }
std::string slsDetector::sgetDetectorsType() { std::string slsDetector::getDetectorTypeAsString() {
return getDetectorType(getDetectorsType()); return slsDetectorDefs::detectorTypeToString(getDetectorTypeAsEnum());
} }
std::string slsDetector::getDetectorType() {
return sgetDetectorsType();
}
int slsDetector::getTotalNumberOfChannels() { int slsDetector::getTotalNumberOfChannels() {
@ -2697,7 +2694,7 @@ std::string slsDetector::setReceiver(const std::string& receiverIP) {
if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) { if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) {
FILE_LOG(logDEBUG1) << FILE_LOG(logDEBUG1) <<
"detector type:" << (slsDetectorDefs::getDetectorType(thisDetector->myDetectorType)) << "detector type:" << (slsDetectorDefs::detectorTypeToString(thisDetector->myDetectorType)) <<
"\ndetector id:" << detId << "\ndetector id:" << detId <<
"\ndetector hostname:" << thisDetector->hostname << "\ndetector hostname:" << thisDetector->hostname <<
"\nfile path:" << thisDetector->receiver_filePath << "\nfile path:" << thisDetector->receiver_filePath <<

View File

@ -373,7 +373,6 @@ public:
*/ */
void disconnectStop(); void disconnectStop();
using slsDetectorDefs::getDetectorType;
/** /**
* Get detector type by connecting to the detector without creating an object * Get detector type by connecting to the detector without creating an object
@ -381,7 +380,19 @@ public:
* @param cport TCP control port * @param cport TCP control port
* @returns detector tpe or GENERIC if failed * @returns detector tpe or GENERIC if failed
*/ */
static detectorType getDetectorType(const char *name, int cport=DEFAULT_PORTNO); static detectorType getDetectorTypeAsEnum(const std::string& hostname, int cport=DEFAULT_PORTNO);
/**
* Get Detector type from shared memory variable
* @returns detector type from shared memory variable
*/
detectorType getDetectorTypeAsEnum();
/**
* Gets string version of detector type from shared memory variable
* @returns string version of detector type from shared memory variable
*/
std::string getDetectorTypeAsString();
/** /**
* Gets detector type from detector and set it in receiver * Gets detector type from detector and set it in receiver
@ -394,27 +405,8 @@ public:
* Gets detector type (string) from detector and set it in receiver * Gets detector type (string) from detector and set it in receiver
* @param type string of detector type * @param type string of detector type
* @returns detector type in receiver * @returns detector type in receiver
*/ // */
int setDetectorType(const std::string& detector_type); // int setDetectorType(const std::string& detector_type);
/**
* Get Detector type from shared memory variable
* @returns detector type from shared memory variable
*/
detectorType getDetectorsType();
/**
* Gets string version of detector type from shared memory variable
* @returns string version of detector type from shared memory variable
*/
std::string sgetDetectorsType();
/**
* Just to overload getDetectorType from users
* Gets string version of detector type from shared memory variable
* @returns gets string version of detector type from shared memory variable
*/
std::string getDetectorType();
/** /**
* Returns the total number of channels from shared memory * Returns the total number of channels from shared memory
@ -1805,7 +1797,7 @@ private:
/** pointer to dac valuse in shared memory */ /** pointer to dac valuse in shared memory */
int *dacs {nullptr}; int *dacs {nullptr};
/** pointer to channal registers in shared memory */ /** pointer to channel registers in shared memory */
int *chanregs {nullptr}; int *chanregs {nullptr};
}; };

View File

@ -3295,7 +3295,7 @@ std::string slsDetectorCommand::cmdSettings(int narg, char *args[], int action,
if (sett == -1) if (sett == -1)
return std::string("unknown settings scanned " + std::string(args[1])); return std::string("unknown settings scanned " + std::string(args[1]));
sett = myDet->setSettings(sett, detPos); sett = myDet->setSettings(sett, detPos);
if (myDet->getDetectorsType(detPos) == EIGER) { if (myDet->getDetectorTypeAsEnum(detPos) == EIGER) {
return myDet->getDetectorSettings(sett); return myDet->getDetectorSettings(sett);
} }
} }
@ -3305,7 +3305,7 @@ std::string slsDetectorCommand::cmdSettings(int narg, char *args[], int action,
if (!sscanf(args[1], "%d", &val)) { if (!sscanf(args[1], "%d", &val)) {
return std::string("invalid threshold value"); return std::string("invalid threshold value");
} }
detectorType type = myDet->getDetectorsType(detPos); detectorType type = myDet->getDetectorTypeAsEnum(detPos);
if (type != EIGER || (type == EIGER && narg <= 2)) { if (type != EIGER || (type == EIGER && narg <= 2)) {
myDet->setThresholdEnergy(val, GET_SETTINGS, 1, detPos); myDet->setThresholdEnergy(val, GET_SETTINGS, 1, detPos);
} else { } else {
@ -3322,7 +3322,7 @@ std::string slsDetectorCommand::cmdSettings(int narg, char *args[], int action,
if (!sscanf(args[1], "%d", &val)) { if (!sscanf(args[1], "%d", &val)) {
return std::string("invalid threshold value"); return std::string("invalid threshold value");
} }
detectorType type = myDet->getDetectorsType(detPos); detectorType type = myDet->getDetectorTypeAsEnum(detPos);
if (type != EIGER) if (type != EIGER)
return std::string("not implemented for this detector"); return std::string("not implemented for this detector");
if (narg <= 2) { if (narg <= 2) {
@ -4049,7 +4049,7 @@ std::string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int d
return std::string("cannot decode adc ") + cmd; return std::string("cannot decode adc ") + cmd;
myDet->setOnline(ONLINE_FLAG, detPos); myDet->setOnline(ONLINE_FLAG, detPos);
if (myDet->getDetectorsType(detPos) == EIGER || myDet->getDetectorsType(detPos) == JUNGFRAU) { if (myDet->getDetectorTypeAsEnum(detPos) == EIGER || myDet->getDetectorTypeAsEnum(detPos) == JUNGFRAU) {
int val = myDet->getADC(adc, detPos); int val = myDet->getADC(adc, detPos);
if (val == -1) if (val == -1)
sprintf(answer, "%d", val); sprintf(answer, "%d", val);
@ -4106,7 +4106,7 @@ std::string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int d
return std::string("cannot decode adc ")+cmd; return std::string("cannot decode adc ")+cmd;
myDet->setOnline(ONLINE_FLAG, detPos); myDet->setOnline(ONLINE_FLAG, detPos);
if (myDet->getDetectorsType(detPos) == EIGER || myDet->getDetectorsType(detPos) == JUNGFRAU){ if (myDet->getDetectorTypeAsEnum(detPos) == EIGER || myDet->getDetectorTypeAsEnum(detPos) == JUNGFRAU){
int val = myDet->getADC(adc, detPos); int val = myDet->getADC(adc, detPos);
if (val == -1) if (val == -1)
sprintf(answer,"%d",val); sprintf(answer,"%d",val);

View File

@ -6,7 +6,7 @@
int slsDetectorUsers::getNumberOfDetectors() { int slsDetectorUsers::getNumberOfDetectors() const {
return detector.getNumberOfDetectors(); return detector.getNumberOfDetectors();
} }
@ -30,7 +30,7 @@ int slsDetectorUsers::getDetectorSize(int &x, int &y, int &nx, int &ny, int detP
} }
std::string slsDetectorUsers::getDetectorType(int detPos){ std::string slsDetectorUsers::getDetectorType(int detPos){
return detector.sgetDetectorsType(detPos); return detector.getDetectorTypeAsString(detPos);
} }
int slsDetectorUsers::setOnline(int const online, int detPos){ int slsDetectorUsers::setOnline(int const online, int detPos){
return detector.setOnline(online, detPos); return detector.setOnline(online, detPos);

View File

@ -100,7 +100,7 @@ public:
* Returns the number of detectors in the multidetector structure * Returns the number of detectors in the multidetector structure
* @returns number of detectors * @returns number of detectors
*/ */
int getNumberOfDetectors(); int getNumberOfDetectors() const;
/** /**
* Returns the maximum number of channels of all detectors * Returns the maximum number of channels of all detectors
@ -215,14 +215,14 @@ public:
/** /**
* Check Detector Version Compatibility * Check Detector Version Compatibility
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns true if compatibile, else false * @returns true if compatible, else false
*/ */
bool isDetectorVersionCompatible(int detPos = -1); bool isDetectorVersionCompatible(int detPos = -1);
/** /**
* Check Receiver Version Compatibility * Check Receiver Version Compatibility
* @param detPos -1 for all detectors in list or specific detector position * @param detPos -1 for all detectors in list or specific detector position
* @returns true if compatibile, else false * @returns true if compatible, else false
*/ */
bool isReceiverVersionCompatible(int detPos = -1); bool isReceiverVersionCompatible(int detPos = -1);
@ -761,7 +761,7 @@ public:
*********************************************************************/ *********************************************************************/
/** /**
* register calbback for accessing detector final data in client, * register callback for accessing detector final data in client,
* also enables data streaming in client and receiver * also enables data streaming in client and receiver
* @param userCallback function for plotting/analyzing the data. * @param userCallback function for plotting/analyzing the data.
* Its arguments are * Its arguments are

View File

@ -216,7 +216,7 @@ public:
*/ */
virtual void Print(TLogLevel level = logDEBUG1) const { virtual void Print(TLogLevel level = logDEBUG1) const {
FILE_LOG(level) << "\n\nDetector Data Variables:"; FILE_LOG(level) << "\n\nDetector Data Variables:";
FILE_LOG(level) << "myDetectorType: " << slsDetectorDefs::getDetectorType(myDetectorType); FILE_LOG(level) << "myDetectorType: " << slsDetectorDefs::detectorTypeToString(myDetectorType);
FILE_LOG(level) << "Pixels X: " << nPixelsX; FILE_LOG(level) << "Pixels X: " << nPixelsX;
FILE_LOG(level) << "Pixels Y: " << nPixelsY; FILE_LOG(level) << "Pixels Y: " << nPixelsY;
FILE_LOG(level) << "Empty Header: " << emptyHeader; FILE_LOG(level) << "Empty Header: " << emptyHeader;

View File

@ -834,7 +834,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
case EIGER: case EIGER:
case CHIPTESTBOARD: case CHIPTESTBOARD:
case JUNGFRAU: case JUNGFRAU:
FILE_LOG(logINFO) << " ***** " << getDetectorType(d) << " Receiver *****"; FILE_LOG(logINFO) << " ***** " << detectorTypeToString(d) << " Receiver *****";
break; break;
default: default:
FILE_LOG(logERROR) << "This is an unknown receiver type " << (int)d; FILE_LOG(logERROR) << "This is an unknown receiver type " << (int)d;
@ -895,7 +895,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) {
// check udp socket buffer size // check udp socket buffer size
setUDPSocketBufferSize(udpSocketBufferSize); setUDPSocketBufferSize(udpSocketBufferSize);
FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d); FILE_LOG(logDEBUG) << " Detector type set to " << detectorTypeToString(d);
return OK; return OK;
} }

View File

@ -572,7 +572,7 @@ public:
\param t string can be EIGER, GOTTHARD, JUNGFRAU, CHIPTESTBOARD \param t string can be EIGER, GOTTHARD, JUNGFRAU, CHIPTESTBOARD
\returns Eiger, Gotthard, Jungfrau, JungfrauCTB, Unknown \returns Eiger, Gotthard, Jungfrau, JungfrauCTB, Unknown
*/ */
static std::string getDetectorType(detectorType t){ \ static std::string detectorTypeToString(detectorType t){ \
switch (t) { \ switch (t) { \
case EIGER: return std::string("Eiger"); \ case EIGER: return std::string("Eiger"); \
case GOTTHARD: return std::string("Gotthard"); \ case GOTTHARD: return std::string("Gotthard"); \
@ -585,7 +585,7 @@ public:
\param type can be Eiger, Gotthard, Jungfrau, JungfrauCTB \param type can be Eiger, Gotthard, Jungfrau, JungfrauCTB
\returns EIGER, GOTTHARD, JUNGFRAU, CHIPTESTBOARD, GENERIC \returns EIGER, GOTTHARD, JUNGFRAU, CHIPTESTBOARD, GENERIC
*/ */
static detectorType getDetectorType(std::string const type){\ static detectorType detectorTypeToEnum(const std::string& type){\
if (type=="Eiger") return EIGER; \ if (type=="Eiger") return EIGER; \
if (type=="Gotthard") return GOTTHARD; \ if (type=="Gotthard") return GOTTHARD; \
if (type=="Jungfrau") return JUNGFRAU; \ if (type=="Jungfrau") return JUNGFRAU; \