This commit is contained in:
maliakal_d 2021-07-01 19:21:33 +02:00
parent eff15b3f89
commit 4422ce61aa

View File

@ -676,7 +676,7 @@ void Implementation::closeFiles() {
uint64_t maxIndexCaught = 0; uint64_t maxIndexCaught = 0;
bool anycaught = false; bool anycaught = false;
for (const auto &it : dataProcessor) { for (const auto &it : dataProcessor) {
/*it->CloseFiles();*/ it->CloseFiles();
maxIndexCaught = std::max(maxIndexCaught, it->GetProcessedIndex()); maxIndexCaught = std::max(maxIndexCaught, it->GetProcessedIndex());
if (it->GetStartedFlag()) if (it->GetStartedFlag())
anycaught = true; anycaught = true;
@ -721,7 +721,8 @@ void Implementation::CreateUDPSockets() {
void Implementation::SetupWriter() { void Implementation::SetupWriter() {
// master file // master file
if (masterFileWriteEnable) { std::unique_ptr<MasterAttributes> masterAttributes;
if (masterFileWriteEnable && modulePos == 0) {
std::unique_ptr<MasterAttributes> masterAttributes; std::unique_ptr<MasterAttributes> masterAttributes;
switch (detType) { switch (detType) {
case GOTTHARD: case GOTTHARD:
@ -799,20 +800,15 @@ void Implementation::SetupWriter() {
masterAttributes->gateDelay3 = gateDelay3; masterAttributes->gateDelay3 = gateDelay3;
masterAttributes->gates = numberOfGates; masterAttributes->gates = numberOfGates;
masterAttributes->additionalJsonHeader = additionalJsonHeader; masterAttributes->additionalJsonHeader = additionalJsonHeader;
try {
/*dataProcessor[0]->CreateMasterFile(masterAttributes.get());*/
} catch (const sls::RuntimeError &e) {
shutDownUDPSockets();
closeFiles();
throw sls::RuntimeError("Could not create master file.");
}
} }
// first data file
//->startofacquisition(which has all the start, and createfirstdatafile)
try { try {
for (unsigned int i = 0; i < dataProcessor.size(); ++i) { for (unsigned int i = 0; i < dataProcessor.size(); ++i) {
/*dataProcessor[i]->CreateFirstDataFile();*/ dataProcessor[i]->CreateFirstFiles(
masterAttributes.get(), filePath, fileName, fileIndex,
overwriteEnable, silentMode, modulePos, numThreads,
udpPortNum[i], framesPerFile, numberOfTotalFrames,
dynamicRange);
} }
} catch (const sls::RuntimeError &e) { } catch (const sls::RuntimeError &e) {
shutDownUDPSockets(); shutDownUDPSockets();
@ -1353,8 +1349,6 @@ void Implementation::setNumberofAnalogSamples(const uint32_t i) {
numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable, numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable,
readoutType); readoutType);
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "Number of Analog Samples: " << numberOfAnalogSamples; LOG(logINFO) << "Number of Analog Samples: " << numberOfAnalogSamples;
@ -1374,8 +1368,6 @@ void Implementation::setNumberofDigitalSamples(const uint32_t i) {
numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable, numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable,
readoutType); readoutType);
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "Number of Digital Samples: " << numberOfDigitalSamples; LOG(logINFO) << "Number of Digital Samples: " << numberOfDigitalSamples;
@ -1395,9 +1387,6 @@ void Implementation::setCounterMask(const uint32_t i) {
counterMask = i; counterMask = i;
generalData->SetNumberofCounters(ncounters, dynamicRange, generalData->SetNumberofCounters(ncounters, dynamicRange,
tengigaEnable); tengigaEnable);
// to update npixelsx, npixelsy in file writer
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "Counter mask: " << sls::ToStringHex(counterMask); LOG(logINFO) << "Counter mask: " << sls::ToStringHex(counterMask);
@ -1420,9 +1409,6 @@ void Implementation::setDynamicRange(const uint32_t i) {
generalData->SetNumberofCounters(ncounters, i, tengigaEnable); generalData->SetNumberofCounters(ncounters, i, tengigaEnable);
} }
// to update npixelsx, npixelsy in file writer
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
fifoDepth = generalData->defaultFifoDepth; fifoDepth = generalData->defaultFifoDepth;
SetupFifoStructure(); SetupFifoStructure();
} }
@ -1440,8 +1426,6 @@ void Implementation::setROI(slsDetectorDefs::ROI arg) {
// only for gotthard // only for gotthard
generalData->SetROI(arg); generalData->SetROI(arg);
framesPerFile = generalData->maxFramesPerFile; framesPerFile = generalData->maxFramesPerFile;
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
@ -1576,8 +1560,6 @@ void Implementation::setReadoutMode(const readoutMode f) {
tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga, tengigaEnable ? adcEnableMaskTenGiga : adcEnableMaskOneGiga,
numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable, numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable,
readoutType); readoutType);
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "Readout Mode: " << sls::ToString(f); LOG(logINFO) << "Readout Mode: " << sls::ToString(f);
@ -1596,8 +1578,6 @@ void Implementation::setADCEnableMask(uint32_t mask) {
numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable, numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable,
readoutType); readoutType);
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "ADC Enable Mask for 1Gb mode: 0x" << std::hex LOG(logINFO) << "ADC Enable Mask for 1Gb mode: 0x" << std::hex
@ -1618,8 +1598,6 @@ void Implementation::setTenGigaADCEnableMask(uint32_t mask) {
numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable, numberOfAnalogSamples, numberOfDigitalSamples, tengigaEnable,
readoutType); readoutType);
for (const auto &it : dataProcessor)
; /*it->SetPixelDimension();*/
SetupFifoStructure(); SetupFifoStructure();
} }
LOG(logINFO) << "ADC Enable Mask for 10Gb mode: 0x" << std::hex LOG(logINFO) << "ADC Enable Mask for 10Gb mode: 0x" << std::hex