quad implemented

This commit is contained in:
maliakal_d 2019-07-10 17:39:43 +02:00
parent 3e2b471ee1
commit 1189b991e5
32 changed files with 558 additions and 76 deletions

View File

@ -17,6 +17,7 @@ This document describes the differences between 4.0.3 and 4.0.2 releases.
1. Topics Concerning 1. Topics Concerning
==================== ====================
- software for eiger quad hardware integrated
- command line framesl, cyclesl was printing in float - command line framesl, cyclesl was printing in float
@ -27,12 +28,23 @@ This document describes the differences between 4.0.3 and 4.0.2 releases.
Client Client
------ ------
1. Command line commands framesl, cyclesl, fatesl, problesl and nframes was 1. Command line quad integrates Eiger quad hardware
2. Command line commands framesl, cyclesl, fatesl, problesl and nframes was
printing the result in decimals. It is now fixed to print as whole numbers. printing the result in decimals. It is now fixed to print as whole numbers.
Detector Server Detector Server (Eiger)
--------------- -----------------------
1. Command line quad integrates Eiger quad hardware
Receiver
--------
1. Command line quad integrates Eiger quad hardware
3. Known Issues 3. Known Issues

View File

@ -1 +0,0 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.1.22.1

View File

@ -0,0 +1 @@
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.3.23.0

View File

