17 from ROOT
import TCanvas, TFile, TProfile, TNtuple, TH1F, TH2F
18 from ROOT
import gROOT, gBenchmark, gRandom, gSystem, Double
21 c1 =
TCanvas(
'c1',
'Dynamic Filling Example', 200, 10, 700, 500 )
25 c1.GetFrame().SetBorderMode( -1 )
32 hfile = gROOT.FindObject(
'py-hsimple.root' )
35 hfile =
TFile(
'py-hsimple.root',
'RECREATE',
'Demo ROOT file with histograms' )
38 hpx =
TH1F(
'hpx',
'This is the px distribution', 100, -4, 4 )
39 hpxpy =
TH2F(
'hpxpy',
'py vs px', 40, -4, 4, 40, -4, 4 )
40 hprof =
TProfile(
'hprof',
'Profile of pz versus px', 100, -4, 4, 0, 20 )
41 ntuple =
TNtuple(
'ntuple',
'Demo ntuple',
'px:py:pz:random:i' )
44 hpx.SetFillColor( 48 )
46 gBenchmark.Start(
'hsimple' )
50 rannor, rndm = gRandom.Rannor, gRandom.Rndm
53 histos = [
'hpx',
'hpxpy',
'hprof',
'ntuple' ]
55 exec(
'%sFill = %s.Fill' % (name,name))
60 for i
in range( 25000 ):
70 ntuple.Fill( px, py, pz, random, i )
73 if i
and i%kUPDATE == 0:
80 if gSystem.ProcessEvents():
85 exec(
'del %sFill' % name)
88 gBenchmark.Show(
'hsimple' )
93 hpx.SetFillColor( 48 )
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
tomato 1-D histogram with a float per channel (see TH1 documentation)}
A simple TTree restricted to a list of float variables only.
tomato 2-D histogram with a float per channel (see TH1 documentation)}