mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-17 16:43:45 +01:00
merge from developer (without the additional json header implementations)
This commit is contained in:
@@ -56,6 +56,7 @@ endif()
|
||||
|
||||
|
||||
install(TARGETS slsDetectorShared
|
||||
EXPORT "${TARGETS_EXPORT_NAME}"
|
||||
LIBRARY DESTINATION lib
|
||||
PUBLIC_HEADER DESTINATION include
|
||||
ARCHIVE DESTINATION lib
|
||||
|
||||
@@ -668,7 +668,9 @@ void multiSlsDetector::updateOffsets() {
|
||||
numY += detectors[idet]->getTotalNumberOfChannels(Y);
|
||||
numY_gp +=
|
||||
detectors[idet]->getTotalNumberOfChannelsInclGapPixels(Y);
|
||||
++thisMultiDetector->numberOfDetector[Y];
|
||||
// increment in y again only in the first column (else you double increment)
|
||||
if (thisMultiDetector->numberOfDetector[X] == 1)
|
||||
++thisMultiDetector->numberOfDetector[Y];
|
||||
FILE_LOG(logDEBUG1) << "incrementing in y direction";
|
||||
}
|
||||
|
||||
@@ -2121,77 +2123,89 @@ int multiSlsDetector::setROI(int n, ROI roiLimits[], int detPos) {
|
||||
ymin = roiLimits[i].ymin;
|
||||
ymax = roiLimits[i].ymax;
|
||||
|
||||
// check roi max values
|
||||
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
||||
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
|
||||
<< "det:" << idet << "\t" << xmax << "\t" << ymax << "\t" << channelX << "\t" << channelY;
|
||||
if (idet == -1) {
|
||||
FILE_LOG(logERROR) << "invalid roi";
|
||||
continue;
|
||||
}
|
||||
if (getDetectorsType() != JUNGFRAUCTB || getNumberOfDetectors() > 1) {
|
||||
// check roi max values
|
||||
idet = decodeNChannel(xmax, ymax, channelX, channelY);
|
||||
FILE_LOG(logDEBUG1) << "Decoded Channel max vals: " << std::endl
|
||||
<< "det:" << idet << "\t" << xmax << "\t" << ymax << "\t" << channelX << "\t" << channelY;
|
||||
if (idet == -1) {
|
||||
FILE_LOG(logERROR) << "invalid roi";
|
||||
continue;
|
||||
}
|
||||
|
||||
// split in x dir
|
||||
while (xmin <= xmax) {
|
||||
invalidroi = false;
|
||||
ymin = roiLimits[i].ymin;
|
||||
// split in y dir
|
||||
while (ymin <= ymax) {
|
||||
// get offset for each detector
|
||||
idet = decodeNChannel(xmin, ymin, channelX, channelY);
|
||||
FILE_LOG(logDEBUG1) << "Decoded Channel min vals: " << std::endl
|
||||
<< "det:" << idet << "\t" << xmin << "\t" << ymin << "\t" << channelX << "\t" << channelY;
|
||||
if (idet < 0 || idet >= (int)detectors.size()) {
|
||||
FILE_LOG(logDEBUG1) << "invalid roi";
|
||||
invalidroi = true;
|
||||
// split in x dir
|
||||
while (xmin <= xmax) {
|
||||
invalidroi = false;
|
||||
ymin = roiLimits[i].ymin;
|
||||
// split in y dir
|
||||
while (ymin <= ymax) {
|
||||
// get offset for each detector
|
||||
idet = decodeNChannel(xmin, ymin, channelX, channelY);
|
||||
FILE_LOG(logDEBUG1) << "Decoded Channel min vals: " << std::endl
|
||||
<< "det:" << idet << "\t" << xmin << "\t" << ymin << "\t" << channelX << "\t" << channelY;
|
||||
if (idet < 0 || idet >= (int)detectors.size()) {
|
||||
FILE_LOG(logDEBUG1) << "invalid roi";
|
||||
invalidroi = true;
|
||||
break;
|
||||
}
|
||||
// get last channel for each det in x and y dir
|
||||
lastChannelX =
|
||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
||||
X)) -
|
||||
1;
|
||||
lastChannelY =
|
||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
||||
Y)) -
|
||||
1;
|
||||
|
||||
offsetX = detectors[idet]->getDetectorOffset(X);
|
||||
offsetY = detectors[idet]->getDetectorOffset(Y);
|
||||
// at the end in x dir
|
||||
if ((offsetX + lastChannelX) >= xmax) {
|
||||
lastChannelX = xmax - offsetX;
|
||||
}
|
||||
// at the end in y dir
|
||||
if ((offsetY + lastChannelY) >= ymax) {
|
||||
lastChannelY = ymax - offsetY;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "lastChannelX:" << lastChannelX << "\t"
|
||||
<< "lastChannelY:" << lastChannelY;
|
||||
|
||||
// creating the list of roi for corresponding detector
|
||||
index = nroi[idet];
|
||||
allroi[idet][index].xmin = channelX;
|
||||
allroi[idet][index].xmax = lastChannelX;
|
||||
allroi[idet][index].ymin = channelY;
|
||||
allroi[idet][index].ymax = lastChannelY;
|
||||
nroi[idet] = nroi[idet] + 1;
|
||||
|
||||
ymin = lastChannelY + offsetY + 1;
|
||||
if ((lastChannelY + offsetY) == ymax) {
|
||||
ymin = ymax + 1;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "nroi[idet]:" << nroi[idet] << "\tymin:" << ymin;
|
||||
}
|
||||
if (invalidroi) {
|
||||
break;
|
||||
}
|
||||
// get last channel for each det in x and y dir
|
||||
lastChannelX =
|
||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
||||
X)) -
|
||||
1;
|
||||
lastChannelY =
|
||||
(detectors[idet]->getTotalNumberOfChannelsInclGapPixels(
|
||||
Y)) -
|
||||
1;
|
||||
|
||||
offsetX = detectors[idet]->getDetectorOffset(X);
|
||||
offsetY = detectors[idet]->getDetectorOffset(Y);
|
||||
// at the end in x dir
|
||||
if ((offsetX + lastChannelX) >= xmax) {
|
||||
lastChannelX = xmax - offsetX;
|
||||
xmin = lastChannelX + offsetX + 1;
|
||||
if ((lastChannelX + offsetX) == xmax) {
|
||||
xmin = xmax + 1;
|
||||
}
|
||||
// at the end in y dir
|
||||
if ((offsetY + lastChannelY) >= ymax) {
|
||||
lastChannelY = ymax - offsetY;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "lastChannelX:" << lastChannelX << "\t"
|
||||
<< "lastChannelY:" << lastChannelY;
|
||||
|
||||
// creating the list of roi for corresponding detector
|
||||
index = nroi[idet];
|
||||
allroi[idet][index].xmin = channelX;
|
||||
allroi[idet][index].xmax = lastChannelX;
|
||||
allroi[idet][index].ymin = channelY;
|
||||
allroi[idet][index].ymax = lastChannelY;
|
||||
nroi[idet] = nroi[idet] + 1;
|
||||
|
||||
ymin = lastChannelY + offsetY + 1;
|
||||
if ((lastChannelY + offsetY) == ymax) {
|
||||
ymin = ymax + 1;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "nroi[idet]:" << nroi[idet] << "\tymin:" << ymin;
|
||||
}
|
||||
if (invalidroi) {
|
||||
break;
|
||||
}
|
||||
} else {// FIXME: check if xmax is greater? or reduce logic above?
|
||||
idet=0;
|
||||
nroi[idet]=n;
|
||||
index = 0;
|
||||
allroi[idet][index].xmin = xmin;
|
||||
allroi[idet][index].xmax = xmax;
|
||||
allroi[idet][index].ymin = ymin;
|
||||
allroi[idet][index].ymax = ymax;
|
||||
// nroi[idet] = nroi[idet] + 1;
|
||||
|
||||
xmin = lastChannelX + offsetX + 1;
|
||||
if ((lastChannelX + offsetX) == xmax) {
|
||||
xmin = xmax + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2753,7 +2753,11 @@ int slsDetector::setUDPConnection() {
|
||||
setReceiverOnline(OFFLINE_FLAG); //FIXME: Needed??
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ret=FAIL;
|
||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||
}
|
||||
|
||||
printReceiverConfiguration(logDEBUG1);
|
||||
return ret;
|
||||
}
|
||||
@@ -2926,6 +2930,8 @@ int slsDetector::setROI(int n, ROI roiLimits[]) {
|
||||
}
|
||||
|
||||
int ret = sendROI(n, roiLimits);
|
||||
if(ret==FAIL)
|
||||
setErrorMask((getErrorMask())|(COULDNOT_SET_ROI));
|
||||
if (thisDetector->myDetectorType == CHIPTESTBOARD) {
|
||||
getTotalNumberOfChannels();
|
||||
}
|
||||
@@ -2996,7 +3002,7 @@ int slsDetector::sendROI(int n, ROI roiLimits[]) {
|
||||
ret = updateDetector();
|
||||
}
|
||||
// old firmware requires configuremac after setting roi
|
||||
if (thisDetector->myDetectorType == GOTTHARD) {
|
||||
if (thisDetector->myDetectorType == GOTTHARD && n != -1) {
|
||||
ret = configureMAC();
|
||||
}
|
||||
|
||||
|
||||
@@ -3226,7 +3226,9 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int acti
|
||||
myDet->setReceiverOnline(ONLINE_FLAG, detPos);
|
||||
ret = myDet->setDynamicRange(val, detPos);
|
||||
} else if (cmd == "roi") {
|
||||
myDet->getROI(ret, detPos);
|
||||
ROI* r = myDet->getROI(ret, detPos);
|
||||
if (r != NULL)
|
||||
delete [] r;
|
||||
} else if (cmd == "detsizechan") {
|
||||
sprintf(ans, "%d %d", myDet->getMaxNumberOfChannelsPerDetector(X), myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
return std::string(ans);
|
||||
@@ -5341,7 +5343,8 @@ std::string slsDetectorCommand::cmdPattern(int narg, char *args[], int action, i
|
||||
}
|
||||
}
|
||||
os << std::hex << reg << std::dec ;
|
||||
|
||||
if (aa != NULL)
|
||||
delete [] aa;
|
||||
//os <<" "<< std::hex << myDet->readRegister(120, detPos) << std::dec ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "slsDetectorUsers.h"
|
||||
#include "detectorData.h"
|
||||
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include "multiSlsDetectorClient.h"
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ int slsDetectorUsers::dumpDetectorSetup(const std::string& fname){
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::getDetectorFirmwareVersion(int detPos){
|
||||
return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION);
|
||||
return detector.getId(slsDetectorDefs::DETECTOR_FIRMWARE_VERSION, detPos);
|
||||
}
|
||||
|
||||
int64_t slsDetectorUsers::getDetectorSerialNumber(int detPos){
|
||||
@@ -234,6 +234,13 @@ int slsDetectorUsers::setFlowControl10G(int i, int detPos) {
|
||||
return detector.setFlowControl10G(i, detPos);
|
||||
}
|
||||
|
||||
int slsDetectorUsers::setROI(int n, slsDetectorDefs::ROI roiLimits[], int detPos) {
|
||||
return myDetector->setROI(n, roiLimits, detPos);
|
||||
}
|
||||
|
||||
slsDetectorDefs::ROI* slsDetectorUsers::getROI(int &n, int detPos) {
|
||||
return myDetector->getROI(n, detPos);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
|
||||
|
||||
@@ -14,9 +14,8 @@
|
||||
|
||||
|
||||
class detectorData;
|
||||
class multiSlsDetector;
|
||||
|
||||
|
||||
#include "multiSlsDetector.h"
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
@@ -530,6 +529,24 @@ public:
|
||||
*/
|
||||
int setFlowControl10G(int enable = -1, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Set ROI (Gotthard) (>= 1 roi, but max 1 roi per module)
|
||||
* At the moment only one set allowed
|
||||
* @param n number of rois
|
||||
* @param roiLimits array of roi
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns OK or FAIL
|
||||
*/
|
||||
int setROI(int n=-1, slsDetectorDefs::ROI roiLimits[]=NULL, int detPos = -1);
|
||||
|
||||
/**
|
||||
* Get ROI from each detector and convert it to the multi detector scale (Gotthard)
|
||||
* >= 1 roi, but max 1 roi per module
|
||||
* @param n number of rois
|
||||
* @param detPos -1 for all detectors in list or specific detector position
|
||||
* @returns pointer to array of ROI structure
|
||||
*/
|
||||
slsDetectorDefs::ROI* getROI(int &n, int detPos = -1);
|
||||
|
||||
|
||||
|
||||
@@ -825,6 +842,7 @@ public:
|
||||
case 3: return std::string("finished"); \
|
||||
case 4: return std::string("data"); \
|
||||
case 5: return std::string("running"); \
|
||||
case 6: return std::string("stopped"); \
|
||||
default: return std::string("unknown"); \
|
||||
}};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user