Bad drawing in TGeo

:frowning: The following CINT Macro uses TGeo and represent a Box, inside a box, inside a box. When I draw it, I only see 2 boxes, the one at top level and the one at the inner most level. Could someone show me how to have the 3 boxes displayed? I use ROOT 5.15/04 on Windows XP but I have tried on Linux and the result is the same. THanks a lot.
Here is the CINT macro:
{
gSystem.Load(“libGeom”);
TGeoManager *geom = new TGeoManager(“world”,“Studying materials”);
TGeoMaterial *mat = new TGeoMaterial(“Vacuum”,0,0,0);
TGeoMedium *med = new TGeoMedium(“Vacuum”,1,mat);
TGeoVolume *top = geom->MakeBox(“TOP”,med,5.0,5.0,14.0);
geom->SetTopVolume(top);
TGeoVolume *revtyvek = geom->MakeBox(“REVTYVEK”,med,3.0,3.0,11.0);
top->AddNode(revtyvek,1);
TGeoVolume *crystal = geom->MakeBox(“CRYSTAL”,med,2.0,2.0,10.0);
revtyvek->AddNode(crystal,1);
geom->CloseGeometry();
top->SetVisibility(kTRUE);
top->SetLineColor(1);
top->SetLineWidth(2);
top->VisibleDaughters();
revtyvek->SetVisibility(kTRUE);
// revtyvek->VisibleDaughters();
revtyvek->SetLineColor(2);
revtyvek->SetLineWidth(2);
crystal->SetVisibility(kTRUE);
crystal->SetLineColor(3);
gGeoManager->SetVisOption(0);
gGeoManager->SetTopVisible();
gGeoManager->SetVisLevel(3);
top->Draw();
}
baddraw.C (947 Bytes)

Jan

Jan

Hi Jan,
:astonished: top->Draw(); gGeoManager->SetVisOption(0); :confused:
Why Draw() method can not do gGeoManager->SetVisOption(0); internally :question: if this is really needed?

Hi Valeri,
see in root.cern.ch/root/htmldoc/src/TG … tml#sjmVGB

if (fTopVolume->IsVisContainers()) fVisOption = kGeoVisDefault; else if (fTopVolume->IsVisLeaves()) fVisOption = kGeoVisLeaves; // !!! our case !!! else if (fTopVolume->IsVisOnly()) fVisOption = kGeoVisOnly; else if (fTopVolume->IsVisBranch()) fVisOption = kGeoVisBranch;

[quote]
root[] top->Draw(); // !!! changed VisOption from 0 to 1 !!!
root[] gGeoManager->GetVisOption()
(const Int_t)1[/quote]Jan

[quote=“musinsky”]see in root.cern.ch/root/htmldoc/src/TG … tml#sjmVGB

if (fTopVolume->IsVisContainers()) fVisOption = kGeoVisDefault; else if (fTopVolume->IsVisLeaves()) fVisOption = kGeoVisLeaves; // !!! our case !!! else if (fTopVolume->IsVisOnly()) fVisOption = kGeoVisOnly; else if (fTopVolume->IsVisBranch()) fVisOption = kGeoVisBranch;

[quote]
root[] top->Draw(); // !!! changed VisOption from 0 to 1 !!!
root[] gGeoManager->GetVisOption()
(const Int_t)1[/quote]Jan[/quote]Do you mean it is an “interesting” feature or just a bug?
At least the same macro produces the “expected” picture with the Qt-based plugin (See attachments). If that is not a bug rather the essential new feature then one should have the Qt-based viewers fixed should not he? I would like to call your attention that one and same “node” attribute can be treated differently. For example, the node which is “transparent” for the simulation could be very solid for the “vizualization” and versa verse.


Thanks!
Putting gGeoManager->SetVisOption(0); after top-Draw() solves the problem.

Hi,

TGeoManager::SetVisOption() is kept just for back compatibility. This is now a volume attribute. One should use:

myVol->SetVisContainers(); // to see all containers down to vis level
or:
myVol->SetVisLeaves() // default, to see only terminal leaves at vis level
myVol->Draw()

Regards,