mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-18 07:47:12 +02:00
some more fixes for eiger 2 udp interface
This commit is contained in:
@ -4857,6 +4857,7 @@ int is_udp_configured() {
|
|||||||
LOG(logWARNING, ("%s", configureMessage));
|
LOG(logWARNING, ("%s", configureMessage));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
|
||||||
if (getNumberofUDPInterfaces() == 2) {
|
if (getNumberofUDPInterfaces() == 2) {
|
||||||
if (udpDetails[i].srcip2 == 0) {
|
if (udpDetails[i].srcip2 == 0) {
|
||||||
sprintf(configureMessage,
|
sprintf(configureMessage,
|
||||||
@ -4883,6 +4884,7 @@ int is_udp_configured() {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@ -9028,7 +9030,10 @@ int set_dest_udp_list(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if still 0, set defaults
|
// if still 0, set defaults
|
||||||
int twoInterfaces = getNumberofUDPInterfaces() == 2 ? 1 : 0;
|
int twoInterfaces = 0;
|
||||||
|
#if defined(JUNGFRAUD) || defined(GOTTHARD2D)
|
||||||
|
twoInterfaces = getNumberofUDPInterfaces() == 2 ? 1 : 0;
|
||||||
|
#endif
|
||||||
udpDetails[entry].srcport = DEFAULT_UDP_SRC_PORTNO;
|
udpDetails[entry].srcport = DEFAULT_UDP_SRC_PORTNO;
|
||||||
if (udpDetails[entry].dstport == 0) {
|
if (udpDetails[entry].dstport == 0) {
|
||||||
udpDetails[entry].dstport =
|
udpDetails[entry].dstport =
|
||||||
|
@ -166,7 +166,6 @@ class GotthardData : public GeneralData {
|
|||||||
maxFramesPerFile = MAX_FRAMES_PER_FILE;
|
maxFramesPerFile = MAX_FRAMES_PER_FILE;
|
||||||
fifoBufferHeaderSize =
|
fifoBufferHeaderSize =
|
||||||
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||||
defaultFifoDepth = 50000;
|
|
||||||
UpdateImageSize();
|
UpdateImageSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -375,6 +374,8 @@ class Mythen3Data : public GeneralData {
|
|||||||
defaultFifoDepth = 50000;
|
defaultFifoDepth = 50000;
|
||||||
standardheader = true;
|
standardheader = true;
|
||||||
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
||||||
|
dynamicRange = 32;
|
||||||
|
tengigaEnable = true;
|
||||||
UpdateImageSize();
|
UpdateImageSize();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -432,7 +433,6 @@ class Gotthard2Data : public GeneralData {
|
|||||||
nPixelsY = 1;
|
nPixelsY = 1;
|
||||||
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||||
dataSize = 2560; // 1280 channels * 2 bytes
|
dataSize = 2560; // 1280 channels * 2 bytes
|
||||||
packetsPerFrame = 1;
|
|
||||||
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
||||||
fifoBufferHeaderSize =
|
fifoBufferHeaderSize =
|
||||||
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||||
@ -486,7 +486,6 @@ class ChipTestBoardData : public GeneralData {
|
|||||||
/** Constructor */
|
/** Constructor */
|
||||||
ChipTestBoardData() {
|
ChipTestBoardData() {
|
||||||
myDetectorType = slsDetectorDefs::CHIPTESTBOARD;
|
myDetectorType = slsDetectorDefs::CHIPTESTBOARD;
|
||||||
nPixelsX = 36; // total number of channels
|
|
||||||
nPixelsY = 1; // number of samples
|
nPixelsY = 1; // number of samples
|
||||||
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||||
frameIndexMask = 0xFFFFFF; // 10g
|
frameIndexMask = 0xFFFFFF; // 10g
|
||||||
|
@ -198,26 +198,30 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
LOG(logDEBUG) << " Detector type set to " << sls::ToString(d);
|
LOG(logDEBUG) << " Detector type set to " << sls::ToString(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
int *Implementation::getDetectorSize() const { return (int *)numMods; }
|
PortGeometry Implementation::getDetectorSize() const { return numModules; }
|
||||||
|
|
||||||
|
PortGeometry Implementation::GetPortGeometry() {
|
||||||
|
portGeometry = {{1, 1}};
|
||||||
|
if (detType == EIGER)
|
||||||
|
portGeometry[X] = numUDPInterfaces;
|
||||||
|
else // (jungfrau and gotthard2)
|
||||||
|
portGeometry[Y] = numUDPInterfaces;
|
||||||
|
return portGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
void Implementation::setDetectorSize(const int *size) {
|
void Implementation::setDetectorSize(const int *size) {
|
||||||
|
PortGeometry portGeometry = GetPortGeometry();
|
||||||
|
|
||||||
std::string log_message = "Detector Size (ports): (";
|
std::string log_message = "Detector Size (ports): (";
|
||||||
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
for (int i = 0; i < MAX_DIMENSIONS; ++i) {
|
||||||
// x dir (colums) each udp port
|
numModules = portGeometry[i] * size[i];
|
||||||
if (detType == EIGER && i == X)
|
log_message += std::to_string(numModules[i]);
|
||||||
numMods[i] = size[i] * 2;
|
|
||||||
// y dir (rows) each udp port
|
|
||||||
else if (numUDPInterfaces == 2 && i == Y)
|
|
||||||
numMods[i] = size[i] * 2;
|
|
||||||
else
|
|
||||||
numMods[i] = size[i];
|
|
||||||
log_message += std::to_string(numMods[i]);
|
|
||||||
if (i < MAX_DIMENSIONS - 1)
|
if (i < MAX_DIMENSIONS - 1)
|
||||||
log_message += ", ";
|
log_message += ", ";
|
||||||
}
|
}
|
||||||
log_message += ")";
|
log_message += ")";
|
||||||
|
|
||||||
int nm[2] = {numMods[0], numMods[1]};
|
int nm[2] = {numModules[X], numModules[Y]};
|
||||||
if (quadEnable) {
|
if (quadEnable) {
|
||||||
nm[0] = 1;
|
nm[0] = 1;
|
||||||
nm[1] = 2;
|
nm[1] = 2;
|
||||||
@ -236,19 +240,18 @@ void Implementation::setModulePositionId(const int id) {
|
|||||||
LOG(logINFO) << "Module Position Id:" << modulePos;
|
LOG(logINFO) << "Module Position Id:" << modulePos;
|
||||||
|
|
||||||
// update zmq port
|
// update zmq port
|
||||||
streamingPort =
|
PortGeometry portGeometry = GetPortGeometry();
|
||||||
DEFAULT_ZMQ_RX_PORTNO + (modulePos * (detType == EIGER ? 2 : 1));
|
streamingPort = DEFAULT_ZMQ_RX_PORTNO + modulePos * portGeometry[X];
|
||||||
|
|
||||||
for (const auto &it : dataProcessor)
|
for (const auto &it : dataProcessor)
|
||||||
it->SetupFileWriter(fileWriteEnable, masterFileWriteEnable,
|
it->SetupFileWriter(fileWriteEnable, masterFileWriteEnable,
|
||||||
fileFormatType, modulePos, &hdf5Lib);
|
fileFormatType, modulePos, &hdf5Lib);
|
||||||
assert(numMods[1] != 0);
|
assert(numModules[Y] != 0);
|
||||||
for (unsigned int i = 0; i < listener.size(); ++i) {
|
for (unsigned int i = 0; i < listener.size(); ++i) {
|
||||||
uint16_t row = 0, col = 0;
|
uint16_t row = 0, col = 0;
|
||||||
row =
|
row = (modulePos % numMods[Y]) * portGeometry[Y];
|
||||||
(modulePos % numMods[1]) * ((numUDPInterfaces == 2) ? 2 : 1); // row
|
col = (modulePos / numMods[Y]) * portGeometry[X] + i;
|
||||||
col = (modulePos / numMods[1]) * ((detType == EIGER) ? 2 : 1) +
|
|
||||||
i; // col for horiz. udp ports
|
|
||||||
listener[i]->SetHardCodedPosition(row, col);
|
listener[i]->SetHardCodedPosition(row, col);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -566,12 +569,12 @@ void Implementation::stopReceiver() {
|
|||||||
if (modulePos == 0) {
|
if (modulePos == 0) {
|
||||||
// more than 1 file, create virtual file
|
// more than 1 file, create virtual file
|
||||||
if (dataProcessor[0]->GetFilesInAcquisition() > 1 ||
|
if (dataProcessor[0]->GetFilesInAcquisition() > 1 ||
|
||||||
(numMods[X] * numMods[Y]) > 1) {
|
(numModules[X] * numModules[Y]) > 1) {
|
||||||
dataProcessor[0]->CreateVirtualFile(
|
dataProcessor[0]->CreateVirtualFile(
|
||||||
filePath, fileName, fileIndex, overwriteEnable, silentMode,
|
filePath, fileName, fileIndex, overwriteEnable, silentMode,
|
||||||
modulePos, numUDPInterfaces, framesPerFile,
|
modulePos, numUDPInterfaces, framesPerFile,
|
||||||
numberOfTotalFrames, dynamicRange, numMods[X], numMods[Y],
|
numberOfTotalFrames, dynamicRange, numModules[X],
|
||||||
&hdf5Lib);
|
numModules[Y], &hdf5Lib);
|
||||||
}
|
}
|
||||||
// link file in master
|
// link file in master
|
||||||
dataProcessor[0]->LinkDataInMasterFile(silentMode);
|
dataProcessor[0]->LinkDataInMasterFile(silentMode);
|
||||||
@ -859,16 +862,19 @@ int Implementation::getNumberofUDPInterfaces() const {
|
|||||||
return numUDPInterfaces;
|
return numUDPInterfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// not Eiger
|
||||||
void Implementation::setNumberofUDPInterfaces(const int n) {
|
void Implementation::setNumberofUDPInterfaces(const int n) {
|
||||||
|
if (detType == EIGER) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Cannot set number of UDP interfaces for Eiger");
|
||||||
|
}
|
||||||
|
|
||||||
if (numUDPInterfaces != n) {
|
if (numUDPInterfaces != n) {
|
||||||
|
|
||||||
// reduce number of detectors in y dir (rows) if it had 2 interfaces
|
// reduce number of detectors to size with 1 interface
|
||||||
// before
|
PortGeometry portGeometry = GetPortGeometry();
|
||||||
if (numUDPInterfaces == 2)
|
numModules[X] /= portGeometry[X];
|
||||||
numMods[Y] /= 2;
|
numModules[Y] /= portGeometry[Y];
|
||||||
|
|
||||||
numUDPInterfaces = n;
|
|
||||||
|
|
||||||
// clear all threads and fifos
|
// clear all threads and fifos
|
||||||
listener.clear();
|
listener.clear();
|
||||||
@ -878,9 +884,10 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
|
|
||||||
// set local variables
|
// set local variables
|
||||||
generalData->SetNumberofInterfaces(n);
|
generalData->SetNumberofInterfaces(n);
|
||||||
udpSocketBufferSize = generalData->defaultUdpSocketBufferSize;
|
numUDPInterfaces = n;
|
||||||
|
|
||||||
// fifo
|
// fifo
|
||||||
|
udpSocketBufferSize = generalData->defaultUdpSocketBufferSize;
|
||||||
SetupFifoStructure();
|
SetupFifoStructure();
|
||||||
|
|
||||||
// create threads
|
// create threads
|
||||||
@ -917,7 +924,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
if (dataStreamEnable) {
|
if (dataStreamEnable) {
|
||||||
try {
|
try {
|
||||||
bool flip = flipRows;
|
bool flip = flipRows;
|
||||||
int nm[2] = {numMods[0], numMods[1]};
|
int nm[2] = {numModules[X], numModules[Y]};
|
||||||
if (quadEnable) {
|
if (quadEnable) {
|
||||||
flip = (i == 1 ? true : false);
|
flip = (i == 1 ? true : false);
|
||||||
nm[0] = 1;
|
nm[0] = 1;
|
||||||
@ -948,7 +955,7 @@ void Implementation::setNumberofUDPInterfaces(const int n) {
|
|||||||
SetThreadPriorities();
|
SetThreadPriorities();
|
||||||
|
|
||||||
// update (from 1 to 2 interface) & also for printout
|
// update (from 1 to 2 interface) & also for printout
|
||||||
setDetectorSize(numMods);
|
setDetectorSize(numModules);
|
||||||
// update row and column in dataprocessor
|
// update row and column in dataprocessor
|
||||||
setModulePositionId(modulePos);
|
setModulePositionId(modulePos);
|
||||||
|
|
||||||
@ -1008,7 +1015,8 @@ void Implementation::setUDPSocketBufferSize(const int s) {
|
|||||||
// testing default setup at startup, argument is 0 to use default values
|
// testing default setup at startup, argument is 0 to use default values
|
||||||
int size = (s == 0) ? udpSocketBufferSize : s;
|
int size = (s == 0) ? udpSocketBufferSize : s;
|
||||||
size_t listSize = listener.size();
|
size_t listSize = listener.size();
|
||||||
if (detType == JUNGFRAU && (int)listSize != numUDPInterfaces) {
|
if ((detType == JUNGFRAU || detytype == GOTTHARD2) &&
|
||||||
|
(int)listSize != numUDPInterfaces) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"Number of Interfaces " + std::to_string(numUDPInterfaces) +
|
"Number of Interfaces " + std::to_string(numUDPInterfaces) +
|
||||||
" do not match listener size " + std::to_string(listSize));
|
" do not match listener size " + std::to_string(listSize));
|
||||||
@ -1046,7 +1054,7 @@ void Implementation::setDataStreamEnable(const bool enable) {
|
|||||||
for (int i = 0; i < numUDPInterfaces; ++i) {
|
for (int i = 0; i < numUDPInterfaces; ++i) {
|
||||||
try {
|
try {
|
||||||
bool flip = flipRows;
|
bool flip = flipRows;
|
||||||
int nm[2] = {numMods[0], numMods[1]};
|
int nm[2] = {numModules[X], numModules[Y]};
|
||||||
if (quadEnable) {
|
if (quadEnable) {
|
||||||
flip = (i == 1 ? true : false);
|
flip = (i == 1 ? true : false);
|
||||||
nm[0] = 1;
|
nm[0] = 1;
|
||||||
@ -1476,7 +1484,7 @@ void Implementation::setQuad(const bool b) {
|
|||||||
|
|
||||||
if (!quadEnable) {
|
if (!quadEnable) {
|
||||||
for (const auto &it : dataStreamer) {
|
for (const auto &it : dataStreamer) {
|
||||||
it->SetNumberofModules(numMods);
|
it->SetNumberofModules(numModules);
|
||||||
it->SetFlipRows(flipRows);
|
it->SetFlipRows(flipRows);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,6 +21,8 @@ class slsDetectorDefs;
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
using ns = std::chrono::nanoseconds;
|
using ns = std::chrono::nanoseconds;
|
||||||
|
|
||||||
|
typedef std::array<int, MAX_DIMENSIONS> PortGeometry;
|
||||||
|
|
||||||
class Implementation : private virtual slsDetectorDefs {
|
class Implementation : private virtual slsDetectorDefs {
|
||||||
public:
|
public:
|
||||||
explicit Implementation(const detectorType d);
|
explicit Implementation(const detectorType d);
|
||||||
@ -33,7 +35,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
* ************************************************/
|
* ************************************************/
|
||||||
|
|
||||||
void setDetectorType(const detectorType d);
|
void setDetectorType(const detectorType d);
|
||||||
int *getDetectorSize() const;
|
PortGeometry *getDetectorSize() const;
|
||||||
void setDetectorSize(const int *size);
|
void setDetectorSize(const int *size);
|
||||||
int getModulePositionId() const;
|
int getModulePositionId() const;
|
||||||
void setModulePositionId(const int id);
|
void setModulePositionId(const int id);
|
||||||
@ -266,6 +268,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
void SetThreadPriorities();
|
void SetThreadPriorities();
|
||||||
void SetupFifoStructure();
|
void SetupFifoStructure();
|
||||||
|
|
||||||
|
PortGeometry GetPortGeometry();
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
void CreateUDPSockets();
|
void CreateUDPSockets();
|
||||||
void SetupWriter();
|
void SetupWriter();
|
||||||
@ -279,7 +282,7 @@ class Implementation : private virtual slsDetectorDefs {
|
|||||||
|
|
||||||
// config parameters
|
// config parameters
|
||||||
detectorType detType{GENERIC};
|
detectorType detType{GENERIC};
|
||||||
int numMods[MAX_DIMENSIONS] = {0, 0};
|
PortGeometry numModules = {{1, 1}};
|
||||||
int modulePos{0};
|
int modulePos{0};
|
||||||
std::string detHostname;
|
std::string detHostname;
|
||||||
bool silentMode{false};
|
bool silentMode{false};
|
||||||
|
Reference in New Issue
Block a user