@ -121,12 +121,21 @@ void qDrawPlot::SetupWidgetWindow(){
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X); nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y); nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
if (detType == slsDetectorDefs::JUNGFRAUCTB) { switch(detType) {
case slsDetectorDefs::JUNGFRAUCTB:
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03 npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
nPixelsX = npixelsx_jctb; nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb; nPixelsY = npixelsy_jctb;
break;
case slsDetectorDefs::EIGER:
if (myDet->setQuad()) {
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2;
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y) * 2;
}
break;
default:
break;
} }
cout<<"nPixelsX:"<<nPixelsX<<endl; cout<<"nPixelsX:"<<nPixelsX<<endl;
cout<<"nPixelsY:"<<nPixelsY<<endl; cout<<"nPixelsY:"<<nPixelsY<<endl;
@ -583,13 +592,26 @@ void qDrawPlot::SetScanArgument(int scanArg){
maxPixelsY = 0; maxPixelsY = 0;
minPixelsY = 0; minPixelsY = 0;
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X); nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y); nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
if (detType == slsDetectorDefs::JUNGFRAUCTB) { switch(detType) {
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25; // for moench 03 case slsDetectorDefs::JUNGFRAUCTB:
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
nPixelsX = npixelsx_jctb; nPixelsX = npixelsx_jctb;
nPixelsY = npixelsy_jctb; nPixelsY = npixelsy_jctb;
break;
case slsDetectorDefs::EIGER:
if (myDet->setQuad()) {
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X) / 2;
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y) * 2;
} }
break;
default:
break;
}
cout<<"nPixelsX:"<<nPixelsX<<endl;
cout<<"nPixelsY:"<<nPixelsY<<endl;
//cannot do this in between measurements , so update instantly //cannot do this in between measurements , so update instantly
if(scanArgument==qDefs::Level0){ if(scanArgument==qDefs::Level0){
@ -1215,7 +1237,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
}else }else
gainPlotEnable = false; gainPlotEnable = false;
//recalculating pedestal //recalculating pedestal
if(startPedestalCal){ if(startPedestalCal){
//start adding frames to get to the pedestal value //start adding frames to get to the pedestal value

View File

@ -52,6 +52,7 @@
#define CLEANUP_ACQUISITION 0x0000080000000000ULL #define CLEANUP_ACQUISITION 0x0000080000000000ULL
#define REGISER_WRITE_READ 0x0000040000000000ULL #define REGISER_WRITE_READ 0x0000040000000000ULL
#define VERSION_COMPATIBILITY 0x0000020000000000ULL #define VERSION_COMPATIBILITY 0x0000020000000000ULL
#define SOME_ERROR 0x0000010000000000ULL
// 0xFFFFFF0000000000ULL // 0xFFFFFF0000000000ULL
// 0x000000FFFFFFFFFFULL // 0x000000FFFFFFFFFFULL
@ -174,6 +175,10 @@ public:
if(slsErrorMask&VERSION_COMPATIBILITY) if(slsErrorMask&VERSION_COMPATIBILITY)
retval.append("Incompatible versions with detector or receiver. Please check log for more details.\n"); retval.append("Incompatible versions with detector or receiver. Please check log for more details.\n");
if(slsErrorMask&SOME_ERROR)
retval.append("Some error has occurred. Please check log for more details.\n");
if(slsErrorMask&COULD_NOT_CONFIGURE_MAC) if(slsErrorMask&COULD_NOT_CONFIGURE_MAC)

View File

@ -123,6 +123,7 @@ enum detFuncs{
F_CHECK_VERSION, /** < check version compatibility */ F_CHECK_VERSION, /** < check version compatibility */
F_SOFTWARE_TRIGGER, /** < software trigger */ F_SOFTWARE_TRIGGER, /** < software trigger */
F_QUAD,
/* Always append functions hereafter!!! */ /* Always append functions hereafter!!! */
/* Always append functions before!!! */ /* Always append functions before!!! */

View File

@ -50,6 +50,8 @@
uint32_t Beb_detid = 0; uint32_t Beb_detid = 0;
int Beb_top =0; int Beb_top =0;
int Beb_quadEnable = 0;
int Beb_positions[3] = {0, 0, 0};
@ -1210,16 +1212,34 @@ void Beb_SetDetectorNumber(uint32_t detid) {
printf("detector id %d has been set in udp header\n", detid); printf("detector id %d has been set in udp header\n", detid);
} }
int Beb_SetQuad(int val) {
if (val >= 0) {
Beb_quadEnable = (val == 0 ? 0 : 1);
Beb_SetDetectorPosition(Beb_positions);
}
return Beb_quadEnable;
}
int Beb_SetDetectorPosition(int pos[]) { int Beb_SetDetectorPosition(int pos[]) {
if(!Beb_activated) if(!Beb_activated)
return OK; return OK;
cprintf(BLUE,"Got Position values %d %d %d...\n", pos[0],pos[1], pos[2]);
pos[0] = Beb_swap_uint16(pos[0]); cprintf(BLUE,"Got Position values [%d %d %d]\n", pos[0], pos[1], pos[2]);
//pos[1] = Beb_swap_uint16(pos[1]);
pos[2] = Beb_swap_uint16(pos[2]);
// save positions
Beb_positions[0] = pos[0];
Beb_positions[1] = pos[1];
Beb_positions[2] = pos[2];
// get left and right
int posLeft[3] = {pos[0], pos[1], pos[2]};
int posRight[3] = {pos[0], pos[1] + 1, pos[2]};
if (Beb_quadEnable) {
posRight[0] = 1; // right is next row
posRight[1] = 0; // right same first column
}
int ret = FAIL; int ret = FAIL;
//mapping new memory to read master top module configuration //mapping new memory to read master top module configuration
@ -1233,26 +1253,28 @@ int Beb_SetDetectorPosition(int pos[]) {
uint32_t value = 0; uint32_t value = 0;
ret = OK; ret = OK;
// x left // x left
int posval = Beb_swap_uint16(posLeft[0]);
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
value &= UDP_HEADER_ID_MSK; // to keep previous id value value &= UDP_HEADER_ID_MSK; // to keep previous id value
Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)); Beb_Write32(csp0base, UDP_HEADER_A_LEFT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
if((value & UDP_HEADER_X_MSK) != ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)) if((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
ret = FAIL; ret = FAIL;
// x right // x right
posval = Beb_swap_uint16(posRight[0]);
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
value &= UDP_HEADER_ID_MSK; // to keep previous id value value &= UDP_HEADER_ID_MSK; // to keep previous id value
Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)); Beb_Write32(csp0base, UDP_HEADER_A_RIGHT_OFST, value | ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
if((value & UDP_HEADER_X_MSK) != ((pos[0] << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK)) if((value & UDP_HEADER_X_MSK) != ((posval << UDP_HEADER_X_OFST) & UDP_HEADER_X_MSK))
ret = FAIL; ret = FAIL;
// y left (column) // y left (column)
// overwriting z anyway, so no need to look at previous z value // overwriting z anyway, so no need to look at previous z value
int posval = Beb_swap_uint16(Beb_top ? pos[1] : (pos[1]+1)); posval = Beb_swap_uint16(posLeft[1]);
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)); Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
@ -1260,7 +1282,7 @@ int Beb_SetDetectorPosition(int pos[]) {
// y right // y right
// overwriting z anyway, so no need to look at previous z value // overwriting z anyway, so no need to look at previous z value
posval = Beb_swap_uint16(Beb_top ? (pos[1]+1) : pos[1]); posval = Beb_swap_uint16(posRight[1]);
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)); Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK)) if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
@ -1269,19 +1291,21 @@ int Beb_SetDetectorPosition(int pos[]) {
// z left // z left
posval = Beb_swap_uint16(posLeft[2]);
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
value &= UDP_HEADER_Y_MSK; // to keep previous y value value &= UDP_HEADER_Y_MSK; // to keep previous y value
Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, value | ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK)); Beb_Write32(csp0base, UDP_HEADER_B_LEFT_OFST, value | ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
if((value & UDP_HEADER_Z_MSK) != ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK)) if((value & UDP_HEADER_Z_MSK) != ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK))
ret = FAIL; ret = FAIL;
// z right // z right
posval = Beb_swap_uint16(posRight[2]);
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
value &= UDP_HEADER_Y_MSK; // to keep previous y value value &= UDP_HEADER_Y_MSK; // to keep previous y value
Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, value | ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK)); Beb_Write32(csp0base, UDP_HEADER_B_RIGHT_OFST, value | ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK));
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST); value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
if((value & UDP_HEADER_Z_MSK) != ((pos[2] << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK)) if((value & UDP_HEADER_Z_MSK) != ((posval << UDP_HEADER_Z_OFST) & UDP_HEADER_Z_MSK))
ret = FAIL; ret = FAIL;
@ -1292,8 +1316,7 @@ int Beb_SetDetectorPosition(int pos[]) {
cprintf(BLUE, "Position set to...\n" cprintf(BLUE, "Position set to...\n"
"Left: [%d, %d, %d]\n" "Left: [%d, %d, %d]\n"
"Right:[%d, %d, %d]\n", "Right:[%d, %d, %d]\n",
Beb_swap_uint16(pos[0]), Beb_top ? pos[1] : (pos[1]+1), Beb_swap_uint16(pos[2]), posLeft[0], posLeft[1], posLeft[2], posRight[0], posRight[1], posRight[2]);
Beb_swap_uint16(pos[0]), Beb_top ? (pos[1]+1) : pos[1], Beb_swap_uint16(pos[2]));
} }
return ret; return ret;

View File

