ROOT logo

From $ROOTSYS/tutorials/geom/geomD0.C

//script drawing a detector geometry (here D0)
//by default the geometry is drawn using the GL viewer
//Using the TBrowser, you can select other components
//if the file containing the geometry is not found in the local
//directory, it is automatically read from the ROOT web site.
// run with .x geomD0.C    top level detectors are transparent
// or       .x geomD0.C(1) top level detectors are visible
//
// Authors: Bertrand Bellenot, Rene Brun
   
void RecursiveInvisible(TGeoVolume *vol);
void RecursiveTransparency(TGeoVolume *vol, Int_t transp);

void geomD0(Int_t allVisible=0) {
   TGeoManager::Import("http://root.cern.ch/files/d0.root");
   gGeoManager->DefaultColors();
   gGeoManager->SetMaxVisNodes(40000);
   //gGeoManager->SetVisLevel(4);
   if (!allVisible) {
      RecursiveInvisible(gGeoManager->GetVolume("D0-"));
      RecursiveInvisible(gGeoManager->GetVolume("D0+"));
      RecursiveInvisible(gGeoManager->GetVolume("D0WZ"));
      RecursiveInvisible(gGeoManager->GetVolume("D0WL"));
      RecursiveTransparency(gGeoManager->GetVolume("MUON"), 90);
   }
   
   gGeoManager->GetVolume("D0")->Draw("ogl");
}

void RecursiveInvisible(TGeoVolume *vol)
{
   vol->InvisibleAll();
   Int_t nd = vol->GetNdaughters();
   for (Int_t i=0; i<nd; i++) {
      RecursiveInvisible(vol->GetNode(i)->GetVolume());
   }
}

void RecursiveTransparency(TGeoVolume *vol, Int_t transp)
{
   vol->SetTransparency(transp);
   Int_t nd = vol->GetNdaughters();
   for (Int_t i=0; i<nd; i++) {
      RecursiveTransparency(vol->GetNode(i)->GetVolume(), transp);
   }
}
 geomD0.C:1
 geomD0.C:2
 geomD0.C:3
 geomD0.C:4
 geomD0.C:5
 geomD0.C:6
 geomD0.C:7
 geomD0.C:8
 geomD0.C:9
 geomD0.C:10
 geomD0.C:11
 geomD0.C:12
 geomD0.C:13
 geomD0.C:14
 geomD0.C:15
 geomD0.C:16
 geomD0.C:17
 geomD0.C:18
 geomD0.C:19
 geomD0.C:20
 geomD0.C:21
 geomD0.C:22
 geomD0.C:23
 geomD0.C:24
 geomD0.C:25
 geomD0.C:26
 geomD0.C:27
 geomD0.C:28
 geomD0.C:29
 geomD0.C:30
 geomD0.C:31
 geomD0.C:32
 geomD0.C:33
 geomD0.C:34
 geomD0.C:35
 geomD0.C:36
 geomD0.C:37
 geomD0.C:38
 geomD0.C:39
 geomD0.C:40
 geomD0.C:41
 geomD0.C:42
 geomD0.C:43
 geomD0.C:44
 geomD0.C:45
 geomD0.C:46
 geomD0.C:47