11 from ROOT
import TCanvas, TH1F, TSlider
12 from ROOT
import gROOT, gBenchmark, gRandom
15 c1 =
TCanvas(
'c1',
'The HSUM example', 200, 10, 600, 400 )
18 gBenchmark.Start(
'hsum' )
21 total =
TH1F(
'total',
'This is the total distribution', 100, -4, 4 )
22 main =
TH1F(
'main',
'Main contributor', 100, -4, 4 )
23 s1 =
TH1F(
's1',
'This is the first signal', 100, -4, 4 )
24 s2 =
TH1F(
's2',
'This is the second signal', 100, -4, 4 )
28 total.SetMarkerStyle( 21 )
29 total.SetMarkerSize( 0.7 )
30 main.SetFillColor( 16 )
36 gauss, landau = gRandom.Gaus, gRandom.Landau
39 histos = [
'total',
'main',
's1',
's2' ]
41 exec(
'%sFill = %s.Fill' % (name,name))
45 for i
in range( 10000 ):
47 xmain =
gauss( -1, 1.5 )
48 xs1 =
gauss( -0.5, 0.5 )
49 xs2 = landau( 1, 0.15 )
60 if i
and (i%kUPDATE) == 0 :
67 slider =
TSlider(
'slider',
'test', 4.2, 0, 4.6, total.GetMaximum(), 38 )
68 slider.SetFillColor( 46 )
71 slider.SetRange( 0, float(i) / 10000. )
78 exec(
'del %sFill' % name)
82 slider.SetRange( 0, 1 )
83 total.Draw(
'sameaxis' )
87 gBenchmark.Show(
'hsum' )
1-D histogram with a float per channel (see TH1 documentation)}
A specialized TPad including a TSliderBox object.
static constexpr double gauss