Drawing stack histograms on subpads.
In this example three histograms are displayed on separate pads. If canvas divided in advance - provided subpads will be used by the THStack.
void hstackpads()
{
auto hs =
new THStack(
"hs",
"Stacked 1D histograms");
auto h1st =
new TH1F(
"h1st",
"test hstack 1", 100, -4, 4);
h1st->FillRandom("gaus", 20000);
hs->Add(h1st);
auto h2st =
new TH1F(
"h2st",
"test hstack 2", 100, -4, 4);
h2st->FillRandom("gaus", 15000);
hs->Add(h2st);
auto h3st =
new TH1F(
"h3st",
"test hstack 3", 100, -4, 4);
h3st->FillRandom("gaus", 10000);
hs->Add(h3st);
auto c1 =
new TCanvas(
"c1",
"THStack drawing on pads", 800, 800);
}
1-D histogram with a float per channel (see TH1 documentation)
The Histogram stack class.
- Author
- Sergey Linev
Definition in file hstackpads.C.