26 lines
699 B
C++
26 lines
699 B
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
|
|
#include "ADUHistogram.h"
|
|
|
|
ADUHistogram::ADUHistogram() : histogram(ADU_HISTO_BIN_COUNT) {
|
|
|
|
}
|
|
|
|
void ADUHistogram::Add(const DeviceOutput &output) {
|
|
std::unique_lock<std::mutex> ul(m);
|
|
for (int i = 0; i < ADU_HISTO_BIN_COUNT; i++)
|
|
histogram[i] += output.adu_histogram[i];
|
|
}
|
|
|
|
const std::vector<uint64_t> &ADUHistogram::GetHistogram() const {
|
|
return histogram;
|
|
}
|
|
|
|
void ADUHistogram::GetPlot(JFJochProtoBuf::Plot &plot) const {
|
|
std::unique_lock<std::mutex> ul(m);
|
|
|
|
for (int i = 0; i < ADU_HISTO_BIN_COUNT; i++) {
|
|
plot.add_x(ADU_HISTO_BIN_WIDTH * i + ADU_HISTO_BIN_WIDTH / 2);
|
|
plot.add_y(histogram[i]);
|
|
}
|
|
} |