diff --git a/slsReceiverSoftware/src/BinaryDataFile.cpp b/slsReceiverSoftware/src/BinaryDataFile.cpp index 5c1075345..731adae3d 100644 --- a/slsReceiverSoftware/src/BinaryDataFile.cpp +++ b/slsReceiverSoftware/src/BinaryDataFile.cpp @@ -1,7 +1,6 @@ #include "BinaryDataFile.h" -#include "sls/logger.h" -BinaryDataFile::BinaryDataFile(int index) : File(BINARY), index_(index) {} +BinaryDataFile::BinaryDataFile(const int index) : File(BINARY), index_(index) {} BinaryDataFile::~BinaryDataFile() { CloseFile(); } @@ -13,10 +12,10 @@ void BinaryDataFile::CloseFile() { } void BinaryDataFile::CreateFirstBinaryDataFile( - std::string filePath, std::string fileNamePrefix, uint64_t fileIndex, - bool overWriteEnable, bool silentMode, int detIndex, - int numUnitsPerDetector, uint32_t udpPortNumber, - uint32_t maxFramesPerFile) { + const std::string filePath, const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode, + const int modulePos, const int numUnitsPerReadout, + const uint32_t udpPortNumber, const uint32_t maxFramesPerFile) { subFileIndex_ = 0; numFramesInFile_ = 0; @@ -26,8 +25,8 @@ void BinaryDataFile::CreateFirstBinaryDataFile( fileIndex_ = fileIndex; overWriteEnable_ = overWriteEnable; silentMode_ = silentMode; - detIndex_ = detIndex; - numUnitsPerDetector_ = numUnitsPerDetector; + detIndex_ = modulePos; + numUnitsPerReadout_ = numUnitsPerReadout; udpPortNumber_ = udpPortNumber; maxFramesPerFile_ = maxFramesPerFile; @@ -39,7 +38,7 @@ void BinaryDataFile::CreateFile() { std::ostringstream os; os << filePath_ << "/" << fileNamePrefix_ << "_d" - << (detIndex_ * numUnitsPerDetector_ + index_) << "_f" << subFileIndex_ + << (detIndex_ * numUnitsPerReadout_ + index_) << "_f" << subFileIndex_ << '_' << fileIndex_ << ".raw"; fileName_ = os.str(); @@ -62,9 +61,9 @@ void BinaryDataFile::CreateFile() { } } -void BinaryDataFile::WriteToFile(char *buffer, int buffersize, - uint64_t currentFrameNumber, - uint32_t numPacketsCaught) { +void BinaryDataFile::WriteToFile(char *buffer, const int buffersize, + const uint64_t currentFrameNumber, + const uint32_t numPacketsCaught) { // check if maxframesperfile = 0 for infinite if (maxFramesPerFile_ && (numFramesInFile_ >= maxFramesPerFile_)) { CloseFile(); diff --git a/slsReceiverSoftware/src/BinaryDataFile.h b/slsReceiverSoftware/src/BinaryDataFile.h index 55d714af7..a76a5003b 100644 --- a/slsReceiverSoftware/src/BinaryDataFile.h +++ b/slsReceiverSoftware/src/BinaryDataFile.h @@ -5,20 +5,22 @@ class BinaryDataFile : private virtual slsDetectorDefs, public File { public: - BinaryDataFile(int index); + BinaryDataFile(const int index); ~BinaryDataFile(); void CloseFile() override; - void CreateFirstBinaryDataFile(std::string filePath, - std::string fileNamePrefix, - uint64_t fileIndex, bool overWriteEnable, - bool silentMode, int detIndex, - int numUnitsPerDetector, - uint32_t udpPortNumber, - uint32_t maxFramesPerFile) override; + void CreateFirstBinaryDataFile(const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, + const bool overWriteEnable, + const bool silentMode, const int modulePos, + const int numUnitsPerReadout, + const uint32_t udpPortNumber, + const uint32_t maxFramesPerFile) override; - void WriteToFile(char *buffer, int buffersize, uint64_t currentFrameNumber, - uint32_t numPacketsCaught) override; + void WriteToFile(char *buffer, const int buffersize, + const uint64_t currentFrameNumber, + const uint32_t numPacketsCaught) override; private: void CreateFile(); @@ -35,7 +37,7 @@ class BinaryDataFile : private virtual slsDetectorDefs, public File { bool overWriteEnable_{false}; bool silentMode_{false}; int detIndex_{0}; - int numUnitsPerDetector_{0}; + int numUnitsPerReadout_{0}; uint32_t udpPortNumber_{0}; uint32_t maxFramesPerFile_{0}; }; \ No newline at end of file diff --git a/slsReceiverSoftware/src/BinaryMasterFile.cpp b/slsReceiverSoftware/src/BinaryMasterFile.cpp index d15d43c80..f52eff130 100644 --- a/slsReceiverSoftware/src/BinaryMasterFile.cpp +++ b/slsReceiverSoftware/src/BinaryMasterFile.cpp @@ -1,6 +1,5 @@ #include "BinaryMasterFile.h" #include "MasterAttributes.h" -#include "sls/logger.h" BinaryMasterFile::BinaryMasterFile() : File(BINARY) {} @@ -13,10 +12,11 @@ void BinaryMasterFile::CloseFile() { fd_ = nullptr; } -void BinaryMasterFile::CreateMasterFile(std::string filePath, - std::string fileNamePrefix, - uint64_t fileIndex, - bool overWriteEnable, bool silentMode, +void BinaryMasterFile::CreateMasterFile(const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, + const bool overWriteEnable, + const bool silentMode, MasterAttributes *attr) { // create file name std::ostringstream os; diff --git a/slsReceiverSoftware/src/BinaryMasterFile.h b/slsReceiverSoftware/src/BinaryMasterFile.h index ef98f057e..ae5405828 100644 --- a/slsReceiverSoftware/src/BinaryMasterFile.h +++ b/slsReceiverSoftware/src/BinaryMasterFile.h @@ -10,9 +10,11 @@ class BinaryMasterFile : private virtual slsDetectorDefs, public File { ~BinaryMasterFile(); void CloseFile() override; - void CreateMasterFile(std::string filePath, std::string fileNamePrefix, - uint64_t fileIndex, bool overWriteEnable, - bool silentMode, MasterAttributes *attr) override; + void CreateMasterFile(const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, + const bool silentMode, + MasterAttributes *attr) override; private: FILE *fd_{nullptr}; diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 2e4e961f5..d474980c9 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -23,63 +23,162 @@ #include #include -const std::string DataProcessor::TypeName = "DataProcessor"; +const std::string DataProcessor::typeName_ = "DataProcessor"; -DataProcessor::DataProcessor(int ind, detectorType dtype, Fifo *f, bool act, - bool depaden, bool *dsEnable, uint32_t *freq, - uint32_t *timer, uint32_t *sfnum, bool *fp, - bool *sm, std::vector *cdl, int *cdo, - int *cad) - : ThreadObject(ind, TypeName), fifo(f), myDetectorType(dtype), - dataStreamEnable(dsEnable), activated(act), - deactivatedPaddingEnable(depaden), streamingFrequency(freq), - streamingTimerInMs(timer), streamingStartFnum(sfnum), silentMode(sm), - framePadding(fp), ctbDbitList(cdl), ctbDbitOffset(cdo), - ctbAnalogDataBytes(cad), firstStreamerFrame(false) { - LOG(logDEBUG) << "DataProcessor " << ind << " created"; - memset((void *)&timerBegin, 0, sizeof(timespec)); +DataProcessor::DataProcessor(int index, detectorType detectorType, Fifo *fifo, + bool *activated, bool *deactivatedPaddingEnable, + bool *dataStreamEnable, + uint32_t *streamingFrequency, + uint32_t *streamingTimerInMs, + uint32_t *streamingStartFnum, bool *framePadding, + std::vector *ctbDbitList, int *ctbDbitOffset, + int *ctbAnalogDataBytes, std::mutex *hdf5Lib) + : ThreadObject(index, typeName_), fifo_(fifo), detectorType_(detectorType), + dataStreamEnable_(dataStreamEnable), activated_(activated), + deactivatedPaddingEnable_(deactivatedPaddingEnable), + streamingFrequency_(streamingFrequency), + streamingTimerInMs_(streamingTimerInMs), + streamingStartFnum_(streamingStartFnum), framePadding_(framePadding), + ctbDbitList_(ctbDbitList), ctbDbitOffset_(ctbDbitOffset), + ctbAnalogDataBytes_(ctbAnalogDataBytes), firstStreamerFrame_(false), + hdf5Lib_(hdf5Lib) { + + LOG(logDEBUG) << "DataProcessor " << index << " created"; + + memset((void *)&timerbegin_, 0, sizeof(timespec)); } -DataProcessor::~DataProcessor() {} +DataProcessor::~DataProcessor() { DeleteFiles(); } /** getters */ -bool DataProcessor::GetStartedFlag() { return startedFlag; } +bool DataProcessor::GetStartedFlag() { return startedFlag_; } -uint64_t DataProcessor::GetNumFramesCaught() { return numFramesCaught; } +uint64_t DataProcessor::GetNumFramesCaught() { return numFramesCaught_; } -uint64_t DataProcessor::GetCurrentFrameIndex() { return currentFrameIndex; } +uint64_t DataProcessor::GetCurrentFrameIndex() { return currentFrameIndex_; } uint64_t DataProcessor::GetProcessedIndex() { - return currentFrameIndex - firstIndex; + return currentFrameIndex_ - firstIndex_; } -void DataProcessor::SetFifo(Fifo *f) { fifo = f; } +void DataProcessor::SetFifo(Fifo *fifo) { fifo_ = fifo; } void DataProcessor::ResetParametersforNewAcquisition() { StopRunning(); - startedFlag = false; - numFramesCaught = 0; - firstIndex = 0; - currentFrameIndex = 0; - firstStreamerFrame = true; + startedFlag_ = false; + numFramesCaught_ = 0; + firstIndex_ = 0; + currentFrameIndex_ = 0; + firstStreamerFrame_ = true; } void DataProcessor::RecordFirstIndex(uint64_t fnum) { // listen to this fnum, later +1 - currentFrameIndex = fnum; + currentFrameIndex_ = fnum; - startedFlag = true; - firstIndex = fnum; + startedFlag_ = true; + firstIndex_ = fnum; - LOG(logDEBUG1) << index << " First Index:" << firstIndex; + LOG(logDEBUG1) << index << " First Index:" << firstIndex_; } -void DataProcessor::SetGeneralData(GeneralData *g) { generalData = g; } +void DataProcessor::SetGeneralData(GeneralData *generalData) { + generalData_ = generalData; +} + +void DataProcessor::DeleteFiles() { + if (dataFile_ != nullptr) { + delete dataFile_; + dataFile_ = nullptr; + } + if (masterFile_ != nullptr) { + delete masterFile_; + masterFile_ = nullptr; + } +} +void DataProcessor::SetupFileWriter(const bool filewriteEnable, + const bool masterFilewriteEnable, + const fileFormat fileFormatType, + const int modulePos) { + DeleteFiles(); + if (filewriteEnable) { + switch (fileFormatType) { +#ifdef HDF5C + case HDF5: + dataFile_ = new HDF5DataFile(index, hdf5Lib_); + if (modulePos == 0 && index == 0) { + if (masterFilewriteEnable) { + masterFile_ = new HDF5MasterFile(hdf5Lib_); + } + // virtual file + } + break; +#endif + case BINARY: + dataFile_ = new BinaryDataFile(index); + if (modulePos == 0 && index == 0 && masterFilewriteEnable) { + masterFile_ = new BinaryMasterFile(); + } + break; + default: + throw sls::RuntimeError( + "Unknown file format (compile with hdf5 flags"); + } + } +} + +void DataProcessor::CreateFirstFiles( + MasterAttributes *attr, const std::string filePath, + const std::string fileNamePrefix, const uint64_t fileIndex, + const bool overWriteEnable, const bool silentMode, const int modulePos, + const int numUnitsPerReadout, const uint32_t udpPortNumber, + const uint32_t maxFramesPerFile, const uint64_t numImages, + const uint32_t nPIxelsX, const uint32_t nPIxelsY, + const uint32_t dynamicRange) { + if (dataFile_ == nullptr) { + throw sls::RuntimeError("file object not contstructed"); + } + dataFile_->CloseFile(); + /* +#ifdef HDF5C + if (virtualFile_) { + virtualFile_->CloseFile(); + } +#endif +*/ + // master file write enabled + if (masterFile_) { + masterFile_->CloseFile(); + masterFile_->CreateMasterFile(filePath, fileNamePrefix, fileIndex, + overWriteEnable, silentMode, attr); + } + + switch (dataFile_->GetFileFormat()) { +#ifdef HDF5C + case HDF5: + dataFile_->CreateFirstHDF5DataFile( + filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode, + modulePos, numUnitsPerReadout, udpPortNumber, maxFramesPerFile, + numImages, nPIxelsX, nPIxelsY, dynamicRange); + /*if (virtualFile_) { + virtualFile_->CreateFile(); + }*/ + break; +#endif + case BINARY: + dataFile_->CreateFirstBinaryDataFile( + filePath, fileNamePrefix, fileIndex, overWriteEnable, silentMode, + modulePos, numUnitsPerReadout, udpPortNumber, maxFramesPerFile); + break; + default: + throw sls::RuntimeError("Unknown file format (compile with hdf5 flags"); + } +} void DataProcessor::ThreadExecution() { char *buffer = nullptr; - fifo->PopAddress(buffer); + fifo_->PopAddress(buffer); LOG(logDEBUG5) << "DataProcessor " << index << ", " "pop 0x" @@ -97,21 +196,21 @@ void DataProcessor::ThreadExecution() { try { fnum = ProcessAnImage(buffer); } catch (const std::exception &e) { - fifo->FreeAddress(buffer); + fifo_->FreeAddress(buffer); return; } // stream (if time/freq to stream) or free - if (*dataStreamEnable && SendToStreamer()) { + if (*dataStreamEnable_ && SendToStreamer()) { // if first frame to stream, add frame index to fifo header (might // not be the first) - if (firstStreamerFrame) { - firstStreamerFrame = false; + if (firstStreamerFrame_) { + firstStreamerFrame_ = false; (*((uint32_t *)(buffer + FIFO_DATASIZE_NUMBYTES))) = - (uint32_t)(fnum - firstIndex); + (uint32_t)(fnum - firstIndex_); } - fifo->PushAddressToStream(buffer); + fifo_->PushAddressToStream(buffer); } else { - fifo->FreeAddress(buffer); + fifo_->FreeAddress(buffer); } } @@ -119,10 +218,10 @@ void DataProcessor::StopProcessing(char *buf) { LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy"; // stream or free - if (*dataStreamEnable) - fifo->PushAddressToStream(buf); + if (*dataStreamEnable_) + fifo_->PushAddressToStream(buf); else - fifo->FreeAddress(buf); + fifo_->FreeAddress(buf); StopRunning(); LOG(logDEBUG1) << index << ": Processing Completed"; @@ -133,37 +232,37 @@ uint64_t DataProcessor::ProcessAnImage(char *buf) { auto *rheader = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES); sls_detector_header header = rheader->detHeader; uint64_t fnum = header.frameNumber; - currentFrameIndex = fnum; + currentFrameIndex_ = fnum; uint32_t nump = header.packetNumber; - if (nump == generalData->packetsPerFrame) { - numFramesCaught++; + if (nump == generalData_->packetsPerFrame) { + numFramesCaught_++; } LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum; - if (!startedFlag) { + if (!startedFlag_) { RecordFirstIndex(fnum); - if (*dataStreamEnable) { + if (*dataStreamEnable_) { // restart timer - clock_gettime(CLOCK_REALTIME, &timerBegin); - timerBegin.tv_sec -= (*streamingTimerInMs) / 1000; - timerBegin.tv_nsec -= ((*streamingTimerInMs) % 1000) * 1000000; + clock_gettime(CLOCK_REALTIME, &timerbegin_); + timerbegin_.tv_sec -= (*streamingTimerInMs_) / 1000; + timerbegin_.tv_nsec -= ((*streamingTimerInMs_) % 1000) * 1000000; // to send first image - currentFreqCount = *streamingFrequency - *streamingStartFnum; + currentFreqCount_ = *streamingFrequency_ - *streamingStartFnum_; } } // frame padding - if (activated && *framePadding && nump < generalData->packetsPerFrame) + if (*activated_ && *framePadding_ && nump < generalData_->packetsPerFrame) PadMissingPackets(buf); // deactivated and padding enabled - else if (!activated && deactivatedPaddingEnable) + else if (!*activated_ && *deactivatedPaddingEnable_) PadMissingPackets(buf); // rearrange ctb digital bits (if ctbDbitlist is not empty) - if (!(*ctbDbitList).empty()) { + if (!(*ctbDbitList_).empty()) { RearrangeDbitData(buf); } @@ -195,7 +294,7 @@ uint64_t DataProcessor::ProcessAnImage(char *buf) { bool DataProcessor::SendToStreamer() { // skip - if ((*streamingFrequency) == 0u) { + if ((*streamingFrequency_) == 0u) { if (!CheckTimer()) return false; } else { @@ -210,26 +309,26 @@ bool DataProcessor::CheckTimer() { clock_gettime(CLOCK_REALTIME, &end); LOG(logDEBUG1) << index << " Timer elapsed time:" - << ((end.tv_sec - timerBegin.tv_sec) + - (end.tv_nsec - timerBegin.tv_nsec) / 1000000000.0) + << ((end.tv_sec - timerbegin_.tv_sec) + + (end.tv_nsec - timerbegin_.tv_nsec) / 1000000000.0) << " seconds"; // still less than streaming timer, keep waiting - if (((end.tv_sec - timerBegin.tv_sec) + - (end.tv_nsec - timerBegin.tv_nsec) / 1000000000.0) < - ((double)*streamingTimerInMs / 1000.00)) + if (((end.tv_sec - timerbegin_.tv_sec) + + (end.tv_nsec - timerbegin_.tv_nsec) / 1000000000.0) < + ((double)*streamingTimerInMs_ / 1000.00)) return false; // restart timer - clock_gettime(CLOCK_REALTIME, &timerBegin); + clock_gettime(CLOCK_REALTIME, &timerbegin_); return true; } bool DataProcessor::CheckCount() { - if (currentFreqCount == *streamingFrequency) { - currentFreqCount = 1; + if (currentFreqCount_ == *streamingFrequency_) { + currentFreqCount_ = 1; return true; } - currentFreqCount++; + currentFreqCount_++; return false; } @@ -249,18 +348,18 @@ void DataProcessor::registerCallBackRawDataModifyReady( void DataProcessor::PadMissingPackets(char *buf) { LOG(logDEBUG) << index << ": Padding Missing Packets"; - uint32_t pperFrame = generalData->packetsPerFrame; + uint32_t pperFrame = generalData_->packetsPerFrame; auto *header = (sls_receiver_header *)(buf + FIFO_HEADER_NUMBYTES); uint32_t nmissing = pperFrame - header->detHeader.packetNumber; sls_bitset pmask = header->packetsMask; - uint32_t dsize = generalData->dataSize; - if (myDetectorType == GOTTHARD2 && index != 0) { - dsize = generalData->vetoDataSize; + uint32_t dsize = generalData_->dataSize; + if (detectorType_ == GOTTHARD2 && index != 0) { + dsize = generalData_->vetoDataSize; } - uint32_t fifohsize = generalData->fifoBufferHeaderSize; + uint32_t fifohsize = generalData_->fifoBufferHeaderSize; uint32_t corrected_dsize = - dsize - ((pperFrame * dsize) - generalData->imageSize); + dsize - ((pperFrame * dsize) - generalData_->imageSize); LOG(logDEBUG1) << "bitmask: " << pmask.to_string(); for (unsigned int pnum = 0; pnum < pperFrame; ++pnum) { @@ -277,7 +376,7 @@ void DataProcessor::PadMissingPackets(char *buf) { << std::endl; // missing packet - switch (myDetectorType) { + switch (detectorType_) { // for gotthard, 1st packet: 4 bytes fnum, CACA + CACA, 639*2 bytes // data // 2nd packet: 4 bytes fnum, previous 1*2 bytes data + @@ -308,7 +407,7 @@ void DataProcessor::RearrangeDbitData(char *buf) { // TODO! (Erik) Refactor and add tests int totalSize = (int)(*((uint32_t *)buf)); int ctbDigitalDataBytes = - totalSize - (*ctbAnalogDataBytes) - (*ctbDbitOffset); + totalSize - (*ctbAnalogDataBytes_) - (*ctbDbitOffset_); // no digital data if (ctbDigitalDataBytes == 0) { @@ -319,19 +418,19 @@ void DataProcessor::RearrangeDbitData(char *buf) { const int numSamples = (ctbDigitalDataBytes / sizeof(uint64_t)); const int digOffset = FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header) + - (*ctbAnalogDataBytes); + (*ctbAnalogDataBytes_); // ceil as numResult8Bits could be decimal const int numResult8Bits = - ceil((double)(numSamples * (*ctbDbitList).size()) / 8.00); + ceil((double)(numSamples * (*ctbDbitList_).size()) / 8.00); std::vector result(numResult8Bits); uint8_t *dest = &result[0]; - auto *source = (uint64_t *)(buf + digOffset + (*ctbDbitOffset)); + auto *source = (uint64_t *)(buf + digOffset + (*ctbDbitOffset_)); // loop through digital bit enable vector int bitoffset = 0; - for (auto bi : (*ctbDbitList)) { + for (auto bi : (*ctbDbitList_)) { // where numbits * numsamples is not a multiple of 8 if (bitoffset != 0) { bitoffset = 0; diff --git a/slsReceiverSoftware/src/DataProcessor.h b/slsReceiverSoftware/src/DataProcessor.h index 791a05b09..de2ff173e 100644 --- a/slsReceiverSoftware/src/DataProcessor.h +++ b/slsReceiverSoftware/src/DataProcessor.h @@ -19,86 +19,47 @@ class DataStreamer; struct MasterAttributes; #include +#include #include class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { public: - /** - * Constructor - * Calls Base Class CreateThread(), sets ErrorMask if error and increments - * NumberofDataProcessors - * @param ind self index - * @param dtype detector type - * @param f address of Fifo pointer - * @param act activated - * @param depaden deactivated padding enable - * @param dsEnable pointer to data stream enable - * @param dr pointer to dynamic range - * @param freq pointer to streaming frequency - * @param timer pointer to timer if streaming frequency is random - * @param sfnum pointer to streaming starting fnum - * @param fp pointer to frame padding enable - * @param sm pointer to silent mode - * @param qe pointer to quad Enable - * @param cdl pointer to vector or ctb digital bits enable - * @param cdo pointer to digital bits offset - * @param cad pointer to ctb analog databytes - */ - DataProcessor(int ind, detectorType dtype, Fifo *f, bool act, bool depaden, - bool *dsEnable, uint32_t *freq, uint32_t *timer, - uint32_t *sfnum, bool *fp, bool *sm, std::vector *cdl, - int *cdo, int *cad); + DataProcessor(int index, detectorType detectorType, Fifo *fifo, + bool *activated, bool *deactivatedPaddingEnable, + bool *dataStreamEnable, uint32_t *streamingFrequency, + uint32_t *streamingTimerInMs, uint32_t *streamingStartFnum, + bool *framePadding, std::vector *ctbDbitList, + int *ctbDbitOffset, int *ctbAnalogDataBytes, + std::mutex *hdf5Lib); - /** - * Destructor - * Calls Base Class DestroyThread() and decrements NumberofDataProcessors - */ ~DataProcessor() override; - //*** getters *** - - /** - * Get acquisition started flag - * @return acquisition started flag - */ bool GetStartedFlag(); - - /** - * Get Frames Complete Caught - * @return number of frames - */ uint64_t GetNumFramesCaught(); - - /** - * Gets Actual Current Frame Index (that has not been subtracted from - * firstIndex) thats been processed - * @return -1 if no frames have been caught, else current frame index - */ + /** (-1 if no frames have been caught */ uint64_t GetCurrentFrameIndex(); - - /** - * Get Current Frame Index thats been processed - * @return -1 if no frames have been caught, else current frame index - */ + /** (-1 if no frames have been caught) */ uint64_t GetProcessedIndex(); - /** - * Set Fifo pointer to the one given - * @param f address of Fifo pointer - */ void SetFifo(Fifo *f); - - /** - * Reset parameters for new acquisition - */ void ResetParametersforNewAcquisition(); + void SetGeneralData(GeneralData *generalData); - /** - * Set GeneralData pointer to the one given - * @param g address of GeneralData (Detector Data) pointer - */ - void SetGeneralData(GeneralData *g); + void DeleteFiles(); + void SetupFileWriter(const bool filewriteEnable, + const bool masterFilewriteEnable, + const fileFormat fileFormatType, const int modulePos); + + void CreateFirstFiles(MasterAttributes *attr, const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, + const bool silentMode, const int modulePos, + const int numUnitsPerReadout, + const uint32_t udpPortNumber, + const uint32_t maxFramesPerFile, + const uint64_t numImages, const uint32_t nPIxelsX, + const uint32_t nPIxelsY, const uint32_t dynamicRange); /** * Call back for raw data @@ -125,10 +86,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { void *arg); private: - /** - * Record First Index - * @param fnum frame index to record - */ void RecordFirstIndex(uint64_t fnum); /** @@ -141,14 +98,12 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { /** * Frees dummy buffer, * reset running mask by calling StopRunning() - * @param buf address of pointer */ void StopProcessing(char *buf); /** * Process an image popped from fifo, * write to file if fw enabled & update parameters - * @param buf address of pointer * @returns frame number */ uint64_t ProcessAnImage(char *buf); @@ -174,10 +129,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { */ bool CheckCount(); - /** - * Pad Missing Packets from the bit mask - * @param buf buffer - */ void PadMissingPackets(char *buf); /** @@ -186,75 +137,40 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject { */ void RearrangeDbitData(char *buf); - /** type of thread */ - static const std::string TypeName; + static const std::string typeName_; - /** GeneralData (Detector Data) object */ - const GeneralData *generalData{nullptr}; - - /** Fifo structure */ - Fifo *fifo; - - // individual members - /** Detector Type */ - detectorType myDetectorType; - - /** Data Stream Enable */ - bool *dataStreamEnable; - - /** Activated/Deactivated */ - bool activated; - - /** Deactivated padding enable */ - bool deactivatedPaddingEnable; - - /** Pointer to Streaming frequency, if 0, sending random images with a timer - */ - uint32_t *streamingFrequency; - - /** Pointer to the timer if Streaming frequency is random */ - uint32_t *streamingTimerInMs; - - /** Pointer to streaming starting fnum */ - uint32_t *streamingStartFnum; - - /** Current frequency count */ - uint32_t currentFreqCount{0}; - - /** timer beginning stamp for random streaming */ - struct timespec timerBegin; - - /** Silent Mode */ - bool *silentMode; - - /** frame padding */ - bool *framePadding; - - /** ctb digital bits enable list */ - std::vector *ctbDbitList; - - /** ctb digital bits offset */ - int *ctbDbitOffset; - - /** ctb analog databytes */ - int *ctbAnalogDataBytes; - - // acquisition start - /** Aquisition Started flag */ - std::atomic startedFlag{false}; - - /** Frame Number of First Frame */ - std::atomic firstIndex{0}; + const GeneralData *generalData_{nullptr}; + Fifo *fifo_; + detectorType detectorType_; + bool *dataStreamEnable_; + bool *activated_; + bool *deactivatedPaddingEnable_; + /** if 0, sending random images with a timer */ + uint32_t *streamingFrequency_; + uint32_t *streamingTimerInMs_; + uint32_t *streamingStartFnum_; + uint32_t currentFreqCount_{0}; + struct timespec timerbegin_; + bool *framePadding_; + std::vector *ctbDbitList_; + int *ctbDbitOffset_; + int *ctbAnalogDataBytes_; + std::atomic startedFlag_{false}; + std::atomic firstIndex_{0}; // for statistics /** Number of complete frames caught */ - uint64_t numFramesCaught{0}; + uint64_t numFramesCaught_{0}; /** Frame Number of latest processed frame number */ - std::atomic currentFrameIndex{0}; + std::atomic currentFrameIndex_{0}; /** first streamer frame to add frame index in fifo header */ - bool firstStreamerFrame{false}; + bool firstStreamerFrame_{false}; + + File *dataFile_{nullptr}; + File *masterFile_{nullptr}; + std::mutex *hdf5Lib_; // call back /** diff --git a/slsReceiverSoftware/src/File.cpp b/slsReceiverSoftware/src/File.cpp index c15a6d604..caa5ea93a 100644 --- a/slsReceiverSoftware/src/File.cpp +++ b/slsReceiverSoftware/src/File.cpp @@ -2,8 +2,8 @@ #include -File::File(slsDetectorDefs::fileFormat type) : type_(type) {} +File::File(const slsDetectorDefs::fileFormat format) : format_(format) {} File::~File() {} -slsDetectorDefs::fileFormat File::GetFileType() { return type_; } +slsDetectorDefs::fileFormat File::GetFileFormat() const { return format_; } diff --git a/slsReceiverSoftware/src/File.h b/slsReceiverSoftware/src/File.h index 32f8b65d3..e0708dc80 100644 --- a/slsReceiverSoftware/src/File.h +++ b/slsReceiverSoftware/src/File.h @@ -1,5 +1,6 @@ #pragma once +#include "sls/logger.h" #include "sls/sls_detector_defs.h" struct MasterAttributes; @@ -7,36 +8,60 @@ struct MasterAttributes; class File : private virtual slsDetectorDefs { public: - File(slsDetectorDefs::fileFormat type); + File(const slsDetectorDefs::fileFormat format); virtual ~File(); - fileFormat GetFileType(); - virtual uint32_t GetFilesInAcquisition() = 0; + fileFormat GetFileFormat() const; virtual void CloseFile() = 0; - virtual void CreateMasterFile(std::string filePath, - std::string fileNamePrefix, - uint64_t fileIndex, bool overWriteEnable, - bool silentMode, MasterAttributes *attr) = 0; + virtual uint32_t GetFilesInAcquisition() const { + LOG(logERROR) + << "This is a generic function GetFilesInAcquisition that " + "should be overloaded by a derived class"; + return 0; + }; - virtual void - CreateFirstBinaryDataFile(std::string filePath, std::string fileNamePrefix, - uint64_t fileIndex, bool overWriteEnable, - bool silentMode, int detIndex, - int numUnitsPerDetector, uint32_t udpPortNumber, - uint32_t maxFramesPerFile) = 0; + virtual void CreateMasterFile(const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, + const bool overWriteEnable, + const bool silentMode, + MasterAttributes *attr) { + LOG(logERROR) << "This is a generic function CreateMasterFile that " + "should be overloaded by a derived class"; + }; + + virtual void CreateFirstBinaryDataFile( + const std::string filePath, const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, + const bool silentMode, const int modulePos, + const int numUnitsPerReadout, const uint32_t udpPortNumber, + const uint32_t maxFramesPerFile) { + LOG(logERROR) + << "This is a generic function CreateFirstBinaryDataFile that " + "should be overloaded by a derived class"; + }; virtual void CreateFirstHDF5DataFile( - std::string filePath, std::string fileNamePrefix, uint64_t fileIndex, - bool overWriteEnable, bool silentMode, int detIndex, - int numUnitsPerDetector, uint32_t udpPortNumber, - uint32_t maxFramesPerFile, uint64_t numImages, uint32_t nPIxelsX, - uint32_t nPIxelsY, uint32_t dynamicRange) = 0; + const std::string filePath, const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, + const bool silentMode, const int modulePos, + const int numUnitsPerReadout, const uint32_t udpPortNumber, + const uint32_t maxFramesPerFile, const uint64_t numImages, + const uint32_t nPIxelsX, const uint32_t nPIxelsY, + const uint32_t dynamicRange) { + LOG(logERROR) + << "This is a generic function CreateFirstHDF5DataFile that " + "should be overloaded by a derived class"; + }; - virtual void WriteToFile(char *buffer, int buffersize, - uint64_t currentFrameNumber, - uint32_t numPacketsCaught) = 0; + virtual void WriteToFile(char *buffer, const int buffersize, + const uint64_t currentFrameNumber, + const uint32_t numPacketsCaught) { + LOG(logERROR) << "This is a generic function WriteToFile that " + "should be overloaded by a derived class"; + }; protected: - slsDetectorDefs::fileFormat type_; + slsDetectorDefs::fileFormat format_; }; diff --git a/slsReceiverSoftware/src/HDF5DataFile.cpp b/slsReceiverSoftware/src/HDF5DataFile.cpp index dfa225a5f..a33b86039 100644 --- a/slsReceiverSoftware/src/HDF5DataFile.cpp +++ b/slsReceiverSoftware/src/HDF5DataFile.cpp @@ -1,6 +1,5 @@ #include "HDF5DataFile.h" #include "receiver_defs.h" -#include "sls/logger.h" #include @@ -34,7 +33,7 @@ HDF5DataFile::HDF5DataFile(int index, std::mutex *hdf5Lib) HDF5DataFile::~HDF5DataFile() { CloseFile(); } -uint32_t HDF5DataFile::GetFilesInAcquisition() { +uint32_t HDF5DataFile::GetFilesInAcquisition() const { return numFilesInAcquisition_; } @@ -70,11 +69,12 @@ void HDF5DataFile::CloseFile() { } void HDF5DataFile::CreateFirstHDF5DataFile( - std::string filePath, std::string fileNamePrefix, uint64_t fileIndex, - bool overWriteEnable, bool silentMode, int detIndex, - int numUnitsPerDetector, uint32_t udpPortNumber, uint32_t maxFramesPerFile, - uint64_t numImages, uint32_t nPIxelsX, uint32_t nPIxelsY, - uint32_t dynamicRange) { + const std::string filePath, const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, const bool silentMode, + const int modulePos, const int numUnitsPerReadout, + const uint32_t udpPortNumber, const uint32_t maxFramesPerFile, + const uint64_t numImages, const uint32_t nPIxelsX, const uint32_t nPIxelsY, + const uint32_t dynamicRange) { subFileIndex_ = 0; numFramesInFile_ = 0; @@ -92,8 +92,8 @@ void HDF5DataFile::CreateFirstHDF5DataFile( fileIndex_ = fileIndex; overWriteEnable_ = overWriteEnable; silentMode_ = silentMode; - detIndex_ = detIndex; - numUnitsPerDetector_ = numUnitsPerDetector; + detIndex_ = modulePos; + numUnitsPerReadout_ = numUnitsPerReadout; udpPortNumber_ = udpPortNumber; switch (dynamicRange_) { @@ -117,7 +117,7 @@ void HDF5DataFile::CreateFile() { std::ostringstream os; os << filePath_ << "/" << fileNamePrefix_ << "_d" - << (detIndex_ * numUnitsPerDetector_ + index_) << "_f" << subFileIndex_ + << (detIndex_ * numUnitsPerReadout_ + index_) << "_f" << subFileIndex_ << '_' << fileIndex_ << ".h5"; fileName_ = os.str(); @@ -211,9 +211,9 @@ void HDF5DataFile::CreateFile() { } } -void HDF5DataFile::WriteToFile(char *buffer, int bufferSize, - uint64_t currentFrameNumber, - uint32_t numPacketsCaught) { +void HDF5DataFile::WriteToFile(char *buffer, const int buffersize, + const uint64_t currentFrameNumber, + const uint32_t numPacketsCaught) { // check if maxframesperfile = 0 for infinite if (maxFramesPerFile_ && (numFramesInFile_ >= maxFramesPerFile_)) { @@ -233,7 +233,8 @@ void HDF5DataFile::WriteToFile(char *buffer, int bufferSize, WriteParameterDatasets(currentFrameNumber, (sls_receiver_header *)(buffer)); } -void HDF5DataFile::WriteDataFile(uint64_t currentFrameNumber, char *buffer) { +void HDF5DataFile::WriteDataFile(const uint64_t currentFrameNumber, + char *buffer) { std::lock_guard lock(*hdf5Lib_); uint64_t nDimx = @@ -260,7 +261,7 @@ void HDF5DataFile::WriteDataFile(uint64_t currentFrameNumber, char *buffer) { } } -void HDF5DataFile::WriteParameterDatasets(uint64_t currentFrameNumber, +void HDF5DataFile::WriteParameterDatasets(const uint64_t currentFrameNumber, sls_receiver_header *rheader) { std::lock_guard lock(*hdf5Lib_); diff --git a/slsReceiverSoftware/src/HDF5DataFile.h b/slsReceiverSoftware/src/HDF5DataFile.h index 10e1c51a5..6887a62d0 100644 --- a/slsReceiverSoftware/src/HDF5DataFile.h +++ b/slsReceiverSoftware/src/HDF5DataFile.h @@ -12,29 +12,30 @@ using namespace H5; class HDF5DataFile : private virtual slsDetectorDefs, public File { public: - HDF5DataFile(int index, std::mutex *hdf5Lib); + HDF5DataFile(const int index, std::mutex *hdf5Lib); ~HDF5DataFile(); - uint32_t GetFilesInAcquisition() override; + uint32_t GetFilesInAcquisition() const override; void CloseFile() override; - void CreateFirstHDF5DataFile(std::string filePath, - std::string fileNamePrefix, uint64_t fileIndex, - bool overWriteEnable, bool silentMode, - int detIndex, int numUnitsPerDetector, - uint32_t udpPortNumber, - uint32_t maxFramesPerFile, uint64_t numImages, - uint32_t nPIxelsX, uint32_t nPIxelsY, - uint32_t dynamicRange) override; + void CreateFirstHDF5DataFile( + const std::string filePath, const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, + const bool silentMode, const int modulePos, + const int numUnitsPerReadout, const uint32_t udpPortNumber, + const uint32_t maxFramesPerFile, const uint64_t numImages, + const uint32_t nPIxelsX, const uint32_t nPIxelsY, + const uint32_t dynamicRange) override; - void WriteToFile(char *buffer, int buffersize, uint64_t currentFrameNumber, - uint32_t numPacketsCaught) override; + void WriteToFile(char *buffer, const int buffersize, + const uint64_t currentFrameNumber, + const uint32_t numPacketsCaught) override; private: void CreateFile(); - void WriteDataFile(uint64_t currentFrameNumber, char *buffer); - void WriteParameterDatasets(uint64_t currentFrameNumber, + void WriteDataFile(const uint64_t currentFrameNumber, char *buffer); + void WriteParameterDatasets(const uint64_t currentFrameNumber, sls_receiver_header *rheader); void ExtendDataset(); @@ -67,6 +68,6 @@ class HDF5DataFile : private virtual slsDetectorDefs, public File { bool overWriteEnable_{false}; bool silentMode_{false}; int detIndex_{0}; - int numUnitsPerDetector_{0}; + int numUnitsPerReadout_{0}; uint32_t udpPortNumber_{0}; }; \ No newline at end of file diff --git a/slsReceiverSoftware/src/HDF5MasterFile.cpp b/slsReceiverSoftware/src/HDF5MasterFile.cpp index 8cbd143fc..c125c7f6d 100644 --- a/slsReceiverSoftware/src/HDF5MasterFile.cpp +++ b/slsReceiverSoftware/src/HDF5MasterFile.cpp @@ -1,6 +1,5 @@ #include "HDF5MasterFile.h" #include "MasterAttributes.h" -#include "sls/logger.h" HDF5MasterFile::HDF5MasterFile(std::mutex *hdf5Lib) : File(HDF5), hdf5Lib_(hdf5Lib) {} @@ -22,10 +21,12 @@ void HDF5MasterFile::CloseFile() { } } -void HDF5MasterFile::CreateMasterFile(std::string filePath, - std::string fileNamePrefix, - uint64_t fileIndex, bool overWriteEnable, - bool silentMode, MasterAttributes *attr) { +void HDF5MasterFile::CreateMasterFile(const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, + const bool overWriteEnable, + const bool silentMode, + MasterAttributes *attr) { std::ostringstream os; os << filePath << "/" << fileNamePrefix << "_master" diff --git a/slsReceiverSoftware/src/HDF5MasterFile.h b/slsReceiverSoftware/src/HDF5MasterFile.h index a52afd700..ca731c4b4 100644 --- a/slsReceiverSoftware/src/HDF5MasterFile.h +++ b/slsReceiverSoftware/src/HDF5MasterFile.h @@ -16,9 +16,11 @@ class HDF5MasterFile : private virtual slsDetectorDefs, public File { ~HDF5MasterFile(); void CloseFile() override; - void CreateMasterFile(std::string filePath, std::string fileNamePrefix, - uint64_t fileIndex, bool overWriteEnable, - bool silentMode, MasterAttributes *attr) override; + void CreateMasterFile(const std::string filePath, + const std::string fileNamePrefix, + const uint64_t fileIndex, const bool overWriteEnable, + const bool silentMode, + MasterAttributes *attr) override; private: std::mutex *hdf5Lib_; diff --git a/slsReceiverSoftware/src/HDF5VirtualFile.cpp b/slsReceiverSoftware/src/HDF5VirtualFile.cpp index 6438c46d1..43e3718f2 100644 --- a/slsReceiverSoftware/src/HDF5VirtualFile.cpp +++ b/slsReceiverSoftware/src/HDF5VirtualFile.cpp @@ -1,5 +1,4 @@ #include "HDF5VirtualFile.h" -#include "sls/logger.h" HDF5VirtualFile::HDF5VirtualFile(std::mutex *hdf5Lib) : File(HDF5), hdf5Lib_(hdf5Lib) {} diff --git a/slsReceiverSoftware/src/Implementation.cpp b/slsReceiverSoftware/src/Implementation.cpp index f3162ba5d..907ff0dfd 100644 --- a/slsReceiverSoftware/src/Implementation.cpp +++ b/slsReceiverSoftware/src/Implementation.cpp @@ -169,11 +169,11 @@ void Implementation::setDetectorType(const detectorType d) { &actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode, &activated, &deactivatedPaddingEnable, &silentMode)); dataProcessor.push_back(sls::make_unique( - i, myDetectorType, fifo_ptr, activated, - deactivatedPaddingEnable, &dataStreamEnable, + i, myDetectorType, fifo_ptr, &activated, + &deactivatedPaddingEnable, &dataStreamEnable, &streamingFrequency, &streamingTimerInMs, &streamingStartFnum, - &framePadding, &silentMode, &ctbDbitList, &ctbDbitOffset, - &ctbAnalogDataBytes)); + &framePadding, &ctbDbitList, &ctbDbitOffset, + &ctbAnalogDataBytes, &hdf5Lib)); } catch (...) { listener.clear(); dataProcessor.clear(); @@ -236,8 +236,8 @@ void Implementation::setModulePositionId(const int id) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) { /*dataProcessor[i]->SetupFileWriter( - fileFormatType, fileWriteEnable, masterFileWriteEnable, activated, - deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, + fileFormatType, fileWriteEnable, masterFileWriteEnable, &activated, + &deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, &fileIndex, &overwriteEnable, &modulePos, &numThreads, &numberOfTotalFrames, &dynamicRange, &udpPortNum[i], generalData);*/ } @@ -348,7 +348,7 @@ void Implementation::setFileFormat(const fileFormat f) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) { /*dataProcessor[i]->SetupFileWriter( fileFormatType, fileWriteEnable, masterFileWriteEnable, - activated, deactivatedPaddingEnable, (int *)numDet, + &activated, &deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, &fileIndex, &overwriteEnable, &modulePos, &numThreads, &numberOfTotalFrames, &dynamicRange, &udpPortNum[i], @@ -392,7 +392,7 @@ void Implementation::setFileWriteEnable(const bool b) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) { /*dataProcessor[i]->SetupFileWriter( fileFormatType, fileWriteEnable, masterFileWriteEnable, - activated, deactivatedPaddingEnable, (int *)numDet, + &activated, &deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, &fileIndex, &overwriteEnable, &modulePos, &numThreads, &numberOfTotalFrames, &dynamicRange, &udpPortNum[i], generalData);*/ @@ -412,7 +412,7 @@ void Implementation::setMasterFileWriteEnable(const bool b) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) { /*dataProcessor[i]->SetupFileWriter( fileFormatType, fileWriteEnable, masterFileWriteEnable, - activated, deactivatedPaddingEnable, (int *)numDet, + &activated, &deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, &fileIndex, &overwriteEnable, &modulePos, &numThreads, &numberOfTotalFrames, &dynamicRange, &udpPortNum[i], generalData);*/ @@ -908,11 +908,11 @@ void Implementation::setNumberofUDPInterfaces(const int n) { listener[i]->SetGeneralData(generalData); dataProcessor.push_back(sls::make_unique( - i, myDetectorType, fifo_ptr, activated, - deactivatedPaddingEnable, &dataStreamEnable, + i, myDetectorType, fifo_ptr, &activated, + &deactivatedPaddingEnable, &dataStreamEnable, &streamingFrequency, &streamingTimerInMs, - &streamingStartFnum, &framePadding, &silentMode, - &ctbDbitList, &ctbDbitOffset, &ctbAnalogDataBytes)); + &streamingStartFnum, &framePadding, &ctbDbitList, + &ctbDbitOffset, &ctbAnalogDataBytes, &hdf5Lib)); dataProcessor[i]->SetGeneralData(generalData); } catch (...) { listener.clear(); @@ -1553,7 +1553,7 @@ bool Implementation::setActivate(bool enable) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) { /*dataProcessor[i]->SetupFileWriter( fileFormatType, fileWriteEnable, masterFileWriteEnable, - activated, deactivatedPaddingEnable, (int *)numDet, + &activated, &deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, &fileIndex, &overwriteEnable, &modulePos, &numThreads, &numberOfTotalFrames, &dynamicRange, &udpPortNum[i], generalData);*/ @@ -1575,7 +1575,7 @@ void Implementation::setDeactivatedPadding(bool enable) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) { ; /*dataProcessor[i]->SetupFileWriter( fileFormatType, fileWriteEnable, masterFileWriteEnable, - activated, deactivatedPaddingEnable, (int *)numDet, + &activated, &deactivatedPaddingEnable, (int *)numDet, &framesPerFile, &fileName, &filePath, &fileIndex, &overwriteEnable, &modulePos, &numThreads, &numberOfTotalFrames, &dynamicRange, &udpPortNum[i], diff --git a/slsReceiverSoftware/src/Implementation.h b/slsReceiverSoftware/src/Implementation.h index 1a82e1c03..77a5b7c29 100644 --- a/slsReceiverSoftware/src/Implementation.h +++ b/slsReceiverSoftware/src/Implementation.h @@ -15,6 +15,7 @@ class slsDetectorDefs; #include #include #include +#include #include using ns = std::chrono::nanoseconds; @@ -349,7 +350,7 @@ class Implementation : private virtual slsDetectorDefs { bool deactivatedPaddingEnable{true}; int numLinesReadout{MAX_EIGER_ROWS_PER_READOUT}; int thresholdEnergyeV{-1}; - std::array thresholdAllEnergyeV={{-1, -1, -1}}; + std::array thresholdAllEnergyeV = {{-1, -1, -1}}; std::vector rateCorrections; readoutMode readoutType{ANALOG_ONLY}; uint32_t adcEnableMaskOneGiga{BIT32_MASK}; @@ -375,4 +376,6 @@ class Implementation : private virtual slsDetectorDefs { std::vector> dataProcessor; std::vector> dataStreamer; std::vector> fifo; + + std::mutex hdf5Lib; };