@ -91,6 +91,7 @@ struct BebInfo{
int Beb_GetBebFPGATemp(); int Beb_GetBebFPGATemp();
void Beb_SetDetectorNumber(uint32_t detid); void Beb_SetDetectorNumber(uint32_t detid);
int Beb_SetQuad(int val);
int Beb_SetDetectorPosition(int pos[]); int Beb_SetDetectorPosition(int pos[]);
uint16_t Beb_swap_uint16( uint16_t val); uint16_t Beb_swap_uint16( uint16_t val);

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
Repsitory UUID: ef3e01b9bdf3a6a08367e2448bcc92bd13cf73ad Repsitory UUID: 3e2b471ee1e6bbbd0fbce6292c30e4403a4f4b2f
Revision: 351 Revision: 352
Branch: 4.0.1-rc Branch: quad
Last Changed Author: Dhanya_Thattil Last Changed Author: Dhanya_Thattil
Last Changed Rev: 4068 Last Changed Rev: 4117
Last Changed Date: 2019-02-06 14:44:47.000000002 +0100 ./xparameters.h Last Changed Date: 2019-07-10 17:22:28.000000002 +0200 ./Beb.c

View File

@ -1,6 +1,6 @@
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
#define GITREPUUID "ef3e01b9bdf3a6a08367e2448bcc92bd13cf73ad" #define GITREPUUID "3e2b471ee1e6bbbd0fbce6292c30e4403a4f4b2f"
#define GITAUTH "Dhanya_Thattil" #define GITAUTH "Dhanya_Thattil"
#define GITREV 0x4068 #define GITREV 0x4117
#define GITDATE 0x20190206 #define GITDATE 0x20190710
#define GITBRANCH "4.0.1-rc" #define GITBRANCH "quad"

View File

@ -1219,6 +1219,10 @@ int setDetectorPosition(int pos[]) {
} }
int setQuad(int val) {
return Beb_SetQuad(val);
}

View File

