void db_hand() { const double pi = 3.14159268; gSystem->Load("libGeom"); new TGeoManager("world","Nested box test"); TGeoMaterial *air_mat = new TGeoMaterial ("Air",1,1,0.01); TGeoMedium *air_med = new TGeoMedium("Air",1,air_mat); TGeoMaterial *water_mat = new TGeoMaterial ("Water",18,10,1.0); TGeoMedium *water_med = new TGeoMedium("Water",2,air_mat); TGeoVolume* top = gGeoManager->MakeBox("Top",air_med,1000,1000,1000); gGeoManager->SetTopVolume(top); TGeoBBox* b1 = new TGeoBBox("b1",800,500,500); TGeoVolume* v1 = new TGeoVolume("b1_vol",b1,water_med); top->AddNode(v1, 1); TGeoBBox* b2 = new TGeoBBox("b2",750, 450, 450); TGeoVolume* v2 = new TGeoVolume("b2_vol",b2,air_med); v1->AddNode(v2, 1); TGeoBBox* b3 = new TGeoBBox("b3",700, 400, 450); TGeoVolume* v3 = new TGeoVolume("b3_vol",b3,water_med); v2->AddNode(v3, 1); TGeoBBox* b4 = new TGeoBBox("b4",650, 350, 400); TGeoVolume* v4 = new TGeoVolume("b4_vol",b4,air_med); v3->AddNode(v4, 1); TGeoVolume* vols[] = {top,v1,v2,v3,v4,0}; for (int ind=0; vols[ind]; ++ind) { // vols[ind]->SetVisibility(true); // not needed (default) // vols[ind]->SetVisLeaves(true); // this is if you want to see just the terminal leaves // vols[ind]->VisibleDaughters(true); // also default vols[ind]->SetLineColor(!ind ? 1 : (ind%2 ? 2 : 4)); } // gGeoManager->SetVisOption(0); // obsolete gGeoManager->SetTopVisible(); gGeoManager->SetVisLevel(4); // automatic should also work // You need just to add this: top->SetVisContainers(); gGeoManager->CloseGeometry(); top->Draw(); }