geomD0.C

Go to the documentation of this file.
00001 //script drawing a detector geometry (here D0)
00002 //by default the geometry is drawn using the GL viewer
00003 //Using the TBrowser, you can select other components
00004 //if the file containing the geometry is not found in the local
00005 //directory, it is automatically read from the ROOT web site.
00006 // run with .x geomD0.C    top level detectors are transparent
00007 // or       .x geomD0.C(1) top level detectors are visible
00008 //
00009 // Authors: Bertrand Bellenot, Rene Brun
00010    
00011 void RecursiveInvisible(TGeoVolume *vol);
00012 void RecursiveTransparency(TGeoVolume *vol, Int_t transp);
00013 
00014 void geomD0(Int_t allVisible=0) {
00015    TGeoManager::Import("http://root.cern.ch/files/d0.root");
00016    gGeoManager->DefaultColors();
00017    gGeoManager->SetMaxVisNodes(40000);
00018    //gGeoManager->SetVisLevel(4);
00019    if (!allVisible) {
00020       RecursiveInvisible(gGeoManager->GetVolume("D0-"));
00021       RecursiveInvisible(gGeoManager->GetVolume("D0+"));
00022       RecursiveInvisible(gGeoManager->GetVolume("D0WZ"));
00023       RecursiveInvisible(gGeoManager->GetVolume("D0WL"));
00024       RecursiveTransparency(gGeoManager->GetVolume("MUON"), 90);
00025    }
00026    
00027    gGeoManager->GetVolume("D0")->Draw("ogl");
00028 }
00029 
00030 void RecursiveInvisible(TGeoVolume *vol)
00031 {
00032    vol->InvisibleAll();
00033    Int_t nd = vol->GetNdaughters();
00034    for (Int_t i=0; i<nd; i++) {
00035       RecursiveInvisible(vol->GetNode(i)->GetVolume());
00036    }
00037 }
00038 
00039 void RecursiveTransparency(TGeoVolume *vol, Int_t transp)
00040 {
00041    vol->SetTransparency(transp);
00042    Int_t nd = vol->GetNdaughters();
00043    for (Int_t i=0; i<nd; i++) {
00044       RecursiveTransparency(vol->GetNode(i)->GetVolume(), transp);
00045    }
00046 }

Generated on Tue Jul 5 15:44:12 2011 for ROOT_528-00b_version by  doxygen 1.5.1