mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
client compiles, more changes required
This commit is contained in:
parent
b5c35ddeac
commit
1c78400369
@ -17,6 +17,7 @@ multiSlsDetector
|
|||||||
sharedMemory
|
sharedMemory
|
||||||
slsDetector
|
slsDetector
|
||||||
slsReceiverInterface
|
slsReceiverInterface
|
||||||
|
../slsSupportLib/include
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(slsDetectorStatic STATIC
|
add_library(slsDetectorStatic STATIC
|
||||||
@ -51,6 +52,7 @@ set(PUBLICHEADERS
|
|||||||
../commonFiles/versionAPI.h
|
../commonFiles/versionAPI.h
|
||||||
../commonFiles/sls_receiver_exceptions.h
|
../commonFiles/sls_receiver_exceptions.h
|
||||||
../commonFiles/utilties.h
|
../commonFiles/utilties.h
|
||||||
|
../slsSupportLib/include/container_utils.h
|
||||||
sharedMemory/SharedMemory.h
|
sharedMemory/SharedMemory.h
|
||||||
slsDetector/slsDetector.h
|
slsDetector/slsDetector.h
|
||||||
slsDetector/slsDetectorBase.h
|
slsDetector/slsDetectorBase.h
|
||||||
|
@ -9,7 +9,7 @@ CFLAGS= -g -DC_ONLY -fPIC
|
|||||||
|
|
||||||
DFLAGS= -g -DDACS_INT
|
DFLAGS= -g -DDACS_INT
|
||||||
|
|
||||||
INCLUDES?= -I../commonFiles -IslsDetector -ImultiSlsDetector -IslsReceiverInterface -IsharedMemory -I$(ASM)
|
INCLUDES?= -I../commonFiles -IslsDetector -ImultiSlsDetector -IslsReceiverInterface -IsharedMemory -I ../slsSupportLib/include-I$(ASM)
|
||||||
|
|
||||||
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
|
#EPICSFLAGS=-D EPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -Wl,-R/usr/local/epics/base/lib/$(EPICS_HOST_ARCH) -lca -lCom
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ LIBZMQDIR = ../commonFiles
|
|||||||
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
LIBZMQ = -L$(LIBZMQDIR) -Wl,-rpath=$(LIBZMQDIR) -lzmq
|
||||||
|
|
||||||
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../commonFiles/utilities.cpp#../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
|
SRC_CLNT= slsDetector/slsDetectorCommand.cpp slsDetector/slsDetector.cpp multiSlsDetector/multiSlsDetector.cpp slsReceiverInterface/receiverInterface.cpp slsDetector/slsDetectorUsers.cpp sharedMemory/SharedMemory.cpp ../commonFiles/utilities.cpp#../slsReceiverSoftware/MySocketTCP/MySocketTCP.cpp
|
||||||
DEPSINCLUDES = ../commonFiles/sls_receiver_defs.h ../commonFiles/sls_receiver_funcs.h ../commonFiles/ansi.h ../commonFiles/sls_detector_defs.h ../commonFiles/sls_detector_funcs.h ../commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../commonFiles/sls_receiver_exceptions.h ../commonFiles/versionAPI.h ../commonFiles/utilities.h
|
DEPSINCLUDES = ../commonFiles/sls_receiver_defs.h ../commonFiles/sls_receiver_funcs.h ../commonFiles/ansi.h ../commonFiles/sls_detector_defs.h ../commonFiles/sls_detector_funcs.h ../commonFiles/error_defs.h slsDetector/slsDetectorBase.h slsDetector/detectorData.h sharedMemory/SharedMemory.h ../commonFiles/sls_receiver_exceptions.h ../commonFiles/versionAPI.h ../commonFiles/utilities.h ../slsSupportLib/include/container_utils.h
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <rapidjson/document.h> //json header in zmq stream
|
#include <rapidjson/document.h> //json header in zmq stream
|
||||||
#include <sys/ipc.h>
|
#include <sys/ipc.h>
|
||||||
#include <sys/shm.h>
|
#include <sys/shm.h>
|
||||||
|
#include <iomanip>
|
||||||
//#include <time.h> //clock()
|
//#include <time.h> //clock()
|
||||||
|
|
||||||
#include "container_utils.h"
|
#include "container_utils.h"
|
||||||
@ -24,8 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
||||||
: slsDetectorUtils(),
|
: detId(id),
|
||||||
detId(id),
|
|
||||||
sharedMemory(0),
|
sharedMemory(0),
|
||||||
thisMultiDetector(0),
|
thisMultiDetector(0),
|
||||||
client_downstream(false),
|
client_downstream(false),
|
||||||
@ -60,12 +60,12 @@ multiSlsDetector::multiSlsDetector(int id, bool verify, bool update)
|
|||||||
|
|
||||||
multiSlsDetector::~multiSlsDetector() {
|
multiSlsDetector::~multiSlsDetector() {
|
||||||
// delete zmq sockets first
|
// delete zmq sockets first
|
||||||
for (auto& it : zmqSocket)
|
for (auto* it : zmqSocket)
|
||||||
delete(*it);
|
delete it;
|
||||||
zmqSocket.clear();
|
zmqSocket.clear();
|
||||||
|
|
||||||
for (auto& it : detectors)
|
for (auto* it : detectors)
|
||||||
delete(*it);
|
delete it;
|
||||||
detectors.clear();
|
detectors.clear();
|
||||||
|
|
||||||
if (sharedMemory) {
|
if (sharedMemory) {
|
||||||
@ -123,8 +123,8 @@ std::string multiSlsDetector::concatResultOrPos(std::string (slsDetector::*somef
|
|||||||
return (detectors[pos]->*somefunc)(pos);
|
return (detectors[pos]->*somefunc)(pos);
|
||||||
} else {
|
} else {
|
||||||
std::string s;
|
std::string s;
|
||||||
for (size_t i = 0; i < detectors.size(); ++i) {
|
for (auto* it : detectors) {
|
||||||
s += (detectors[i]->*somefunc)(pos) + "+";
|
s += (it->*somefunc)(pos) + "+";
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ std::string multiSlsDetector::getErrorMessage(int& critical, int detPos) {
|
|||||||
if ((multiMask & (1 << idet)) || (detPos >= 0)) {
|
if ((multiMask & (1 << idet)) || (detPos >= 0)) {
|
||||||
|
|
||||||
//append detector id
|
//append detector id
|
||||||
sprintf(sNumber, "%d", idet);
|
sprintf(sNumber, "%ld", idet);
|
||||||
retval.append("Detector " + std::string(sNumber) + std::string(":\n"));
|
retval.append("Detector " + std::string(sNumber) + std::string(":\n"));
|
||||||
|
|
||||||
//get sls det error mask
|
//get sls det error mask
|
||||||
@ -235,13 +235,14 @@ std::string multiSlsDetector::getErrorMessage(int& critical, int detPos) {
|
|||||||
int64_t multiSlsDetector::clearAllErrorMask(int detPos) {
|
int64_t multiSlsDetector::clearAllErrorMask(int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[idet]->clearErrorMask();
|
return detectors[detPos]->clearErrorMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
clearErrorMask();
|
clearErrorMask();
|
||||||
clearNotAddedList();
|
clearNotAddedList();
|
||||||
serialCall(&slsDetector::clearErrorMask);
|
for (auto* it : detectors)
|
||||||
|
it->clearErrorMask();
|
||||||
return getErrorMask();
|
return getErrorMask();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,19 +302,27 @@ int64_t multiSlsDetector::getId(idMode mode, int detPos) {
|
|||||||
|
|
||||||
|
|
||||||
slsDetector* multiSlsDetector::getSlsDetector(int detPos) {
|
slsDetector* multiSlsDetector::getSlsDetector(int detPos) {
|
||||||
return detectors[pos];
|
return detectors[detPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
slsDetector *multiSlsDetector::operator()(int detPos) const {
|
slsDetector *multiSlsDetector::operator()(int detPos) const {
|
||||||
return detectors[pos];
|
return detectors[detPos];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slsDetector* multiSlsDetector::operator[](int detPos) const {
|
||||||
|
//Providing access to detectors with range checking
|
||||||
|
//throw exception if out of range
|
||||||
|
if (detPos >= 0 && detPos < (int)detectors.size())
|
||||||
|
return detectors[detPos];
|
||||||
|
else
|
||||||
|
throw(std::range_error("Detector does not exist"));
|
||||||
|
}
|
||||||
|
|
||||||
void multiSlsDetector::freeSharedMemory(int multiId, int detPos) {
|
void multiSlsDetector::freeSharedMemory(int multiId, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
detectors[detPos]->freeSharedMemory(multiId, detPos);
|
slsDetector::freeSharedMemory(multiId, detPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,7 +350,7 @@ void multiSlsDetector::freeSharedMemory(int multiId, int detPos) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void multiSlsDetector::freeSharedMemory() {
|
void multiSlsDetector::freeSharedMemory(int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
detectors[detPos]->freeSharedMemory();
|
detectors[detPos]->freeSharedMemory();
|
||||||
@ -350,17 +359,17 @@ void multiSlsDetector::freeSharedMemory() {
|
|||||||
|
|
||||||
// multi
|
// multi
|
||||||
// clear zmq vector
|
// clear zmq vector
|
||||||
for (auto& it : zmqSocket)
|
for (auto* it : zmqSocket)
|
||||||
delete(*it);
|
delete it;
|
||||||
zmqSocket.clear();
|
zmqSocket.clear();
|
||||||
|
|
||||||
// should be done before the detector list is deleted
|
// should be done before the detector list is deleted
|
||||||
clearAllErrorMask();
|
clearAllErrorMask();
|
||||||
|
|
||||||
// clear sls detector vector shm
|
// clear sls detector vector shm
|
||||||
for (auto& it : detectors) {
|
for (auto* it : detectors) {
|
||||||
(*it)->freeSharedMemory();
|
it->freeSharedMemory();
|
||||||
delete(*it);
|
delete it;
|
||||||
}
|
}
|
||||||
detectors.clear();
|
detectors.clear();
|
||||||
|
|
||||||
@ -392,8 +401,8 @@ std::string multiSlsDetector::getUserDetails() {
|
|||||||
|
|
||||||
//type
|
//type
|
||||||
sstream<< "\nType: ";
|
sstream<< "\nType: ";
|
||||||
for (auto& it : detectors) {
|
for (auto* it : detectors) {
|
||||||
sstream<< (*it)->sgetDetectorsType() << "+";
|
sstream<< it->sgetDetectorsType() << "+";
|
||||||
}
|
}
|
||||||
|
|
||||||
//PID
|
//PID
|
||||||
@ -478,9 +487,8 @@ void multiSlsDetector::initializeDetectorStructure() {
|
|||||||
|
|
||||||
void multiSlsDetector::initializeMembers(bool verify) {
|
void multiSlsDetector::initializeMembers(bool verify) {
|
||||||
//multiSlsDetector
|
//multiSlsDetector
|
||||||
for (auto& it : zmqSocket) {
|
for (auto* it : zmqSocket)
|
||||||
delete(*it);
|
delete it;
|
||||||
}
|
|
||||||
zmqSocket.clear();
|
zmqSocket.clear();
|
||||||
|
|
||||||
// get objects from single det shared memory (open)
|
// get objects from single det shared memory (open)
|
||||||
@ -490,9 +498,8 @@ void multiSlsDetector::initializeMembers(bool verify) {
|
|||||||
detectors.push_back(sdet);
|
detectors.push_back(sdet);
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
// clear detectors list
|
// clear detectors list
|
||||||
for (auto& it : detectors) {
|
for (auto* it : detectors)
|
||||||
delete(*it);
|
delete it;
|
||||||
}
|
|
||||||
detectors.clear();
|
detectors.clear();
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
@ -597,8 +604,8 @@ void multiSlsDetector::addSlsDetector (std::string s) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Adding detector " << s << std::endl;
|
std::cout << "Adding detector " << s << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for (auto& it : detectors) {
|
for (auto* it : detectors) {
|
||||||
if ((*it)->getHostname((it-detectors.begin())) == s) {
|
if (it->getHostname() == s) {
|
||||||
std::cout << "Detector " << s << "already part of the multiDetector!" << std::endl
|
std::cout << "Detector " << s << "already part of the multiDetector!" << std::endl
|
||||||
<< "Remove it before adding it back in a new position!" << std::endl;
|
<< "Remove it before adding it back in a new position!" << std::endl;
|
||||||
return;
|
return;
|
||||||
@ -685,8 +692,6 @@ int multiSlsDetector::getTotalNumberOfChannels(int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = serialCall(&slsDetector::getTotalNumberOfChannels);
|
|
||||||
thisMultiDetector->numberOfChannels = sls::sum(r);
|
|
||||||
return thisMultiDetector->numberOfChannels;
|
return thisMultiDetector->numberOfChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,10 +876,14 @@ void multiSlsDetector::updateOffsets() {
|
|||||||
thisMultiDetector->numberOfChannelInclGapPixels[Y] << std::endl
|
thisMultiDetector->numberOfChannelInclGapPixels[Y] << std::endl
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
thisMultiDetector->numberOfChannels =
|
||||||
|
thisMultiDetector->numberOfChannel[0] *
|
||||||
|
thisMultiDetector->numberOfChannel[1];
|
||||||
|
|
||||||
serialCall(&slsDetector::updateMultiSize,
|
for (auto* it : detectors) {
|
||||||
thisMultiDetector->numberOfDetector[0],
|
it->updateMultiSize(thisMultiDetector->numberOfDetector[0],
|
||||||
thisMultiDetector->numberOfDetector[1]);
|
thisMultiDetector->numberOfDetector[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -912,7 +921,7 @@ int multiSlsDetector::setPort(portType t, int num, int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = serialcall(&slsDetector::setPort, t, num);
|
auto r = serialCall(&slsDetector::setPort, t, num);
|
||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1077,7 +1086,7 @@ int multiSlsDetector::writeConfigurationFile(std::string const fname) {
|
|||||||
// single detector configuration
|
// single detector configuration
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||||
outfile << std::endl;
|
outfile << std::endl;
|
||||||
ret1 = detectors[idet]->writeConfigurationFile(outfile, idet);
|
ret1 = detectors[idet]->writeConfigurationFile(outfile, this);
|
||||||
if (detectors[idet]->getErrorMask())
|
if (detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask() | (1 << idet));
|
setErrorMask(getErrorMask() | (1 << idet));
|
||||||
if (ret1 == FAIL)
|
if (ret1 == FAIL)
|
||||||
@ -1257,6 +1266,7 @@ slsDetectorDefs::runStatus multiSlsDetector::getRunStatus(int detPos) {
|
|||||||
for (const auto& value : r)
|
for (const auto& value : r)
|
||||||
if (value != IDLE)
|
if (value != IDLE)
|
||||||
return value;
|
return value;
|
||||||
|
return IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::prepareAcquisition(int detPos) {
|
int multiSlsDetector::prepareAcquisition(int detPos) {
|
||||||
@ -1385,11 +1395,11 @@ int multiSlsDetector::readAll(int detPos) {
|
|||||||
int multiSlsDetector::configureMAC(int detPos) {
|
int multiSlsDetector::configureMAC(int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->configureMAC(getNumberOfDetectors(Y));
|
return detectors[detPos]->configureMAC();
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::configureMAC, getNumberOfDetectors(Y));
|
auto r = parallelCall(&slsDetector::configureMAC);
|
||||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1563,11 +1573,11 @@ double multiSlsDetector::getMeasuredSubFramePeriod(bool inseconds, int detPos){
|
|||||||
int64_t multiSlsDetector::getTimeLeft(timerIndex index, int detPos) {
|
int64_t multiSlsDetector::getTimeLeft(timerIndex index, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->getTimeLeft(index, t);
|
return detectors[detPos]->getTimeLeft(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::getTimeLeft, index, t);
|
auto r = parallelCall(&slsDetector::getTimeLeft, index);
|
||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1600,10 +1610,10 @@ int multiSlsDetector::setDynamicRange(int p, int detPos) {
|
|||||||
thisMultiDetector->dataBytes = 0;
|
thisMultiDetector->dataBytes = 0;
|
||||||
thisMultiDetector->dataBytesInclGapPixels = 0;
|
thisMultiDetector->dataBytesInclGapPixels = 0;
|
||||||
thisMultiDetector->numberOfChannels = 0;
|
thisMultiDetector->numberOfChannels = 0;
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++det_id) {
|
for (auto* it : detectors) {
|
||||||
thisMultiDetector->dataBytes += detectors[idet]->getDataBytes();
|
thisMultiDetector->dataBytes += it->getDataBytes();
|
||||||
thisMultiDetector->dataBytesInclGapPixels += detectors[idet]->getDataBytesInclGapPixels();
|
thisMultiDetector->dataBytesInclGapPixels += it->getDataBytesInclGapPixels();
|
||||||
thisMultiDetector->numberOfChannels += detectors[idet]->getTotalNumberOfChannels();
|
thisMultiDetector->numberOfChannels += it->getTotalNumberOfChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1669,11 +1679,11 @@ int multiSlsDetector::setDAC(int val, dacIndex idac, int mV, int detPos) {
|
|||||||
int multiSlsDetector::getADC(dacIndex idac, int detPos) {
|
int multiSlsDetector::getADC(dacIndex idac, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->getADC(val, idac);
|
return detectors[detPos]->getADC(idac);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::getADC, val, idac);
|
auto r = parallelCall(&slsDetector::getADC, idac);
|
||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1729,7 +1739,7 @@ uint32_t multiSlsDetector::writeRegister(uint32_t addr, uint32_t val, int detPos
|
|||||||
|
|
||||||
// can't have different values
|
// can't have different values
|
||||||
FILE_LOG(logERROR) << "Error: Different Values for function writeRegister "
|
FILE_LOG(logERROR) << "Error: Different Values for function writeRegister "
|
||||||
"(write 0x" << hex << val << " to addr 0x" << hex << addr << dec << ")";
|
"(write 0x" << std::hex << val << " to addr 0x" << std::hex << addr << std::dec << ")";
|
||||||
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1748,7 +1758,7 @@ uint32_t multiSlsDetector::readRegister(uint32_t addr, int detPos) {
|
|||||||
|
|
||||||
// can't have different values
|
// can't have different values
|
||||||
FILE_LOG(logERROR) << "Error: Different Values for function readRegister "
|
FILE_LOG(logERROR) << "Error: Different Values for function readRegister "
|
||||||
"(read from 0x" << hex << addr << dec << ")";
|
"(read from 0x" << std::hex << addr << std::dec << ")";
|
||||||
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1767,7 +1777,7 @@ uint32_t multiSlsDetector::setBit(uint32_t addr, int n, int detPos) {
|
|||||||
|
|
||||||
// can't have different values
|
// can't have different values
|
||||||
FILE_LOG(logERROR) << "Error: Different Values for function setBit "
|
FILE_LOG(logERROR) << "Error: Different Values for function setBit "
|
||||||
"(set bit " << n << " to addr 0x" << hex << addr << dec << ")";
|
"(set bit " << n << " to addr 0x" << std::hex << addr << std::dec << ")";
|
||||||
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1786,7 +1796,7 @@ uint32_t multiSlsDetector::clearBit(uint32_t addr, int n, int detPos) {
|
|||||||
|
|
||||||
// can't have different values
|
// can't have different values
|
||||||
FILE_LOG(logERROR) << "Error: Different Values for function clearBit "
|
FILE_LOG(logERROR) << "Error: Different Values for function clearBit "
|
||||||
"(clear bit " << n << " to addr 0x" << hex << addr << dec << ")";
|
"(clear bit " << n << " to addr 0x" << std::hex << addr << std::dec << ")";
|
||||||
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1803,8 +1813,8 @@ std::string multiSlsDetector::setNetworkParameter(networkParameter p, std::strin
|
|||||||
// single argument for all
|
// single argument for all
|
||||||
if (s.find('+') == std::string::npos) {
|
if (s.find('+') == std::string::npos) {
|
||||||
|
|
||||||
if (p =! RECEIVER_STREAMING_PORT && p != CLIENT_STREAMING_PORT){
|
if (p != RECEIVER_STREAMING_PORT && p != CLIENT_STREAMING_PORT){
|
||||||
auto r = parallelCall(&slsDetector::setReadOutFlags, flag);
|
auto r = parallelCall(&slsDetector::setNetworkParameter, p, s);
|
||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1814,8 +1824,8 @@ std::string multiSlsDetector::setNetworkParameter(networkParameter p, std::strin
|
|||||||
|
|
||||||
std::vector<std::string> r;
|
std::vector<std::string> r;
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
||||||
s = to_string(firstPort + (idet * numSockets));
|
s = std::to_string(firstPort + (idet * numSockets));
|
||||||
r.push_back(detectots[idet]->setNetworkParameter(p,s));
|
r.push_back(detectors[idet]->setNetworkParameter(p,s));
|
||||||
}
|
}
|
||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
@ -1851,7 +1861,7 @@ std::string multiSlsDetector::getNetworkParameter(networkParameter p, int detPos
|
|||||||
|
|
||||||
int multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
|
int multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
std::string s = to_string(i);
|
std::string s = std::to_string(i);
|
||||||
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
|
int prev_streaming = enableDataStreamingFromReceiver(-1, detPos);
|
||||||
setNetworkParameter(RECEIVER_STREAMING_PORT, s, detPos);
|
setNetworkParameter(RECEIVER_STREAMING_PORT, s, detPos);
|
||||||
if (prev_streaming) {
|
if (prev_streaming) {
|
||||||
@ -1865,7 +1875,7 @@ int multiSlsDetector::setReceiverDataStreamingOutPort(int i, int detPos) {
|
|||||||
|
|
||||||
int multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
|
int multiSlsDetector::setClientDataStreamingInPort(int i, int detPos) {
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
std::string s = to_string(i);
|
std::string s = std::to_string(i);
|
||||||
int prev_streaming = enableDataStreamingToClient();
|
int prev_streaming = enableDataStreamingToClient();
|
||||||
setNetworkParameter(CLIENT_STREAMING_PORT, s, detPos);
|
setNetworkParameter(CLIENT_STREAMING_PORT, s, detPos);
|
||||||
if (prev_streaming) {
|
if (prev_streaming) {
|
||||||
@ -1905,8 +1915,8 @@ std::string multiSlsDetector::setClientDataStreamingInIP(std::string ip, int det
|
|||||||
|
|
||||||
int multiSlsDetector::setFlowControl10G(int enable, int detPos) {
|
int multiSlsDetector::setFlowControl10G(int enable, int detPos) {
|
||||||
std::string s;
|
std::string s;
|
||||||
if (i != -1) {
|
if (enable != -1) {
|
||||||
s = to_string((enable >= 1) ? 1 : 0);
|
s = std::to_string((enable >= 1) ? 1 : 0);
|
||||||
s = setNetworkParameter(FLOW_CONTROL_10G, s);
|
s = setNetworkParameter(FLOW_CONTROL_10G, s);
|
||||||
} else
|
} else
|
||||||
s = getNetworkParameter(FLOW_CONTROL_10G);
|
s = getNetworkParameter(FLOW_CONTROL_10G);
|
||||||
@ -1917,11 +1927,11 @@ int multiSlsDetector::setFlowControl10G(int enable, int detPos) {
|
|||||||
int multiSlsDetector::digitalTest(digitalTestMode mode, int ival, int detPos) {
|
int multiSlsDetector::digitalTest(digitalTestMode mode, int ival, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->digitalTest(ival);
|
return detectors[detPos]->digitalTest(mode, ival);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::digitalTest, ival);
|
auto r = parallelCall(&slsDetector::digitalTest, mode, ival);
|
||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1937,7 +1947,7 @@ int multiSlsDetector::loadImageToDetector(imageType index, std::string const fna
|
|||||||
//read image for all
|
//read image for all
|
||||||
int nch = thisMultiDetector->numberOfChannels;
|
int nch = thisMultiDetector->numberOfChannels;
|
||||||
short int imageVals[nch];
|
short int imageVals[nch];
|
||||||
if (readDataFile(fname, imageVals, nch) < nch * sizeof(short int)) {
|
if (readDataFile(fname, imageVals, nch) < nch * (int)sizeof(short int)) {
|
||||||
FILE_LOG(logERROR) << "Could not open file or not enough data in file "
|
FILE_LOG(logERROR) << "Could not open file or not enough data in file "
|
||||||
"to load image to detector.";
|
"to load image to detector.";
|
||||||
setErrorMask(getErrorMask() | MULTI_OTHER_ERROR);
|
setErrorMask(getErrorMask() | MULTI_OTHER_ERROR);
|
||||||
@ -1974,7 +1984,7 @@ int multiSlsDetector::writeCounterBlockFile(std::string const fname, int startAC
|
|||||||
|
|
||||||
// write image if all ok
|
// write image if all ok
|
||||||
if (sls::allEqualTo(r, static_cast<int>(OK))) {
|
if (sls::allEqualTo(r, static_cast<int>(OK))) {
|
||||||
if (writeDataFile(fname, nch, imageVals) < nch * sizeof(short int)) {
|
if (writeDataFile(fname, nch, imageVals) < nch * (int)sizeof(short int)) {
|
||||||
FILE_LOG(logERROR) << "Could not open file to write or did not write enough data in file "
|
FILE_LOG(logERROR) << "Could not open file to write or did not write enough data in file "
|
||||||
"to wrte counter block file from detector.";
|
"to wrte counter block file from detector.";
|
||||||
setErrorMask(getErrorMask() | MULTI_OTHER_ERROR);
|
setErrorMask(getErrorMask() | MULTI_OTHER_ERROR);
|
||||||
@ -2033,7 +2043,6 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
int ret1 = -100, ret;
|
|
||||||
int i, xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX,
|
int i, xmin, xmax, ymin, ymax, channelX, channelY, idet, lastChannelX,
|
||||||
lastChannelY, index, offsetX, offsetY;
|
lastChannelY, index, offsetX, offsetY;
|
||||||
|
|
||||||
@ -2323,7 +2332,7 @@ int multiSlsDetector::writeAdcRegister(int addr, int val, int detPos) {
|
|||||||
|
|
||||||
// can't have different values
|
// can't have different values
|
||||||
FILE_LOG(logERROR) << "Error: Different Values for function writeAdcRegister "
|
FILE_LOG(logERROR) << "Error: Different Values for function writeAdcRegister "
|
||||||
"(write 0x" << hex << val << " to addr 0x" << hex << addr << dec << ")";
|
"(write 0x" << std::hex << val << " to addr 0x" << std::hex << addr << std::dec << ")";
|
||||||
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
setErrorMask(getErrorMask() | MULTI_HAVE_DIFFERENT_VALUES);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -2582,14 +2591,12 @@ int multiSlsDetector::setAutoComparatorDisableMode(int ival, int detPos) {
|
|||||||
|
|
||||||
int multiSlsDetector::getChanRegs(double* retval, bool fromDetector, int detPos) {
|
int multiSlsDetector::getChanRegs(double* retval, bool fromDetector, int detPos) {
|
||||||
|
|
||||||
int nch = thisMultiDetector->numberOfChannels;
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
std::vector<int> r;
|
std::vector<int> r;
|
||||||
|
for (auto* it : detectors) {
|
||||||
for (size_t idet = 0; idet < detectors.size(); ++idet) {
|
int nch = it->getTotalNumberOfChannels();
|
||||||
int nch = detectors[idet]->getTotalNumberOfChannels();
|
|
||||||
double result[nch];
|
double result[nch];
|
||||||
r.push_back(detectors[idet]->getChanRegs(result, fromDetector));
|
r.push_back(it->getChanRegs(result, fromDetector));
|
||||||
memcpy(retval + offset, result, nch * sizeof(double));
|
memcpy(retval + offset, result, nch * sizeof(double));
|
||||||
}
|
}
|
||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
@ -2608,7 +2615,7 @@ int multiSlsDetector::calibratePedestal(int frames, int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setRateCorrection(double t, int detPos) {
|
int multiSlsDetector::setRateCorrection(int t, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->setRateCorrection(t);
|
return detectors[detPos]->setRateCorrection(t);
|
||||||
@ -2653,9 +2660,9 @@ int multiSlsDetector::setReceiverOnline(int off, int detPos) {
|
|||||||
// multi
|
// multi
|
||||||
if (off != GET_ONLINE_FLAG) {
|
if (off != GET_ONLINE_FLAG) {
|
||||||
auto r = parallelCall(&slsDetector::setReceiverOnline, off);
|
auto r = parallelCall(&slsDetector::setReceiverOnline, off);
|
||||||
receiverOnlineFlag->onlineFlag = sls::minusOneIfDifferent(r);
|
thisMultiDetector->receiverOnlineFlag = sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
return receiverOnlineFlag->onlineFlag;
|
return thisMultiDetector->receiverOnlineFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2674,11 +2681,11 @@ std::string multiSlsDetector::checkReceiverOnline(int detPos) {
|
|||||||
int multiSlsDetector::lockReceiver(int lock, int detPos) {
|
int multiSlsDetector::lockReceiver(int lock, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->lockReceiver(p);
|
return detectors[detPos]->lockReceiver(lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::lockReceiver, p);
|
auto r = parallelCall(&slsDetector::lockReceiver, lock);
|
||||||
return sls::minusOneIfDifferent(r);
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2695,7 +2702,7 @@ std::string multiSlsDetector::getReceiverLastClientIP(int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::exitReceiver(int imod) {
|
int multiSlsDetector::exitReceiver(int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->exitReceiver();
|
return detectors[detPos]->exitReceiver();
|
||||||
@ -2752,11 +2759,11 @@ std::string multiSlsDetector::setFileName(std::string s, int detPos) {
|
|||||||
|
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->getFileName(s);
|
return detectors[detPos]->setFileName(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::getFileName, s);
|
auto r = parallelCall(&slsDetector::setFileName, s);
|
||||||
return sls::concatenateIfDifferent(r);
|
return sls::concatenateIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2897,6 +2904,7 @@ slsDetectorDefs::runStatus multiSlsDetector::getReceiverStatus(int detPos) {
|
|||||||
for (const auto& value : r)
|
for (const auto& value : r)
|
||||||
if (value != IDLE)
|
if (value != IDLE)
|
||||||
return value;
|
return value;
|
||||||
|
return IDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2914,7 +2922,7 @@ int multiSlsDetector::getFramesCaughtByReceiver(int detPos) {
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// return average
|
// return average
|
||||||
return ((sls::sum(r))/(int)detector.size());
|
return ((sls::sum(r))/(int)detectors.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2932,7 +2940,7 @@ int multiSlsDetector::getReceiverCurrentFrameIndex(int detPos) {
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// return average
|
// return average
|
||||||
return ((sls::sum(r))/(int)detector.size());
|
return ((sls::sum(r))/(int)detectors.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2952,9 +2960,8 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
|||||||
if (destroy) {
|
if (destroy) {
|
||||||
cprintf(MAGENTA, "Going to destroy data sockets\n");
|
cprintf(MAGENTA, "Going to destroy data sockets\n");
|
||||||
//close socket
|
//close socket
|
||||||
for (auto& it : zmqSocket) {
|
for (auto* it : zmqSocket)
|
||||||
delete(*it);
|
delete it;
|
||||||
}
|
|
||||||
zmqSocket.clear();
|
zmqSocket.clear();
|
||||||
|
|
||||||
client_downstream = false;
|
client_downstream = false;
|
||||||
@ -2979,7 +2986,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
|||||||
detectors[iSocket / numSocketsPerDetector]->getClientStreamingIP().c_str(),
|
detectors[iSocket / numSocketsPerDetector]->getClientStreamingIP().c_str(),
|
||||||
portnum);
|
portnum);
|
||||||
zmqSocket.push_back(z);
|
zmqSocket.push_back(z);
|
||||||
printf("Zmq Client[%d] at %s\n", iSocket, z->GetZmqServerAddress());
|
printf("Zmq Client[%lu] at %s\n", iSocket, z->GetZmqServerAddress());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
cprintf(RED, "Error: Could not create Zmq socket on port %d\n", portnum);
|
||||||
createReceivingDataSockets(true);
|
createReceivingDataSockets(true);
|
||||||
@ -3203,7 +3210,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disconnect resources
|
// Disconnect resources
|
||||||
for (size_t = 0; i < zmqSocket.size(); ++i)
|
for (size_t i= 0; i < zmqSocket.size(); ++i)
|
||||||
if (connectList[i])
|
if (connectList[i])
|
||||||
zmqSocket[i]->Disconnect();
|
zmqSocket[i]->Disconnect();
|
||||||
|
|
||||||
@ -3482,12 +3489,12 @@ int multiSlsDetector::setCTBPattern(std::string fname, int detPos) {
|
|||||||
uint64_t multiSlsDetector::setCTBWord(int addr, uint64_t word, int detPos) {
|
uint64_t multiSlsDetector::setCTBWord(int addr, uint64_t word, int detPos) {
|
||||||
// single
|
// single
|
||||||
if (detPos >= 0) {
|
if (detPos >= 0) {
|
||||||
return detectors[detPos]->setCTBWord(i);
|
return detectors[detPos]->setCTBWord(addr, word);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::setCTBWord, addr, word);
|
auto r = parallelCall(&slsDetector::setCTBWord, addr, word);
|
||||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
return sls::minusOneIfDifferent(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3498,7 +3505,10 @@ int multiSlsDetector::setCTBPatLoops(int level, int& start, int& stop, int& n, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
// multi
|
// multi
|
||||||
auto r = parallelCall(&slsDetector::setCTBPatLoops,level, start, stop, n);
|
std::vector<int> r;
|
||||||
|
for (auto* it : detectors) {
|
||||||
|
r.push_back(it->setCTBPatLoops(level, start, stop, n));
|
||||||
|
}
|
||||||
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
return sls::allEqualTo(r, static_cast<int>(OK)) ? OK : FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3547,7 +3557,7 @@ int multiSlsDetector::retrieveDetectorSetup(std::string const fname1, int level)
|
|||||||
|
|
||||||
if (level==2) {
|
if (level==2) {
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "config file read" << endl;
|
std::cout << "config file read" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
fname=fname1+std::string(".det");
|
fname=fname1+std::string(".det");
|
||||||
} else
|
} else
|
||||||
@ -3773,26 +3783,26 @@ void multiSlsDetector::registerDataCallback(int( *userCallback)(detectorData*, i
|
|||||||
int multiSlsDetector::setTotalProgress() {
|
int multiSlsDetector::setTotalProgress() {
|
||||||
int nf=1, nc=1, ns=1, nm=1;
|
int nf=1, nc=1, ns=1, nm=1;
|
||||||
|
|
||||||
if (timerValue[FRAME_NUMBER])
|
if (thisMultiDetector->timerValue[FRAME_NUMBER])
|
||||||
nf=timerValue[FRAME_NUMBER];
|
nf=thisMultiDetector->timerValue[FRAME_NUMBER];
|
||||||
|
|
||||||
if (timerValue[CYCLES_NUMBER]>0)
|
if (thisMultiDetector->timerValue[CYCLES_NUMBER]>0)
|
||||||
nc=timerValue[CYCLES_NUMBER];
|
nc=thisMultiDetector->timerValue[CYCLES_NUMBER];
|
||||||
|
|
||||||
if (timerValue[STORAGE_CELL_NUMBER]>0)
|
if (thisMultiDetector->timerValue[STORAGE_CELL_NUMBER]>0)
|
||||||
ns=timerValue[STORAGE_CELL_NUMBER]+1;
|
ns=thisMultiDetector->timerValue[STORAGE_CELL_NUMBER]+1;
|
||||||
|
|
||||||
if (timerValue[MEASUREMENTS_NUMBER]>0)
|
if (thisMultiDetector->timerValue[MEASUREMENTS_NUMBER]>0)
|
||||||
nm=timerValue[MEASUREMENTS_NUMBER];
|
nm=thisMultiDetector->timerValue[MEASUREMENTS_NUMBER];
|
||||||
|
|
||||||
totalProgress=nm*nf*nc*ns;
|
totalProgress=nm*nf*nc*ns;
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << "nm " << nm << endl;
|
std::cout << "nm " << nm << std::endl;
|
||||||
cout << "nf " << nf << endl;
|
std::cout << "nf " << nf << std::endl;
|
||||||
cout << "nc " << nc << endl;
|
std::cout << "nc " << nc << std::endl;
|
||||||
cout << "ns " << ns << endl;
|
std::cout << "ns " << ns << std::endl;
|
||||||
cout << "Set total progress " << totalProgress << endl;
|
std::cout << "Set total progress " << totalProgress << std::endl;
|
||||||
#endif
|
#endif
|
||||||
return totalProgress;
|
return totalProgress;
|
||||||
}
|
}
|
||||||
@ -3801,7 +3811,7 @@ int multiSlsDetector::setTotalProgress() {
|
|||||||
double multiSlsDetector::getCurrentProgress() {
|
double multiSlsDetector::getCurrentProgress() {
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << progressIndex << " / " << totalProgress << endl;
|
std::cout << progressIndex << " / " << totalProgress << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
double p=100.*((double)progressIndex)/((double)totalProgress);
|
double p=100.*((double)progressIndex)/((double)totalProgress);
|
||||||
@ -3813,13 +3823,13 @@ double multiSlsDetector::getCurrentProgress() {
|
|||||||
void multiSlsDetector::incrementProgress() {
|
void multiSlsDetector::incrementProgress() {
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
progressIndex++;
|
progressIndex++;
|
||||||
cout << std::fixed << std::setprecision(2) << std::setw (6)
|
std::cout << std::fixed << std::setprecision(2) << std::setw (6)
|
||||||
<< 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
<< 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << endl;
|
std::cout << std::endl;
|
||||||
#else
|
#else
|
||||||
cout << "\r" << flush;
|
std::cout << "\r" << std::flush;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -3828,13 +3838,13 @@ void multiSlsDetector::incrementProgress() {
|
|||||||
void multiSlsDetector::setCurrentProgress(int i){
|
void multiSlsDetector::setCurrentProgress(int i){
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
progressIndex=i;
|
progressIndex=i;
|
||||||
cout << std::fixed << std::setprecision(2) << std::setw (6)
|
std::cout << std::fixed << std::setprecision(2) << std::setw (6)
|
||||||
<< 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
<< 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << endl;
|
std::cout << std::endl;
|
||||||
#else
|
#else
|
||||||
cout << "\r" << flush;
|
std::cout << "\r" << std::flush;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3863,7 +3873,7 @@ int multiSlsDetector::acquire(){
|
|||||||
void *status;
|
void *status;
|
||||||
setJoinThread(0);
|
setJoinThread(0);
|
||||||
|
|
||||||
int nm=timerValue[MEASUREMENTS_NUMBER];
|
int nm=thisMultiDetector->timerValue[MEASUREMENTS_NUMBER];
|
||||||
if (nm<1)
|
if (nm<1)
|
||||||
nm=1;
|
nm=1;
|
||||||
|
|
||||||
@ -3900,7 +3910,7 @@ int multiSlsDetector::acquire(){
|
|||||||
|
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
if(startReceiver() == FAIL) {
|
if(startReceiver() == FAIL) {
|
||||||
cout << "Start receiver failed " << endl;
|
std::cout << "Start receiver failed " << std::endl;
|
||||||
stopReceiver();
|
stopReceiver();
|
||||||
thisMultiDetector->stoppedFlag=1;
|
thisMultiDetector->stoppedFlag=1;
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
@ -3966,14 +3976,14 @@ int multiSlsDetector::acquire(){
|
|||||||
progress_call(getCurrentProgress(),pProgressCallArg);
|
progress_call(getCurrentProgress(),pProgressCallArg);
|
||||||
|
|
||||||
if (acquisition_finished)
|
if (acquisition_finished)
|
||||||
acquisition_finished(getCurrentProgress(),getDetectorStatus(),acqFinished_p);
|
acquisition_finished(getCurrentProgress(),getRunStatus(),acqFinished_p);
|
||||||
|
|
||||||
sem_destroy(&sem_newRTAcquisition);
|
sem_destroy(&sem_newRTAcquisition);
|
||||||
sem_destroy(&sem_endRTAcquisition);
|
sem_destroy(&sem_endRTAcquisition);
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << endl;
|
std::cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setAcquiringFlag(false);
|
setAcquiringFlag(false);
|
||||||
@ -3985,7 +3995,7 @@ int multiSlsDetector::acquire(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int multiSlsDetector::setThreadedProcessing(int enable=-1) {
|
int multiSlsDetector::setThreadedProcessing(int enable) {
|
||||||
if (enable>=0)
|
if (enable>=0)
|
||||||
thisMultiDetector->threadedProcessing=enable;
|
thisMultiDetector->threadedProcessing=enable;
|
||||||
return thisMultiDetector->threadedProcessing;
|
return thisMultiDetector->threadedProcessing;
|
||||||
@ -4029,9 +4039,8 @@ void multiSlsDetector::startProcessingThread() {
|
|||||||
|
|
||||||
|
|
||||||
void* multiSlsDetector::startProcessData(void *n) {
|
void* multiSlsDetector::startProcessData(void *n) {
|
||||||
postProcessing *myDet=(postProcessing*)n;
|
((multiSlsDetector*)n)->processData();
|
||||||
myDet->processData();
|
return n;
|
||||||
pthread_exit(NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class detectorData;
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <semaphore.h>
|
||||||
|
|
||||||
|
|
||||||
#define MULTI_SHMVERSION 0x181002
|
#define MULTI_SHMVERSION 0x181002
|
||||||
@ -244,6 +245,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
slsDetector *operator()(int detPos = -1) const;
|
slsDetector *operator()(int detPos = -1) const;
|
||||||
|
|
||||||
|
slsDetector* operator[](int detPos) const;
|
||||||
/**
|
/**
|
||||||
* Free shared memory from the command line
|
* Free shared memory from the command line
|
||||||
* avoiding creating the constructor classes and mapping
|
* avoiding creating the constructor classes and mapping
|
||||||
@ -656,7 +658,7 @@ public:
|
|||||||
* @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 sub frame dead time in ns, or s if specified
|
* @returns sub frame dead time in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setSubFrameDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
|
double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get number of frames
|
* Set/get number of frames
|
||||||
@ -1165,7 +1167,7 @@ public:
|
|||||||
* @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 0 if rate correction disabled, >0 otherwise
|
* @returns 0 if rate correction disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setRateCorrection(double t=0, int detPos = -1);
|
int setRateCorrection(int t=0, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rate correction ( Eiger)
|
* Get rate correction ( Eiger)
|
||||||
@ -1561,6 +1563,12 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool isDetectorIndexOutOfBounds(int detPos);
|
bool isDetectorIndexOutOfBounds(int detPos);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Combines data from all readouts and gives it to the gui
|
||||||
|
* or just gives progress of acquisition by polling receivers
|
||||||
|
*/
|
||||||
|
void* processData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Initialize (open/create) shared memory for the sharedMultiDetector structure
|
* Initialize (open/create) shared memory for the sharedMultiDetector structure
|
||||||
@ -1640,12 +1648,6 @@ private:
|
|||||||
*/
|
*/
|
||||||
static void* startProcessData(void *n);
|
static void* startProcessData(void *n);
|
||||||
|
|
||||||
/**
|
|
||||||
* Combines data from all readouts and gives it to the gui
|
|
||||||
* or just gives progress of acquisition by polling receivers
|
|
||||||
*/
|
|
||||||
void* processData();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if processing thread is ready to join main thread
|
* Check if processing thread is ready to join main thread
|
||||||
* @returns true if ready, else false
|
* @returns true if ready, else false
|
||||||
|
@ -31,13 +31,11 @@ public:
|
|||||||
"[id-][pos:]channel arg" << std::endl; \
|
"[id-][pos:]channel arg" << std::endl; \
|
||||||
std::cout << std::endl; \
|
std::cout << std::endl; \
|
||||||
return; \
|
return; \
|
||||||
if (del) delete myDetector; \
|
|
||||||
}; \
|
}; \
|
||||||
if (action==slsDetectorDefs::GET_ACTION && argc<1) { \
|
if (action==slsDetectorDefs::GET_ACTION && argc<1) { \
|
||||||
std::cout << "Wrong usage - should be: "<< argv[0] << \
|
std::cout << "Wrong usage - should be: "<< argv[0] << \
|
||||||
"[id-][pos:]channel arg" << std::endl; \
|
"[id-][pos:]channel arg" << std::endl; \
|
||||||
std::cout << std::endl; \
|
std::cout << std::endl; \
|
||||||
if (del) delete myDetector; \
|
|
||||||
return; \
|
return; \
|
||||||
}; \
|
}; \
|
||||||
|
|
||||||
@ -93,17 +91,13 @@ public:
|
|||||||
std::string scmd = cmd; \
|
std::string scmd = cmd; \
|
||||||
// free without calling multiSlsDetector constructor
|
// free without calling multiSlsDetector constructor
|
||||||
if (scmd == "free") { \
|
if (scmd == "free") { \
|
||||||
if (pos != -1) \
|
multiSlsDetector::freeSharedMemory(id, pos); \
|
||||||
slsDetector::freeSharedMemory(id, pos); \
|
|
||||||
else \
|
|
||||||
multiSlsDetector::freeSharedMemory(id); \
|
|
||||||
return; \
|
return; \
|
||||||
} \
|
} \
|
||||||
// get user details without verify sharedMultiSlsDetector version
|
// get user details without verify sharedMultiSlsDetector version
|
||||||
else if ((scmd == "user") && (action==slsDetectorDefs::GET_ACTION)) { \
|
else if ((scmd == "user") && (action==slsDetectorDefs::GET_ACTION)) { \
|
||||||
verify = false; \
|
verify = false; \
|
||||||
update = false; \
|
update = false; \
|
||||||
myDetector=NULL; \
|
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -353,7 +353,7 @@ public:
|
|||||||
* @param pos insignificant
|
* @param pos insignificant
|
||||||
* @returns hostname
|
* @returns hostname
|
||||||
*/
|
*/
|
||||||
std::string getHostname(int pos = -1);
|
std::string getHostname();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to the control port
|
* Connect to the control port
|
||||||
@ -388,7 +388,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void disconnectStop();
|
void disconnectStop();
|
||||||
|
|
||||||
using slsDetectorUtils::getDetectorType;
|
using slsDetectorBase::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
|
||||||
@ -594,36 +594,22 @@ public:
|
|||||||
*/
|
*/
|
||||||
int updateDetector();
|
int updateDetector();
|
||||||
|
|
||||||
/**
|
|
||||||
* Load configuration from a configuration File
|
|
||||||
* calls readConfigurationFile and gives it the stream
|
|
||||||
* @param fname configuration file name
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int readConfigurationFile(std::string const fname);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load configuration from a stream
|
|
||||||
* @param infile stream
|
|
||||||
* @return OK or FAIL
|
|
||||||
*/
|
|
||||||
int readConfigurationFile(std::ifstream &infile);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write current configuration to a file
|
* Write current configuration to a file
|
||||||
* calls writeConfigurationFile giving it a stream to write to
|
* calls writeConfigurationFile giving it a stream to write to
|
||||||
* @param fname configuration file name
|
* @param fname configuration file name
|
||||||
|
* @param m multiSlsDetector reference to parse commands
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int writeConfigurationFile(std::string const fname);
|
int writeConfigurationFile(std::string const fname, multiSlsDetector* m);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write current configuration to a stream
|
* Write current configuration to a stream
|
||||||
* @param outfile outstream
|
* @param outfile outstream
|
||||||
* @param id detector id
|
* @param m multiSlsDetector reference to parse commands
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int writeConfigurationFile(std::ofstream &outfile, int id=-1);
|
int writeConfigurationFile(std::ofstream &outfile, multiSlsDetector* m);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the trimfile or settings file name (Useless??)
|
* Returns the trimfile or settings file name (Useless??)
|
||||||
@ -772,10 +758,9 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures in detector the destination for UDP packets
|
* Configures in detector the destination for UDP packets
|
||||||
* @param ndety number of detectors in y dir
|
|
||||||
* @returns OK or FAIL
|
* @returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
int configureMAC(int ndety);
|
int configureMAC();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get timer value (not all implemented for all detectors)
|
* Set/get timer value (not all implemented for all detectors)
|
||||||
@ -829,7 +814,7 @@ public:
|
|||||||
* @param mV 0 in dac units or 1 in mV
|
* @param mV 0 in dac units or 1 in mV
|
||||||
* @returns current DAC value
|
* @returns current DAC value
|
||||||
*/
|
*/
|
||||||
int setDAC(int val, dacIndex index , int mV);
|
int setDAC(int val, dacIndex index, int mV);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get adc value
|
* Get adc value
|
||||||
@ -894,14 +879,14 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Set network parameter
|
* Set network parameter
|
||||||
* @param p network parameter type
|
* @param p network parameter type
|
||||||
* @param s network parameter value
|
* @param value network parameter value
|
||||||
* @returns network parameter value set (from getNetworkParameter)
|
* @returns network parameter value set (from getNetworkParameter)
|
||||||
*/
|
*/
|
||||||
std::string setNetworkParameter(networkParameter index, std::string value);
|
std::string setNetworkParameter(networkParameter index, std::string value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get network parameter
|
* Get network parameter
|
||||||
* @param p network parameter type
|
* @param index network parameter type
|
||||||
* @returns network parameter value set (from getNetworkParameter)
|
* @returns network parameter value set (from getNetworkParameter)
|
||||||
*/
|
*/
|
||||||
std::string getNetworkParameter(networkParameter index);
|
std::string getNetworkParameter(networkParameter index);
|
||||||
@ -1056,9 +1041,10 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Execute a digital test (Gotthard, Mythen)
|
* Execute a digital test (Gotthard, Mythen)
|
||||||
* @param mode testmode type
|
* @param mode testmode type
|
||||||
|
* @param value 1 to set or 0 to clear the digital test bit
|
||||||
* @returns result of test
|
* @returns result of test
|
||||||
*/
|
*/
|
||||||
int digitalTest(digitalTestMode mode);
|
int digitalTest(digitalTestMode mode, int ival=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load dark or gain image to detector (Gotthard)
|
* Load dark or gain image to detector (Gotthard)
|
||||||
@ -1336,23 +1322,10 @@ public:
|
|||||||
* for current settings
|
* for current settings
|
||||||
* @returns 0 if rate correction disabled, >0 otherwise
|
* @returns 0 if rate correction disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setRateCorrection(double t=0);
|
int setRateCorrection(int t=0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get rate correction (Mythen, Eiger)
|
* Get rate correction Eiger)
|
||||||
* @param t reference for dead time
|
|
||||||
* @returns 0 if rate correction disabled, > 0 otherwise
|
|
||||||
*/
|
|
||||||
int getRateCorrection(double &t);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get rate correction tau (Mythen, Eiger)
|
|
||||||
* @returns 0 if rate correction disabled, otherwise the tau used for the correction
|
|
||||||
*/
|
|
||||||
double getRateCorrectionTau();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get rate correction (Mythen, Eiger)
|
|
||||||
* @returns 0 if rate correction disabled, > 0 otherwise
|
* @returns 0 if rate correction disabled, > 0 otherwise
|
||||||
*/
|
*/
|
||||||
int getRateCorrection();
|
int getRateCorrection();
|
||||||
|
@ -791,7 +791,7 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \page data
|
/*! \page data
|
||||||
- <b>ratecorr [ns]</b> Returns the dead time used for rate correections in ns (int). \c put sets the deadtime correction constant in ns, -1 will set it to default tau of settings (0 unset). \c Returns \c (double with 9 decimal digit precision). For Eiger only.
|
- <b>ratecorr [ns]</b> Returns the dead time used for rate correections in ns (int). \c put sets the deadtime correction constant in ns, -1 will set it to default tau of settings (0 unset). \c Returns \c (int). For Eiger only.
|
||||||
*/
|
*/
|
||||||
descrToFuncMap[i].m_pFuncName="ratecorr"; //
|
descrToFuncMap[i].m_pFuncName="ratecorr"; //
|
||||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRateCorr;
|
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdRateCorr;
|
||||||
@ -2046,7 +2046,7 @@ Make sure you have first read \ref intro "the introduction".
|
|||||||
|
|
||||||
|
|
||||||
string slsDetectorCommand::cmdUnknown(int narg, char *args[], int action, int detPos) {
|
string slsDetectorCommand::cmdUnknown(int narg, char *args[], int action, int detPos) {
|
||||||
return string("Unknown command ")+string(args[0])+string("\n")+helpLine(0, action);
|
return string("Unknown command ")+string(args[0])+string("\n")+helpLine(0, args, action, detPos);
|
||||||
|
|
||||||
}
|
}
|
||||||
string slsDetectorCommand::cmdUnderDevelopment(int narg, char *args[], int action, int detPos) {
|
string slsDetectorCommand::cmdUnderDevelopment(int narg, char *args[], int action, int detPos) {
|
||||||
@ -2057,7 +2057,7 @@ string slsDetectorCommand::cmdUnderDevelopment(int narg, char *args[], int actio
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
string slsDetectorCommand::helpLine(int narg, int action) {
|
string slsDetectorCommand::helpLine(int narg, char *args[], int action, int detPos) {
|
||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
|
|
||||||
@ -2074,7 +2074,7 @@ string slsDetectorCommand::helpLine(int narg, int action) {
|
|||||||
os << endl;
|
os << endl;
|
||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
return executeLine(narg,args,HELP_ACTION);
|
return executeLine(narg,args,HELP_ACTION, detPos);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2392,9 +2392,9 @@ string slsDetectorCommand::cmdHelp(int narg, char *args[], int action, int detPo
|
|||||||
cout << narg << endl;
|
cout << narg << endl;
|
||||||
|
|
||||||
if (narg>=1)
|
if (narg>=1)
|
||||||
return helpLine(narg-1, action);
|
return helpLine(narg-1, args, action, detPos);
|
||||||
else
|
else
|
||||||
return helpLine(0, action);
|
return helpLine(0, args, action, detPos);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -2686,21 +2686,16 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action, int d
|
|||||||
if (action==HELP_ACTION) {
|
if (action==HELP_ACTION) {
|
||||||
return helpRateCorr(action);
|
return helpRateCorr(action);
|
||||||
}
|
}
|
||||||
double fval;
|
int fval;
|
||||||
char answer[1000];
|
char answer[1000];
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
|
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
sscanf(args[1],"%lf",&fval);
|
sscanf(args[1],"%d",&fval);
|
||||||
myDet->setRateCorrection(fval, detPos);
|
myDet->setRateCorrection(fval, detPos);
|
||||||
}
|
}
|
||||||
double t;
|
sprintf(answer,"%d",myDet->getRateCorrection(detPos));
|
||||||
if (myDet->getRateCorrection(t, detPos)) {
|
|
||||||
sprintf(answer,"%0.9f",t);
|
|
||||||
} else {
|
|
||||||
sprintf(answer,"%0.9f",0.);
|
|
||||||
}
|
|
||||||
return string(answer);
|
return string(answer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3459,12 +3454,12 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int d
|
|||||||
}
|
}
|
||||||
detectorType type = myDet->getDetectorsType(detPos);
|
detectorType type = myDet->getDetectorsType(detPos);
|
||||||
if (type != EIGER || (type == EIGER && narg<=2)) {
|
if (type != EIGER || (type == EIGER && narg<=2)) {
|
||||||
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 1, detPos);
|
myDet->setThresholdEnergy(val, GET_SETTINGS, 1, detPos);
|
||||||
} else {
|
} else {
|
||||||
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
|
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
|
||||||
if(sett == -1)
|
if(sett == -1)
|
||||||
return string("invalid settings value");
|
return string("invalid settings value");
|
||||||
myDet->setThresholdEnergy(val, -1, sett, 1, detPos);
|
myDet->setThresholdEnergy(val, sett, 1, detPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(ans,"%d",myDet->getThresholdEnergy(detPos));
|
sprintf(ans,"%d",myDet->getThresholdEnergy(detPos));
|
||||||
@ -3478,12 +3473,12 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action, int d
|
|||||||
if (type != EIGER)
|
if (type != EIGER)
|
||||||
return string("not implemented for this detector");
|
return string("not implemented for this detector");
|
||||||
if (narg<=2) {
|
if (narg<=2) {
|
||||||
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 0, detPos);
|
myDet->setThresholdEnergy(val, GET_SETTINGS, 0, detPos);
|
||||||
} else {
|
} else {
|
||||||
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
|
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
|
||||||
if(sett == -1)
|
if(sett == -1)
|
||||||
return string("invalid settings value");
|
return string("invalid settings value");
|
||||||
myDet->setThresholdEnergy(val, -1, sett, 0, detPos);
|
myDet->setThresholdEnergy(val, sett, 0, detPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sprintf(ans,"%d",myDet->getThresholdEnergy(detPos));
|
sprintf(ans,"%d",myDet->getThresholdEnergy(detPos));
|
||||||
@ -3996,12 +3991,8 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action, int detPos
|
|||||||
if(narg >= 3)
|
if(narg >= 3)
|
||||||
if(!strcasecmp(args[2],"mv"))
|
if(!strcasecmp(args[2],"mv"))
|
||||||
mode = 1;
|
mode = 1;
|
||||||
#ifdef DACS_INT
|
|
||||||
|
|
||||||
if (sscanf(args[1],"%d", &val))
|
if (sscanf(args[1],"%d", &val))
|
||||||
#else
|
|
||||||
if (sscanf(args[1],"%f", &val))
|
|
||||||
#endif
|
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
return string("cannot scan DAC value ")+string(args[1]);
|
return string("cannot scan DAC value ")+string(args[1]);
|
||||||
@ -4013,11 +4004,7 @@ string slsDetectorCommand::cmdDAC(int narg, char *args[], int action, int detPos
|
|||||||
if(!strcasecmp(args[1],"mv"))
|
if(!strcasecmp(args[1],"mv"))
|
||||||
mode = 1;
|
mode = 1;
|
||||||
|
|
||||||
#ifdef DACS_INT
|
|
||||||
sprintf(answer,"%d",myDet->setDAC(-1,dac,mode, detPos));
|
sprintf(answer,"%d",myDet->setDAC(-1,dac,mode, detPos));
|
||||||
#else
|
|
||||||
sprintf(answer,"%f",myDet->setDAC(-1,dac,mode, detPos));
|
|
||||||
#endif
|
|
||||||
if(mode)
|
if(mode)
|
||||||
strcat(answer," mV");
|
strcat(answer," mV");
|
||||||
return string(answer);
|
return string(answer);
|
||||||
@ -4202,7 +4189,6 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int detPos
|
|||||||
return string("cannot decode adc ")+cmd;
|
return string("cannot decode adc ")+cmd;
|
||||||
|
|
||||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
#ifdef DACS_INT
|
|
||||||
if (myDet->getDetectorsType(detPos) == EIGER || myDet->getDetectorsType(detPos) == JUNGFRAU){
|
if (myDet->getDetectorsType(detPos) == EIGER || myDet->getDetectorsType(detPos) == JUNGFRAU){
|
||||||
int val = myDet->getADC(adc, detPos);
|
int val = myDet->getADC(adc, detPos);
|
||||||
if (val == -1)
|
if (val == -1)
|
||||||
@ -4211,9 +4197,7 @@ string slsDetectorCommand::cmdADC(int narg, char *args[], int action, int detPos
|
|||||||
sprintf(answer,"%.2f", (double)val/1000.000);
|
sprintf(answer,"%.2f", (double)val/1000.000);
|
||||||
}
|
}
|
||||||
else sprintf(answer,"%d",myDet->getADC(adc, detPos));
|
else sprintf(answer,"%d",myDet->getADC(adc, detPos));
|
||||||
#else
|
|
||||||
sprintf(answer,"%f",myDet->getADC(adc, detPos));
|
|
||||||
#endif
|
|
||||||
//if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
//if ((adc == TEMPERATURE_ADC) || (adc == TEMPERATURE_FPGA))
|
||||||
if (adc<=100)
|
if (adc<=100)
|
||||||
strcat(answer,"°C");
|
strcat(answer,"°C");
|
||||||
@ -4337,7 +4321,7 @@ string slsDetectorCommand::cmdTiming(int narg, char *args[], int action, int det
|
|||||||
myDet->setOnline(ONLINE_FLAG, detPos);
|
myDet->setOnline(ONLINE_FLAG, detPos);
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
if (myDet->externalCommunicationType(string(args[1]))== GET_EXTERNAL_COMMUNICATION_MODE)
|
if (myDet->externalCommunicationType(string(args[1]))== GET_EXTERNAL_COMMUNICATION_MODE)
|
||||||
return helpTiming(narg,args, action);
|
return helpTiming(action);
|
||||||
myDet->setExternalCommunicationMode(myDet->externalCommunicationType(string(args[1])), detPos);
|
myDet->setExternalCommunicationMode(myDet->externalCommunicationType(string(args[1])), detPos);
|
||||||
}
|
}
|
||||||
return myDet->externalCommunicationType(myDet->setExternalCommunicationMode(GET_EXTERNAL_COMMUNICATION_MODE, detPos));
|
return myDet->externalCommunicationType(myDet->setExternalCommunicationMode(GET_EXTERNAL_COMMUNICATION_MODE, detPos));
|
||||||
@ -4903,20 +4887,20 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action,
|
|||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
sval=string(args[1]);
|
sval=string(args[1]);
|
||||||
myDet->retrieveDetectorSetup(sval, 0, detPos);
|
myDet->retrieveDetectorSetup(sval, 0);
|
||||||
} else if (action==GET_ACTION) {
|
} else if (action==GET_ACTION) {
|
||||||
sval=string(args[1]);
|
sval=string(args[1]);
|
||||||
myDet->dumpDetectorSetup(sval, 0, detPos);
|
myDet->dumpDetectorSetup(sval, 0);
|
||||||
}
|
}
|
||||||
return sval;
|
return sval;
|
||||||
} else if (cmd=="setup") {
|
} else if (cmd=="setup") {
|
||||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||||
if (action==PUT_ACTION) {
|
if (action==PUT_ACTION) {
|
||||||
sval=string(args[1]);
|
sval=string(args[1]);
|
||||||
myDet->retrieveDetectorSetup(sval,2, detPos);
|
myDet->retrieveDetectorSetup(sval,2);
|
||||||
} else if (action==GET_ACTION) {
|
} else if (action==GET_ACTION) {
|
||||||
sval=string(args[1]);
|
sval=string(args[1]);
|
||||||
myDet->dumpDetectorSetup(sval,2, detPos);
|
myDet->dumpDetectorSetup(sval,2);
|
||||||
}
|
}
|
||||||
return sval;
|
return sval;
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
/* \param os output stream to return the help to */
|
/* \param os output stream to return the help to */
|
||||||
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
/* \param action can be PUT_ACTION or GET_ACTION (from text client even READOUT_ACTION for acquisition) */
|
||||||
/* *\/ */
|
/* *\/ */
|
||||||
std::string helpLine(int narg, int action=HELP_ACTION);
|
std::string helpLine(int narg, char *args[], int action=HELP_ACTION, int detPos = -1);
|
||||||
static std::string helpAcquire(int action);
|
static std::string helpAcquire(int action);
|
||||||
static std::string helpData(int action);
|
static std::string helpData(int action);
|
||||||
static std::string helpStatus(int action);
|
static std::string helpStatus(int action);
|
||||||
@ -146,7 +146,7 @@ class slsDetectorCommand : public virtual slsDetectorDefs {
|
|||||||
int numberOfCommands;
|
int numberOfCommands;
|
||||||
std::string cmd;
|
std::string cmd;
|
||||||
|
|
||||||
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action, int detPos = -1);
|
typedef std::string (slsDetectorCommand::*MemFuncGetter)(int narg, char *args[], int action, int detPos);
|
||||||
|
|
||||||
|
|
||||||
struct FuncTable
|
struct FuncTable
|
||||||
|
@ -93,12 +93,12 @@ int64_t slsDetectorUsers::getReceiverSoftwareVersion(int detPos){
|
|||||||
return myDetector->getId(slsDetectorDefs::RECEIVER_VERSION, detPos);
|
return myDetector->getId(slsDetectorDefs::RECEIVER_VERSION, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDetectorVersionCompatible(int detPos) {
|
bool slsDetectorUsers::isDetectorVersionCompatible(int detPos) {
|
||||||
return (myDetector->checkVersionCompatibility(slsDetectorDefs::CONTROL_PORT, detPos) == OK);
|
return (myDetector->checkVersionCompatibility(slsDetectorDefs::CONTROL_PORT, detPos) == slsReceiverDefs::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isReceiverVersionCompatible(int detPos) {
|
bool slsDetectorUsers::isReceiverVersionCompatible(int detPos) {
|
||||||
return (myDetector->checkVersionCompatibility(slsDetectorDefs::DATA_PORT, detPos) == OK);
|
return (myDetector->checkVersionCompatibility(slsDetectorDefs::DATA_PORT, detPos) == slsReceiverDefs::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::startMeasurement(){
|
int slsDetectorUsers::startMeasurement(){
|
||||||
@ -139,21 +139,17 @@ int slsDetectorUsers::setBitDepth(int i, int detPos){
|
|||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setSettings(int isettings, int detPos){
|
int slsDetectorUsers::setSettings(int isettings, int detPos){
|
||||||
return myDetector->slsDetectorBase::setSettings(isettings, detPos);
|
return myDetector->setSettings((slsDetectorDefs::detectorSettings)isettings, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::getThresholdEnergy(int detPos){
|
int slsDetectorUsers::getThresholdEnergy(int detPos){
|
||||||
return myDetector->getThresholdEnergy(detPos);
|
return myDetector->getThresholdEnergy(detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setThresholdEnergy(int e_eV){
|
|
||||||
return myDetector->setThresholdEnergy(e_eV);
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int detPos) {
|
int slsDetectorUsers::setThresholdEnergy(int e_ev, int tb, int isettings, int detPos) {
|
||||||
return myDetector->setThresholdEnergy(e_ev, tb,
|
return myDetector->setThresholdEnergy(e_ev,
|
||||||
(isettings == -1) ? slsDetectorDefs::GET_SETTINGS : isettings,
|
(isettings == -1) ? slsDetectorDefs::GET_SETTINGS : (slsDetectorDefs::detectorSettings)isettings,
|
||||||
detPos);
|
tb, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int detPos){
|
double slsDetectorUsers::setExposureTime(double t, bool inseconds, int detPos){
|
||||||
@ -211,7 +207,7 @@ int slsDetectorUsers::setClockDivider(int value, int detPos) {
|
|||||||
int slsDetectorUsers::setParallelMode(int value, int detPos) {
|
int slsDetectorUsers::setParallelMode(int value, int detPos) {
|
||||||
if(value >= 0)
|
if(value >= 0)
|
||||||
myDetector->setReadOutFlags(slsDetectorDefs::readOutFlags(value), detPos);
|
myDetector->setReadOutFlags(slsDetectorDefs::readOutFlags(value), detPos);
|
||||||
return myDetector->setReadOutFlags(-1, detPos);
|
return myDetector->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setOverflowMode(int value, int detPos) {
|
int slsDetectorUsers::setOverflowMode(int value, int detPos) {
|
||||||
@ -221,7 +217,7 @@ int slsDetectorUsers::setOverflowMode(int value, int detPos) {
|
|||||||
else
|
else
|
||||||
myDetector->setReadOutFlags(slsDetectorDefs::NOOVERFLOW, detPos);
|
myDetector->setReadOutFlags(slsDetectorDefs::NOOVERFLOW, detPos);
|
||||||
}
|
}
|
||||||
int ret = myDetector->setReadOutFlags(-1, detPos);
|
int ret = myDetector->setReadOutFlags(slsDetectorDefs::GET_READOUT_FLAGS, detPos);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
return -1;
|
return -1;
|
||||||
return ((ret & slsDetectorDefs::SHOW_OVERFLOW) ? 1 : 0);
|
return ((ret & slsDetectorDefs::SHOW_OVERFLOW) ? 1 : 0);
|
||||||
@ -232,19 +228,19 @@ int slsDetectorUsers::setAllTrimbits(int val, int detPos) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setDAC(int val, int index , int detPos) {
|
int slsDetectorUsers::setDAC(int val, int index , int detPos) {
|
||||||
return myDetector->setDAC(val, dacsIndex(index), 0, detPos);
|
return myDetector->setDAC(val, slsDetectorDefs::dacIndex(index), 0, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::getADC(int index, int detPos) {
|
int slsDetectorUsers::getADC(int index, int detPos) {
|
||||||
return myDetector->getADC(dacsIndex(index),detPos);
|
return myDetector->getADC(slsDetectorDefs::dacIndex(index),detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setTenGigabitEthernet(int i, int detPos) {
|
int slsDetectorUsers::setTenGigabitEthernet(int i, int detPos) {
|
||||||
return myDetector->enableTenGigabitEthernet(i, detPos);
|
return myDetector->enableTenGigabitEthernet(i, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setStoragecellStart(int pos) {
|
int slsDetectorUsers::setStoragecellStart(int pos, int detPos) {
|
||||||
return myDetector->setStoragecellStart(pos);
|
return myDetector->setStoragecellStart(pos, detPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
int slsDetectorUsers::setHighVoltage(int i, int detPos) {
|
int slsDetectorUsers::setHighVoltage(int i, int detPos) {
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
* @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 (1)online/(0)offline status
|
* @returns (1)online/(0)offline status
|
||||||
*/
|
*/
|
||||||
int setReceiverOnline(int const online = GET_ONLINE_FLAG, int detPos = -1);
|
int setReceiverOnline(int const online = -1, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load configuration from a configuration File (for one time detector setup)
|
* Load configuration from a configuration File (for one time detector setup)
|
||||||
@ -368,7 +368,7 @@ public:
|
|||||||
* @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 sub frame dead time in ns, or s if specified
|
* @returns sub frame dead time in ns, or s if specified
|
||||||
*/
|
*/
|
||||||
double setSubFrameDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
|
double setSubFrameExposureDeadTime(double t = -1, bool inseconds = false, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get number of frames
|
* Set/get number of frames
|
||||||
@ -483,7 +483,7 @@ public:
|
|||||||
* @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 current DAC value
|
* @returns current DAC value
|
||||||
*/
|
*/
|
||||||
dacs_t setDAC(int val, int index , int detPos = -1);
|
int setDAC(int val, int index , int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get adc value
|
* Get adc value
|
||||||
@ -495,7 +495,7 @@ public:
|
|||||||
* @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 current adc value (temperature for eiger and jungfrau in millidegrees)
|
* @returns current adc value (temperature for eiger and jungfrau in millidegrees)
|
||||||
*/
|
*/
|
||||||
dacs_t getADC(int index, int detPos = -1);
|
int getADC(int index, int detPos = -1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable or 10Gbe (Eiger)
|
* Enable/disable or 10Gbe (Eiger)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user