mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
bug fix on quad: if no data streaming enabled in the beginning
This commit is contained in:
parent
445f3c66fd
commit
350b4f0368
@ -27,14 +27,14 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
* @param dr pointer to dynamic range
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fd flipped data enable for x and y dimensions
|
||||
* @param fd flipped data enable for x dimension
|
||||
* @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, int* nd, bool* gpEnable);
|
||||
uint64_t* fi, int fd, char* ajh, bool* sm, int* nd, bool* gpEnable);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@ -97,10 +97,10 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
void SetNumberofDetectors(int* nd);
|
||||
|
||||
/**
|
||||
* Set Flipped data enable across both dimensions
|
||||
* @param flipped data enable in both dimensions
|
||||
* Set Flipped data enable across x dimension
|
||||
* @param flipped data enable in x dimension
|
||||
*/
|
||||
void SetFlippedData(int* fd);
|
||||
void SetFlippedDataX(int fd);
|
||||
|
||||
/**
|
||||
* Creates Zmq Sockets
|
||||
@ -197,8 +197,8 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
||||
/** Pointer to file index */
|
||||
uint64_t* fileIndex;
|
||||
|
||||
/** flipped data across both dimensions enable */
|
||||
int flippedData[2];
|
||||
/** flipped data across x dimension */
|
||||
int flippedDataX;
|
||||
|
||||
/** additional json header */
|
||||
char* additionJsonHeader;
|
||||
|
@ -747,8 +747,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
||||
bool tengigaEnable;
|
||||
/** Fifo Depth */
|
||||
uint32_t fifoDepth;
|
||||
/** enable for flipping data across both axes */
|
||||
int flippedData[2];
|
||||
/** enable for flipping data across x axis */
|
||||
int flippedDataX;
|
||||
/** gap pixels enable */
|
||||
bool gapPixelsEnable;
|
||||
/** quad type enable */
|
||||
|
@ -273,7 +273,7 @@ public:
|
||||
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 gapPixelsEnable = 0, int* flippedData = 0,
|
||||
uint8_t detType = 0, uint8_t version = 0, uint32_t gapPixelsEnable = 0, uint32_t flippedDataX = 0,
|
||||
char* additionalJsonHeader = 0) {
|
||||
|
||||
|
||||
@ -321,7 +321,7 @@ public:
|
||||
|
||||
//additional stuff
|
||||
gapPixelsEnable,
|
||||
((flippedData == 0 ) ? 0 :flippedData[0])
|
||||
flippedDataX
|
||||
);
|
||||
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
|
||||
length = sprintf(buf, "%s, %s}\n", buf, additionalJsonHeader);
|
||||
|
@ -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, int* nd, bool* gpEnable) :
|
||||
uint64_t* fi, int fd, char* ajh, bool* sm, int* nd, bool* gpEnable) :
|
||||
ThreadObject(ind),
|
||||
runningFlag(0),
|
||||
generalData(0),
|
||||
@ -26,6 +26,7 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
roi(r),
|
||||
adcConfigured(-1),
|
||||
fileIndex(fi),
|
||||
flippedDataX(fd),
|
||||
additionJsonHeader(ajh),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
@ -34,8 +35,6 @@ DataStreamer::DataStreamer(int ind, Fifo*& f, uint32_t* dr, std::vector<ROI>* r,
|
||||
completeBuffer(0),
|
||||
gapPixelsEnable(gpEnable)
|
||||
{
|
||||
flippedData[0] = fd[0];
|
||||
flippedData[1] = fd[1];
|
||||
numDet[0] = nd[0];
|
||||
numDet[1] = nd[1];
|
||||
|
||||
@ -140,9 +139,8 @@ void DataStreamer::SetNumberofDetectors(int* nd) {
|
||||
numDet[1] = nd[1];
|
||||
}
|
||||
|
||||
void DataStreamer::SetFlippedData(int* fd) {
|
||||
flippedData[0] = fd[0];
|
||||
flippedData[1] = fd[1];
|
||||
void DataStreamer::SetFlippedDataX(int fd) {
|
||||
flippedDataX = fd;
|
||||
}
|
||||
|
||||
|
||||
@ -282,7 +280,7 @@ int DataStreamer::SendHeader(sls_receiver_header* rheader, uint32_t size, uint32
|
||||
header.modId, header.row, header.column, header.reserved,
|
||||
header.debug, header.roundRNumber,
|
||||
header.detType, header.version,
|
||||
*gapPixelsEnable ? 1 : 0, flippedData,
|
||||
*gapPixelsEnable ? 1 : 0, flippedDataX,
|
||||
additionJsonHeader
|
||||
);
|
||||
}
|
||||
|
@ -50,8 +50,7 @@ void UDPBaseImplementation::initializeMembers(){
|
||||
dynamicRange = 16;
|
||||
tengigaEnable = false;
|
||||
fifoDepth = 0;
|
||||
flippedData[0] = 0;
|
||||
flippedData[1] = 0;
|
||||
flippedDataX = 0;
|
||||
gapPixelsEnable = false;
|
||||
quadEnable = false;
|
||||
|
||||
@ -129,8 +128,14 @@ char *UDPBaseImplementation::getDetectorHostname() const{
|
||||
|
||||
int UDPBaseImplementation::getFlippedData(int axis) const{
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
if(axis<0 || axis > 1) return -1;
|
||||
return flippedData[axis];
|
||||
switch(axis) {
|
||||
case 0:
|
||||
return flippedDataX;
|
||||
case 1:
|
||||
return 0;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
bool UDPBaseImplementation::getGapPixelsEnable() const {
|
||||
@ -404,9 +409,10 @@ void UDPBaseImplementation::setMultiDetectorSize(const int* size) {
|
||||
|
||||
void UDPBaseImplementation::setFlippedData(int axis, int enable){
|
||||
FILE_LOG(logDEBUG) << __AT__ << " starting";
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
if (axis != 0)
|
||||
return;
|
||||
flippedDataX = enable==0?0:1;
|
||||
FILE_LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
||||
|
||||
// overridden
|
||||
}
|
||||
|
@ -125,38 +125,36 @@ void UDPStandardImplementation::setMultiDetectorSize(const int* size) {
|
||||
}
|
||||
strcat(message,")");
|
||||
|
||||
int sz[2] = {numDet[0], numDet[1]};
|
||||
int nd[2] = {numDet[0], numDet[1]};
|
||||
if (quadEnable) {
|
||||
sz[0] = 1;
|
||||
sz[1] = 2;
|
||||
nd[0] = 1;
|
||||
nd[1] = 2;
|
||||
}
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetNumberofDetectors(sz);
|
||||
(*it)->SetNumberofDetectors(nd);
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << message;
|
||||
}
|
||||
|
||||
void UDPStandardImplementation::setFlippedData(int axis, int enable){
|
||||
if(axis<0 || axis>1) return;
|
||||
flippedData[axis] = enable==0?0:1;
|
||||
if (axis != 0)
|
||||
return;
|
||||
flippedDataX = enable == 0 ? 0 : 1;
|
||||
|
||||
if (!quadEnable) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetFlippedData(flippedData);
|
||||
(*it)->SetFlippedDataX(flippedDataX);
|
||||
}
|
||||
}
|
||||
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);
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
}
|
||||
}
|
||||
|
||||
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
|
||||
FILE_LOG(logINFO) << "Flipped Data X: " << flippedDataX;
|
||||
}
|
||||
|
||||
|
||||
@ -186,19 +184,16 @@ void UDPStandardImplementation::setQuad(const bool b) {
|
||||
if (!quadEnable) {
|
||||
for (std::vector<DataStreamer*>::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it){
|
||||
(*it)->SetNumberofDetectors(numDet);
|
||||
(*it)->SetFlippedData(flippedData);
|
||||
(*it)->SetFlippedDataX(flippedDataX);
|
||||
}
|
||||
} 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);
|
||||
dataStreamer[0]->SetFlippedDataX(0);
|
||||
dataStreamer[1]->SetFlippedDataX(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -326,8 +321,15 @@ int UDPStandardImplementation::setDataStreamEnable(const bool enable) {
|
||||
if (enable) {
|
||||
for ( int i = 0; i < numThreads; ++i ) {
|
||||
try {
|
||||
int fd = flippedDataX;
|
||||
int nd[2] = {numDet[0], numDet[1]};
|
||||
if (quadEnable) {
|
||||
fd = i;
|
||||
nd[0] = 1;
|
||||
nd[1] = 2;
|
||||
}
|
||||
DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange,
|
||||
&roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode, (int*)numDet, &gapPixelsEnable);
|
||||
&roi, &fileIndex, fd, additionalJsonHeader, &silentMode, (int*)nd, &gapPixelsEnable);
|
||||
dataStreamer.push_back(s);
|
||||
dataStreamer[i]->SetGeneralData(generalData);
|
||||
dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP);
|
||||
|
Loading…
x
Reference in New Issue
Block a user