ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
hist024_THStack_pads.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_hist
3
/// \notebook
4
/// \preview Drawing stack histograms on subpads.
5
///
6
/// In this example three histograms are displayed on separate pads.
7
/// If canvas divided in advance - provided subpads will be used by the THStack.
8
///
9
/// \macro_image
10
/// \macro_code
11
///
12
/// \date June 2024
13
/// \author Sergey Linev
14
15
void
hist024_THStack_pads()
16
{
17
auto
hs =
new
THStack
(
"hs"
,
"Stacked 1D histograms"
);
18
19
// Create three 1-d histograms and add them in the stack
20
auto
h1st =
new
TH1F
(
"h1st"
,
"test hstack 1"
, 100, -4, 4);
21
h1st->FillRandom(
"gaus"
, 20000);
22
hs->Add(h1st);
23
24
auto
h2st =
new
TH1F
(
"h2st"
,
"test hstack 2"
, 100, -4, 4);
25
h2st->FillRandom(
"gaus"
, 15000);
26
hs->Add(h2st);
27
28
auto
h3st =
new
TH1F
(
"h3st"
,
"test hstack 3"
, 100, -4, 4);
29
h3st->FillRandom(
"gaus"
, 10000);
30
hs->Add(h3st);
31
32
auto
c1
=
new
TCanvas
(
"c1"
,
"THStack drawing on pads"
, 800, 800);
33
34
// prepare subpads for drawing of histograms
35
c1
->Divide(1, 3);
36
37
// draw thstack on canvas with "pads" draw option
38
c1
->Add(hs,
"pads"
);
39
}
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1F
1-D histogram with a float per channel (see TH1 documentation)
Definition
TH1.h:878
THStack
Definition
THStack.h:40
c1
return c1
Definition
legend1.C:41
tutorials
hist
hist024_THStack_pads.C
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1