mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
quad implemented
This commit is contained in:
parent
3e2b471ee1
commit
1189b991e5
18
RELEASE.txt
18
RELEASE.txt
@ -17,6 +17,7 @@ This document describes the differences between 4.0.3 and 4.0.2 releases.
|
||||
1. Topics Concerning
|
||||
====================
|
||||
|
||||
- software for eiger quad hardware integrated
|
||||
- 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
|
||||
------
|
||||
|
||||
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.
|
||||
|
||||
|
||||
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
|
||||
|
@ -1 +0,0 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.1.22.1
|
1
serverBin/eigerDetectorServerv4.0.3.23.0
Symbolic link
1
serverBin/eigerDetectorServerv4.0.3.23.0
Symbolic link
@ -0,0 +1 @@
|
||||
../slsDetectorSoftware/eigerDetectorServer/bin/eigerDetectorServerv4.0.3.23.0
|
@ -121,12 +121,21 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
|
||||
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
|
||||
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
|
||||
nPixelsX = npixelsx_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;
|
||||
|
||||
@ -583,13 +592,26 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
||||
|
||||
maxPixelsY = 0;
|
||||
minPixelsY = 0;
|
||||
|
||||
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
|
||||
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
|
||||
if (detType == slsDetectorDefs::JUNGFRAUCTB) {
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25; // for moench 03
|
||||
switch(detType) {
|
||||
case slsDetectorDefs::JUNGFRAUCTB:
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
|
||||
nPixelsX = npixelsx_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
|
||||
if(scanArgument==qDefs::Level0){
|
||||
@ -1215,7 +1237,6 @@ int qDrawPlot::GetData(detectorData *data,int fIndex, int subIndex){
|
||||
}else
|
||||
gainPlotEnable = false;
|
||||
|
||||
|
||||
//recalculating pedestal
|
||||
if(startPedestalCal){
|
||||
//start adding frames to get to the pedestal value
|
||||
|
@ -52,6 +52,7 @@
|
||||
#define CLEANUP_ACQUISITION 0x0000080000000000ULL
|
||||
#define REGISER_WRITE_READ 0x0000040000000000ULL
|
||||
#define VERSION_COMPATIBILITY 0x0000020000000000ULL
|
||||
#define SOME_ERROR 0x0000010000000000ULL
|
||||
// 0xFFFFFF0000000000ULL
|
||||
|
||||
// 0x000000FFFFFFFFFFULL
|
||||
@ -174,6 +175,10 @@ public:
|
||||
if(slsErrorMask&VERSION_COMPATIBILITY)
|
||||
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)
|
||||
|
@ -123,6 +123,7 @@ enum detFuncs{
|
||||
F_CHECK_VERSION, /** < check version compatibility */
|
||||
|
||||
F_SOFTWARE_TRIGGER, /** < software trigger */
|
||||
F_QUAD,
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
/* Always append functions before!!! */
|
||||
|
@ -50,6 +50,8 @@
|
||||
|
||||
uint32_t Beb_detid = 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);
|
||||
}
|
||||
|
||||
|
||||
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[]) {
|
||||
if(!Beb_activated)
|
||||
return OK;
|
||||
cprintf(BLUE,"Got Position values %d %d %d...\n", pos[0],pos[1], pos[2]);
|
||||
|
||||
pos[0] = Beb_swap_uint16(pos[0]);
|
||||
//pos[1] = Beb_swap_uint16(pos[1]);
|
||||
pos[2] = Beb_swap_uint16(pos[2]);
|
||||
cprintf(BLUE,"Got Position values [%d %d %d]\n", pos[0], pos[1], 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;
|
||||
//mapping new memory to read master top module configuration
|
||||
@ -1233,26 +1253,28 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
uint32_t value = 0;
|
||||
ret = OK;
|
||||
// x left
|
||||
int posval = Beb_swap_uint16(posLeft[0]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_LEFT_OFST);
|
||||
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);
|
||||
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;
|
||||
|
||||
// x right
|
||||
posval = Beb_swap_uint16(posRight[0]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_A_RIGHT_OFST);
|
||||
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);
|
||||
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;
|
||||
|
||||
|
||||
|
||||
// y left (column)
|
||||
// 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));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
|
||||
@ -1260,7 +1282,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
|
||||
// y right
|
||||
// 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));
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||
if(value != ((posval << UDP_HEADER_Y_OFST) & UDP_HEADER_Y_MSK))
|
||||
@ -1269,19 +1291,21 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
|
||||
|
||||
// z left
|
||||
posval = Beb_swap_uint16(posLeft[2]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_LEFT_OFST);
|
||||
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);
|
||||
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;
|
||||
|
||||
// z right
|
||||
posval = Beb_swap_uint16(posRight[2]);
|
||||
value = Beb_Read32(csp0base, UDP_HEADER_B_RIGHT_OFST);
|
||||
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);
|
||||
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;
|
||||
|
||||
|
||||
@ -1292,8 +1316,7 @@ int Beb_SetDetectorPosition(int pos[]) {
|
||||
cprintf(BLUE, "Position set to...\n"
|
||||
"Left: [%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]),
|
||||
Beb_swap_uint16(pos[0]), Beb_top ? (pos[1]+1) : pos[1], Beb_swap_uint16(pos[2]));
|
||||
posLeft[0], posLeft[1], posLeft[2], posRight[0], posRight[1], posRight[2]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -91,6 +91,7 @@ struct BebInfo{
|
||||
int Beb_GetBebFPGATemp();
|
||||
|
||||
void Beb_SetDetectorNumber(uint32_t detid);
|
||||
int Beb_SetQuad(int val);
|
||||
int Beb_SetDetectorPosition(int pos[]);
|
||||
|
||||
uint16_t Beb_swap_uint16( uint16_t val);
|
||||
|
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorsPackage/slsDetectorSoftware/eigerDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: ef3e01b9bdf3a6a08367e2448bcc92bd13cf73ad
|
||||
Revision: 351
|
||||
Branch: 4.0.1-rc
|
||||
Repsitory UUID: 3e2b471ee1e6bbbd0fbce6292c30e4403a4f4b2f
|
||||
Revision: 352
|
||||
Branch: quad
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4068
|
||||
Last Changed Date: 2019-02-06 14:44:47.000000002 +0100 ./xparameters.h
|
||||
Last Changed Rev: 4117
|
||||
Last Changed Date: 2019-07-10 17:22:28.000000002 +0200 ./Beb.c
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "ef3e01b9bdf3a6a08367e2448bcc92bd13cf73ad"
|
||||
#define GITREPUUID "3e2b471ee1e6bbbd0fbce6292c30e4403a4f4b2f"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4068
|
||||
#define GITDATE 0x20190206
|
||||
#define GITBRANCH "4.0.1-rc"
|
||||
#define GITREV 0x4117
|
||||
#define GITDATE 0x20190710
|
||||
#define GITBRANCH "quad"
|
||||
|
@ -1219,6 +1219,10 @@ int setDetectorPosition(int pos[]) {
|
||||
}
|
||||
|
||||
|
||||
int setQuad(int val) {
|
||||
return Beb_SetQuad(val);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -4983,17 +4983,12 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy) {
|
||||
}
|
||||
|
||||
void multiSlsDetector::readFrameFromReceiver() {
|
||||
|
||||
int nX = thisMultiDetector->numberOfDetector[X]; // to copy data in multi module
|
||||
int nY = thisMultiDetector->numberOfDetector[Y]; // for eiger, to reverse the data
|
||||
int nX = 0;
|
||||
int nY = 0;
|
||||
int nDetPixelsX = 0;
|
||||
int nDetPixelsY = 0;
|
||||
bool gappixelsenable = 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()];
|
||||
int numRunning = 0;
|
||||
for (unsigned int i = 0; i < zmqSocket.size(); ++i) {
|
||||
@ -5068,6 +5063,15 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
// shape
|
||||
nPixelsX = doc["shape"][0].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
|
||||
cprintf(BLUE, "(Debug) One Time Header Info:\n"
|
||||
@ -5076,9 +5080,13 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
"dynamicRange: %u\n"
|
||||
"bytesPerPixel: %f\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,
|
||||
nPixelsX, nPixelsY);
|
||||
nPixelsX, nPixelsY, nX, nY, eiger, gappixelsenable);
|
||||
#endif
|
||||
}
|
||||
// each time, parse rest of header
|
||||
@ -5149,20 +5157,17 @@ void multiSlsDetector::readFrameFromReceiver() {
|
||||
|
||||
//send data to callback
|
||||
if (data) {
|
||||
int nCompletePixelsX = thisMultiDetector->numberOfChannelInclGapPixels[X];
|
||||
int nCompletePixelsY = thisMultiDetector->numberOfChannelInclGapPixels[Y];
|
||||
|
||||
// 4bit gap pixels
|
||||
if (dynamicRange == 4 && gappixelsenable) {
|
||||
int n = processImageWithGapPixels(multiframe, multigappixels);
|
||||
thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(),
|
||||
currentFileName.c_str(), nCompletePixelsX, nCompletePixelsY,
|
||||
currentFileName.c_str(), nDetPixelsX, nDetPixelsY,
|
||||
multigappixels, n, dynamicRange, currentFileIndex);
|
||||
}
|
||||
// normal pixels
|
||||
else {
|
||||
thisData = new detectorData(NULL, NULL, NULL, getCurrentProgress(),
|
||||
currentFileName.c_str(), nCompletePixelsX, nCompletePixelsY,
|
||||
currentFileName.c_str(), nDetPixelsX, nDetPixelsY,
|
||||
multiframe, multisize, dynamicRange, currentFileIndex);
|
||||
}
|
||||
dataReady(thisData, currentFrameIndex,
|
||||
@ -5429,3 +5434,9 @@ int multiSlsDetector::setCTBPatWaitAddr(int level, int addr) {
|
||||
int multiSlsDetector::setCTBPatWaitTime(int level, uint64_t t) {
|
||||
return callDetectorMember(&slsDetector::setCTBPatWaitTime, level, t);
|
||||
}
|
||||
|
||||
int multiSlsDetector::setQuad(int val) {
|
||||
if (getNumberOfDetectors() > 1)
|
||||
val = 0;
|
||||
return callDetectorMember(&slsDetector::setQuad, val);
|
||||
}
|
||||
|
@ -1869,6 +1869,13 @@ public:
|
||||
*/
|
||||
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:
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -2274,6 +2274,13 @@ public:
|
||||
*/
|
||||
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:
|
||||
|
||||
/**
|
||||
|
@ -378,6 +378,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
++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
|
||||
- <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);
|
||||
|
||||
if (cmd == "roi")
|
||||
if (cmd == "roi" || cmd == "quad")
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
@ -4494,6 +4501,13 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
|
||||
}
|
||||
|
||||
if(cmd=="quad"){
|
||||
if (val >=0 ) {
|
||||
sprintf(ans, "%d", myDet->setQuad(val));
|
||||
return string(ans);
|
||||
}
|
||||
}
|
||||
|
||||
if(cmd=="flippeddatax"){
|
||||
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 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));
|
||||
return string(ans);
|
||||
}
|
||||
|
||||
else if (cmd=="quad") {
|
||||
sprintf(ans, "%d", myDet->setQuad());
|
||||
return string(ans);
|
||||
}
|
||||
|
||||
else if(cmd=="flippeddatax"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
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 << "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 << "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 << "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;
|
||||
@ -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 << "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 << "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 << "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;
|
||||
|
@ -1021,6 +1021,13 @@ virtual int setReceiverSilentMode(int i = -1)=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:
|
||||
|
||||
|
||||
|
@ -194,6 +194,9 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32
|
||||
#if defined(JUNGFRAUD) || defined(EIGERD)
|
||||
int setDetectorPosition(int pos[]);
|
||||
#endif
|
||||
#ifdef EIGERD
|
||||
int setQuad(int val);
|
||||
#endif
|
||||
|
||||
|
||||
// very detector specific
|
||||
|
@ -211,6 +211,7 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START";
|
||||
case F_CHECK_VERSION: return "F_CHECK_VERSION";
|
||||
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
|
||||
case F_QUAD: return "F_QUAD";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -297,6 +298,7 @@ void function_table() {
|
||||
flist[F_STORAGE_CELL_START] = &storage_cell_start;
|
||||
flist[F_CHECK_VERSION] = &check_version;
|
||||
flist[F_SOFTWARE_TRIGGER] = &software_trigger;
|
||||
flist[F_QUAD] = &set_quad;
|
||||
|
||||
// check
|
||||
if (NUM_DET_FUNCTIONS >= TOO_MANY_FUNCTIONS_DEFINED) {
|
||||
@ -5926,3 +5928,60 @@ int software_trigger(int file_des) {
|
||||
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;
|
||||
}
|
@ -97,5 +97,6 @@ int auto_comp_disable(int);
|
||||
int storage_cell_start(int);
|
||||
int check_version(int);
|
||||
int software_trigger(int);
|
||||
int set_quad(int);
|
||||
|
||||
#endif
|
||||
|
@ -30,9 +30,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param fd flipped data enable for x and y dimensions
|
||||
* @param ajh additional json header
|
||||
* @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,
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm);
|
||||
uint64_t* fi, int* fd, char* ajh, bool* sm, int* nd, bool* gpEnable);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -88,6 +90,18 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
*/
|
||||
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
|
||||
* (throws an exception if it couldnt create zmq sockets)
|
||||
@ -184,7 +198,7 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
uint64_t* fileIndex;
|
||||
|
||||
/** flipped data across both dimensions enable */
|
||||
int* flippedData;
|
||||
int flippedData[2];
|
||||
|
||||
/** additional json header */
|
||||
char* additionJsonHeader;
|
||||
@ -207,5 +221,11 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Complete buffer used for roi, eg. shortGotthard */
|
||||
char* completeBuffer;
|
||||
|
||||
/** Number of Detectors in X and Y dimension */
|
||||
int numDet[2];
|
||||
|
||||
/** Gap Pixels Enable */
|
||||
bool* gapPixelsEnable;
|
||||
|
||||
};
|
||||
|
||||
|
@ -72,6 +72,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
*/
|
||||
bool getGapPixelsEnable() const;
|
||||
|
||||
/**
|
||||
* Get Quad type Enable (eiger and hardware specific)
|
||||
* @return true if quad enabled, else false
|
||||
*/
|
||||
bool getQuad() const;
|
||||
|
||||
|
||||
//***file parameters***
|
||||
/**
|
||||
@ -341,7 +347,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
void setMultiDetectorSize(const int* size);
|
||||
|
||||
/*
|
||||
* Get flipped data across 'axis'
|
||||
* Set flipped data across 'axis'
|
||||
* @return if data is flipped across 'axis'
|
||||
*/
|
||||
void setFlippedData(int axis=0, int enable=-1);
|
||||
@ -353,6 +359,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
*/
|
||||
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***
|
||||
/**
|
||||
@ -739,6 +751,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
int flippedData[2];
|
||||
/** gap pixels enable */
|
||||
bool gapPixelsEnable;
|
||||
/** quad type enable */
|
||||
bool quadEnable;
|
||||
|
||||
//***receiver parameters***
|
||||
/** Maximum Number of Listening Threads/ UDP Ports */
|
||||
|
@ -162,6 +162,12 @@ class UDPInterface {
|
||||
*/
|
||||
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***
|
||||
/**
|
||||
@ -444,6 +450,12 @@ class UDPInterface {
|
||||
*/
|
||||
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***
|
||||
/**
|
||||
|
@ -53,6 +53,18 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
|
||||
*/
|
||||
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)
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Set Quad type Enable (eiger and hardware specific)
|
||||
* @param true if quad enabled, else false
|
||||
*/
|
||||
void setQuad(const bool b);
|
||||
|
||||
/**
|
||||
* Set File Format
|
||||
* @param f fileformat binary or hdf5
|
||||
|
@ -238,19 +238,42 @@ public:
|
||||
|
||||
/**
|
||||
* Send Message Header
|
||||
* @param buf message
|
||||
* @param length length of message
|
||||
* @param dummy true if end of acquistion else false
|
||||
* @param index self index for debugging
|
||||
* @param dummy true if a dummy message for end of acquisition
|
||||
* @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
|
||||
*/
|
||||
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 frameNumber = 0, uint32_t expLength = 0, uint32_t packetNumber = 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,
|
||||
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) {
|
||||
|
||||
|
||||
@ -261,6 +284,7 @@ public:
|
||||
"\"jsonversion\":%u, "
|
||||
"\"bitmode\":%u, "
|
||||
"\"fileIndex\":%llu, "
|
||||
"\"detshape\":[%u, %u], "
|
||||
"\"shape\":[%u, %u], "
|
||||
"\"size\":%u, "
|
||||
"\"acqIndex\":%llu, "
|
||||
@ -283,11 +307,12 @@ public:
|
||||
"\"version\":%u, "
|
||||
|
||||
//additional stuff
|
||||
"\"gappixels\":%u, "
|
||||
"\"flippedDataX\":%u"
|
||||
|
||||
;//"}\n";
|
||||
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,
|
||||
|
||||
frameNumber, expLength, packetNumber, bunchId, timestamp,
|
||||
@ -295,6 +320,7 @@ public:
|
||||
detType, version,
|
||||
|
||||
//additional stuff
|
||||
gapPixelsEnable,
|
||||
((flippedData == 0 ) ? 0 :flippedData[0])
|
||||
);
|
||||
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
|
||||
|
@ -284,6 +284,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/** set deactivated receiver padding enable */
|
||||
int set_deactivated_receiver_padding_enable();
|
||||
|
||||
/** set quad type */
|
||||
int set_quad_type();
|
||||
|
||||
|
||||
/** detector type */
|
||||
detectorType myDetectorType;
|
||||
|
@ -71,6 +71,7 @@ enum recFuncs{
|
||||
F_RECEIVER_DISCARD_POLICY, /** < frames discard policy */
|
||||
F_RECEIVER_PADDING_ENABLE, /** < partial frames padding enable */
|
||||
F_RECEIVER_DEACTIVATED_PADDING_ENABLE, /** < deactivated receiver padding enable */
|
||||
F_RECEIVER_QUAD,
|
||||
/* Always append functions hereafter!!! */
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ const std::string DataStreamer::TypeName = "DataStreamer";
|
||||
|
||||
|
||||
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),
|
||||
runningFlag(0),
|
||||
generalData(0),
|
||||
@ -26,14 +26,19 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
roi(r),
|
||||
adcConfigured(-1),
|
||||
fileIndex(fi),
|
||||
flippedData(fd),
|
||||
additionJsonHeader(ajh),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(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)
|
||||
throw std::exception();
|
||||
|
||||
@ -130,6 +135,16 @@ int DataStreamer::SetThreadPriority(int priority) {
|
||||
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) {
|
||||
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;
|
||||
|
||||
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,
|
||||
header.frameNumber, header.expLength, header.packetNumber, header.bunchId, header.timestamp,
|
||||
header.modId, header.row, header.column, header.reserved,
|
||||
header.debug, header.roundRNumber,
|
||||
header.detType, header.version,
|
||||
flippedData,
|
||||
gapPixelsEnable ? 1 : 0, flippedData,
|
||||
additionJsonHeader
|
||||
);
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
flippedData[0] = 0;
|
||||
flippedData[1] = 0;
|
||||
gapPixelsEnable = false;
|
||||
quadEnable = false;
|
||||
|
||||
//***receiver parameters***
|
||||
status = IDLE;
|
||||
@ -137,6 +138,11 @@ bool UDPBaseImplementation::getGapPixelsEnable() const {
|
||||
return gapPixelsEnable;
|
||||
}
|
||||
|
||||
bool UDPBaseImplementation::getQuad() const {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
return quadEnable;
|
||||
}
|
||||
|
||||
/***file parameters***/
|
||||
slsReceiverDefs::fileFormat UDPBaseImplementation::getFileFormat() const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
@ -392,6 +398,8 @@ void UDPBaseImplementation::setMultiDetectorSize(const int* size) {
|
||||
}
|
||||
strcat(message,")");
|
||||
FILE_LOG(logINFO) << message;
|
||||
|
||||
// overridden
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
@ -399,6 +407,8 @@ void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
|
||||
// overridden
|
||||
}
|
||||
|
||||
int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
|
||||
@ -410,6 +420,14 @@ int UDPBaseImplementation::setGapPixelsEnable(const bool b) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::setQuad(const bool b) {
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
quadEnable = b;
|
||||
FILE_LOG(logINFO) << "Quad Enable: " << quadEnable;
|
||||
|
||||
// overridden
|
||||
}
|
||||
|
||||
/***file parameters***/
|
||||
void UDPBaseImplementation::setFileFormat(const fileFormat f){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
|
@ -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) {
|
||||
if (gapPixelsEnable != b) {
|
||||
@ -130,6 +179,32 @@ int UDPStandardImplementation::setGapPixelsEnable(const bool b) {
|
||||
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){
|
||||
switch(f){
|
||||
@ -252,7 +327,7 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
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[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
|
@ -246,6 +246,7 @@ const char* slsReceiverTCPIPInterface::getFunctionName(enum recFuncs func) {
|
||||
case F_RECEIVER_DISCARD_POLICY: return "F_RECEIVER_DISCARD_POLICY";
|
||||
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_QUAD: return "F_RECEIVER_QUAD";
|
||||
|
||||
default: return "Unknown Function";
|
||||
}
|
||||
@ -303,7 +304,7 @@ int slsReceiverTCPIPInterface::function_table(){
|
||||
flist[F_RECEIVER_DISCARD_POLICY] = &slsReceiverTCPIPInterface::set_discard_policy;
|
||||
flist[F_RECEIVER_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_padding_enable;
|
||||
flist[F_RECEIVER_DEACTIVATED_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable;
|
||||
|
||||
flist[F_RECEIVER_QUAD] = &slsReceiverTCPIPInterface::set_quad_type;
|
||||
|
||||
#ifdef VERYVERBOSE
|
||||
for (int i = 0; i < NUM_REC_FUNCTIONS ; i++) {
|
||||
@ -2982,3 +2983,53 @@ int slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable() {
|
||||
// return ok/fail
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user