mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 00:58:01 +02:00
Merge branch 'developer' into dev/test_all_acquire_file
This commit is contained in:
@ -72,14 +72,6 @@ void DataProcessor::SetStreamingStartFnum(uint32_t value) {
|
||||
|
||||
void DataProcessor::SetFramePadding(bool enable) { framePadding = enable; }
|
||||
|
||||
void DataProcessor::SetCtbDbitList(std::vector<int> value) {
|
||||
ctbDbitList = value;
|
||||
}
|
||||
|
||||
void DataProcessor::SetCtbDbitOffset(int value) { ctbDbitOffset = value; }
|
||||
|
||||
void DataProcessor::SetCtbDbitReorder(bool value) { ctbDbitReorder = value; }
|
||||
|
||||
void DataProcessor::SetQuadEnable(bool value) { quadEnable = value; }
|
||||
|
||||
void DataProcessor::SetFlipRows(bool fd) {
|
||||
@ -303,7 +295,7 @@ void DataProcessor::ThreadExecution() {
|
||||
memImage->data);
|
||||
} catch (const std::exception &e) {
|
||||
fifo->FreeAddress(buffer);
|
||||
return;
|
||||
throw RuntimeError(e.what());
|
||||
}
|
||||
|
||||
// stream (if time/freq to stream) or free
|
||||
@ -361,13 +353,14 @@ void DataProcessor::ProcessAnImage(sls_receiver_header &header, size_t &size,
|
||||
PadMissingPackets(header, data);
|
||||
|
||||
// rearrange ctb digital bits
|
||||
if (!ctbDbitList.empty()) {
|
||||
if (!generalData->ctbDbitList.empty()) {
|
||||
ArrangeDbitData(size, data);
|
||||
} else if (ctbDbitReorder) {
|
||||
ctbDbitList.resize(64);
|
||||
} else if (generalData->ctbDbitReorder) {
|
||||
std::vector<int> ctbDbitList(64);
|
||||
std::iota(ctbDbitList.begin(), ctbDbitList.end(), 0);
|
||||
generalData->SetctbDbitList(ctbDbitList);
|
||||
ArrangeDbitData(size, data);
|
||||
} else if (ctbDbitOffset > 0) {
|
||||
} else if (generalData->ctbDbitOffset > 0) {
|
||||
RemoveTrailingBits(size, data);
|
||||
}
|
||||
|
||||
@ -542,6 +535,7 @@ void DataProcessor::RemoveTrailingBits(size_t &size, char *data) {
|
||||
const size_t nDigitalDataBytes = generalData->GetNumberOfDigitalDatabytes();
|
||||
const size_t nTransceiverDataBytes =
|
||||
generalData->GetNumberOfTransceiverDatabytes();
|
||||
const size_t ctbDbitOffset = generalData->ctbDbitOffset;
|
||||
|
||||
const size_t ctbDigitalDataBytes = nDigitalDataBytes - ctbDbitOffset;
|
||||
|
||||
@ -568,10 +562,14 @@ void DataProcessor::ArrangeDbitData(size_t &size, char *data) {
|
||||
std::to_string(generalData->detType));
|
||||
}
|
||||
|
||||
size_t nAnalogDataBytes = generalData->GetNumberOfAnalogDatabytes();
|
||||
size_t nDigitalDataBytes = generalData->GetNumberOfDigitalDatabytes();
|
||||
size_t nTransceiverDataBytes =
|
||||
const size_t nAnalogDataBytes = generalData->GetNumberOfAnalogDatabytes();
|
||||
const size_t nDigitalDataBytes = generalData->GetNumberOfDigitalDatabytes();
|
||||
const size_t nTransceiverDataBytes =
|
||||
generalData->GetNumberOfTransceiverDatabytes();
|
||||
const size_t ctbDbitOffset = generalData->ctbDbitOffset;
|
||||
const bool ctbDbitReorder = generalData->ctbDbitReorder;
|
||||
const auto ctbDbitList = generalData->ctbDbitList;
|
||||
|
||||
// TODO! (Erik) Refactor and add tests
|
||||
int ctbDigitalDataBytes = nDigitalDataBytes - ctbDbitOffset;
|
||||
|
||||
|
@ -45,9 +45,6 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
void SetStreamingTimerInMs(uint32_t value);
|
||||
void SetStreamingStartFnum(uint32_t value);
|
||||
void SetFramePadding(bool enable);
|
||||
void SetCtbDbitList(std::vector<int> value);
|
||||
void SetCtbDbitOffset(int value);
|
||||
void SetCtbDbitReorder(bool value);
|
||||
void SetQuadEnable(bool value);
|
||||
void SetFlipRows(bool fd);
|
||||
void SetNumberofTotalFrames(uint64_t value);
|
||||
@ -171,11 +168,8 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
uint32_t streamingTimerInMs;
|
||||
uint32_t streamingStartFnum;
|
||||
uint32_t currentFreqCount{0};
|
||||
struct timespec timerbegin {};
|
||||
struct timespec timerbegin{};
|
||||
bool framePadding;
|
||||
std::vector<int> ctbDbitList{};
|
||||
int ctbDbitOffset{0};
|
||||
bool ctbDbitReorder{true};
|
||||
std::atomic<bool> startedFlag{false};
|
||||
std::atomic<uint64_t> firstIndex{0};
|
||||
bool quadEnable{false};
|
||||
|
@ -52,6 +52,9 @@ class GeneralData {
|
||||
uint32_t nAnalogSamples{0};
|
||||
uint32_t nDigitalSamples{0};
|
||||
uint32_t nTransceiverSamples{0};
|
||||
std::vector<int> ctbDbitList{};
|
||||
int ctbDbitOffset{0};
|
||||
bool ctbDbitReorder{false};
|
||||
slsDetectorDefs::readoutMode readoutType{slsDetectorDefs::ANALOG_ONLY};
|
||||
uint32_t adcEnableMaskOneGiga{BIT32_MASK};
|
||||
uint32_t adcEnableMaskTenGiga{BIT32_MASK};
|
||||
@ -148,6 +151,18 @@ class GeneralData {
|
||||
virtual void SetTransceiverEnableMask(int n) {
|
||||
ThrowGenericError("SetTransceiverEnableMask");
|
||||
};
|
||||
|
||||
virtual void SetctbDbitOffset(const int n) {
|
||||
ThrowGenericError("SetctbDbitOffset");
|
||||
};
|
||||
|
||||
virtual void SetctbDbitList(const std::vector<int> &value) {
|
||||
ThrowGenericError("SetctbDbitList");
|
||||
};
|
||||
|
||||
virtual void SetctbDbitReorder(const bool reorder) {
|
||||
ThrowGenericError("SetctbDbitReorder");
|
||||
};
|
||||
};
|
||||
|
||||
class EigerData : public GeneralData {
|
||||
@ -387,6 +402,7 @@ class ChipTestBoardData : public GeneralData {
|
||||
framesPerFile = CTB_MAX_FRAMES_PER_FILE;
|
||||
fifoDepth = 2500;
|
||||
standardheader = true;
|
||||
ctbDbitReorder = true;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
@ -412,6 +428,12 @@ class ChipTestBoardData : public GeneralData {
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetctbDbitOffset(const int value) { ctbDbitOffset = value; }
|
||||
|
||||
void SetctbDbitList(const std::vector<int> &value) { ctbDbitList = value; }
|
||||
|
||||
void SetctbDbitReorder(const bool value) { ctbDbitReorder = value; }
|
||||
|
||||
void SetOneGigaAdcEnableMask(int n) {
|
||||
adcEnableMaskOneGiga = n;
|
||||
UpdateImageSize();
|
||||
@ -518,6 +540,7 @@ class XilinxChipTestBoardData : public GeneralData {
|
||||
dataSize = 8144;
|
||||
packetSize = headerSizeinPacket + dataSize;
|
||||
tengigaEnable = true;
|
||||
ctbDbitReorder = true;
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
@ -543,6 +566,12 @@ class XilinxChipTestBoardData : public GeneralData {
|
||||
UpdateImageSize();
|
||||
};
|
||||
|
||||
void SetctbDbitOffset(const int value) { ctbDbitOffset = value; }
|
||||
|
||||
void SetctbDbitList(const std::vector<int> &value) { ctbDbitList = value; }
|
||||
|
||||
void SetctbDbitReorder(const bool value) { ctbDbitReorder = value; }
|
||||
|
||||
void SetOneGigaAdcEnableMask(int n) {
|
||||
adcEnableMaskOneGiga = n;
|
||||
UpdateImageSize();
|
||||
|
@ -200,9 +200,6 @@ void Implementation::SetupDataProcessor(int i) {
|
||||
dataProcessor[i]->SetStreamingTimerInMs(streamingTimerInMs);
|
||||
dataProcessor[i]->SetStreamingStartFnum(streamingStartFnum);
|
||||
dataProcessor[i]->SetFramePadding(framePadding);
|
||||
dataProcessor[i]->SetCtbDbitList(ctbDbitList);
|
||||
dataProcessor[i]->SetCtbDbitOffset(ctbDbitOffset);
|
||||
dataProcessor[i]->SetCtbDbitReorder(ctbDbitReorder);
|
||||
dataProcessor[i]->SetQuadEnable(quadEnable);
|
||||
dataProcessor[i]->SetFlipRows(flipRows);
|
||||
dataProcessor[i]->SetNumberofTotalFrames(numberOfTotalFrames);
|
||||
@ -991,11 +988,11 @@ void Implementation::StartMasterWriter() {
|
||||
? 1
|
||||
: 0;
|
||||
masterAttributes.digitalSamples = generalData->nDigitalSamples;
|
||||
masterAttributes.dbitoffset = ctbDbitOffset;
|
||||
masterAttributes.dbitreorder = ctbDbitReorder;
|
||||
masterAttributes.dbitoffset = generalData->ctbDbitOffset;
|
||||
masterAttributes.dbitreorder = generalData->ctbDbitReorder;
|
||||
masterAttributes.dbitlist = 0;
|
||||
|
||||
for (auto &i : ctbDbitList) {
|
||||
for (auto &i : generalData->ctbDbitList) {
|
||||
masterAttributes.dbitlist |= (static_cast<uint64_t>(1) << i);
|
||||
}
|
||||
masterAttributes.transceiverSamples =
|
||||
@ -1751,31 +1748,29 @@ void Implementation::setTenGigaADCEnableMask(uint32_t mask) {
|
||||
LOG(logINFO) << "Packets per Frame: " << (generalData->packetsPerFrame);
|
||||
}
|
||||
|
||||
std::vector<int> Implementation::getDbitList() const { return ctbDbitList; }
|
||||
std::vector<int> Implementation::getDbitList() const {
|
||||
return generalData->ctbDbitList;
|
||||
}
|
||||
|
||||
void Implementation::setDbitList(const std::vector<int> &v) {
|
||||
ctbDbitList = v;
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetCtbDbitList(ctbDbitList);
|
||||
LOG(logINFO) << "Dbit list: " << ToString(ctbDbitList);
|
||||
generalData->SetctbDbitList(v);
|
||||
LOG(logINFO) << "Dbit list: " << ToString(v);
|
||||
}
|
||||
|
||||
int Implementation::getDbitOffset() const { return ctbDbitOffset; }
|
||||
int Implementation::getDbitOffset() const { return generalData->ctbDbitOffset; }
|
||||
|
||||
void Implementation::setDbitOffset(const int s) {
|
||||
ctbDbitOffset = s;
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetCtbDbitOffset(ctbDbitOffset);
|
||||
LOG(logINFO) << "Dbit offset: " << ctbDbitOffset;
|
||||
generalData->SetctbDbitOffset(s);
|
||||
LOG(logINFO) << "Dbit offset: " << s;
|
||||
}
|
||||
|
||||
bool Implementation::getDbitReorder() const { return ctbDbitReorder; }
|
||||
bool Implementation::getDbitReorder() const {
|
||||
return generalData->ctbDbitReorder;
|
||||
}
|
||||
|
||||
void Implementation::setDbitReorder(const bool reorder) {
|
||||
ctbDbitReorder = reorder;
|
||||
for (const auto &it : dataProcessor)
|
||||
it->SetCtbDbitReorder(ctbDbitReorder);
|
||||
LOG(logINFO) << "Dbit reorder: " << ctbDbitReorder;
|
||||
generalData->SetctbDbitReorder(reorder);
|
||||
LOG(logINFO) << "Dbit reorder: " << reorder;
|
||||
}
|
||||
|
||||
uint32_t Implementation::getTransceiverEnableMask() const {
|
||||
|
@ -370,9 +370,6 @@ class Implementation : private virtual slsDetectorDefs {
|
||||
int thresholdEnergyeV{-1};
|
||||
std::array<int, 3> thresholdAllEnergyeV = {{-1, -1, -1}};
|
||||
std::vector<int64_t> rateCorrections;
|
||||
std::vector<int> ctbDbitList;
|
||||
int ctbDbitOffset{0};
|
||||
bool ctbDbitReorder{true};
|
||||
|
||||
// callbacks
|
||||
void (*startAcquisitionCallBack)(const startCallbackHeader,
|
||||
|
Reference in New Issue
Block a user