Example of macro illustrating how to superimpose two histograms with different scales in the "same" pad.
void hist010_TH1_two_scales()
{
TH1D *
h1 =
new TH1D(
"h1",
"my histogram", 100, -3, 3);
for (int i = 0; i < 10000; i++)
TH1D *hint1 =
new TH1D(
"hint1",
"h1 bins integral", 100, -3, 3);
for (int i = 1; i <= 100; i++) {
sum +=
h1->GetBinContent(i);
}
double scale =
gPad->GetUymax() / rightmax;
}
virtual void SetLineColor(Color_t lcolor)
Set the line color.
void SetLabelColor(Int_t labelcolor)
1-D histogram with a double per channel (see TH1 documentation)
virtual Double_t GetMaximum(Double_t maxval=FLT_MAX) const
Return maximum value smaller than maxval of bins in the range, unless the value has been overridden b...
void Draw(Option_t *option="") override
Draw this histogram with options.
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual void Scale(Double_t c1=1, Option_t *option="")
Multiply this histogram by a constant c1.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
Random number generator class based on M.
virtual Double_t Gaus(Double_t mean=0, Double_t sigma=1)
Samples a random number from the standard Normal (Gaussian) Distribution with the given mean and sigm...
static uint64_t sum(uint64_t i)
- Date
- November 2024
- Author
- Rene Brun
Definition in file hist010_TH1_two_scales.C.