TGeo: drawing mother volume

Hello,

I have a novice question regarding this geometry with 2 boxes:

[code]ex()
{
gSystem->Load(“libGeom”);
TGeoManager *geom = new TGeoManager(“geom”, “test”);

TGeoMaterial *vacuum = new TGeoMaterial(“Vacuum”, 0, 0, 0);
TGeoMedium *mVac = new TGeoMedium(“GVAC”, 0, vacuum);

TGeoVolume *top = gGeoManager->MakeBox(“Top”, mVac, 1000., 1000., 1000.);
gGeoManager->SetTopVolume(top);
gGeoManager->SetTopVisible(0);

box1 = gGeoManager->MakeBox(“box1”, mVac, 100., 100., 100.);
box1->SetLineColor(kGray);
box1->SetTransparency(70);
box2 = gGeoManager->MakeBox(“box2”, mVac, 50., 50., 50.);
box2->SetLineColor(kRed);

// both boxes are shown
top->AddNode(box1, 1);
top->AddNodeOverlap(box2, 1);

// Why only box2 is visible?
// box1->AddNode(box2, 1);
// top->AddNode(box1, 1);

top->Draw(“ogl”);
}[/code]

If I put the boxes directly into the top volume

top->AddNode(box1, 1); top->AddNodeOverlap(box2, 1);
Then both boxes are shown (see top.png attached).

However, if I put box2 into box1, and box1 into top:

box1->AddNode(box2, 1); top->AddNode(box1, 1);
then only box2 is shown (see box2.png attached)

How do I visualise the mother volume (box1) in the latter case? What am I doing wrong?





ex.C (663 Bytes)

Hi,

By default visualization will show only the volumes at the depth specified with gGeoManager->SetVisLevel(), plus all volumes having no daughter at lower depths. So in your case it will just show the innermost box. To see the top volume, you need to call gGeoManager->SetTopVisible(true), and to see all intermediate volumes you have to call volume->SetVisContainers() for the volume you are drawing (in your case top).

Best,