12from ROOT
import TCanvas, TColor, TGaxis, TH1F, TPad
13from ROOT
import kBlack, kBlue, kRed
17 h1 =
TH1F(
"h1", (
"Two gaussian plots and their ratio; x title; h1 and h2"
18 " histograms"), 100, -5, 5)
19 h1.SetLineColor(kBlue+1)
22 h1.GetYaxis().SetTitleSize(20)
23 h1.GetYaxis().SetTitleFont(43)
24 h1.GetYaxis().SetTitleOffset(1.55)
30 h2 =
TH1F(
"h2",
"h2", 100, -5, 5)
37def createRatio(h1, h2):
39 h3.SetLineColor(kBlack)
51 y.SetTitle(
"ratio h1/h2 ")
55 y.SetTitleOffset(1.55)
70def createCanvasPads():
71 c =
TCanvas(
"c",
"canvas", 800, 800)
73 pad1 =
TPad(
"pad1",
"pad1", 0, 0.3, 1, 1.0)
74 pad1.SetBottomMargin(0)
79 pad2 =
TPad(
"pad2",
"pad2", 0, 0.05, 1, 0.3)
81 pad2.SetBottomMargin(0.2)
92 h3 = createRatio(h1, h2)
93 c, pad1, pad2 = createCanvasPads()
100 h1.GetYaxis().SetLabelSize(0.0)
101 axis =
TGaxis(-5, 20, -5, 220, 20, 220, 510,
"")
102 axis.SetLabelFont(43)
103 axis.SetLabelSize(15)
112if __name__ ==
"__main__":
1-D histogram with a float per channel (see TH1 documentation)
The most important graphics class in the ROOT system.