14void hist003_TH1_draw()
18 auto *form1 =
new TFormula(
"form1",
"abs(sin(x)/x)");
19 double rangeMin = 0.0;
20 double rangeMax = 10.0;
21 auto *sqroot =
new TF1(
"sqroot",
"x*gaus(0) + [3]*form1", rangeMin, rangeMax);
22 sqroot->SetLineColor(4);
23 sqroot->SetLineWidth(6);
24 sqroot->SetParameters(10.0, 4.0, 1.0, 20.0);
27 auto *h1d =
new TH1D(
"h1d",
"Test random numbers", nBins, rangeMin, rangeMax);
29 h1d->FillRandom(
"sqroot", 10000);
36 auto *
c1 =
new TCanvas(
"c1",
"The FillRandom example", topX, topY, width, height);
40 auto *pad1 =
new TPad(
"pad1",
"The pad with the function", 0.05, 0.50, 0.95, 0.95);
41 auto *pad2 =
new TPad(
"pad2",
"The pad with the histogram", 0.05, 0.05, 0.95, 0.45);
51 pad1->GetFrame()->SetBorderMode(-1);
52 pad1->GetFrame()->SetBorderSize(5);
58 auto *lfunction =
new TPaveLabel(5, 39, 9.8, 46,
"The sqroot function");
64 pad2->GetFrame()->SetBorderMode(-1);
65 pad2->GetFrame()->SetBorderSize(5);
67 h1d->SetFillColor(45);
1-D histogram with a double per channel (see TH1 documentation)
The most important graphics class in the ROOT system.
A Pave (see TPave) with a text centered in the Pave.