5 from ROOT
import TCanvas, TPad, TFormula, TF1, TPaveLabel, TH1F, TFile
6 from ROOT
import gROOT, gBenchmark
10 c1 = TCanvas(
'c1',
'The FillRandom example', 200, 10, 700, 900 )
13 pad1 = TPad(
'pad1',
'The pad with the function', 0.05, 0.50, 0.95, 0.95, 21 )
14 pad2 = TPad(
'pad2',
'The pad with the histogram', 0.05, 0.05, 0.95, 0.45, 21 )
19 gBenchmark.Start(
'fillrandom' )
24 form1 = TFormula(
'form1',
'abs(sin(x)/x)' )
25 sqroot = TF1(
'sqroot',
'x*gaus(0) + [3]*form1', 0, 10 )
26 sqroot.SetParameters( 10, 4, 1, 20 )
30 pad1.GetFrame().SetBorderMode( -1 )
32 sqroot.SetLineColor( 4 )
33 sqroot.SetLineWidth( 6 )
35 lfunction = TPaveLabel( 5, 39, 9.8, 46,
'The sqroot function' )
36 lfunction.SetFillColor( 41 )
46 pad2.GetFrame().SetBorderMode( -1 )
48 h1f = TH1F(
'h1f',
'Test random numbers', 200, 0, 10 )
49 h1f.SetFillColor( 45 )
50 h1f.FillRandom(
'sqroot', 10000 )
56 myfile = TFile(
'py-fillrandom.root',
'RECREATE' )
61 gBenchmark.Show(
'fillrandom' )