Creating and Viewing Geometries
Creating and Viewing Geometries
{
//
// This macro generates two canvases.
// The first Canvas
// has 2 views of the ATLAS detector.
// The second Canvas
// has 2 views of the NA49 detector.
//
gROOT.Reset();
TCanvas *c1 = gROOT->FindObject("c1"); if (c1) c1->Delete();
c1 = new TCanvas("c1","The ATLAS canvas",200,10,700,780);
gBenchmark->Start("atlasna49");
//
// Inside the ATLAS canvas, we create 2 pads for 2 different ATLAS views
//
TPad oute("oute","Outer Detector",0.02,0.02,0.48,0.82,18);
TPad gaas("cryo","Ga Arsenite Detector",0.52,0.02,0.98,0.82,18);
oute.Draw();
gaas.Draw();
TPaveLabel atlastitle(0.1,0.86,0.9,0.98,"Two views of the ATLAS detector");
atlastitle.SetFillColor(28);
atlastitle.Draw();
//
// Connect ROOT file with the ATLAS detector geometry.
// See TGeometry for explanations how this file was produced.
//
TFile atgeom("atlas.root");
//
//
// ATLAS is a barrel detector. Let's make an exploded view.
atlas.cd(); //Set current geometry
atlas.SetBomb(2);
//
// Set colors
FMUC2.SetLineColor(5);
RPCB1.SetLineColor(3);
RPTI1.SetLineColor(4);
RPT12.SetLineColor(4);
RPT23.SetLineColor(3);
RPT34.SetLineColor(3);
oute.cd(); //Set current pad
OUTE1.Draw();
c1->Update();
GAAS1.SetVisibility(0);
GDSI2.SetVisibility();
GDSI2.SetLineColor(5);
GSUP1.SetLineColor(2);
gaas.cd();
GAAS1.Draw();
c1->Update();
//
// Repeat similar operation for the NA49 detector.
//
TCanvas *c2 = gROOT->FindObject("c2"); if (c2) c2->Delete();
c2 = new TCanvas("c2","The NA49 canvas",280,50,700,780);
TPad all("all","A Global view of NA49",0.02,0.02,0.48,0.82,18);
TPad tof("tof","One Time Of Flight element",0.52,0.02,0.98,0.82,18);
all.Draw();
tof.Draw();
TPaveLabel na49title(0.1,0.86,0.9,0.98,"Two views of the NA49 detector");
na49title.SetFillColor(28);
na49title.Draw();
//
TFile nageom("na49.root");
na49.SetBomb(1.2);
na49.cd(); //Set current geometry
all.cd(); //Set current pad
na49.Draw();
c2.Update();
tof.cd();
TOFR1.Draw();
c2.Update();
gBenchmark->Show("atlasna49");
// To have a better and dynamic view of any of these pads,
// you can click with the middle button of your mouse to select it.
// Then select "View with x3d" in the VIEW menu of the Canvas.
// Once in x3d, you are in wireframe mode by default.
// You can switch to:
// - Hidden Line mode by typing E
// - Solid mode by typing R
// - Wireframe mode by typing W
// - Stereo mode by clicking S (and you need special glasses)
// - To leave x3d type Q
}
[ROOT page] [Class index] [Top of the page]
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or
contact the developers with any questions or problems regarding ROOT.