Conversion of RHist to TH1.
#include <cstddef>
#include <random>
void hist005_RHist_convert_TH1()
{
std::mt19937 gen;
std::normal_distribution normal(10.0, 4.0);
for (std::size_t i = 0; i < 1000; i++) {
hist.Fill(normal(gen));
}
std::cout << "hist with expected mean = " << normal.mean() << "\n";
std::cout << "\n";
auto *
c =
new TCanvas(
"c",
"", 10, 10, 900, 500);
}
A histogram for aggregation of data along multiple dimensions.
virtual Double_t GetStdDev(Int_t axis=1) const
Returns the Standard Deviation (Sigma).
virtual Double_t GetMean(Int_t axis=1) const
For axis = 1,2 or 3 returns the mean value of the histogram along X,Y or Z axis.
virtual Double_t GetEntries() const
Return the current number of entries.
virtual TH1 * DrawCopy(Option_t *option="", const char *name_postfix="_copy") const
Copy this histogram and Draw in the current pad.
std::unique_ptr< TH1I > ConvertToTH1I(const RHistEngine< int > &engine)
Convert a one-dimensional histogram to TH1I.
hist with expected mean = 10
entries = 1000, mean = 9.97154, stddev = 3.97326
- Date
- February 2026
- Author
- The ROOT Team
Definition in file hist005_RHist_convert_TH1.C.