ROOT
master
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
/// 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
}
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1F
1-D histogram with a float per channel (see TH1 documentation)
Definition
TH1.h:645
THStack
The Histogram stack class.
Definition
THStack.h:40
c1
return c1
Definition
legend1.C:41
tutorials
hist
hist024_THStack_pads.C
ROOT master - Reference Guide Generated on Thu Feb 13 2025 15:59:18 (GVA Time) using Doxygen 1.10.0