Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
11void na49view()
12{
13 TCanvas *c1 = new TCanvas("c1", "The NA49 canvas", 200, 10, 700, 780);
14
15 gBenchmark->Start("na49view");
16
17 TPad *all = new TPad("all", "A Global view of NA49", 0.02, 0.02, 0.48, 0.82, 28);
18 TPad *tof = new TPad("tof", "One Time Of Flight element", 0.52, 0.02, 0.98, 0.82, 28);
19 all->Draw();
20 tof->Draw();
21 TPaveLabel *na49title = new TPaveLabel(0.04, 0.86, 0.96, 0.98, "Two views of the NA49 detector");
22 na49title->SetFillColor(32);
23 na49title->Draw();
24 //
25 TFile *nageom = new TFile("na49.root");
26 if (!nageom || nageom->IsZombie())
27 return;
28 TGeometry *n49 = (TGeometry *)gROOT->FindObject("na49");
29 n49->SetBomb(1.2);
30 n49->cd(); // Set current geometry
31 all->cd(); // Set current pad
32 n49->Draw();
33 c1->Update();
34 tof->cd();
35 TNode *TOFR1 = n49->GetNode("TOFR1");
36 TOFR1->Draw();
37 c1->Update();
38
39 gBenchmark->Show("na49view");
40
41 // To have a better and dynamic view of any of these pads,
42 // you can click with the middle button of your mouse to select it.
43 // Then select "View with x3d" in the VIEW menu of the Canvas.
44 // Once in x3d, you are in wireframe mode by default.
45 // You can switch to:
46 // - Hidden Line mode by typing E
47 // - Solid mode by typing R
48 // - Wireframe mode by typing W
49 // - Stereo mode by clicking S (and you need special glasses)
50 // - To leave x3d type Q
51}
R__EXTERN TBenchmark * gBenchmark
Definition TBenchmark.h:59
#define gROOT
Definition TROOT.h:406
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:38
virtual void Start(const char *name)
Starts Benchmark with the specified name.
virtual void Show(const char *name)
Stops Benchmark name and Prints results.
The Canvas class.
Definition TCanvas.h:23
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
TGeometry description.
Definition TGeometry.h:39
void Draw(Option_t *option="") override
Draw this Geometry.
virtual void SetBomb(Float_t bomb=1.4)
Definition TGeometry.h:102
TObject * FindObject(const char *name) const override
Search object identified by name in the geometry tree.
virtual void cd(const char *path=nullptr)
Change Current Geometry to this.
TNode * GetNode(const char *name) const
Return pointer to node with name in the geometry tree.
TNode description.
Definition TNode.h:33
void Draw(Option_t *option="") override
Draw Referenced node with current parameters.
Definition TNode.cxx:322
R__ALWAYS_INLINE Bool_t IsZombie() const
Definition TObject.h:153
The most important graphics class in the ROOT system.
Definition TPad.h:28
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
Definition TPad.cxx:693
void Draw(Option_t *option="") override
Draw Pad in Current pad (re-parent pad if necessary).
Definition TPad.cxx:1364
A Pave (see TPave) with a text centered in the Pave.
Definition TPaveLabel.h:20
void Draw(Option_t *option="") override
Draw this pavelabel with its current attributes.
return c1
Definition legend1.C:41