ROOT
Version master
master
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
v6.04
Reference Guide
►
ROOT
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
hist029_TRatioPlot_simple.py
2
## \ingroup tutorial_hist
3
## \notebook
4
## Example creating a simple ratio plot of two histograms using the `pois` division option.
5
## Two histograms are set up and filled with random numbers. The constructor of `TRatioPlot`
6
## takes the to histograms, name and title for the object, drawing options for the histograms (`hist` and `E` in this case)
7
## and a drawing option for the output graph.
8
## Inspired by the tutorial of Paul Gessinger.
9
##
10
## \macro_image
11
## \macro_code
12
##
13
## \author Alberto Ferro
14
15
import
ROOT
16
17
ROOT.gStyle.SetOptStat
(0)
18
19
c1 =
ROOT.TCanvas
(
"c1"
,
"A ratio example"
)
20
h1 =
ROOT.TH1D
(
"h1"
,
"h1"
, 50, 0, 10)
21
h2 =
ROOT.TH1D
(
"h2"
,
"h2"
, 50, 0, 10)
22
f1 =
ROOT.TF1
(
"f1"
,
"exp(- x/[0] )"
)
23
f1.SetParameter
(0,3)
24
25
h1.FillRandom
(f1, 1900)
26
h2.FillRandom
(f1, 2000)
27
h1.Sumw2
()
28
h2.Scale
(1.9/2.)
29
30
h1.GetXaxis
().SetTitle(
"x"
)
31
h1.GetYaxis
().SetTitle(
"y"
)
32
33
rp =
ROOT.TRatioPlot
(h1,h2)
34
35
c1.SetTicks
(0,1)
36
rp.GetLowYaxis
().SetNdivisions(505)
37
c1.Update
()
38
c1.Draw
()
39
rp.Draw
()
40
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
tutorials
hist
hist029_TRatioPlot_simple.py
ROOT master - Reference Guide Generated on Sun Mar 2 2025 15:20:40 (GVA Time) using Doxygen 1.10.0