Normalizing a Histogram.
Image produced by .x NormalizeHistogram.C Two different methods of normalizing histograms are shown, each with the original histogram. next to the normalized one. SUÁc␅
void hist009_TH1_normalize()
{
const std::array<double, 6> binsx{0, 5, 10, 20, 50, 100};
TH1D *orig =
new TH1D(
"orig",
"Original histogram before normalization", binsx.size() - 1, binsx.data());
gStyle->SetTitleFontSize(0.06);
for (int i = 0; i < 100000; ++i) {
double r = rand.
Rndm() * 100;
}
}
1-D histogram with a double per channel (see TH1 documentation)
void SetTitle(const char *title) override
Change/set the title.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual Double_t Integral(Option_t *option="") const
Return integral of bin contents.
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
TObject * Clone(const char *newname="") const override
Make a complete copy of the underlying object.
Random number generator class based on the maximally equidistributed combined Tausworthe generator by...
Double_t Rndm() override
TausWorth generator from L'Ecuyer, uses as seed 3x32bits integers Use a mask of 0xffffffffUL to make ...
- Date
- November 2024
- Author
- Advait Dhingra
Definition in file hist009_TH1_normalize.C.