@ -4983,17 +4983,12 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
} }
void multiSlsDetector::readFrameFromReceiver() { void multiSlsDetector::readFrameFromReceiver() {
int nX = 0;
int nX = thisMultiDetector->numberOfDetector[X]; // to copy data in multi module int nY = 0;
int nY = thisMultiDetector->numberOfDetector[Y]; // for eiger, to reverse the data int nDetPixelsX = 0;
int nDetPixelsY = 0;
bool gappixelsenable = false; bool gappixelsenable = false;
bool eiger = false; bool eiger = false;
if (getDetectorsType() == EIGER) {
eiger = true;
nX *= 2;
gappixelsenable = detectors[0]->enableGapPixels(-1) >= 1 ? true : false;
}
bool runningList[zmqSocket.size()], connectList[zmqSocket.size()]; bool runningList[zmqSocket.size()], connectList[zmqSocket.size()];
int numRunning = 0; int numRunning = 0;
for (unsigned int i = 0; i < zmqSocket.size(); ++i) { for (unsigned int i = 0; i < zmqSocket.size(); ++i) {
@ -5068,6 +5063,15 @@ void multiSlsDetector::readFrameFromReceiver() {
// shape // shape
nPixelsX = doc["shape"][0].GetUint(); nPixelsX = doc["shape"][0].GetUint();
nPixelsY = doc["shape"][1].GetUint(); nPixelsY = doc["shape"][1].GetUint();
// detector shape
nX = doc["detshape"][0].GetUint();
nY = doc["detshape"][1].GetUint();
nDetPixelsX = nX * nPixelsX;
nDetPixelsY = nY * nPixelsY;
// det type
eiger = (doc["detType"].GetUint() == (int)EIGER) ? true : false;
// gap pixels enable
gappixelsenable = (doc["gappixels"].GetUint() == 0) ? false : true;
#ifdef VERBOSE #ifdef VERBOSE
cprintf(BLUE, "(Debug) One Time Header Info:\n" cprintf(BLUE, "(Debug) One Time Header Info:\n"
@ -5076,9 +5080,13 @@ void multiSlsDetector::readFrameFromReceiver() {
"dynamicRange: %u\n" "dynamicRange: %u\n"
"bytesPerPixel: %f\n" "bytesPerPixel: %f\n"
"nPixelsX: %u\n" "nPixelsX: %u\n"
"nPixelsY: %u\n", "nPixelsY: %u\n"
"nX: %u\n"
"nY: %u\n"
"eiger: %d\n"
"gappixelsenable: %d\n",
size, multisize, dynamicRange, bytesPerPixel, size, multisize, dynamicRange, bytesPerPixel,
nPixelsX, nPixelsY); nPixelsX, nPixelsY, nX, nY, eiger, gappixelsenable);
#endif #endif
} }
// each time, parse rest of header // each time, parse rest of header
@ -5149,20 +5157,17 @@ void multiSlsDetector::readFrameFromReceiver() {
//send data to callback //send data to callback
if (data) { if (data) {
int nCompletePixelsX = thisMultiDetector->numberOfChannelInclGapPixels[X];
int nCompletePixelsY = thisMultiDetector->numberOfChannelInclGapPixels[Y];
// 4bit gap pixels // 4bit gap pixels
if (dynamicRange == 4 && gappixelsenable) { if (dynamicRange == 4 && gappixelsenable) {
int n = processImageWithGapPixels(multiframe, multigappixels); int n = processImageWithGapPixels(multiframe, multigappixels);
thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(), thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(),
currentFileName.c_str(), nCompletePixelsX, nCompletePixelsY, currentFileName.c_str(), nDetPixelsX, nDetPixelsY,
multigappixels, n, dynamicRange, currentFileIndex); multigappixels, n, dynamicRange, currentFileIndex);
} }
// normal pixels // normal pixels
else { else {
thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(), thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(),
currentFileName.c_str(), nCompletePixelsX, nCompletePixelsY, currentFileName.c_str(), nDetPixelsX, nDetPixelsY,
multiframe, multisize, dynamicRange, currentFileIndex); multiframe, multisize, dynamicRange, currentFileIndex);
} }
dataReady(thisData, currentFrameIndex, dataReady(thisData, currentFrameIndex,
@ -5429,3 +5434,9 @@ int multiSlsDetector::setCTBPatWaitAddr(int level, int addr) {
int multiSlsDetector::setCTBPatWaitTime(int level, uint64_t t) { int multiSlsDetector::setCTBPatWaitTime(int level, uint64_t t) {
return callDetectorMember(&slsDetector::setCTBPatWaitTime, level, t); return callDetectorMember(&slsDetector::setCTBPatWaitTime, level, t);
} }
int multiSlsDetector::setQuad(int val) {
if (getNumberOfDetectors() > 1)
val = 0;
return callDetectorMember(&slsDetector::setQuad, val);
}

View File

@ -1869,6 +1869,13 @@ public:
*/ */
int setCTBPatWaitTime(int level, uint64_t t=-1); int setCTBPatWaitTime(int level, uint64_t t=-1);
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
int setQuad(int val = -1);
private: private:
/** /**

View File

@ -9756,5 +9756,50 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) {
} }
int slsDetector::setQuad(int val) {
int fnum = F_QUAD, fnum2 = F_RECEIVER_QUAD;
int ret = FAIL;
int retval = -1;
// set row column header in detector
if (val >= 0) {
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&val,sizeof(val));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
char mess[MAX_STR_LENGTH] = {};
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
setErrorMask((getErrorMask())|(SOME_ERROR));
}
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
disconnectControl();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
} else
ret = OK;
// set quad type to receiver (flipped data and detector shape, numdet)
if (ret != FAIL) {
ret = FAIL;
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
#ifdef VERBOSE
if(val ==-1)
std::cout<< "Getting Receiver Quad mode" << endl;
else
std::cout<< "Setting Receiver Quad Mode to " << val << endl;
#endif
if (connectData() == OK){
ret=thisReceiver->sendInt(fnum2,retval,val);
disconnectData();
}
if(ret==FAIL)
setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET));
}
}
return retval;
}

View File

@ -2274,6 +2274,13 @@ public:
*/ */
int setCTBPatWaitTime(int level, uint64_t t=-1); int setCTBPatWaitTime(int level, uint64_t t=-1);
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
int setQuad(int val = -1);
private: private:
/** /**

View File

@ -378,6 +378,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i; ++i;
/*! \page config
- <b>quad [i] </b> if 1, sets the detector size to a quad (Specific to an EIGER quad hardware). 0 by default. \c Returns \c (int)
*/
descrToFuncMap[i].m_pFuncName="quad"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
++i;
/*! \page config /*! \page config
- <b>roimask [i]</b> ?? \c Returns \c (int) in hexadecimal - <b>roimask [i]</b> ?? \c Returns \c (int) in hexadecimal
*/ */
@ -4458,7 +4465,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setOnline(ONLINE_FLAG); myDet->setOnline(ONLINE_FLAG);
if (cmd == "roi") if (cmd == "roi" || cmd == "quad")
myDet->setReceiverOnline(ONLINE_FLAG); myDet->setReceiverOnline(ONLINE_FLAG);
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
@ -4494,6 +4501,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
myDet->setMaxNumberOfChannelsPerDetector(Y,val); myDet->setMaxNumberOfChannelsPerDetector(Y,val);
} }
if(cmd=="quad"){
if (val >=0 ) {
sprintf(ans, "%d", myDet->setQuad(val));
return string(ans);
}
}
if(cmd=="flippeddatax"){ if(cmd=="flippeddatax"){
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1)) if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
return string ("cannot scan flippeddata x mode: must be 0 or 1"); return string ("cannot scan flippeddata x mode: must be 0 or 1");
@ -4534,6 +4548,12 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y)); sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
return string(ans); return string(ans);
} }
else if (cmd=="quad") {
sprintf(ans, "%d", myDet->setQuad());
return string(ans);
}
else if(cmd=="flippeddatax"){ else if(cmd=="flippeddatax"){
myDet->setReceiverOnline(ONLINE_FLAG); myDet->setReceiverOnline(ONLINE_FLAG);
ret = myDet->getFlippedData(X); ret = myDet->getFlippedData(X);
@ -4571,6 +4591,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "dr i \n sets the dynamic range of the detector"<< std::endl; os << "dr i \n sets the dynamic range of the detector"<< std::endl;
os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois"<< std::endl; os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois"<< std::endl;
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl; os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 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 << "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 << "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;
@ -4581,6 +4602,7 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
os << "dr \n gets the dynamic range of the detector"<< std::endl; os << "dr \n gets the dynamic range of the detector"<< std::endl;
os << "roi \n gets region of interest"<< std::endl; os << "roi \n gets region of interest"<< std::endl;
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl; os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 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 << "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 << "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;

View File

@ -1021,6 +1021,13 @@ virtual int setReceiverSilentMode(int i = -1)=0;
*/ */
virtual int checkVersionCompatibility(portType t) = 0; virtual int checkVersionCompatibility(portType t) = 0;
/**
* Set or Get Quad Type (Only for Eiger Quad detector hardware)
* @param val 1 if quad type set, else 0, -1 gets
* @returns 1 if quad type set, else 0
*/
virtual int setQuad(int val = -1) = 0;
protected: protected:

View File

@ -194,6 +194,9 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32
#if defined(JUNGFRAUD) || defined(EIGERD) #if defined(JUNGFRAUD) || defined(EIGERD)
int setDetectorPosition(int pos[]); int setDetectorPosition(int pos[]);
#endif #endif
#ifdef EIGERD
int setQuad(int val);
#endif
// very detector specific // very detector specific

View File

@ -211,6 +211,7 @@ const char* getFunctionName(enum detFuncs func) {
case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START"; case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START";
case F_CHECK_VERSION: return "F_CHECK_VERSION"; case F_CHECK_VERSION: return "F_CHECK_VERSION";
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER"; case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
case F_QUAD: return "F_QUAD";
default: return "Unknown Function"; default: return "Unknown Function";
} }
@ -297,6 +298,7 @@ void function_table() {
flist[F_STORAGE_CELL_START] = &storage_cell_start; flist[F_STORAGE_CELL_START] = &storage_cell_start;
flist[F_CHECK_VERSION] = &check_version; flist[F_CHECK_VERSION] = &check_version;
flist[F_SOFTWARE_TRIGGER] = &software_trigger; flist[F_SOFTWARE_TRIGGER] = &software_trigger;
flist[F_QUAD] = &set_quad;
// check // check
if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) { if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) {
@ -5926,3 +5928,60 @@ int software_trigger(int file_des) {
return ret; return ret;
} }
int set_quad(int file_des) {
int ret=OK,ret1=OK;
int n=0;
int retval=-1;
sprintf(mess,"Setting quad failed\n");
// execute action
#ifndef EIGERD
//to receive any arguments
while (n > 0)
n = receiveData(file_des,mess,MAX_STR_LENGTH,OTHER);
ret = FAIL;
sprintf(mess,"Function (set_quad) is not implemented for this detector\n");
cprintf(RED, "Warning: %s", mess);
#else
// receive arguments
int arg=-1;
n = receiveData(file_des,&arg,sizeof(arg),INT32);
if (n < 0) return printSocketReadError();
// execute action
if (differentClients && lockStatus && arg!=-1) {
ret = FAIL;
sprintf(mess,"Detector locked by %s\n",lastClientIP);
cprintf(RED, "Warning: %s", mess);
}
#ifdef SLS_DETECTOR_FUNCTION_LIST
else {
#ifdef VERBOSE
printf("Setting Quad :%d \n",arg);
#endif
retval=setQuad(arg);
if((arg != -1) && (retval != arg)) {
ret=FAIL;
cprintf(RED, "Warning: %s", mess);
}
}
#endif
if (ret==OK && differentClients)
ret=FORCE_UPDATE;
#endif
// ret could be swapped during sendData
ret1 = ret;
// send ok / fail
n = sendData(file_des,&ret1,sizeof(ret),INT32);
// send return argument
if (ret==FAIL) {
n += sendData(file_des,mess,sizeof(mess),OTHER);
}
n += sendData(file_des,&retval,sizeof(retval),INT32);
// return ok / fail
return ret;
}

View File

@ -97,5 +97,6 @@ int auto_comp_disable(int);
int storage_cell_start(int); int storage_cell_start(int);
int check_version(int); int check_version(int);
int software_trigger(int); int software_trigger(int);
int set_quad(int);
#endif #endif

View File

@ -30,9 +30,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
* @param fd flipped data enable for x and y dimensions * @param fd flipped data enable for x and y dimensions
* @param ajh additional json header * @param ajh additional json header
* @param sm pointer to silent mode * @param sm pointer to silent mode
* @param nd pointer to number of detectors in each dimension
* @param gpEnable pointer to gap pixels enable
*/ */
DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r, DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
uint64_t* fi, int* fd, char* ajh, bool* sm); uint64_t* fi, int* fd, char* ajh, bool* sm, int* nd, bool* gpEnable);
/** /**
* Destructor * Destructor
@ -88,6 +90,18 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
*/ */
int SetThreadPriority(int priority); int SetThreadPriority(int priority);
/**
* Set number of detectors
* @param number of detectors in both dimensions
*/
void SetNumberofDetectors(int* nd);
/**
* Set Flipped data enable across both dimensions
* @param flipped data enable in both dimensions
*/
void SetFlippedData(int* fd);
/** /**
* Creates Zmq Sockets * Creates Zmq Sockets
* (throws an exception if it couldnt create zmq sockets) * (throws an exception if it couldnt create zmq sockets)
@ -184,7 +198,7 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
uint64_t* fileIndex; uint64_t* fileIndex;
/** flipped data across both dimensions enable */ /** flipped data across both dimensions enable */
int* flippedData; int flippedData[2];
/** additional json header */ /** additional json header */
char* additionJsonHeader; char* additionJsonHeader;
@ -207,5 +221,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** Complete buffer used for roi, eg. shortGotthard */ /** Complete buffer used for roi, eg. shortGotthard */
char* completeBuffer; char* completeBuffer;
/** Number of Detectors in X and Y dimension */
int numDet[2];
/** Gap Pixels Enable */
bool* gapPixelsEnable;
}; };

