ROOT
git-r3/HEAD
Reference Guide
Loading...
Searching...
No Matches
hstack.C
Go to the documentation of this file.
1
// Example of stacked histograms using the class THStack
2
3
void
hstack
(){
4
THStack
*
a
=
new
THStack
(
"a"
,
"Stacked 2D histograms"
);
5
6
TF2
*
f1
=
new
TF2
(
"f1"
,
"xygaus + xygaus(5) + xylandau(10)"
,-4,4,-4,4);
7
Double_t
params1[] = {130,-1.4,1.8,1.5,1, 150,2,0.5,-2,0.5, 3600,-2,0.7,-3,0.3};
8
f1
->SetParameters(params1);
9
TH2F
*h2sta =
new
TH2F
(
"h2sta"
,
"h2sta"
,20,-4,4,20,-4,4);
10
h2sta->
SetFillColor
(38);
11
h2sta->
FillRandom
(
"f1"
,4000);
12
13
TF2
*
f2
=
new
TF2
(
"f2"
,
"xygaus + xygaus(5)"
,-4,4,-4,4);
14
Double_t
params2[] = {100,-1.4,1.9,1.1,2, 80,2,0.7,-2,0.5};
15
f2
->SetParameters(params2);
16
TH2F
*h2stb =
new
TH2F
(
"h2stb"
,
"h2stb"
,20,-4,4,20,-4,4);
17
h2stb->
SetFillColor
(46);
18
h2stb->
FillRandom
(
"f2"
,3000);
19
20
a
->Add(h2sta);
21
a
->Add(h2stb);
22
23
a
->Draw();
24
}
a
#define a(i)
Definition
RSha256.hxx:99
Double_t
double Double_t
Double 8 bytes.
Definition
RtypesCore.h:73
f2
auto f2
Definition
TGaxis_002.C:5
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition
TAttFill.h:40
TF2
A 2-Dim function with parameters.
Definition
TF2.h:29
TH2F
2-D histogram with a float per channel (see TH1 documentation)
Definition
TH2.h:345
TH2::FillRandom
void FillRandom(TF1 *f1, Int_t ntimes=5000, TRandom *rng=nullptr) override
Fill histogram following distribution in function fname.
Definition
TH2.cxx:684
THStack
The Histogram stack class.
Definition
THStack.h:40
hstack
void hstack()
Definition
hstack.C:3
f1
TF1 * f1
Definition
legend1.C:11
documentation
primer
macros
hstack.C
ROOTgit-r3/HEAD - Reference Guide Generated on
(GVA Time) using Doxygen 1.16.1