Logo ROOT  
Reference Guide
geomD0.C File Reference

Detailed Description

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
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->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);
}
}
Authors
Bertrand Bellenot, Rene Brun

Definition in file geomD0.C.

TGeoVolume::GetNdaughters
Int_t GetNdaughters() const
Definition: TGeoVolume.h:349
gGeoManager
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:602
TGeoNode::GetVolume
TGeoVolume * GetVolume() const
Definition: TGeoNode.h:97
Int_t
int Int_t
Definition: RtypesCore.h:45
TGeoManager::GetVolume
TGeoVolume * GetVolume(const char *name) const
Search for a named volume. All trailing blanks stripped.
Definition: TGeoManager.cxx:2710
TGeoVolume::Draw
virtual void Draw(Option_t *option="")
draw top volume according to option
Definition: TGeoVolume.cxx:1146
TGeoVolume::SetTransparency
void SetTransparency(Char_t transparency=0)
Definition: TGeoVolume.h:217
TGeoManager::SetMaxVisNodes
void SetMaxVisNodes(Int_t maxnodes=10000)
set the maximum number of visible nodes.
Definition: TGeoManager.cxx:2180
TGeoVolume::GetNode
TGeoNode * GetNode(const char *name) const
get the pointer to a daughter node
Definition: TGeoVolume.cxx:2059
TGeoManager::Import
static TGeoManager * Import(const char *filename, const char *name="", Option_t *option="")
static function Import a geometry from a gdml or ROOT file
Definition: TGeoManager.cxx:3817
TGeoVolume::InvisibleAll
void InvisibleAll(Bool_t flag=kTRUE)
Make volume and each of it daughters (in)visible.
Definition: TGeoVolume.cxx:764
TGeoVolume
Definition: TGeoVolume.h:44
TGeoManager::DefaultColors
void DefaultColors()
Set default volume colors according to A of material.
Definition: TGeoManager.cxx:2077