Weighted filling of RHist and RBinWithError bin content type.
#include <cstddef>
#include <iostream>
#include <random>
#include <variant>
{
auto &axis = std::get<ROOT::Experimental::RRegularAxis>(hist.
GetAxes()[0]);
std::cout << "\n";
for (int row = 15; row > 0; row--) {
static constexpr int Scale = 100;
std::cout << (
value >= (row * Scale) ?
'*' :
' ');
};
std::cout << '|';
for (auto bin : axis.GetNormalRange()) {
print(bin);
}
std::cout << '|';
std::cout << "\n";
}
}
{
std::normal_distribution
normal(10.0, 5.0);
for (std::size_t i = 0; i < 25000; i++) {
}
std::cout <<
"hist1 with expected mean = " <<
normal.mean() <<
"\n";
std::cout << "\n";
std::cout << "hist2 with distorted normal distribution\n";
std::cout << "\n";
for (std::size_t i = 0; i < 25000; i++) {
}
std::cout << "bin errors of hist3 (not to scale)\n";
for (int row = 15; row > 0; row--) {
auto error = std::sqrt(
hist3.GetBinContent(bin).fSum2);
static constexpr int Scale = 5;
std::cout << (error >= (row * Scale) ? '*' : ' ');
};
std::cout << '|';
for (auto bin : axis.GetNormalRange()) {
print(bin);
}
std::cout << '|';
std::cout << "\n";
}
}
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
A bin index with special values for underflow and overflow bins.
static RBinIndex Overflow()
static RBinIndex Underflow()
A histogram for aggregation of data along multiple dimensions.
double ComputeMean(std::size_t dim=0) const
Compute the arithmetic mean of unbinned values.
double ComputeStdDev(std::size_t dim=0) const
Compute the standard deviation of unbinned values.
const BinContentType & GetBinContent(const std::array< RBinIndex, N > &indices) const
Get the content of a single bin.
const std::vector< RAxisVariant > & GetAxes() const
std::uint64_t GetNEntries() const
A regular axis with equidistant bins in the interval .
A weight for filling histograms.
hist1 with expected mean = 10
entries = 25000, mean = 9.99652, stddev = 4.99767
| |
| |
| |
| |
| |
| * |
| ******** |
| ************ |
| ***************** |
| ******************** |
*| ************************ |*
*| *************************** |*
*| ******************************** |*
*| *********************************** |*
*|****************************************|*
hist2 with distorted normal distribution
entries = 25000, mean = 13.2862, stddev = 4.69151
| |*
| |*
| * |*
| ******* |*
| ********** |*
| ************** |*
| *************** |*
| ***************** |*
| ******************** |*
| ************************ |*
| **************************|*
| ***************************|*
| *****************************|*
| *******************************|*
*| **********************************|*
bin errors of hist3 (not to scale)
| |*
| |*
| |*
| |*
| |*
| * * |*
| ************ * |*
| *************** |*
| *******************|*
| *********************|*
| ***********************|*
| ************************|*
| ***************************|*
| ******************************|*
*| **********************************|*