From dd9387ef292bc52d5255595aa44e40d57cdb3daa Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 2 Dec 2016 08:53:08 +0100 Subject: [PATCH] using detid to calculte zmq port in case of shmget error and det id does not start with 0 and 1 as in receiver zmq server ports --- .../multiSlsDetector/multiSlsDetector.cpp | 15 +++++++++------ slsDetectorSoftware/slsDetector/slsDetector.cpp | 2 ++ slsDetectorSoftware/slsDetector/slsDetector.h | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp index 62513113d..c6cc741cf 100644 --- a/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp +++ b/slsDetectorSoftware/multiSlsDetector/multiSlsDetector.cpp @@ -5070,9 +5070,11 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){ //number of sockets int numSockets = thisMultiDetector->numberOfDetectors; - if(getDetectorsType() == EIGER) - numSockets *= 2; - + int numSocketsPerDetector = 1; + if(getDetectorsType() == EIGER){ + numSocketsPerDetector = 2; + } + numSockets *= numSocketsPerDetector; if(destroy){ cprintf(MAGENTA,"Going to destroy data sockets\n"); @@ -5099,7 +5101,7 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){ //get name of rx_hostname char rx_hostname[100]; strcpy(dataSocketServerDetails[i],"tcp://"); - strcpy(rx_hostname, detectors[i/numSockets]->getReceiver()); + strcpy(rx_hostname, detectors[i/numSocketsPerDetector]->getReceiver()); cout<<"rx_hostname:"<h_addr)); } //add port - sprintf(dataSocketServerDetails[i],"%s:%d",dataSocketServerDetails[i],DEFAULT_ZMQ_PORTNO + i); + sprintf(dataSocketServerDetails[i],"%s:%d",dataSocketServerDetails[i],DEFAULT_ZMQ_PORTNO + + (detectors[i/numSocketsPerDetector]->getDetectorId())*numSocketsPerDetector + (i%numSocketsPerDetector));//using this instead of i in the offchance, detid doesnt start at 0 (shmget error) //create context context[i] = zmq_ctx_new(); @@ -5272,7 +5275,7 @@ void multiSlsDetector::readFrameFromReceiver(){ ny = getTotalNumberOfChannels(slsDetectorDefs::Y); //calculating offsets (for eiger interleaving ports) int offsetX[numSockets]; int offsetY[numSockets]; - bool bottom[numSockets]; + int bottom[numSockets]; if(maxX){ for(int i=0; ioffsetY[i/numSocketsPerSLSDetector] + slsmaxY)) * maxX * bytesperchannel; diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 46cfe99bf..1983e54c7 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -754,6 +754,8 @@ int slsDetector::initializeDetectorSize(detectorType type) { thisDetector->tenGigaEnable=0; thisDetector->acquiringFlag = false; + thisDetector->flippedData[0] = 0; + thisDetector->flippedData[1] = 0; for (int ia=0; iaactionScript[ia],"none"); diff --git a/slsDetectorSoftware/slsDetector/slsDetector.h b/slsDetectorSoftware/slsDetector/slsDetector.h index 9c861e179..4f332907d 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.h +++ b/slsDetectorSoftware/slsDetector/slsDetector.h @@ -268,7 +268,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion { /** flag for acquiring */ bool acquiringFlag; /** flipped data across x or y axis */ - bool flippedData[2]; + int flippedData[2]; } sharedSlsDetector;