187 const math_utils::StatisticsData
data = getStatisticsData();
188 LOGP(info,
"\n Entries: {}", mBinCount);
189 LOGP(info,
"Truncated Mean: {}",
data.mCOG);
190 LOGP(info,
"Standard Deviation: {}",
data.mStdDev);
191 LOGP(info,
"sum of content: {}",
data.mSum);
193 const int maxEle = *std::max_element(mBinCont.begin(), mBinCont.end());
202 for (
int i = 2;
i <= maxEle; ++
i) {
206 LOGP(info,
"{}",
stream.str());
207 stream.str(std::string());
209 for (
int i = 0;
i <= maxEle; ++
i) {
212 LOGP(info,
"{}",
stream.str());
214 const float binWidth = getBinWidth();
215 const int totalBins = mBinCont.size();
217 for (
int i = 0;
i < totalBins; ++
i) {
218 stream.str(std::string());
219 if (
i == 0 && mUseUnderflow) {
221 stream << std::right <<
"U_Flow | ";
222 }
else if (
i == totalBins - 1 && mUseOverflow) {
224 stream << std::right <<
"O_Flow | ";
227 const float xPos = mXmin + binWidth * (
i - mUseUnderflow);
228 stream << std::fixed << std::setprecision(prec) << xPos;
229 const std::string sIn =
" | ";
233 for (
int j = 1;
j <= getBinContent(
i); ++
j) {
234 const std::string sIn =
"x ";
237 std::string xPosString =
stream.str();
238 LOGP(info,
"{}", xPosString);
246 math_utils::StatisticsData
data{};
249 if (mBinCont.size() == 0) {
257 const T integral = std::accumulate(mBinCont.begin(), mBinCont.end(), 0);
261 const float lowerBound = integral * low;
262 const float upperBound = integral * high;
263 const unsigned int lastBin = mBinCont.size() - 1;
270 const float binWidth = getBinWidth();
271 const int shiftBin = mUseUnderflow ? -1 : 0;
274 bool isLowerFrac =
false;
275 unsigned int bin = 0;
276 for (bin = 0; bin <= lastBin; ++bin) {
277 countContent += mBinCont[bin];
279 if (countContent - lowerBound <= 0) {
281 }
else if (countContent >= upperBound) {
285 const float xcenter = mXmin + (bin + 0.5f + shiftBin) * binWidth;
286 const float tmpBinCont = isLowerFrac ? mBinCont[bin] : countContent - lowerBound;
287 const float tmpMean = tmpBinCont * xcenter;
290 rms2 += tmpMean * xcenter;
294 if (!checkBin(bin)) {
300 const float xcenter = mXmin + (bin + 0.5f + shiftBin) * binWidth;
301 const T upFrac = mBinCont[bin] - (
static_cast<float>(countContent) - upperBound);
302 const float tmpMean = upFrac * xcenter;
305 rms2 += tmpMean * xcenter;
314 data.mStdDev = std::sqrt(std::abs(rms2 - mean * mean));
348 if (
other.mBinCount == 0) {
353 if (mNBins !=
other.mNBins || mXmin !=
other.mXmin || mXmax !=
other.mXmax || mUseUnderflow !=
other.mUseUnderflow || mUseOverflow !=
other.mUseOverflow) {
354 static int errCount = 0;
355 if (mBinCount && errCount < 10) {
357 LOGP(warning,
"mBinCount {} other.mBinCount: {} mNBins {}, other.mNBins {}, mXmin {}, other.mXmin {}, mXmax {}, other.mXmax {}, mUseUnderflow {}, other.mUseUnderflow {}, mUseOverflow {}, other.mUseOverflow {}", mBinCount,
other.mBinCount, mNBins,
other.mNBins, mXmin,
other.mXmin, mXmax,
other.mXmax, mUseUnderflow,
other.mUseUnderflow, mUseOverflow,
other.mUseOverflow);
362 mBinCount +=
other.mBinCount;
363 std::transform(mBinCont.begin(), mBinCont.end(),
other.mBinCont.begin(), mBinCont.begin(), std::plus<T>());