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,
top->Draw();
gGeoManager->SetVisOption(0);
Why Draw() method can not do gGeoManager->SetVisOption(0); internally 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,