View File

@ -72,6 +72,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/ */
bool getGapPixelsEnable() const; bool getGapPixelsEnable() const;
/**
* Get Quad type Enable (eiger and hardware specific)
* @return true if quad enabled, else false
*/
bool getQuad() const;
//***file parameters*** //***file parameters***
/** /**
@ -341,7 +347,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
void setMultiDetectorSize(const int* size); void setMultiDetectorSize(const int* size);
/* /*
* Get flipped data across 'axis' * Set flipped data across 'axis'
* @return if data is flipped across 'axis' * @return if data is flipped across 'axis'
*/ */
void setFlippedData(int axis=0, int enable=-1); void setFlippedData(int axis=0, int enable=-1);
@ -353,6 +359,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/ */
int setGapPixelsEnable(const bool b); int setGapPixelsEnable(const bool b);
/**
* Set Quad type Enable (eiger and hardware specific)
* @param true if quad enabled, else false
*/
void setQuad(const bool b);
//***file parameters*** //***file parameters***
/** /**
@ -739,6 +751,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
int flippedData[2]; int flippedData[2];
/** gap pixels enable */ /** gap pixels enable */
bool gapPixelsEnable; bool gapPixelsEnable;
/** quad type enable */
bool quadEnable;
//***receiver parameters*** //***receiver parameters***
/** Maximum Number of Listening Threads/ UDP Ports */ /** Maximum Number of Listening Threads/ UDP Ports */

View File

