This commit is contained in:
maliakal_d 2019-08-16 17:07:30 +02:00
parent 336f8ceb50
commit 10ce82fc5f
10 changed files with 115 additions and 181 deletions

View File

@ -54,13 +54,13 @@ struct sharedMultiSlsDetector {
* -----------------------------------------------*/ * -----------------------------------------------*/
/** Number of detectors operated at once */ /** Number of detectors operated at once */
int numberOfDetector[2]; slsDetectorDefs::xy numberOfDetector;
/** total number of channels for all detectors */ /** total number of channels for all detectors */
int numberOfChannels[2]; slsDetectorDefs::xy numberOfChannels;
/** max number of channels for complete detector*/ /** max number of channels for complete detector*/
int maxNumberOfChannels[2]; slsDetectorDefs::xy maxNumberOfChannels;
/** flag for acquiring */ /** flag for acquiring */
bool acquiringFlag; bool acquiringFlag;
@ -1413,22 +1413,20 @@ class multiSlsDetector : public virtual slsDetectorDefs {
int setDeactivatedRxrPaddingMode(int padding = -1, int detPos = -1); int setDeactivatedRxrPaddingMode(int padding = -1, int detPos = -1);
/** /**
* Returns the enable if data will be flipped across x or y axis (Eiger) * Returns the enable if data will be flipped across x axis (Eiger)
* @param d axis across which data is flipped
* @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 for flipped, else 0 * @returns 1 for flipped, else 0
*/ */
int getFlippedData(dimension d = X, int detPos = -1); // int getFlippedDataX(int detPos = -1); //
/** /**
* Sets the enable which determines if * Sets the enable which determines if
* data will be flipped across x or y axis (Eiger) * data will be flipped across x axis (Eiger)
* @param d axis across which data is flipped
* @param value 0 or 1 to reset/set or -1 to get value * @param value 0 or 1 to reset/set or -1 to get value
* @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 enable flipped data across x or y axis * @returns enable flipped data across x or y axis
*/ */
int setFlippedData(dimension d = X, int value = -1, int detPos = -1); // int setFlippedDataX(int value = -1, int detPos = -1); //
/** /**
* Sets all the trimbits to a particular value (Eiger) * Sets all the trimbits to a particular value (Eiger)

View File

@ -13,7 +13,7 @@
class ServerInterface; class ServerInterface;
#define SLS_SHMAPIVERSION 0x190726 #define SLS_SHMAPIVERSION 0x190726
#define SLS_SHMVERSION 0x190815 #define SLS_SHMVERSION 0x190816
/** /**
* @short structure allocated in shared memory to store detector settings for * @short structure allocated in shared memory to store detector settings for
@ -36,7 +36,7 @@ struct sharedSlsDetector {
/** END OF FIXED PATTERN -----------------------------------------------*/ /** END OF FIXED PATTERN -----------------------------------------------*/
/** Number of detectors in multi list in x dir and y dir */ /** Number of detectors in multi list in x dir and y dir */
int multiSize[2]; slsDetectorDefs::xy multiSize;
/** is the port used for control functions */ /** is the port used for control functions */
int controlPort; int controlPort;
@ -50,17 +50,11 @@ struct sharedSlsDetector {
/** list of the energies at which the detector has been trimmed */ /** list of the energies at which the detector has been trimmed */
sls::FixedCapacityContainer<int, MAX_TRIMEN> trimEnergies; sls::FixedCapacityContainer<int, MAX_TRIMEN> trimEnergies;
/** number of channels per chip */
int nChans;
/** number of channels per chip in one direction */ /** number of channels per chip in one direction */
int nChan[2]; slsDetectorDefs::xy nChan;
/** number of chips per module*/
int nChips;
/** number of chips per module in one direction */ /** number of chips per module in one direction */
int nChip[2]; slsDetectorDefs::xy nChip;
/** number of dacs per module*/ /** number of dacs per module*/
int nDacs; int nDacs;
@ -142,7 +136,7 @@ struct sharedSlsDetector {
int tenGigaEnable; int tenGigaEnable;
/** flipped data across x or y axis */ /** flipped data across x or y axis */
int flippedData[2]; int flippedDataX;
/** tcp port from gui/different process to receiver (only data) */ /** tcp port from gui/different process to receiver (only data) */
int zmqport; int zmqport;
@ -166,7 +160,7 @@ struct sharedSlsDetector {
int gappixels; int gappixels;
/** gap pixels in each direction */ /** gap pixels in each direction */
int nGappixels[2]; slsDetectorDefs::xy nGappixels;
/** additional json header */ /** additional json header */
char rxAdditionalJsonHeader[MAX_STR_LENGTH]; char rxAdditionalJsonHeader[MAX_STR_LENGTH];
@ -356,10 +350,9 @@ class slsDetector : public virtual slsDetectorDefs {
/** /**
* Set Detector offset in shared memory in dimension d * Set Detector offset in shared memory in dimension d
* @param detx number of detectors in X dir in multi list * @param det detector size
* @param dety number of detectors in Y dir in multi list
*/ */
void updateMultiSize(int detx, int dety); void updateMultiSize(slsDetectorDefs::xy det);
int setControlPort(int port_number); int setControlPort(int port_number);
@ -1168,20 +1161,18 @@ class slsDetector : public virtual slsDetectorDefs {
bool setDeactivatedRxrPaddingMode(int padding = -1); bool setDeactivatedRxrPaddingMode(int padding = -1);
/** /**
* Returns the enable if data will be flipped across x or y axis (Eiger) * Returns the enable if data will be flipped across x axis (Eiger)
* @param d axis across which data is flipped
* @returns 1 for flipped, else 0 * @returns 1 for flipped, else 0
*/ */
int getFlippedData(dimension d = X) const; int getFlippedDataX() const;
/** /**
* Sets the enable which determines if * Sets the enable which determines if
* data will be flipped across x or y axis (Eiger) * data will be flipped across x axis (Eiger)
* @param d axis across which data is flipped
* @param value 0 or 1 to reset/set or -1 to get value * @param value 0 or 1 to reset/set or -1 to get value
* @returns enable flipped data across x or y axis * @returns enable flipped data across x axis
*/ */
int setFlippedData(dimension d = X, int value = -1); int setFlippedDataX(int value = -1);
/** /**
* Sets all the trimbits to a particular value (Eiger) * Sets all the trimbits to a particular value (Eiger)

View File

@ -1094,11 +1094,11 @@ void Detector::setActive(bool active, Positions pos) {
} }
Result<bool> Detector::getBottom(Positions pos) const { Result<bool> Detector::getBottom(Positions pos) const {
return pimpl->Parallel(&slsDetector::getFlippedData, pos, defs::X); return pimpl->Parallel(&slsDetector::getFlippedDataX, pos);
} }
void Detector::setBottom(bool value, Positions pos) { void Detector::setBottom(bool value, Positions pos) {
pimpl->Parallel(&slsDetector::setFlippedData, pos, defs::X, static_cast<int>(value)); pimpl->Parallel(&slsDetector::setFlippedDataX, pos, static_cast<int>(value));
} }
Result<int> Detector::getAllTrimbits(Positions pos) const { Result<int> Detector::getAllTrimbits(Positions pos) const {

View File

@ -276,12 +276,12 @@ void multiSlsDetector::initializeDetectorStructure() {
multi_shm()->shmversion = MULTI_SHMVERSION; multi_shm()->shmversion = MULTI_SHMVERSION;
multi_shm()->numberOfDetectors = 0; multi_shm()->numberOfDetectors = 0;
multi_shm()->multiDetectorType = GENERIC; multi_shm()->multiDetectorType = GENERIC;
multi_shm()->numberOfDetector[X] = 0; multi_shm()->numberOfDetector.x = 0;
multi_shm()->numberOfDetector[Y] = 0; multi_shm()->numberOfDetector.y = 0;
multi_shm()->numberOfChannels[X] = 0; multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels[Y] = 0; multi_shm()->numberOfChannels.y = 0;
multi_shm()->maxNumberOfChannels[X] = 0; multi_shm()->maxNumberOfChannels.x = 0;
multi_shm()->maxNumberOfChannels[Y] = 0; multi_shm()->maxNumberOfChannels.y = 0;
multi_shm()->acquiringFlag = false; multi_shm()->acquiringFlag = false;
multi_shm()->receiver_upstream = false; multi_shm()->receiver_upstream = false;
} }
@ -431,7 +431,7 @@ void multiSlsDetector::updateDetectorSize() {
const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels(); const slsDetectorDefs::xy det_size = detectors[0]->getNumberOfChannels();
int maxy = multi_shm()->maxNumberOfChannels[Y]; int maxy = multi_shm()->maxNumberOfChannels.y;
if (maxy == 0) { if (maxy == 0) {
maxy = det_size.y * size(); maxy = det_size.y * size();
} }
@ -442,29 +442,26 @@ void multiSlsDetector::updateDetectorSize() {
++ndetx; ++ndetx;
} }
multi_shm()->numberOfDetector[X] = ndetx; multi_shm()->numberOfDetector.x = ndetx;
multi_shm()->numberOfDetector[Y] = ndety; multi_shm()->numberOfDetector.y = ndety;
multi_shm()->numberOfChannels[X] = det_size.x * ndetx; multi_shm()->numberOfChannels.x = det_size.x * ndetx;
multi_shm()->numberOfChannels[Y] = det_size.y * ndety; multi_shm()->numberOfChannels.y = det_size.y * ndety;
FILE_LOG(logDEBUG) FILE_LOG(logDEBUG)
<< "\n\tNumber of Detectors in X direction:" << "\n\tNumber of Detectors in X direction:"
<< multi_shm()->numberOfDetector[X] << multi_shm()->numberOfDetector.x
<< "\n\tNumber of Detectors in Y direction:" << "\n\tNumber of Detectors in Y direction:"
<< multi_shm()->numberOfDetector[Y] << multi_shm()->numberOfDetector.y
<< "\n\tNumber of Channels in X direction:" << "\n\tNumber of Channels in X direction:"
<< multi_shm()->numberOfChannels[X] << multi_shm()->numberOfChannels.x
<< "\n\tNumber of Channels in Y direction:" << "\n\tNumber of Channels in Y direction:"
<< multi_shm()->numberOfChannels[Y]; << multi_shm()->numberOfChannels.y;
for (auto &d : detectors) { for (auto &d : detectors) {
d->updateMultiSize(multi_shm()->numberOfDetector[0], d->updateMultiSize(multi_shm()->numberOfDetector);
multi_shm()->numberOfDetector[1]);
} }
multi_shm()->maxNumberOfChannels = multi_shm()->numberOfChannels;
multi_shm()->maxNumberOfChannels[X] = multi_shm()->numberOfChannels[X];
multi_shm()->maxNumberOfChannels[Y] = multi_shm()->numberOfChannels[Y];
} }
slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const { slsDetectorDefs::detectorType multiSlsDetector::getDetectorTypeAsEnum() const {
@ -497,10 +494,7 @@ std::string multiSlsDetector::getDetectorTypeAsString(int detPos) {
size_t multiSlsDetector::size() const { return detectors.size(); } size_t multiSlsDetector::size() const { return detectors.size(); }
slsDetectorDefs::xy multiSlsDetector::getNumberOfDetectors() const { slsDetectorDefs::xy multiSlsDetector::getNumberOfDetectors() const {
slsDetectorDefs::xy res; return multi_shm()->numberOfDetector;
res.x = multi_shm()->numberOfDetector[X];
res.y = multi_shm()->numberOfDetector[Y];
return res;
} }
slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) { slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) {
@ -510,22 +504,15 @@ slsDetectorDefs::xy multiSlsDetector::getNumberOfChannels(int detPos) {
} }
// multi // multi
slsDetectorDefs::xy coord; return multi_shm()->numberOfChannels;
coord.x = multi_shm()->numberOfChannels[X];
coord.y = multi_shm()->numberOfChannels[Y];
return coord;
} }
slsDetectorDefs::xy multiSlsDetector::getMaxNumberOfChannels() const { slsDetectorDefs::xy multiSlsDetector::getMaxNumberOfChannels() const {
slsDetectorDefs::xy coord; return multi_shm()->maxNumberOfChannels;
coord.x = multi_shm()->maxNumberOfChannels[X];
coord.y = multi_shm()->maxNumberOfChannels[Y];
return coord;
} }
void multiSlsDetector::setMaxNumberOfChannels(const slsDetectorDefs::xy c) { void multiSlsDetector::setMaxNumberOfChannels(const slsDetectorDefs::xy c) {
multi_shm()->maxNumberOfChannels[X] = c.x; multi_shm()->maxNumberOfChannels = c;
multi_shm()->maxNumberOfChannels[Y] = c.y;
} }
int multiSlsDetector::getQuad(int detPos) { int multiSlsDetector::getQuad(int detPos) {
@ -2140,25 +2127,25 @@ int multiSlsDetector::setDeactivatedRxrPaddingMode(int padding, int detPos) {
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::getFlippedData(dimension d, int detPos) { int multiSlsDetector::getFlippedDataX(int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->getFlippedData(d); return detectors[detPos]->getFlippedDataX();
} }
// multi // multi
auto r = serialCall(&slsDetector::getFlippedData, d); auto r = serialCall(&slsDetector::getFlippedDataX);
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
int multiSlsDetector::setFlippedData(dimension d, int value, int detPos) { int multiSlsDetector::setFlippedDataX(int value, int detPos) {
// single // single
if (detPos >= 0) { if (detPos >= 0) {
return detectors[detPos]->setFlippedData(d, value); return detectors[detPos]->setFlippedDataX(value);
} }
// multi // multi
auto r = parallelCall(&slsDetector::setFlippedData, d, value); auto r = parallelCall(&slsDetector::setFlippedDataX, value);
return sls::minusOneIfDifferent(r); return sls::minusOneIfDifferent(r);
} }
@ -2198,11 +2185,11 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
if (val != -1) { if (val != -1) {
Parallel(&slsDetector::enableGapPixels, {}, val); Parallel(&slsDetector::enableGapPixels, {}, val);
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {}); Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels[X] = 0; multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels[Y] = 0; multi_shm()->numberOfChannels.y = 0;
for (auto &it : res) { for (auto &it : res) {
multi_shm()->numberOfChannels[X] += it.x; multi_shm()->numberOfChannels.x += it.x;
multi_shm()->numberOfChannels[Y] += it.y; multi_shm()->numberOfChannels.y += it.y;
} }
} }
return ret; return ret;
@ -2211,11 +2198,11 @@ int multiSlsDetector::enableGapPixels(int val, int detPos) {
void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){ void multiSlsDetector::setGapPixelsEnable(bool enable, Positions pos){
Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable)); Parallel(&slsDetector::enableGapPixels, pos, static_cast<int>(enable));
Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {}); Result<slsDetectorDefs::xy> res = Parallel(&slsDetector::getNumberOfChannels, {});
multi_shm()->numberOfChannels[X] = 0; multi_shm()->numberOfChannels.x = 0;
multi_shm()->numberOfChannels[Y] = 0; multi_shm()->numberOfChannels.y = 0;
for (auto &it : res) { for (auto &it : res) {
multi_shm()->numberOfChannels[X] += it.x; multi_shm()->numberOfChannels.x += it.x;
multi_shm()->numberOfChannels[Y] += it.y; multi_shm()->numberOfChannels.y += it.y;
} }
} }
@ -3046,14 +3033,14 @@ void multiSlsDetector::readFrameFromReceiver() {
int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, bool quadEnable) { int multiSlsDetector::processImageWithGapPixels(char *image, char *&gpImage, bool quadEnable) {
// eiger 4 bit mode // eiger 4 bit mode
int nxb = multi_shm()->numberOfDetector[X] * (512 + 3); //(divided by 2 already) int nxb = multi_shm()->numberOfDetector.x * (512 + 3); //(divided by 2 already)
int nyb = multi_shm()->numberOfDetector[Y] * (256 + 1); int nyb = multi_shm()->numberOfDetector.y * (256 + 1);
int nchipInRow = 4; int nchipInRow = 4;
int nxchip = multi_shm()->numberOfDetector[X] * 4; int nxchip = multi_shm()->numberOfDetector.x * 4;
int nychip = multi_shm()->numberOfDetector[Y] * 1; int nychip = multi_shm()->numberOfDetector.y * 1;
if (quadEnable) { if (quadEnable) {
nxb = multi_shm()->numberOfDetector[X] * (256 + 1); //(divided by 2 already) nxb = multi_shm()->numberOfDetector.x * (256 + 1); //(divided by 2 already)
nyb = multi_shm()->numberOfDetector[Y] * (512 + 2); nyb = multi_shm()->numberOfDetector.y * (512 + 2);
nxchip /= 2; nxchip /= 2;
nychip *= 2; nychip *= 2;
nchipInRow /= 2; nchipInRow /= 2;

View File

@ -308,8 +308,8 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->controlPort = DEFAULT_PORTNO; shm()->controlPort = DEFAULT_PORTNO;
sls::strcpy_safe(shm()->hostname, DEFAULT_HOSTNAME); sls::strcpy_safe(shm()->hostname, DEFAULT_HOSTNAME);
shm()->myDetectorType = type; shm()->myDetectorType = type;
shm()->multiSize[X] = 0; shm()->multiSize.x = 0;
shm()->multiSize[Y] = 0; shm()->multiSize.y = 0;
shm()->controlPort = DEFAULT_PORTNO; shm()->controlPort = DEFAULT_PORTNO;
shm()->stopPort = DEFAULT_PORTNO + 1; shm()->stopPort = DEFAULT_PORTNO + 1;
sls::strcpy_safe(shm()->settingsDir, getenv("HOME")); sls::strcpy_safe(shm()->settingsDir, getenv("HOME"));
@ -354,8 +354,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
shm()->selectedUDPInterface = 0; shm()->selectedUDPInterface = 0;
shm()->useReceiverFlag = false; shm()->useReceiverFlag = false;
shm()->tenGigaEnable = 0; shm()->tenGigaEnable = 0;
shm()->flippedData[X] = 0; shm()->flippedDataX = 0;
shm()->flippedData[Y] = 0;
shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO + shm()->zmqport = DEFAULT_ZMQ_CL_PORTNO +
(detId * ((shm()->myDetectorType == EIGER) ? 2 : 1)); (detId * ((shm()->myDetectorType == EIGER) ? 2 : 1));
shm()->rxZmqport = DEFAULT_ZMQ_RX_PORTNO + shm()->rxZmqport = DEFAULT_ZMQ_RX_PORTNO +
@ -401,20 +400,16 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
// get the detector parameters based on type // get the detector parameters based on type
detParameters parameters{type}; detParameters parameters{type};
shm()->nChan[X] = parameters.nChanX; shm()->nChan.x = parameters.nChanX;
shm()->nChan[Y] = parameters.nChanY; shm()->nChan.y = parameters.nChanY;
shm()->nChip[X] = parameters.nChipX; shm()->nChip.x = parameters.nChipX;
shm()->nChip[Y] = parameters.nChipY; shm()->nChip.y = parameters.nChipY;
shm()->nDacs = parameters.nDacs; shm()->nDacs = parameters.nDacs;
shm()->dynamicRange = parameters.dynamicRange; shm()->dynamicRange = parameters.dynamicRange;
shm()->nGappixels[X] = parameters.nGappixelsX; shm()->nGappixels.x = parameters.nGappixelsX;
shm()->nGappixels[Y] = parameters.nGappixelsY; shm()->nGappixels.y = parameters.nGappixelsY;
// derived parameters // update #nchan, as it depends on #samples, adcmask,
shm()->nChans = shm()->nChan[X] * shm()->nChan[Y];
shm()->nChips = shm()->nChip[X] * shm()->nChip[Y];
// update #nchans, as it depends on #samples, adcmask,
// readoutflags (ctb only) // readoutflags (ctb only)
updateNumberOfChannels(); updateNumberOfChannels();
} }
@ -491,8 +486,7 @@ int slsDetector::receiveModule(sls_detector_module *myMod,
if (shm()->myDetectorType == EIGER) { if (shm()->myDetectorType == EIGER) {
ts += client.Receive(myMod->chanregs, sizeof(int) * (myMod->nchan)); ts += client.Receive(myMod->chanregs, sizeof(int) * (myMod->nchan));
FILE_LOG(logDEBUG1) FILE_LOG(logDEBUG1)
<< "nchans= " << shm()->nChans << " nchips= " << shm()->nChips << " nchan= " << myMod->nchan << " nchip= " << myMod->nchip
<< "mod - nchans= " << myMod->nchan << " nchips= " << myMod->nchip
<< "received chans of size " << ts; << "received chans of size " << ts;
} }
FILE_LOG(logDEBUG1) << "received module of size " << ts << " register " FILE_LOG(logDEBUG1) << "received module of size " << ts << " register "
@ -593,15 +587,15 @@ void slsDetector::updateNumberOfChannels() {
ndchans = 64; ndchans = 64;
FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans; FILE_LOG(logDEBUG1) << "#Digital Channels:" << ndchans;
} }
shm()->nChans = nachans + ndchans; shm()->nChan.x = nachans + ndchans;
FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChans; FILE_LOG(logDEBUG1) << "# Total #Channels:" << shm()->nChan.x;
} }
} }
slsDetectorDefs::xy slsDetector::getNumberOfChannels() const { slsDetectorDefs::xy slsDetector::getNumberOfChannels() const {
slsDetectorDefs::xy coord; slsDetectorDefs::xy coord;
coord.x = (shm()->nChan[X] * shm()->nChip[X] + shm()->gappixels * shm()->nGappixels[X]); coord.x = (shm()->nChan.x * shm()->nChip.x + shm()->gappixels * shm()->nGappixels.x);
coord.y = (shm()->nChan[Y] * shm()->nChip[Y] + shm()->gappixels * shm()->nGappixels[Y]); coord.y = (shm()->nChan.y * shm()->nChip.y + shm()->gappixels * shm()->nGappixels.y);
return coord; return coord;
} }
@ -641,9 +635,8 @@ int slsDetector::getReadNLines() {
return retval; return retval;
} }
void slsDetector::updateMultiSize(int detx, int dety) { void slsDetector::updateMultiSize(slsDetectorDefs::xy det) {
shm()->multiSize[0] = detx; shm()->multiSize = det;
shm()->multiSize[1] = dety;
} }
@ -831,7 +824,7 @@ void slsDetector::updateCachedDetectorVariables() {
if (shm()->myDetectorType == MOENCH) if (shm()->myDetectorType == MOENCH)
setAdditionalJsonParameter("adcmask", std::to_string(u32)); setAdditionalJsonParameter("adcmask", std::to_string(u32));
// update #nchans, as it depends on #samples, adcmask, // update #nchan, as it depends on #samples, adcmask,
// readoutflags // readoutflags
updateNumberOfChannels(); updateNumberOfChannels();
} }
@ -1259,7 +1252,7 @@ void slsDetector::configureMAC() {
// 2d positions to detector to put into udp header // 2d positions to detector to put into udp header
{ {
int pos[2] = {0, 0}; int pos[2] = {0, 0};
int max = shm()->multiSize[Y] * (shm()->numUDPInterfaces); int max = shm()->multiSize.y * (shm()->numUDPInterfaces);
// row // row
pos[0] = (detId % max); pos[0] = (detId % max);
// col for horiz. udp ports // col for horiz. udp ports
@ -1340,7 +1333,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
sendToDetector(F_SET_TIMER, args, retval); sendToDetector(F_SET_TIMER, args, retval);
FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval; FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval;
shm()->timerValue[index] = retval; shm()->timerValue[index] = retval;
// update #nchans, as it depends on #samples, adcmask, // update #nchan, as it depends on #samples, adcmask,
// readoutflags // readoutflags
if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) { if (index == ANALOG_SAMPLES || index == DIGITAL_SAMPLES) {
updateNumberOfChannels(); updateNumberOfChannels();
@ -1492,7 +1485,7 @@ int slsDetector::setReadOutFlags(readOutFlags flag) {
sendToDetector(F_SET_READOUT_FLAGS, arg, retval); sendToDetector(F_SET_READOUT_FLAGS, arg, retval);
FILE_LOG(logDEBUG1) << "Readout flag: " << retval; FILE_LOG(logDEBUG1) << "Readout flag: " << retval;
shm()->roFlags = retval; shm()->roFlags = retval;
// update #nchans, as it depends on #samples, adcmask, // update #nchan, as it depends on #samples, adcmask,
// readoutflags // readoutflags
if (shm()->myDetectorType == CHIPTESTBOARD) { if (shm()->myDetectorType == CHIPTESTBOARD) {
updateNumberOfChannels(); updateNumberOfChannels();
@ -1677,7 +1670,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
<< "\nasamples:" << (shm()->timerValue[ANALOG_SAMPLES]) << "\nasamples:" << (shm()->timerValue[ANALOG_SAMPLES])
<< "\ndsamples:" << (shm()->timerValue[DIGITAL_SAMPLES]) << "\ndsamples:" << (shm()->timerValue[DIGITAL_SAMPLES])
<< "\ndynamic range:" << shm()->dynamicRange << "\ndynamic range:" << shm()->dynamicRange
<< "\nflippeddatax:" << (shm()->flippedData[X]) << "\nflippeddatax:" << (shm()->flippedDataX)
<< "\nactivated: " << shm()->activated << "\nactivated: " << shm()->activated
<< "\nreceiver deactivated padding: " << shm()->rxPadDeactivatedModules << "\nreceiver deactivated padding: " << shm()->rxPadDeactivatedModules
<< "\nsilent Mode:" << shm()->rxSilentMode << "\nsilent Mode:" << shm()->rxSilentMode
@ -1719,7 +1712,7 @@ std::string slsDetector::setReceiverHostname(const std::string &receiverIP) {
shm()->timerValue[SUBFRAME_ACQUISITION_TIME]); shm()->timerValue[SUBFRAME_ACQUISITION_TIME]);
setTimer(SUBFRAME_DEADTIME, shm()->timerValue[SUBFRAME_DEADTIME]); setTimer(SUBFRAME_DEADTIME, shm()->timerValue[SUBFRAME_DEADTIME]);
setDynamicRange(shm()->dynamicRange); setDynamicRange(shm()->dynamicRange);
setFlippedData(X, -1); setFlippedDataX(-1);
activate(-1); activate(-1);
setDeactivatedRxrPaddingMode( setDeactivatedRxrPaddingMode(
static_cast<int>(shm()->rxPadDeactivatedModules)); static_cast<int>(shm()->rxPadDeactivatedModules));
@ -2330,7 +2323,7 @@ void slsDetector::setADCEnableMask(uint32_t mask) {
sendToDetector(F_SET_ADC_ENABLE_MASK, &arg, sizeof(arg), nullptr, 0); sendToDetector(F_SET_ADC_ENABLE_MASK, &arg, sizeof(arg), nullptr, 0);
shm()->adcEnableMask = mask; shm()->adcEnableMask = mask;
// update #nchans, as it depends on #samples, adcmask, // update #nchan, as it depends on #samples, adcmask,
// readoutflags // readoutflags
updateNumberOfChannels(); updateNumberOfChannels();
@ -2477,29 +2470,24 @@ bool slsDetector::setDeactivatedRxrPaddingMode(int padding) {
return shm()->rxPadDeactivatedModules; return shm()->rxPadDeactivatedModules;
} }
int slsDetector::getFlippedData(dimension d) const { int slsDetector::getFlippedDataX() const {
return shm()->flippedData[d]; return shm()->flippedDataX;
} }
int slsDetector::setFlippedData(dimension d, int value) { int slsDetector::setFlippedDataX(int value) {
if (d == Y) {
throw RuntimeError("Flipped across Y axis is not implemented");
}
// replace get with shm value (write to shm right away as it is a det value, // replace get with shm value (write to shm right away as it is a det value,
// not rx value) // not rx value)
if (value > -1) { if (value > -1) {
shm()->flippedData[d] = (value > 0) ? 1 : 0; shm()->flippedDataX = (value > 0) ? 1 : 0;
} }
int args[]{static_cast<int>(d), value};
int retval = -1; int retval = -1;
args[1] = shm()->flippedData[d]; int arg = shm()->flippedDataX;
FILE_LOG(logDEBUG1) << "Setting flipped data across axis " << d FILE_LOG(logDEBUG1) << "Setting flipped data across x axis with value: " << arg;
<< " with value: " << value;
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, args, retval); sendToReceiver(F_SET_FLIPPED_DATA_RECEIVER, arg, retval);
FILE_LOG(logDEBUG1) << "Flipped data:" << retval; FILE_LOG(logDEBUG1) << "Flipped data:" << retval;
} }
return shm()->flippedData[d]; return shm()->flippedDataX;
} }
int slsDetector::setAllTrimbits(int val) { int slsDetector::setAllTrimbits(int val) {
@ -2978,10 +2966,10 @@ void slsDetector::updateCachedReceiverVariables() const {
} }
void slsDetector::sendMultiDetectorSize() { void slsDetector::sendMultiDetectorSize() {
int args[]{shm()->multiSize[0], shm()->multiSize[1]}; int args[]{shm()->multiSize.x, shm()->multiSize.y};
int retval = -1; int retval = -1;
FILE_LOG(logDEBUG1) << "Sending multi detector size to receiver: (" FILE_LOG(logDEBUG1) << "Sending multi detector size to receiver: ("
<< shm()->multiSize[0] << "," << shm()->multiSize[1] << shm()->multiSize.x << "," << shm()->multiSize.y
<< ")"; << ")";
if (shm()->useReceiverFlag) { if (shm()->useReceiverFlag) {
sendToReceiver(F_SEND_RECEIVER_MULTIDETSIZE, args, retval); sendToReceiver(F_SEND_RECEIVER_MULTIDETSIZE, args, retval);

View File

@ -122,13 +122,6 @@ slsDetectorCommand::slsDetectorCommand(multiSlsDetector *det) {
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer; descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdExitServer;
++i; ++i;
/*! \page test
- <b>flippeddatay [i]</b> enables/disables data being flipped across y axis. 1 enables, 0 disables. Not implemented.
*/
descrToFuncMap[i].m_pFuncName = "flippeddatay";
descrToFuncMap[i].m_pFuncPtr = &slsDetectorCommand::cmdDetectorSize;
++i;
/* digital test and debugging */ /* digital test and debugging */
/*! \page test /*! \page test
@ -3304,15 +3297,7 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1)) if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1))
return std::string("cannot scan flippeddata x mode: must be 0 or 1"); return std::string("cannot scan flippeddata x mode: must be 0 or 1");
myDet->setFlippedData(X, val, detPos); myDet->setFlippedDataX(val, detPos);
}
if (cmd == "flippeddatay") {
return std::string("Not required for this detector\n");
if ((!sscanf(args[1], "%d", &val)) || (val != 0 && val != 1))
return std::string("cannot scan flippeddata y mode: must be 0 or 1");
myDet->setFlippedData(Y, val, detPos);
} }
if (cmd == "gappixels") { if (cmd == "gappixels") {
@ -3341,10 +3326,7 @@ std::string slsDetectorCommand::cmdDetectorSize(int narg, const char * const arg
} else if (cmd=="quad") { } else if (cmd=="quad") {
return std::to_string(myDet->getQuad()); return std::to_string(myDet->getQuad());
} else if (cmd == "flippeddatax") { } else if (cmd == "flippeddatax") {
ret = myDet->getFlippedData(X, detPos); ret = myDet->getFlippedDataX(detPos);
} else if (cmd == "flippeddatay") {
return std::string("Not required for this detector\n");
ret = myDet->getFlippedData(Y, detPos);
} else if (cmd == "gappixels") { } else if (cmd == "gappixels") {
if (detPos >= 0) // only in multi detector level to update number of channels etc. if (detPos >= 0) // only in multi detector level to update number of channels etc.
return std::string("Cannot execute this command from slsDetector level. Please use multiSlsDetector level.\n"); return std::string("Cannot execute this command from slsDetector level. Please use multiSlsDetector level.\n");
@ -3370,7 +3352,6 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; 0 is no limit" << std::endl; os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; 0 is no limit" << std::endl;
os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl; os << "quad i \n if i = 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax x \n sets if the data should be flipped on the x axis" << std::endl; os << "flippeddatax x \n sets if the data should be flipped on the x axis" << std::endl;
os << "flippeddatay y \n sets if the data should be flipped on the y axis" << std::endl;
os << "gappixels i \n enables/disables gap pixels in system (detector & receiver). 1 sets, 0 unsets. Used in EIGER only and multidetector level." << std::endl; os << "gappixels i \n enables/disables gap pixels in system (detector & receiver). 1 sets, 0 unsets. Used in EIGER only and multidetector level." << std::endl;
} }
if (action == GET_ACTION || action == HELP_ACTION) { if (action == GET_ACTION || action == HELP_ACTION) {
@ -3379,7 +3360,6 @@ std::string slsDetectorCommand::helpDetectorSize(int action) {
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; 0 is no limit" << std::endl; os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; 0 is no limit" << std::endl;
os << "quad \n returns 1 if the detector size is a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl; os << "quad \n returns 1 if the detector size is a quad (Specific to an EIGER quad hardware). 0 by default."<< std::endl;
os << "flippeddatax\n gets if the data will be flipped on the x axis" << std::endl; os << "flippeddatax\n gets if the data will be flipped on the x axis" << std::endl;
os << "flippeddatay\n gets if the data will be flipped on the y axis" << std::endl;
os << "gappixels\n gets if gap pixels is enabled in system. Used in EIGER only and multidetector level." << std::endl; os << "gappixels\n gets if gap pixels is enabled in system. Used in EIGER only and multidetector level." << std::endl;
} }
return os.str(); return os.str();

View File

@ -63,10 +63,10 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
std::string getDetectorHostname() const; std::string getDetectorHostname() const;
/* /*
* Get flipped data across 'axis' * Get flipped data across x axis
* @return if data is flipped across 'axis' * @return if data is flipped across x axis
*/ */
int getFlippedData(int axis = 0) const; int getFlippedDataX() const;
/** /**
* Get Gap Pixels Enable (eiger specific) * Get Gap Pixels Enable (eiger specific)
@ -390,10 +390,10 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
void setMultiDetectorSize(const int *size); void setMultiDetectorSize(const int *size);
/* /*
* Get flipped data across 'axis' * Get flipped data across x axis
* @return if data is flipped across 'axis' * @return if data is flipped across x axis
*/ */
void setFlippedData(int axis = 0, int enable = -1); void setFlippedDataX(int enable = -1);
/** /**
* Set Gap Pixels Enable (eiger specific) * Set Gap Pixels Enable (eiger specific)

View File

@ -148,16 +148,9 @@ std::string slsReceiverImplementation::getDetectorHostname() const {
return std::string(detHostname); return std::string(detHostname);
} }
int slsReceiverImplementation::getFlippedData(int axis) const { int slsReceiverImplementation::getFlippedDataX() const {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
switch(axis) {
case 0:
return flippedDataX; return flippedDataX;
case 1:
return 0;
default:
return -1;
}
} }
bool slsReceiverImplementation::getGapPixelsEnable() const { bool slsReceiverImplementation::getGapPixelsEnable() const {
@ -482,10 +475,8 @@ void slsReceiverImplementation::setMultiDetectorSize(const int *size) {
FILE_LOG(logINFO) << log_message; FILE_LOG(logINFO) << log_message;
} }
void slsReceiverImplementation::setFlippedData(int axis, int enable) { void slsReceiverImplementation::setFlippedDataX(int enable) {
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
if (axis != 0)
return;
flippedDataX = (enable == 0) ? 0 : 1; flippedDataX = (enable == 0) ? 0 : 1;
if (!quadEnable) { if (!quadEnable) {

View File

@ -976,19 +976,18 @@ int slsReceiverTCPIPInterface::set_streaming_timer(Interface &socket) {
int slsReceiverTCPIPInterface::set_flipped_data(Interface &socket) { int slsReceiverTCPIPInterface::set_flipped_data(Interface &socket) {
// TODO! Why 2 args? // TODO! Why 2 args?
memset(mess, 0, sizeof(mess)); memset(mess, 0, sizeof(mess));
int args[2]{0, -1}; auto arg = socket.Receive<int>();
socket.Receive(args);
if (myDetectorType != EIGER) if (myDetectorType != EIGER)
functionNotImplemented(); functionNotImplemented();
if (args[1] >= 0) { if (arg >= 0) {
VerifyIdle(socket); VerifyIdle(socket);
FILE_LOG(logDEBUG1) << "Setting flipped data:" << args[1]; FILE_LOG(logDEBUG1) << "Setting flipped data:" << arg;
impl()->setFlippedData(args[0], args[1]); impl()->setFlippedDataX(arg);
} }
int retval = impl()->getFlippedData(args[0]); int retval = impl()->getFlippedDataX();
validate(args[1], retval, std::string("set flipped data"), DEC); validate(arg, retval, std::string("set flipped data"), DEC);
FILE_LOG(logDEBUG1) << "Flipped Data:" << retval; FILE_LOG(logDEBUG1) << "Flipped Data:" << retval;
return socket.sendResult(retval); return socket.sendResult(retval);
} }

View File

@ -7,4 +7,4 @@
#define APIGUI 0x190723 #define APIGUI 0x190723
#define APIJUNGFRAU 0x190730 #define APIJUNGFRAU 0x190730
#define APIGOTTHARD 0x190813 #define APIGOTTHARD 0x190813
#define APIEIGER 0x190814 #define APIEIGER 0x190816