mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 15:20:02 +02:00
fixed effects of scan
This commit is contained in:
parent
4b2cb7ecc1
commit
eb2040f0a7
@ -2467,7 +2467,7 @@ void multiSlsDetector::readFrameFromReceiver() {
|
|||||||
|
|
||||||
// send data to callback
|
// send data to callback
|
||||||
if (data) {
|
if (data) {
|
||||||
setCurrentProgress(currentAcquisitionIndex + 1);
|
setCurrentProgress(currentFrameIndex + 1);
|
||||||
// 4bit gap pixels
|
// 4bit gap pixels
|
||||||
if (dynamicRange == 4 && gappixelsenable) {
|
if (dynamicRange == 4 && gappixelsenable) {
|
||||||
if (quadEnable) {
|
if (quadEnable) {
|
||||||
|
@ -70,43 +70,25 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
* Get acquisition started flag
|
* Get acquisition started flag
|
||||||
* @return acquisition started flag
|
* @return acquisition started flag
|
||||||
*/
|
*/
|
||||||
bool GetAcquisitionStartedFlag();
|
bool GetStartedFlag();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get measurement started flag
|
* Get Frames Complete Caught
|
||||||
* @return measurement started flag
|
* @return number of frames
|
||||||
*/
|
|
||||||
bool GetMeasurementStartedFlag();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Total Complete Frames Caught for an entire acquisition (including all scans)
|
|
||||||
* @return total number of frames caught for entire acquisition
|
|
||||||
*/
|
|
||||||
uint64_t GetNumTotalFramesCaught();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Frames Complete Caught for each real time acquisition (eg. for each scan)
|
|
||||||
* @return number of frames caught for each scan
|
|
||||||
*/
|
*/
|
||||||
uint64_t GetNumFramesCaught();
|
uint64_t GetNumFramesCaught();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets Actual Current Frame Index (that has not been subtracted from firstAcquisitionIndex) thats been processed for an entire acquisition (including all scans)
|
* Gets Actual Current Frame Index (that has not been subtracted from firstAcquisitionIndex) thats been processed
|
||||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
||||||
*/
|
*/
|
||||||
uint64_t GetActualProcessedAcquisitionIndex();
|
uint64_t GetCurrentFrameIndex();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Current Frame Index thats been processed for an entire acquisition (including all scans)
|
* Get Current Frame Index thats been processed
|
||||||
* @return -1 if no frames have been caught, else current frame index (represents all scans too)
|
|
||||||
*/
|
|
||||||
uint64_t GetProcessedAcquisitionIndex();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Current Frame Index thats been processed for each real time acquisition (eg. for each scan)
|
|
||||||
* @return -1 if no frames have been caught, else current frame index
|
* @return -1 if no frames have been caught, else current frame index
|
||||||
*/
|
*/
|
||||||
uint64_t GetProcessedMeasurementIndex();
|
uint64_t GetProcessedIndex();
|
||||||
|
|
||||||
//*** setters ***
|
//*** setters ***
|
||||||
/**
|
/**
|
||||||
@ -126,15 +108,10 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetFifo(Fifo* f);
|
void SetFifo(Fifo* f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset parameters for new acquisition (including all scans)
|
* Reset parameters for new acquisition
|
||||||
*/
|
*/
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset parameters for new measurement (eg. for each scan)
|
|
||||||
*/
|
|
||||||
void ResetParametersforNewMeasurement();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set GeneralData pointer to the one given
|
* Set GeneralData pointer to the one given
|
||||||
* @param g address of GeneralData (Detector Data) pointer
|
* @param g address of GeneralData (Detector Data) pointer
|
||||||
@ -231,10 +208,10 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
std::string GetType() override;
|
std::string GetType() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record First Indices (firstAcquisitionIndex, firstMeasurementIndex)
|
* Record First Index
|
||||||
* @param fnum frame index to record
|
* @param fnum frame index to record
|
||||||
*/
|
*/
|
||||||
void RecordFirstIndices(uint64_t fnum);
|
void RecordFirstIndex(uint64_t fnum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy file writer object
|
* Destroy file writer object
|
||||||
@ -382,26 +359,17 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
//acquisition start
|
//acquisition start
|
||||||
/** Aquisition Started flag */
|
/** Aquisition Started flag */
|
||||||
bool acquisitionStartedFlag;
|
bool startedFlag;
|
||||||
|
|
||||||
/** Measurement Started flag */
|
/** Frame Number of First Frame */
|
||||||
bool measurementStartedFlag;
|
uint64_t firstIndex;
|
||||||
|
|
||||||
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
|
||||||
uint64_t firstAcquisitionIndex;
|
|
||||||
|
|
||||||
/** Frame Number of First Frame for each real time acquisition (eg. for each scan) */
|
|
||||||
uint64_t firstMeasurementIndex;
|
|
||||||
|
|
||||||
|
|
||||||
//for statistics
|
//for statistics
|
||||||
/**Number of complete frames caught for an entire acquisition (including all scans) */
|
/** Number of complete frames caught */
|
||||||
uint64_t numTotalFramesCaught;
|
|
||||||
|
|
||||||
/** Number of complete frames caught for each real time acquisition (eg. for each scan) */
|
|
||||||
uint64_t numFramesCaught;
|
uint64_t numFramesCaught;
|
||||||
|
|
||||||
/** Frame Number of latest processed frame number of an entire Acquisition (including all scans) */
|
/** Frame Number of latest processed frame number */
|
||||||
uint64_t currentFrameIndex;
|
uint64_t currentFrameIndex;
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,14 +69,9 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetFifo(Fifo* f);
|
void SetFifo(Fifo* f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset parameters for new acquisition (including all scans)
|
* Reset parameters for new acquisition
|
||||||
*/
|
*/
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition(const std::string& fname);
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset parameters for new measurement (eg. for each scan)
|
|
||||||
*/
|
|
||||||
void ResetParametersforNewMeasurement(const std::string& fname);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set GeneralData pointer to the one given
|
* Set GeneralData pointer to the one given
|
||||||
@ -133,10 +128,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
std::string GetType();
|
std::string GetType();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record First Indices (firstAcquisitionIndex, firstMeasurementIndex)
|
* Record First Index
|
||||||
* @param fnum frame index to record
|
* @param fnum frame index to record
|
||||||
*/
|
*/
|
||||||
void RecordFirstIndices(uint64_t fnum);
|
void RecordFirstIndex(uint64_t fnum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread Exeution for DataStreamer Class
|
* Thread Exeution for DataStreamer Class
|
||||||
@ -205,16 +200,10 @@ class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
char* additionJsonHeader;
|
char* additionJsonHeader;
|
||||||
|
|
||||||
/** Aquisition Started flag */
|
/** Aquisition Started flag */
|
||||||
bool acquisitionStartedFlag;
|
bool startedFlag;
|
||||||
|
|
||||||
/** Measurement Started flag */
|
/** Frame Number of First Frame */
|
||||||
bool measurementStartedFlag;
|
uint64_t firstIndex;
|
||||||
|
|
||||||
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
|
||||||
uint64_t firstAcquisitionIndex;
|
|
||||||
|
|
||||||
/** Frame Number of First Frame for each real time acquisition (eg. for each scan) */
|
|
||||||
uint64_t firstMeasurementIndex;
|
|
||||||
|
|
||||||
/* File name to stream */
|
/* File name to stream */
|
||||||
std::string fileNametoStream;
|
std::string fileNametoStream;
|
||||||
|
@ -59,20 +59,8 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
bool IsRunning() override;
|
bool IsRunning() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get acquisition started flag
|
* Get Packets caught
|
||||||
* @return acquisition started flag
|
* @return Packets caught
|
||||||
*/
|
|
||||||
bool GetAcquisitionStartedFlag();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get measurement started flag
|
|
||||||
* @return measurement started flag
|
|
||||||
*/
|
|
||||||
bool GetMeasurementStartedFlag();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Packets caught in a real time acquisition (start and stop of receiver)
|
|
||||||
* @return Packets caught in a real time acquisition
|
|
||||||
*/
|
*/
|
||||||
uint64_t GetPacketsCaught();
|
uint64_t GetPacketsCaught();
|
||||||
|
|
||||||
@ -101,15 +89,10 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
void SetFifo(Fifo* f);
|
void SetFifo(Fifo* f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset parameters for new acquisition (including all scans)
|
* Reset parameters for new acquisition
|
||||||
*/
|
*/
|
||||||
void ResetParametersforNewAcquisition();
|
void ResetParametersforNewAcquisition();
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset parameters for new measurement (eg. for each scan)
|
|
||||||
*/
|
|
||||||
void ResetParametersforNewMeasurement();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set GeneralData pointer to the one given
|
* Set GeneralData pointer to the one given
|
||||||
* @param g address of GeneralData (Detector Data) pointer
|
* @param g address of GeneralData (Detector Data) pointer
|
||||||
@ -160,10 +143,10 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
std::string GetType() override;
|
std::string GetType() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record First Indices (firstAcquisitionIndex, firstMeasurementIndex)
|
* Record First Acquisition Index
|
||||||
* @param fnum frame index to record
|
* @param fnum frame index to record
|
||||||
*/
|
*/
|
||||||
void RecordFirstIndices(uint64_t fnum);
|
void RecordFirstIndex(uint64_t fnum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread Exeution for Listener Class
|
* Thread Exeution for Listener Class
|
||||||
@ -263,20 +246,13 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
// acquisition start
|
// acquisition start
|
||||||
/** Aquisition Started flag */
|
/** Aquisition Started flag */
|
||||||
std::atomic<bool> acquisitionStartedFlag;
|
std::atomic<bool> startedFlag;
|
||||||
|
|
||||||
/** Measurement Started flag */
|
|
||||||
std::atomic<bool> measurementStartedFlag;
|
|
||||||
|
|
||||||
/** Frame Number of First Frame of an entire Acquisition (including all scans) */
|
|
||||||
uint64_t firstAcquisitionIndex;
|
|
||||||
|
|
||||||
/** Frame Number of First Frame for each real time acquisition (eg. for each scan) */
|
|
||||||
uint64_t firstMeasurementIndex;
|
|
||||||
|
|
||||||
|
/** Frame Number of First Frame */
|
||||||
|
uint64_t firstIndex;
|
||||||
|
|
||||||
// for acquisition summary
|
// for acquisition summary
|
||||||
/** Number of complete Packets caught for each real time acquisition (eg. for each scan (start& stop of receiver)) */
|
/** Number of complete Packets caught */
|
||||||
std::atomic<uint64_t> numPacketsCaught;
|
std::atomic<uint64_t> numPacketsCaught;
|
||||||
|
|
||||||
/** Last Frame Index caught from udp network */
|
/** Last Frame Index caught from udp network */
|
||||||
@ -285,7 +261,7 @@ class Listener : private virtual slsDetectorDefs, public ThreadObject {
|
|||||||
|
|
||||||
// parameters to acquire image
|
// parameters to acquire image
|
||||||
/** Current Frame Index, default value is 0
|
/** Current Frame Index, default value is 0
|
||||||
* ( always check acquisitionStartedFlag for validity first)
|
* ( always check startedFlag for validity first)
|
||||||
*/
|
*/
|
||||||
uint64_t currentFrameIndex;
|
uint64_t currentFrameIndex;
|
||||||
|
|
||||||
|
@ -157,21 +157,14 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
|||||||
|
|
||||||
//***acquisition count parameters***
|
//***acquisition count parameters***
|
||||||
/**
|
/**
|
||||||
* Get Total Frames Caught for an entire acquisition (including all scans)
|
* Get Frames Caught
|
||||||
* @return total number of frames caught for entire acquisition
|
* @return number of frames caught (0 if none, else min of all)
|
||||||
*/
|
|
||||||
uint64_t getTotalFramesCaught() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get Frames Caught for each real time acquisition (eg. for each scan)
|
|
||||||
* @return number of frames caught for each scan
|
|
||||||
*/
|
*/
|
||||||
uint64_t getFramesCaught() const;
|
uint64_t getFramesCaught() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Current Frame Index for an entire acquisition (including all scans)
|
* Get Current Frame Index
|
||||||
* @return 0 if no frames have been caught, else average of all current
|
* @return current frame index (0 if none, else min of all)
|
||||||
* frame index
|
|
||||||
*/
|
*/
|
||||||
uint64_t getAcquisitionIndex() const;
|
uint64_t getAcquisitionIndex() const;
|
||||||
|
|
||||||
@ -709,11 +702,6 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
|||||||
void setDetectorPositionId(const int id);
|
void setDetectorPositionId(const int id);
|
||||||
|
|
||||||
//***acquisition functions***
|
//***acquisition functions***
|
||||||
/**
|
|
||||||
* Reset acquisition parameters such as total frames caught for an entire
|
|
||||||
* acquisition (including all scans)
|
|
||||||
*/
|
|
||||||
void resetAcquisitionCount();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start Listening for Packets by activating all configuration settings to
|
* Start Listening for Packets by activating all configuration settings to
|
||||||
@ -839,9 +827,9 @@ class slsReceiverImplementation : private virtual slsDetectorDefs {
|
|||||||
int SetupFifoStructure();
|
int SetupFifoStructure();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset parameters for new measurement (eg. for each scan)
|
* Reset parameters for new acquisition
|
||||||
*/
|
*/
|
||||||
void ResetParametersforNewMeasurement();
|
void ResetParametersforNewAcquisition();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates UDP Sockets
|
* Creates UDP Sockets
|
||||||
|
@ -180,13 +180,13 @@ class slsReceiverTCPIPInterface : private virtual slsDetectorDefs {
|
|||||||
/** Set File path */
|
/** Set File path */
|
||||||
int set_file_dir(sls::ServerInterface2 &socket);
|
int set_file_dir(sls::ServerInterface2 &socket);
|
||||||
|
|
||||||
/** Set File name without frame index, file index and extension */
|
/** Set File name prefix */
|
||||||
int set_file_name(sls::ServerInterface2 &socket);
|
int set_file_name(sls::ServerInterface2 &socket);
|
||||||
|
|
||||||
/** Set File index */
|
/** Set File index */
|
||||||
int set_file_index(sls::ServerInterface2 &socket);
|
int set_file_index(sls::ServerInterface2 &socket);
|
||||||
|
|
||||||
/** Gets frame index for each acquisition */
|
/** Gets current frame index */
|
||||||
int get_frame_index(sls::ServerInterface2 &socket);
|
int get_frame_index(sls::ServerInterface2 &socket);
|
||||||
|
|
||||||
/** Gets Total Frames Caught */
|
/** Gets Total Frames Caught */
|
||||||
|
@ -54,11 +54,8 @@ DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo* f,
|
|||||||
ctbDbitList(cdl),
|
ctbDbitList(cdl),
|
||||||
ctbDbitOffset(cdo),
|
ctbDbitOffset(cdo),
|
||||||
ctbAnalogDataBytes(cad),
|
ctbAnalogDataBytes(cad),
|
||||||
acquisitionStartedFlag(false),
|
startedFlag(false),
|
||||||
measurementStartedFlag(false),
|
firstIndex(0),
|
||||||
firstAcquisitionIndex(0),
|
|
||||||
firstMeasurementIndex(0),
|
|
||||||
numTotalFramesCaught(0),
|
|
||||||
numFramesCaught(0),
|
numFramesCaught(0),
|
||||||
currentFrameIndex(0),
|
currentFrameIndex(0),
|
||||||
rawDataReadyCallBack(nullptr),
|
rawDataReadyCallBack(nullptr),
|
||||||
@ -89,32 +86,20 @@ bool DataProcessor::IsRunning() {
|
|||||||
return runningFlag;
|
return runningFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DataProcessor::GetAcquisitionStartedFlag(){
|
bool DataProcessor::GetStartedFlag(){
|
||||||
return acquisitionStartedFlag;
|
return startedFlag;
|
||||||
}
|
|
||||||
|
|
||||||
bool DataProcessor::GetMeasurementStartedFlag(){
|
|
||||||
return measurementStartedFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t DataProcessor::GetNumTotalFramesCaught() {
|
|
||||||
return numTotalFramesCaught;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t DataProcessor::GetNumFramesCaught() {
|
uint64_t DataProcessor::GetNumFramesCaught() {
|
||||||
return numFramesCaught;
|
return numFramesCaught;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t DataProcessor::GetActualProcessedAcquisitionIndex() {
|
uint64_t DataProcessor::GetCurrentFrameIndex() {
|
||||||
return currentFrameIndex;
|
return currentFrameIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t DataProcessor::GetProcessedAcquisitionIndex() {
|
uint64_t DataProcessor::GetProcessedIndex() {
|
||||||
return currentFrameIndex - firstAcquisitionIndex;
|
return currentFrameIndex - firstIndex;
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t DataProcessor::GetProcessedMeasurementIndex() {
|
|
||||||
return currentFrameIndex - firstMeasurementIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -134,17 +119,11 @@ void DataProcessor::SetFifo(Fifo* f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DataProcessor::ResetParametersforNewAcquisition(){
|
void DataProcessor::ResetParametersforNewAcquisition(){
|
||||||
numTotalFramesCaught = 0;
|
|
||||||
firstAcquisitionIndex = 0;
|
|
||||||
currentFrameIndex = 0;
|
|
||||||
acquisitionStartedFlag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataProcessor::ResetParametersforNewMeasurement(){
|
|
||||||
runningFlag = false;
|
runningFlag = false;
|
||||||
|
startedFlag = false;
|
||||||
numFramesCaught = 0;
|
numFramesCaught = 0;
|
||||||
firstMeasurementIndex = 0;
|
firstIndex = 0;
|
||||||
measurementStartedFlag = false;
|
currentFrameIndex = 0;
|
||||||
|
|
||||||
if (tempBuffer != nullptr) {
|
if (tempBuffer != nullptr) {
|
||||||
delete [] tempBuffer;
|
delete [] tempBuffer;
|
||||||
@ -157,21 +136,14 @@ void DataProcessor::ResetParametersforNewMeasurement(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DataProcessor::RecordFirstIndices(uint64_t fnum) {
|
void DataProcessor::RecordFirstIndex(uint64_t fnum) {
|
||||||
//listen to this fnum, later +1
|
//listen to this fnum, later +1
|
||||||
currentFrameIndex = fnum;
|
currentFrameIndex = fnum;
|
||||||
|
|
||||||
measurementStartedFlag = true;
|
startedFlag = true;
|
||||||
firstMeasurementIndex = fnum;
|
firstIndex = fnum;
|
||||||
|
|
||||||
//start of entire acquisition
|
FILE_LOG(logDEBUG1) << index << " First Index:" << firstIndex;
|
||||||
if (!acquisitionStartedFlag) {
|
|
||||||
acquisitionStartedFlag = true;
|
|
||||||
firstAcquisitionIndex = fnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << index << " First Acquisition Index:" << firstAcquisitionIndex <<
|
|
||||||
"\tFirst Measurement Index:" << firstMeasurementIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -322,13 +294,12 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
|||||||
uint32_t nump = header.packetNumber;
|
uint32_t nump = header.packetNumber;
|
||||||
if (nump == generalData->packetsPerFrame) {
|
if (nump == generalData->packetsPerFrame) {
|
||||||
numFramesCaught++;
|
numFramesCaught++;
|
||||||
numTotalFramesCaught++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum;
|
FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum;
|
||||||
|
|
||||||
if (!measurementStartedFlag) {
|
if (!startedFlag) {
|
||||||
RecordFirstIndices(fnum);
|
RecordFirstIndex(fnum);
|
||||||
|
|
||||||
if (*dataStreamEnable) {
|
if (*dataStreamEnable) {
|
||||||
//restart timer
|
//restart timer
|
||||||
@ -384,7 +355,7 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
|||||||
if (file != nullptr)
|
if (file != nullptr)
|
||||||
file->WriteToFile(buf + FIFO_HEADER_NUMBYTES,
|
file->WriteToFile(buf + FIFO_HEADER_NUMBYTES,
|
||||||
sizeof(sls_receiver_header) + (uint32_t)(*((uint32_t*)buf)), //+ size of data (resizable from previous call back
|
sizeof(sls_receiver_header) + (uint32_t)(*((uint32_t*)buf)), //+ size of data (resizable from previous call back
|
||||||
fnum-firstMeasurementIndex, nump);
|
fnum-firstIndex, nump);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,10 +29,8 @@ DataStreamer::DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
|||||||
fileIndex(fi),
|
fileIndex(fi),
|
||||||
flippedDataX(fd),
|
flippedDataX(fd),
|
||||||
additionJsonHeader(ajh),
|
additionJsonHeader(ajh),
|
||||||
acquisitionStartedFlag(false),
|
startedFlag(false),
|
||||||
measurementStartedFlag(false),
|
firstIndex(0),
|
||||||
firstAcquisitionIndex(0),
|
|
||||||
firstMeasurementIndex(0),
|
|
||||||
completeBuffer(nullptr),
|
completeBuffer(nullptr),
|
||||||
gapPixelsEnable(gpEnable),
|
gapPixelsEnable(gpEnable),
|
||||||
quadEnable(qe)
|
quadEnable(qe)
|
||||||
@ -79,15 +77,11 @@ void DataStreamer::SetFifo(Fifo* f) {
|
|||||||
fifo = f;
|
fifo = f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::ResetParametersforNewAcquisition() {
|
void DataStreamer::ResetParametersforNewAcquisition(const std::string& fname){
|
||||||
firstAcquisitionIndex = 0;
|
|
||||||
acquisitionStartedFlag = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DataStreamer::ResetParametersforNewMeasurement(const std::string& fname){
|
|
||||||
runningFlag = false;
|
runningFlag = false;
|
||||||
firstMeasurementIndex = 0;
|
startedFlag = false;
|
||||||
measurementStartedFlag = false;
|
firstIndex = 0;
|
||||||
|
|
||||||
// strcpy(fileNametoStream, fname);
|
// strcpy(fileNametoStream, fname);
|
||||||
fileNametoStream = fname;
|
fileNametoStream = fname;
|
||||||
if (completeBuffer) {
|
if (completeBuffer) {
|
||||||
@ -103,18 +97,11 @@ void DataStreamer::ResetParametersforNewMeasurement(const std::string& fname){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::RecordFirstIndices(uint64_t fnum) {
|
void DataStreamer::RecordFirstIndex(uint64_t fnum) {
|
||||||
measurementStartedFlag = true;
|
startedFlag = true;
|
||||||
firstMeasurementIndex = fnum;
|
firstIndex = fnum;
|
||||||
|
|
||||||
//start of entire acquisition
|
FILE_LOG(logDEBUG1) << index << " First Index: " << firstIndex;
|
||||||
if (!acquisitionStartedFlag) {
|
|
||||||
acquisitionStartedFlag = true;
|
|
||||||
firstAcquisitionIndex = fnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1) << index << " First Acquisition Index: " << firstAcquisitionIndex <<
|
|
||||||
"\tFirst Measurement Index: " << firstMeasurementIndex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataStreamer::SetGeneralData(GeneralData* g) {
|
void DataStreamer::SetGeneralData(GeneralData* g) {
|
||||||
@ -206,8 +193,8 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
|||||||
uint64_t fnum = header->detHeader.frameNumber;
|
uint64_t fnum = header->detHeader.frameNumber;
|
||||||
FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": fnum:" << fnum;
|
FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": fnum:" << fnum;
|
||||||
|
|
||||||
if (!measurementStartedFlag) {
|
if (!startedFlag) {
|
||||||
RecordFirstIndices(fnum);
|
RecordFirstIndex(fnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
//shortframe gotthard
|
//shortframe gotthard
|
||||||
@ -254,8 +241,8 @@ int DataStreamer::SendHeader(sls_receiver_header* rheader, uint32_t size, uint32
|
|||||||
|
|
||||||
sls_detector_header header = rheader->detHeader;
|
sls_detector_header header = rheader->detHeader;
|
||||||
|
|
||||||
uint64_t frameIndex = header.frameNumber - firstMeasurementIndex;
|
uint64_t frameIndex = header.frameNumber - firstIndex;
|
||||||
uint64_t acquisitionIndex = header.frameNumber - firstAcquisitionIndex;
|
uint64_t acquisitionIndex = header.frameNumber;
|
||||||
|
|
||||||
return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex,
|
return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex,
|
||||||
numDet[0], numDet[1], nx, ny, size,
|
numDet[0], numDet[1], nx, ny, size,
|
||||||
|
@ -44,10 +44,8 @@ Listener::Listener(int ind, detectorType dtype, Fifo* f, std::atomic<runStatus>*
|
|||||||
silentMode(sm),
|
silentMode(sm),
|
||||||
row(0),
|
row(0),
|
||||||
column(0),
|
column(0),
|
||||||
acquisitionStartedFlag(false),
|
startedFlag(false),
|
||||||
measurementStartedFlag(false),
|
firstIndex(0),
|
||||||
firstAcquisitionIndex(0),
|
|
||||||
firstMeasurementIndex(0),
|
|
||||||
numPacketsCaught(0),
|
numPacketsCaught(0),
|
||||||
lastCaughtFrameIndex(0),
|
lastCaughtFrameIndex(0),
|
||||||
currentFrameIndex(0),
|
currentFrameIndex(0),
|
||||||
@ -82,14 +80,6 @@ bool Listener::IsRunning() {
|
|||||||
return runningFlag;
|
return runningFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Listener::GetAcquisitionStartedFlag(){
|
|
||||||
return acquisitionStartedFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Listener::GetMeasurementStartedFlag(){
|
|
||||||
return measurementStartedFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t Listener::GetPacketsCaught() {
|
uint64_t Listener::GetPacketsCaught() {
|
||||||
return numPacketsCaught;
|
return numPacketsCaught;
|
||||||
}
|
}
|
||||||
@ -115,18 +105,12 @@ void Listener::SetFifo(Fifo* f) {
|
|||||||
|
|
||||||
|
|
||||||
void Listener::ResetParametersforNewAcquisition() {
|
void Listener::ResetParametersforNewAcquisition() {
|
||||||
acquisitionStartedFlag = false;
|
runningFlag = false;
|
||||||
firstAcquisitionIndex = 0;
|
startedFlag = false;
|
||||||
|
numPacketsCaught = 0;
|
||||||
|
firstIndex = 0;
|
||||||
currentFrameIndex = 0;
|
currentFrameIndex = 0;
|
||||||
lastCaughtFrameIndex = 0;
|
lastCaughtFrameIndex = 0;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Listener::ResetParametersforNewMeasurement() {
|
|
||||||
runningFlag = false;
|
|
||||||
measurementStartedFlag = false;
|
|
||||||
numPacketsCaught = 0;
|
|
||||||
firstMeasurementIndex = 0;
|
|
||||||
carryOverFlag = false;
|
carryOverFlag = false;
|
||||||
carryOverPacket = sls::make_unique<char[]>(generalData->packetSize);
|
carryOverPacket = sls::make_unique<char[]>(generalData->packetSize);
|
||||||
memset(carryOverPacket.get(),0,generalData->packetSize);
|
memset(carryOverPacket.get(),0,generalData->packetSize);
|
||||||
@ -142,24 +126,17 @@ void Listener::ResetParametersforNewMeasurement() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Listener::RecordFirstIndices(uint64_t fnum) {
|
void Listener::RecordFirstIndex(uint64_t fnum) {
|
||||||
//listen to this fnum, later +1
|
//listen to this fnum, later +1
|
||||||
currentFrameIndex = fnum;
|
currentFrameIndex = fnum;
|
||||||
|
|
||||||
measurementStartedFlag = true;
|
startedFlag = true;
|
||||||
firstMeasurementIndex = fnum;
|
firstIndex = fnum;
|
||||||
|
|
||||||
//start of entire acquisition
|
|
||||||
if (!acquisitionStartedFlag) {
|
|
||||||
acquisitionStartedFlag = true;
|
|
||||||
firstAcquisitionIndex = fnum;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!(*silentMode)) {
|
if(!(*silentMode)) {
|
||||||
if (!index) {
|
if (!index) {
|
||||||
FILE_LOG(logINFOBLUE) << index <<
|
FILE_LOG(logINFOBLUE) << index <<
|
||||||
" First Acquisition Index: " << firstAcquisitionIndex;
|
" First Index: " << firstIndex;
|
||||||
FILE_LOG(logDEBUG1) << index << " First Measurement Index: " << firstMeasurementIndex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -519,7 +496,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
// -------------------old header -----------------------------------------------------------------------------
|
// -------------------old header -----------------------------------------------------------------------------
|
||||||
else {
|
else {
|
||||||
// set first packet to be odd or even (check required when switching from roi to no roi)
|
// set first packet to be odd or even (check required when switching from roi to no roi)
|
||||||
if (myDetectorType == GOTTHARD && !measurementStartedFlag) {
|
if (myDetectorType == GOTTHARD && !startedFlag) {
|
||||||
oddStartingPacket = generalData->SetOddStartingPacket(index, &listeningPacket[0]);
|
oddStartingPacket = generalData->SetOddStartingPacket(index, &listeningPacket[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,8 +517,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
FILE_LOG(logDEBUG5) << "Listening " << index << ": currentfindex:" << currentFrameIndex <<
|
FILE_LOG(logDEBUG5) << "Listening " << index << ": currentfindex:" << currentFrameIndex <<
|
||||||
", fnum:" << fnum << ", pnum:" << pnum << ", numpackets:" << numpackets;
|
", fnum:" << fnum << ", pnum:" << pnum << ", numpackets:" << numpackets;
|
||||||
|
|
||||||
if (!measurementStartedFlag)
|
if (!startedFlag)
|
||||||
RecordFirstIndices(fnum);
|
RecordFirstIndex(fnum);
|
||||||
|
|
||||||
if (pnum >= pperFrame ) {
|
if (pnum >= pperFrame ) {
|
||||||
FILE_LOG(logERROR) << "Bad packet " << pnum <<
|
FILE_LOG(logERROR) << "Bad packet " << pnum <<
|
||||||
|
@ -228,49 +228,36 @@ bool slsReceiverImplementation::getOverwriteEnable() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/***acquisition count parameters***/
|
/***acquisition count parameters***/
|
||||||
uint64_t slsReceiverImplementation::getTotalFramesCaught() const {
|
|
||||||
uint64_t sum = 0;
|
|
||||||
uint32_t flagsum = 0;
|
|
||||||
|
|
||||||
for (const auto &it : dataProcessor) {
|
|
||||||
flagsum += it->GetMeasurementStartedFlag();
|
|
||||||
sum += it->GetNumTotalFramesCaught();
|
|
||||||
}
|
|
||||||
// no data processed
|
|
||||||
if (flagsum != dataProcessor.size())
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return (sum / dataProcessor.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t slsReceiverImplementation::getFramesCaught() const {
|
uint64_t slsReceiverImplementation::getFramesCaught() const {
|
||||||
uint64_t sum = 0;
|
uint64_t min = -1;
|
||||||
uint32_t flagsum = 0;
|
uint32_t flagsum = 0;
|
||||||
|
|
||||||
for (const auto &it : dataProcessor) {
|
for (const auto &it : dataProcessor) {
|
||||||
flagsum += it->GetMeasurementStartedFlag();
|
flagsum += it->GetStartedFlag();
|
||||||
sum += it->GetNumFramesCaught();
|
uint64_t curr = it->GetNumFramesCaught();
|
||||||
|
min = curr < min ? curr : min;
|
||||||
}
|
}
|
||||||
// no data processed
|
// no data processed
|
||||||
if (flagsum != dataProcessor.size())
|
if (flagsum != dataProcessor.size())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (sum / dataProcessor.size());
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
uint64_t slsReceiverImplementation::getAcquisitionIndex() const {
|
||||||
uint64_t sum = 0;
|
uint64_t min = -1;
|
||||||
uint32_t flagsum = 0;
|
uint32_t flagsum = 0;
|
||||||
|
|
||||||
for (const auto &it : dataProcessor) {
|
for (const auto &it : dataProcessor) {
|
||||||
flagsum += it->GetMeasurementStartedFlag();
|
flagsum += it->GetStartedFlag();
|
||||||
sum += it->GetActualProcessedAcquisitionIndex();
|
uint64_t curr = it->GetCurrentFrameIndex();
|
||||||
|
min = curr < min ? curr : min;
|
||||||
}
|
}
|
||||||
// no data processed
|
// no data processed
|
||||||
if (flagsum != dataProcessor.size())
|
if (flagsum != dataProcessor.size())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (sum / dataProcessor.size());
|
return min;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***connection parameters***/
|
/***connection parameters***/
|
||||||
@ -1221,24 +1208,11 @@ void slsReceiverImplementation::setDetectorPositionId(const int id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/***acquisition functions***/
|
|
||||||
void slsReceiverImplementation::resetAcquisitionCount() {
|
|
||||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
|
||||||
for (const auto &it : listener)
|
|
||||||
it->ResetParametersforNewAcquisition();
|
|
||||||
for (const auto &it : dataProcessor)
|
|
||||||
it->ResetParametersforNewAcquisition();
|
|
||||||
for (const auto &it : dataStreamer)
|
|
||||||
it->ResetParametersforNewAcquisition();
|
|
||||||
|
|
||||||
FILE_LOG(logINFO) << "Acquisition Count has been reset";
|
|
||||||
}
|
|
||||||
|
|
||||||
int slsReceiverImplementation::startReceiver(char *c) {
|
int slsReceiverImplementation::startReceiver(char *c) {
|
||||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||||
FILE_LOG(logINFO) << "Starting Receiver";
|
FILE_LOG(logINFO) << "Starting Receiver";
|
||||||
resetAcquisitionCount();
|
ResetParametersforNewAcquisition();
|
||||||
ResetParametersforNewMeasurement();
|
|
||||||
|
|
||||||
// listener
|
// listener
|
||||||
if (CreateUDPSockets() == FAIL) {
|
if (CreateUDPSockets() == FAIL) {
|
||||||
@ -1308,8 +1282,8 @@ void slsReceiverImplementation::stopReceiver() {
|
|||||||
bool anycaught = false;
|
bool anycaught = false;
|
||||||
for (const auto &it : dataProcessor) {
|
for (const auto &it : dataProcessor) {
|
||||||
maxIndexCaught =
|
maxIndexCaught =
|
||||||
std::max(maxIndexCaught, it->GetProcessedMeasurementIndex());
|
std::max(maxIndexCaught, it->GetProcessedIndex());
|
||||||
if (it->GetMeasurementStartedFlag())
|
if (it->GetStartedFlag())
|
||||||
anycaught = true;
|
anycaught = true;
|
||||||
}
|
}
|
||||||
// to create virtual file & set files/acquisition to 0 (only hdf5 at the
|
// to create virtual file & set files/acquisition to 0 (only hdf5 at the
|
||||||
@ -1422,8 +1396,8 @@ void slsReceiverImplementation::closeFiles() {
|
|||||||
for (const auto &it : dataProcessor) {
|
for (const auto &it : dataProcessor) {
|
||||||
it->CloseFiles();
|
it->CloseFiles();
|
||||||
maxIndexCaught =
|
maxIndexCaught =
|
||||||
std::max(maxIndexCaught, it->GetProcessedMeasurementIndex());
|
std::max(maxIndexCaught, it->GetProcessedIndex());
|
||||||
if (it->GetMeasurementStartedFlag())
|
if (it->GetStartedFlag())
|
||||||
anycaught = true;
|
anycaught = true;
|
||||||
}
|
}
|
||||||
// to create virtual file & set files/acquisition to 0 (only hdf5 at the
|
// to create virtual file & set files/acquisition to 0 (only hdf5 at the
|
||||||
@ -1554,20 +1528,20 @@ int slsReceiverImplementation::SetupFifoStructure() {
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void slsReceiverImplementation::ResetParametersforNewMeasurement() {
|
void slsReceiverImplementation::ResetParametersforNewAcquisition() {
|
||||||
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called";
|
||||||
|
|
||||||
for (const auto &it : listener)
|
for (const auto &it : listener)
|
||||||
it->ResetParametersforNewMeasurement();
|
it->ResetParametersforNewAcquisition();
|
||||||
for (const auto &it : dataProcessor)
|
for (const auto &it : dataProcessor)
|
||||||
it->ResetParametersforNewMeasurement();
|
it->ResetParametersforNewAcquisition();
|
||||||
|
|
||||||
if (dataStreamEnable) {
|
if (dataStreamEnable) {
|
||||||
char fnametostream[MAX_STR_LENGTH * 2];
|
char fnametostream[MAX_STR_LENGTH * 2];
|
||||||
snprintf(fnametostream, MAX_STR_LENGTH * 2, "%s/%s", filePath,
|
snprintf(fnametostream, MAX_STR_LENGTH * 2, "%s/%s", filePath,
|
||||||
fileName);
|
fileName);
|
||||||
for (const auto &it : dataStreamer)
|
for (const auto &it : dataStreamer)
|
||||||
it->ResetParametersforNewMeasurement(fnametostream);
|
it->ResetParametersforNewAcquisition(fnametostream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,7 +757,7 @@ int slsReceiverTCPIPInterface::get_frame_index(Interface &socket) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int slsReceiverTCPIPInterface::get_frames_caught(Interface &socket) {
|
int slsReceiverTCPIPInterface::get_frames_caught(Interface &socket) {
|
||||||
int retval = impl()->getTotalFramesCaught();
|
int retval = impl()->getFramesCaught();
|
||||||
FILE_LOG(logDEBUG1) << "frames caught:" << retval;
|
FILE_LOG(logDEBUG1) << "frames caught:" << retval;
|
||||||
return socket.sendResult(retval);
|
return socket.sendResult(retval);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user