mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 00:07:13 +02:00
removed unnecessary functions in listener and dataprocessor and ensure processedin measurement is not same saas processed frames in acqustion
This commit is contained in:
@ -39,17 +39,17 @@ DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool*
|
||||
ThreadObject(NumberofDataProcessors),
|
||||
generalData(0),
|
||||
fifo(f),
|
||||
dataStreamEnable(dsEnable),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
numTotalFramesCaught(0),
|
||||
numFramesCaught(0),
|
||||
firstAcquisitionIndex(0),
|
||||
firstMeasurementIndex(0),
|
||||
currentFrameIndex(0),
|
||||
file(0),
|
||||
dataStreamEnable(dsEnable),
|
||||
fileFormatType(ftype),
|
||||
fileWriteEnable(fwenable),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
firstMeasurementIndex(0),
|
||||
numTotalFramesCaught(0),
|
||||
numFramesCaught(0),
|
||||
currentFrameIndex(0),
|
||||
rawDataReadyCallBack(dataReadycb),
|
||||
pRawDataReady(pDataReadycb)
|
||||
{
|
||||
@ -114,6 +114,9 @@ uint64_t DataProcessor::GetProcessedAcquisitionIndex() {
|
||||
return currentFrameIndex - firstAcquisitionIndex;
|
||||
}
|
||||
|
||||
uint64_t DataProcessor::GetProcessedMeasurementIndex() {
|
||||
return currentFrameIndex - firstMeasurementIndex;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -32,8 +32,6 @@ Listener::Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno,
|
||||
generalData(0),
|
||||
fifo(f),
|
||||
myDetectorType(dtype),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
status(s),
|
||||
udpSocket(0),
|
||||
udpPortNumber(portno),
|
||||
@ -41,12 +39,13 @@ Listener::Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno,
|
||||
activated(act),
|
||||
numImages(nf),
|
||||
dynamicRange(dr),
|
||||
numTotalPacketsCaught(0),
|
||||
numPacketsCaught(0),
|
||||
acquisitionStartedFlag(false),
|
||||
measurementStartedFlag(false),
|
||||
firstAcquisitionIndex(0),
|
||||
firstMeasurementIndex(0),
|
||||
currentFrameIndex(0),
|
||||
numPacketsCaught(0),
|
||||
lastCaughtFrameIndex(0),
|
||||
currentFrameIndex(0),
|
||||
carryOverFlag(0),
|
||||
carryOverPacket(0),
|
||||
listeningPacket(0)
|
||||
@ -103,8 +102,8 @@ bool Listener::GetMeasurementStartedFlag(){
|
||||
return measurementStartedFlag;
|
||||
}
|
||||
|
||||
uint64_t Listener::GetTotalPacketsCaught() {
|
||||
return numTotalPacketsCaught;
|
||||
uint64_t Listener::GetPacketsCaught() {
|
||||
return numPacketsCaught;
|
||||
}
|
||||
|
||||
uint64_t Listener::GetLastFrameIndexCaught() {
|
||||
@ -133,7 +132,6 @@ void Listener::SetFifo(Fifo*& f) {
|
||||
|
||||
void Listener::ResetParametersforNewAcquisition() {
|
||||
acquisitionStartedFlag = false;
|
||||
numTotalPacketsCaught = 0;
|
||||
firstAcquisitionIndex = 0;
|
||||
currentFrameIndex = 0;
|
||||
lastCaughtFrameIndex = 0;
|
||||
@ -387,7 +385,6 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
||||
|
||||
//update parameters
|
||||
numPacketsCaught++; //record immediately to get more time before socket shutdown
|
||||
numTotalPacketsCaught++;
|
||||
|
||||
// -------------------------- new header ----------------------------------------------------------------------
|
||||
if (myDetectorType == JUNGFRAU) {
|
||||
@ -463,7 +460,6 @@ uint32_t Listener::CreateAnImage(char* buf) {
|
||||
|
||||
//update parameters
|
||||
numPacketsCaught++; //record immediately to get more time before socket shutdown
|
||||
numTotalPacketsCaught++;
|
||||
|
||||
//reset data to -1
|
||||
memset(buf, 0xFF, generalData->dataSize);
|
||||
|
@ -492,12 +492,12 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
|
||||
//create virtual file
|
||||
if (fileWriteEnable && fileFormatType == HDF5) {
|
||||
uint64_t maxFramescaught = 0;
|
||||
uint64_t maxIndexCaught = 0;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
maxFramescaught = max(maxFramescaught, (*it)->GetNumFramesCaught());
|
||||
maxIndexCaught = max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
}
|
||||
if (maxFramescaught)
|
||||
dataProcessor[0]->EndofAcquisition(maxFramescaught);
|
||||
if (maxIndexCaught)
|
||||
dataProcessor[0]->EndofAcquisition(maxIndexCaught); //to create virtual file
|
||||
}
|
||||
|
||||
while(DataStreamer::GetRunningMask()){
|
||||
@ -515,7 +515,7 @@ void UDPStandardImplementation::stopReceiver(){
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
tot += dataProcessor[i]->GetNumFramesCaught();
|
||||
|
||||
uint64_t missingpackets = numberOfFrames*generalData->packetsPerFrame-listener[i]->GetTotalPacketsCaught();
|
||||
uint64_t missingpackets = numberOfFrames*generalData->packetsPerFrame-listener[i]->GetPacketsCaught();
|
||||
if (missingpackets) {
|
||||
cprintf(RED, "\n[Port %d]\n",udpPortNum[i]);
|
||||
cprintf(RED, "Missing Packets\t\t: %lld\n",(long long int)missingpackets);
|
||||
@ -555,7 +555,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
//current packets caught
|
||||
volatile int totalP = 0,prev=-1;
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetTotalPacketsCaught();
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
|
||||
//wait for all packets
|
||||
if((unsigned long long int)totalP!=numberOfFrames*generalData->packetsPerFrame*listener.size()){
|
||||
@ -574,7 +574,7 @@ void UDPStandardImplementation::startReadout(){
|
||||
totalP = 0;
|
||||
|
||||
for (vector<Listener*>::const_iterator it = listener.begin(); it != listener.end(); ++it)
|
||||
totalP += (*it)->GetTotalPacketsCaught();
|
||||
totalP += (*it)->GetPacketsCaught();
|
||||
#ifdef VERY_VERBOSE
|
||||
cprintf(MAGENTA,"\tupdated: totalP:%d\n",totalP);
|
||||
#endif
|
||||
@ -602,13 +602,13 @@ void UDPStandardImplementation::shutDownUDPSockets() {
|
||||
|
||||
|
||||
void UDPStandardImplementation::closeFiles() {
|
||||
uint64_t maxFramescaught = 0;
|
||||
uint64_t maxIndexCaught = 0;
|
||||
for (vector<DataProcessor*>::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) {
|
||||
(*it)->CloseFiles();
|
||||
maxFramescaught = max(maxFramescaught, (*it)->GetNumFramesCaught());
|
||||
maxIndexCaught = max(maxIndexCaught, (*it)->GetProcessedMeasurementIndex());
|
||||
}
|
||||
if (maxFramescaught)
|
||||
dataProcessor[0]->EndofAcquisition(maxFramescaught);
|
||||
if (maxIndexCaught)
|
||||
dataProcessor[0]->EndofAcquisition(maxIndexCaught);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user