12from ROOT
import TCanvas, TPad, TFormula, TF1, TPaveLabel, TH1F, TFile
13from ROOT
import gROOT, gBenchmark
17c1 =
TCanvas(
'c1',
'The FillRandom example', 200, 10, 700, 900 )
20pad1 =
TPad(
'pad1',
'The pad with the function', 0.05, 0.50, 0.95, 0.95, 21 )
21pad2 =
TPad(
'pad2',
'The pad with the histogram', 0.05, 0.05, 0.95, 0.45, 21 )
26gBenchmark.Start(
'fillrandom' )
31form1 =
TFormula(
'form1',
'abs(sin(x)/x)' )
32sqroot =
TF1(
'sqroot',
'x*gaus(0) + [3]*form1', 0, 10 )
33sqroot.SetParameters( 10, 4, 1, 20 )
37pad1.GetFrame().SetBorderMode( -1 )
39sqroot.SetLineColor( 4 )
40sqroot.SetLineWidth( 6 )
42lfunction =
TPaveLabel( 5, 39, 9.8, 46,
'The sqroot function' )
43lfunction.SetFillColor( 41 )
53pad2.GetFrame().SetBorderMode( -1 )
55h1f =
TH1F(
'h1f',
'Test random numbers', 200, 0, 10 )
57h1f.FillRandom(
'sqroot', 10000 )
63myfile =
TFile(
'py-fillrandom.root',
'RECREATE' )
68gBenchmark.Show(
'fillrandom' )
Option_t Option_t SetFillColor
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
1-D histogram with a float per channel (see TH1 documentation)
The most important graphics class in the ROOT system.
A Pave (see TPave) with a text centered in the Pave.