84 std::fill(hist_.begin(), hist_.end(), 0);
87 std::fill(hist_buffer_.begin(), hist_buffer_.end(), 0);
90 std::fill(hist_hat_.begin(), hist_hat_.end(), 0.0f);
100 if (val < params_.data_sp || val >= params_.
data_ep) {
101 AERROR <<
"Input data to histogram: out-of-range";
107 int index = GetIndex(val);
117 std::fill(hist_.begin(), hist_.end(), 0);
118 val_cur_ = val_estimation_ = 0.0f;
121 const std::vector<uint32_t> &
get_hist()
const {
return hist_; }
137 int GetIndex(
float val)
const {
138 return static_cast<int>((val - params_.
data_sp) * step_bin_reversed_);
141 float GetValFromIndex(
int index)
const {
143 (
static_cast<float>(index) + 0.5f) * params_.
step_bin);
146 void Smooth(
const uint32_t *hist_input,
int nr_bins, uint32_t *hist_output);
148 bool IsGoodShape(
const uint32_t *hist,
int nr_bins,
int max_index);
150 void GetPeakIndexAndMass(
const uint32_t *hist,
int nr_bins,
int *index,
153 void Decay(uint32_t *hist,
int nr_bins) {
155 for (
int i = 0; i < nr_bins; ++i) {
156 hist[i] =
static_cast<uint32_t
>(
static_cast<float>(hist[i]) * df);
160 void GenerateHat(
float *hist_hat,
int nr_bins);
166 std::vector<uint32_t> hist_ = {};
167 std::vector<uint32_t> hist_buffer_ = {};
169 std::vector<float> hist_hat_ = {};
171 HistogramEstimatorParams params_;
173 float step_bin_reversed_ = 0.0f;
174 float val_cur_ = 0.0f;
175 float val_estimation_ = 0.0f;