Logo ROOT  
Reference Guide
na49view.py
Go to the documentation of this file.
1## \file
2## \ingroup tutorial_pyroot
3## This macro generates two views of the NA49 detector.
4##
5## To have a better and dynamic view of any of these pads,
6## you can click with the middle button of your mouse to select it.
7## Then select "View with x3d" in the VIEW menu of the Canvas.
8## Once in x3d, you are in wireframe mode by default.
9## You can switch to:
10## - Hidden Line mode by typing E
11## - Solid mode by typing R
12## - Wireframe mode by typing W
13## - Stereo mode by clicking S (and you need special glasses)
14## - To leave x3d type Q
15##
16## \macro_code
17##
18## \author Wim Lavrijsen
19
20import ROOT
21
22c1 = ROOT.TCanvas( 'c1', 'The NA49 canvas', 200, 10, 700, 780 )
23
24ROOT.gBenchmark.Start( 'na49view' )
25
26all = ROOT.TPad( 'all', 'A Global view of NA49', 0.02, 0.02, 0.48, 0.82, 28 )
27tof = ROOT.TPad( 'tof', 'One Time Of Flight element', 0.52, 0.02, 0.98, 0.82, 28 )
28all.Draw();
29tof.Draw();
30na49title = ROOT.TPaveLabel( 0.04, 0.86, 0.96, 0.98, 'Two views of the NA49 detector' )
31na49title.SetFillColor( 32 )
32na49title.Draw()
33#
34nageom = ROOT.TFile( 'py-na49.root' )
35n49 = ROOT.gROOT.FindObject( 'na49' )
36n49.SetBomb( 1.2 )
37n49.cd() # Set current geometry
38all.cd() # Set current pad
39n49.Draw()
40c1.Update()
41tof.cd()
42TOFR1 = n49.GetNode( 'TOFR1' )
43TOFR1.Draw()
44c1.Update()
45
46ROOT.gBenchmark.Show( 'na49view' )