Logo ROOT  
Reference Guide
na49view.C
Go to the documentation of this file.
1 /// \file
2 /// \ingroup tutorial_geom
3 /// This macro generates
4 /// with 2 views of the NA49 detector using the old obsolete geometry package.
5 ///
6 /// \macro_image
7 /// \macro_code
8 ///
9 /// \author Rene Brun
10 
11 void na49view() {
12  TCanvas *c1 = new TCanvas("c1","The NA49 canvas",200,10,700,780);
13 
14  gBenchmark->Start("na49view");
15 
16  TPad *all = new TPad("all","A Global view of NA49",0.02,0.02,0.48,0.82,28);
17  TPad *tof = new TPad("tof","One Time Of Flight element",0.52,0.02,0.98,0.82,28);
18  all->Draw();
19  tof->Draw();
20  TPaveLabel *na49title = new TPaveLabel(0.04,0.86,0.96,0.98,"Two views of the NA49 detector");
21  na49title->SetFillColor(32);
22  na49title->Draw();
23  //
24  TFile *nageom = new TFile("na49.root");
25  if (!nageom || nageom->IsZombie()) return;
26  TGeometry *n49 =(TGeometry*)gROOT->FindObject("na49");
27  n49->SetBomb(1.2);
28  n49->cd(); //Set current geometry
29  all->cd(); //Set current pad
30  n49->Draw();
31  c1->Update();
32  tof->cd();
33  TNode *TOFR1 = n49->GetNode("TOFR1");
34  TOFR1->Draw();
35  c1->Update();
36 
37  gBenchmark->Show("na49view");
38 
39  // To have a better and dynamic view of any of these pads,
40  // you can click with the middle button of your mouse to select it.
41  // Then select "View with x3d" in the VIEW menu of the Canvas.
42  // Once in x3d, you are in wireframe mode by default.
43  // You can switch to:
44  // - Hidden Line mode by typing E
45  // - Solid mode by typing R
46  // - Wireframe mode by typing W
47  // - Stereo mode by clicking S (and you need special glasses)
48  // - To leave x3d type Q
49 }
TPad
The most important graphics class in the ROOT system.
Definition: TPad.h:26
TBenchmark::Start
virtual void Start(const char *name)
Starts Benchmark with the specified name.
Definition: TBenchmark.cxx:172
TGeometry::SetBomb
virtual void SetBomb(Float_t bomb=1.4)
Definition: TGeometry.h:102
TGeometry::Draw
virtual void Draw(Option_t *option="")
Draw this Geometry.
Definition: TGeometry.cxx:254
TGeometry::cd
virtual void cd(const char *path=0)
Change Current Geometry to this.
Definition: TGeometry.cxx:246
TGeometry
TGeometry description.
Definition: TGeometry.h:39
TPaveLabel::Draw
virtual void Draw(Option_t *option="")
Draw this pavelabel with its current attributes.
Definition: TPaveLabel.cxx:77
TGeometry::GetNode
TNode * GetNode(const char *name) const
Return pointer to node with name in the geometry tree.
Definition: TGeometry.cxx:345
na49view
Definition: na49view.py:1
gBenchmark
R__EXTERN TBenchmark * gBenchmark
Definition: TBenchmark.h:59
TFile
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
TNode
TNode description.
Definition: TNode.h:33
TObject::IsZombie
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition: TObject.h:134
TPaveLabel
A Pave (see TPave) with a text centered in the Pave.
Definition: TPaveLabel.h:20
TCanvas
The Canvas class.
Definition: TCanvas.h:23
TPad::cd
TVirtualPad * cd(Int_t subpadnumber=0)
Set Current pad.
Definition: TPad.cxx:603
TAttFill::SetFillColor
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition: TAttFill.h:37
TNode::Draw
virtual void Draw(Option_t *option="")
Draw Referenced node with current parameters.
Definition: TNode.cxx:324
TBenchmark::Show
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
Definition: TBenchmark.cxx:155
gROOT
#define gROOT
Definition: TROOT.h:406
c1
return c1
Definition: legend1.C:41
TPad::Draw
virtual void Draw(Option_t *option="")
Draw Pad in Current pad (re-parent pad if necessary).
Definition: TPad.cxx:1299