10 from ROOT
import TCanvas, TPad, TFile, TPaveText
11 from ROOT
import gBenchmark, gStyle, gROOT
13 c1 = TCanvas(
'c1',
'The Ntuple canvas',200,10,700,780)
15 gBenchmark.Start(
'ntuple1')
20 f1 = TFile(
'py-hsimple.root')
24 pad1 = TPad(
'pad1',
'This is pad1',0.02,0.52,0.48,0.98,21)
25 pad2 = TPad(
'pad2',
'This is pad2',0.52,0.52,0.98,0.98,21)
26 pad3 = TPad(
'pad3',
'This is pad3',0.02,0.02,0.48,0.48,21)
27 pad4 = TPad(
'pad4',
'This is pad4',0.52,0.02,0.98,0.48,1)
37 gStyle.SetStatColor(42)
45 pad1.GetFrame().SetFillColor(15)
46 ntuple = gROOT.FindObject(
'ntuple')
47 ntuple.SetLineColor(1)
48 ntuple.SetFillStyle(1001)
49 ntuple.SetFillColor(45)
50 ntuple.Draw(
'3*px+2',
'px**2+py**2>1')
51 ntuple.SetFillColor(38)
52 ntuple.Draw(
'2*px+2',
'pz>2',
'same')
53 ntuple.SetFillColor(5)
54 ntuple.Draw(
'1.3*px+2',
'(px^2+py^2>4) && py>0',
'same')
63 pad2.GetFrame().SetFillColor(32)
64 ntuple.Draw(
'pz:px>>hprofs',
'',
'goffprofs')
65 hprofs = gROOT.FindObject(
'hprofs')
66 hprofs.SetMarkerColor(5)
67 hprofs.SetMarkerSize(0.7)
68 hprofs.SetMarkerStyle(21)
73 fpol2 = hprofs.GetFunction(
'pol2')
82 pad3.GetFrame().SetFillColor(38)
83 pad3.GetFrame().SetBorderSize(8)
84 ntuple.SetMarkerColor(1)
85 ntuple.Draw(
'py:px',
'pz>1')
86 ntuple.SetMarkerColor(2)
87 ntuple.Draw(
'py:px',
'pz<1',
'same')
93 ntuple.Draw(
'pz:py:px',
'(pz<10 && pz>6)+(pz<4 && pz>3)')
94 ntuple.SetMarkerColor(4)
95 ntuple.Draw(
'pz:py:px',
'pz<6 && pz>4',
'same')
96 ntuple.SetMarkerColor(5)
97 ntuple.Draw(
'pz:py:px',
'pz<4 && pz>3',
'same')
98 l4 = TPaveText(-0.9,0.5,0.9,0.95)
101 l4.AddText(
'You can interactively rotate this view in 2 ways:')
102 l4.AddText(
' - With the RotateCube in clicking in this pad')
103 l4.AddText(
' - Selecting View with x3d in the View menu')
110 gStyle.SetStatColor(19)
111 gBenchmark.Show(
'ntuple1')