11from ROOT
import TCanvas, TH1F, TSlider
12from ROOT
import gROOT, gBenchmark, gRandom
15c1 =
TCanvas(
'c1',
'The HSUM example', 200, 10, 600, 400 )
18gBenchmark.Start(
'hsum' )
21total =
TH1F(
'total',
'This is the total distribution', 100, -4, 4 )
22main =
TH1F(
'main',
'Main contributor', 100, -4, 4 )
23s1 =
TH1F(
's1',
'This is the first signal', 100, -4, 4 )
24s2 =
TH1F(
's2',
'This is the second signal', 100, -4, 4 )
28total.SetMarkerStyle( 21 )
29total.SetMarkerSize( 0.7 )
30main.SetFillColor( 16 )
36gauss, landau = gRandom.Gaus, gRandom.Landau
39histos = [
'total',
'main',
's1',
's2' ]
41 exec(
'%sFill = %s.Fill' % (name,name))
45for 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)
82slider.SetRange( 0, 1 )
83total.Draw(
'sameaxis' )
87gBenchmark.Show(
'hsum' )
1-D histogram with a float per channel (see TH1 documentation)}
A specialized TPad including a TSliderBox object.
static constexpr double gauss