@ -162,6 +162,12 @@ class UDPInterface {
*/ */
virtual bool getGapPixelsEnable() const = 0; virtual bool getGapPixelsEnable() const = 0;
/**
* Get Quad type Enable (eiger and hardware specific)
* @return true if quad enabled, else false
*/
virtual bool getQuad() const = 0;
//***file parameters*** //***file parameters***
/** /**
@ -444,6 +450,12 @@ class UDPInterface {
*/ */
virtual int setGapPixelsEnable(const bool b) = 0; virtual int setGapPixelsEnable(const bool b) = 0;
/**
* Set Quad type Enable (eiger and hardware specific)
* @param true if quad enabled, else false
*/
virtual void setQuad(const bool b) = 0;
//***file parameters*** //***file parameters***
/** /**

View File

@ -53,6 +53,18 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/ */
int64_t getAcquisitionIndex() const; int64_t getAcquisitionIndex() const;
/*
* Set multi detector size
* @param pointer to array of multi detector size in every dimension
*/
void setMultiDetectorSize(const int* size);
/*
* Set flipped data across 'axis'
* @return if data is flipped across 'axis'
*/
void setFlippedData(int axis=0, int enable=-1);
/** /**
* Set Gap Pixels Enable (eiger specific) * Set Gap Pixels Enable (eiger specific)
* @param b true for gap pixels enable, else false * @param b true for gap pixels enable, else false
@ -60,6 +72,12 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
*/ */
int setGapPixelsEnable(const bool b); int setGapPixelsEnable(const bool b);
/**
* Set Quad type Enable (eiger and hardware specific)
* @param true if quad enabled, else false
*/
void setQuad(const bool b);
/** /**
* Set File Format * Set File Format
* @param f fileformat binary or hdf5 * @param f fileformat binary or hdf5

View File

@ -238,19 +238,42 @@ public:
/** /**
* Send Message Header * Send Message Header
* @param buf message * @param index self index for debugging
* @param length length of message * @param dummy true if a dummy message for end of acquisition
* @param dummy true if end of acquistion else false * @param jsonversion json version
* @param dynamicrange dynamic range
* @param fileIndex file or acquisition index
* @param ndetx number of detectors in x axis
* @param ndety number of detectors in y axis
* @param npixelsx number of pixels/channels in x axis for this zmq socket
* @param npixelsy number of pixels/channels in y axis for this zmq socket
* @param imageSize number of bytes for an image in this socket
* @param frameNumber current frame number
* @param expLength exposure length or subframe index if eiger
* @param packetNumber number of packets caught for this frame
* @param bunchId bunch id
* @param timestamp time stamp
* @param modId module Id
* @param row row index in complete detector
* @param column column index in complete detector
* @param reserved reserved
* @param debug debug
* @param roundRNumber not used yet
* @param detType detector enum
* @param version detector header version
* @param gapPixelsEnable gap pixels enable (exception: if gap pixels enable for 4 bit mode, data is not yet gap pixel enabled in receiver)
* @param flippedData int array of 2 elements for x and y, if it is flipped across x or y axis
* @param additionalJsonHeader additional json header
* @returns 0 if error, else 1 * @returns 0 if error, else 1
*/ */
int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0, int SendHeaderData ( int index, bool dummy, uint32_t jsonversion, uint32_t dynamicrange = 0, uint64_t fileIndex = 0,
uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0, uint32_t ndetx = 0, uint32_t ndety = 0, uint32_t npixelsx = 0, uint32_t npixelsy = 0, uint32_t imageSize = 0,
uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL, uint64_t acqIndex = 0, uint64_t fIndex = 0, char* fname = NULL,
uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0, uint64_t frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 0,
uint64_t bunchId = 0, uint64_t timestamp = 0, uint64_t bunchId = 0, uint64_t timestamp = 0,
uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0, uint16_t modId = 0, uint16_t row = 0, uint16_t column = 0, uint16_t reserved = 0,
uint32_t debug = 0, uint16_t roundRNumber = 0, uint32_t debug = 0, uint16_t roundRNumber = 0,
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0, uint8_t detType = 0, uint8_t version = 0, int gapPixelsEnable = 0, int* flippedData = 0,
char* additionalJsonHeader = 0) { char* additionalJsonHeader = 0) {
@ -261,6 +284,7 @@ public:
"\"jsonversion\":%u, " "\"jsonversion\":%u, "
"\"bitmode\":%u, " "\"bitmode\":%u, "
"\"fileIndex\":%llu, " "\"fileIndex\":%llu, "
"\"detshape\":[%u, %u], "
"\"shape\":[%u, %u], " "\"shape\":[%u, %u], "
"\"size\":%u, " "\"size\":%u, "
"\"acqIndex\":%llu, " "\"acqIndex\":%llu, "
@ -283,11 +307,12 @@ public:
"\"version\":%u, " "\"version\":%u, "
//additional stuff //additional stuff
"\"gappixels\":%u, "
"\"flippedDataX\":%u" "\"flippedDataX\":%u"
;//"}\n"; ;//"}\n";
int length = sprintf(buf, jsonHeaderFormat, int length = sprintf(buf, jsonHeaderFormat,
jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, imageSize, jsonversion, dynamicrange, fileIndex, ndetx, ndety, npixelsx, npixelsy, imageSize,
acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1, acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1,
frameNumber, expLength, packetNumber, bunchId, timestamp, frameNumber, expLength, packetNumber, bunchId, timestamp,
@ -295,6 +320,7 @@ public:
detType, version, detType, version,
//additional stuff //additional stuff
gapPixelsEnable,
((flippedData == 0 ) ? 0 :flippedData[0]) ((flippedData == 0 ) ? 0 :flippedData[0])
); );
if (additionalJsonHeader && strlen(additionalJsonHeader)) { if (additionalJsonHeader && strlen(additionalJsonHeader)) {

View File

@ -284,6 +284,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
/** set deactivated receiver padding enable */ /** set deactivated receiver padding enable */
int set_deactivated_receiver_padding_enable(); int set_deactivated_receiver_padding_enable();
/** set quad type */
int set_quad_type();
/** detector type */ /** detector type */
detectorType myDetectorType; detectorType myDetectorType;

View File

@ -71,6 +71,7 @@ enum recFuncs{
F_RECEIVER_DISCARD_POLICY, /** < frames discard policy */ F_RECEIVER_DISCARD_POLICY, /** < frames discard policy */
F_RECEIVER_PADDING_ENABLE, /** < partial frames padding enable */ F_RECEIVER_PADDING_ENABLE, /** < partial frames padding enable */
F_RECEIVER_DEACTIVATED_PADDING_ENABLE, /** < deactivated receiver padding enable */ F_RECEIVER_DEACTIVATED_PADDING_ENABLE, /** < deactivated receiver padding enable */
F_RECEIVER_QUAD,
/* Always append functions hereafter!!! */ /* Always append functions hereafter!!! */

View File

@ -16,7 +16,7 @@ const std::string DataStreamer::TypeName = "DataStreamer";
DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r, DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
uint64_t* fi, int* fd, char* ajh, bool* sm) : uint64_t* fi, int* fd, char* ajh, bool* sm, int* nd, bool* gpEnable) :
ThreadObject(ind), ThreadObject(ind),
runningFlag(0), runningFlag(0),
generalData(0), generalData(0),
@ -26,14 +26,19 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
roi(r), roi(r),
adcConfigured(-1), adcConfigured(-1),
fileIndex(fi), fileIndex(fi),
flippedData(fd),
additionJsonHeader(ajh), additionJsonHeader(ajh),
acquisitionStartedFlag(false), acquisitionStartedFlag(false),
measurementStartedFlag(false), measurementStartedFlag(false),
firstAcquisitionIndex(0), firstAcquisitionIndex(0),
firstMeasurementIndex(0), firstMeasurementIndex(0),
completeBuffer(0) completeBuffer(0),
gapPixelsEnable(gpEnable)
{ {
flippedData[0] = fd[0];
flippedData[1] = fd[1];
numDet[0] = nd[0];
numDet[1] = nd[1];
if(ThreadObject::CreateThread() == FAIL) if(ThreadObject::CreateThread() == FAIL)
throw std::exception(); throw std::exception();
@ -130,6 +135,16 @@ int DataStreamer::SetThreadPriority(int priority) {
return OK; return OK;
} }
void DataStreamer::SetNumberofDetectors(int* nd) {
numDet[0] = nd[0];
numDet[1] = nd[1];
}
void DataStreamer::SetFlippedData(int* fd) {
flippedData[0] = fd[0];
flippedData[1] = fd[1];
}
void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const char* srcip) { void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const char* srcip) {
uint32_t portnum = port + index; uint32_t portnum = port + index;
@ -261,13 +276,13 @@ int DataStreamer::SendHeader(sls_receiver_header* rheader, uint32_t size, uint32
uint64_t acquisitionIndex = header.frameNumber - firstAcquisitionIndex; uint64_t acquisitionIndex = header.frameNumber - firstAcquisitionIndex;
return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex, return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex,
nx, ny, size, numDet[0], numDet[1], nx, ny, size,
acquisitionIndex, frameIndex, fileNametoStream, acquisitionIndex, frameIndex, fileNametoStream,
header.frameNumber, header.expLength, header.packetNumber, header.bunchId, header.timestamp, header.frameNumber, header.expLength, header.packetNumber, header.bunchId, header.timestamp,
header.modId, header.row, header.column, header.reserved, header.modId, header.row, header.column, header.reserved,
header.debug, header.roundRNumber, header.debug, header.roundRNumber,
header.detType, header.version, header.detType, header.version,
flippedData, gapPixelsEnable ? 1 : 0, flippedData,
additionJsonHeader additionJsonHeader
); );
} }

View File

@ -53,6 +53,7 @@ void UDPBaseImplementation::initializeMembers(){
flippedData[0] = 0; flippedData[0] = 0;
flippedData[1] = 0; flippedData[1] = 0;
gapPixelsEnable = false; gapPixelsEnable = false;
quadEnable = false;
//***receiver parameters*** //***receiver parameters***
status = IDLE; status = IDLE;
@ -137,6 +138,11 @@ bool UDPBaseImplementation::getGapPixelsEnable() const {
return gapPixelsEnable; return gapPixelsEnable;
} }
bool UDPBaseImplementation::getQuad() const {
FILE_LOG(logDEBUG) << __AT__ << " starting";
return quadEnable;
}
/***file parameters***/ /***file parameters***/
slsReceiverDefs::fileFormat UDPBaseImplementation::getFileFormat() const{ slsReceiverDefs::fileFormat UDPBaseImplementation::getFileFormat() const{
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";
@ -392,6 +398,8 @@ void UDPBaseImplementation::setMultiDetectorSize(const int* size) {
} }
strcat(message,")"); strcat(message,")");
FILE_LOG(logINFO) << message; FILE_LOG(logINFO) << message;
// overridden
} }
void UDPBaseImplementation::setFlippedData(int axis, int enable){ void UDPBaseImplementation::setFlippedData(int axis, int enable){
@ -399,6 +407,8 @@ void UDPBaseImplementation::setFlippedData(int axis, int enable){
if(axis<0 || axis>1) return; if(axis<0 || axis>1) return;
flippedData[axis] = enable==0?0:1; flippedData[axis] = enable==0?0:1;
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1]; FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
// overridden
} }
int UDPBaseImplementation::setGapPixelsEnable(const bool b) { int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
@ -410,6 +420,14 @@ int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
return OK; return OK;
} }
void UDPBaseImplementation::setQuad(const bool b) {
FILE_LOG(logDEBUG) << __AT__ << " starting";
quadEnable = b;
FILE_LOG(logINFO) << "Quad Enable: " << quadEnable;
// overridden
}
/***file parameters***/ /***file parameters***/
void UDPBaseImplementation::setFileFormat(const fileFormat f){ void UDPBaseImplementation::setFileFormat(const fileFormat f){
FILE_LOG(logDEBUG) << __AT__ << " starting"; FILE_LOG(logDEBUG) << __AT__ << " starting";

View File

@ -111,6 +111,55 @@ int64_t UDPStandardImplementation::getAcquisitionIndex() const {
} }
void UDPStandardImplementation::setMultiDetectorSize(const int* size) {
char message[100];
strcpy(message, "Detector Size: (");
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
if (myDetectorType == EIGER && (!i))
numDet[i] = size[i]*2;
else
numDet[i] = size[i];
sprintf(message,"%s%d",message,numDet[i]);
if (i < MAX_DIMENSIONS-1 )
strcat(message,",");
}
strcat(message,")");
int sz[2] = {numDet[0], numDet[1]};
if (quadEnable) {
sz[0] = 1;
sz[1] = 2;
}
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
(*it)->SetNumberofDetectors(sz);
}
FILE_LOG(logINFO) << message;
}
void UDPStandardImplementation::setFlippedData(int axis, int enable){
if(axis<0 || axis>1) return;
flippedData[axis] = enable==0?0:1;
if (!quadEnable) {
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
(*it)->SetFlippedData(flippedData);
}
}
else {
int fd[2] = {flippedData[0], flippedData[1]};
if (dataStreamer.size() == 2) {
fd[0] = 0;
dataStreamer[0]->SetFlippedData(fd);
fd[0] = 1;
dataStreamer[1]->SetFlippedData(fd);
}
}
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
}
int UDPStandardImplementation::setGapPixelsEnable(const bool b) { int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
if (gapPixelsEnable != b) { if (gapPixelsEnable != b) {
@ -130,6 +179,32 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
return OK; return OK;
} }
void UDPStandardImplementation::setQuad(const bool b) {
if (quadEnable != b) {
quadEnable = b;
if (!quadEnable) {
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
(*it)->SetNumberofDetectors(numDet);
(*it)->SetFlippedData(flippedData);
}
} else {
int size[2] = {1, 2};
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
(*it)->SetNumberofDetectors(size);
}
int fd[2] = {flippedData[0], flippedData[1]};
if (dataStreamer.size() == 2) {
fd[0] = 0;
dataStreamer[0]->SetFlippedData(fd);
fd[0] = 1;
dataStreamer[1]->SetFlippedData(fd);
}
}
}
FILE_LOG(logINFO) << "Quad Enable: " << quadEnable;
}
void UDPStandardImplementation::setFileFormat(const fileFormat f){ void UDPStandardImplementation::setFileFormat(const fileFormat f){
switch(f){ switch(f){
@ -252,7 +327,7 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
for ( int i = 0; i < numThreads; ++i ) { for ( int i = 0; i < numThreads; ++i ) {
try { try {
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange, DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode); &roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode, (int*)numDet, &gapPixelsEnable);
dataStreamer.push_back(s); dataStreamer.push_back(s);
dataStreamer[i]->SetGeneralData(generalData); dataStreamer[i]->SetGeneralData(generalData);
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP); dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);

View File

@ -246,6 +246,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
case F_RECEIVER_DISCARD_POLICY: return "F_RECEIVER_DISCARD_POLICY"; case F_RECEIVER_DISCARD_POLICY: return "F_RECEIVER_DISCARD_POLICY";
case F_RECEIVER_PADDING_ENABLE: return "F_RECEIVER_PADDING_ENABLE"; case F_RECEIVER_PADDING_ENABLE: return "F_RECEIVER_PADDING_ENABLE";
case F_RECEIVER_DEACTIVATED_PADDING_ENABLE: return "F_RECEIVER_DEACTIVATED_PADDING_ENABLE"; case F_RECEIVER_DEACTIVATED_PADDING_ENABLE: return "F_RECEIVER_DEACTIVATED_PADDING_ENABLE";
case F_RECEIVER_QUAD: return "F_RECEIVER_QUAD";
default: return "Unknown Function"; default: return "Unknown Function";
} }
@ -303,7 +304,7 @@ int slsReceiverTCPIPInterface::function_table(){
flist[F_RECEIVER_DISCARD_POLICY] = &slsReceiverTCPIPInterface::set_discard_policy; flist[F_RECEIVER_DISCARD_POLICY] = &slsReceiverTCPIPInterface::set_discard_policy;
flist[F_RECEIVER_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_padding_enable; flist[F_RECEIVER_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_padding_enable;
flist[F_RECEIVER_DEACTIVATED_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable; flist[F_RECEIVER_DEACTIVATED_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable;
flist[F_RECEIVER_QUAD] = &slsReceiverTCPIPInterface::set_quad_type;
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) { for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) {
@ -2982,3 +2983,53 @@ int slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable() {
// return ok/fail // return ok/fail
return ret; return ret;
} }
int slsReceiverTCPIPInterface::set_quad_type() {
ret = OK;
memset(mess, 0, sizeof(mess));
int value = -1;
int retval = -1;
// receive arguments
if (mySock->ReceiveDataOnly(&value,sizeof(value)) < 0 )
return printSocketReadError();
// execute action
#ifdef SLS_RECEIVER_UDP_FUNCTIONS
if (receiverBase == NULL)
invalidReceiverObject();
else {
// set
if(value >= 0) {
if (mySock->differentClients && lockStatus)
receiverlocked();
else if (receiverBase->getStatus() != IDLE)
receiverNotIdle();
else {
receiverBase->setQuad(value); // no check required
}
}
//get
retval = (int)receiverBase->getQuad(); // no check required
}
#endif
#ifdef VERYVERBOSE
FILE_LOG(logINFO) << "Quad mode:" << retval;
#endif
if (ret == OK && mySock->differentClients)
ret = FORCE_UPDATE;
// send answer
mySock->SendDataOnly(&ret,sizeof(ret));
if (ret == FAIL)
mySock->SendDataOnly(mess,sizeof(mess));
mySock->SendDataOnly(&retval,sizeof(retval));
// return ok/fail
return ret;
}