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