The ROOT geometry package is a tool to build, browse and visualize detector geometries. It is independent from any tracking Monte Carlo engine, though it has been designed to optimize particle transport in correlation with simulation packages as Geant3, Geant4 and Fluka.

The building blocks of any geometry are the volumes that may contain other volumes. The biggest one, called the “cave”, contains all other volumes and provides the master reference system (MARS) in which the others are positioned. Each volume needs to be associated with a medium that can be a mixture of different materials (whose weights are the relative densities). An example of creating of the simplest setup having a single empty box in the ROOT environment (CINT) is presented below.

root[] gSystem->Load("libGeom"); // load the ROOT geometry library
root[] TGeoManager*mng = new TGeoManager ("cave", "the simplest geometry");
root[] TGeoMaterial*mat = new TGeoMaterial("Vacuum",0,0,0);
root[] TGeoMedium*med = new TGeoMedium("Vacuum",1,mat);
root[] TGeoVolume*top = gGeoManager->MakeBox("Top",med,10.,10.,10.);
root[] gGeoManager->SetTopVolume(top);
Info in : Top volume is Top. Master volume is Top
root[] gGeoManager->CloseGeometry();
Info in : Fixing runtime shapes…
Info in : …Nothing to fix
Info in : Counting nodes…
Info in : Voxelizing…
Info in : Building cache…
Info in :---Maximum geometry depth set to 100
Info in : 1 nodes/ 1 volume UIDs in title
Info in :----------------modeler ready----------------
root[] mng->SetTopVisible(); // the TOP is generally invisible
root[] top->Draw();
---Drawing 1 nodes with 3 visible levels
: created default TCanvas with name c1

The last command pops up a new window displaying a canvas with our magenta cube. It is possible to move, rotate and zoom the camera interactively by clicking and dragging the mouse.

Complex geometries can be built in a hierarchical way, through the concept of containment: one has to define and position some volumes inside other ones. Positioning is done with spatial transformations with respect to the “mother reference system”(i.e.the system defined by the containing volume). Complex volumes are built using basic or primitive shapes, already defined by ROOT (e.g.box, tube, cone, etc.), through operations like join, subtract or intersect. Finally, a given volume can be positioned several times in the geometry or it can be divided accordingly to user-defined patterns, automatically defining new contained volumes.

Once a geometry has been created, it can be saved into a ROOT file or as C++ macro with the Export(…) method of TGeoManager. Loading the geometry is done with its Import(…) method. In addition, individual volumes can also be saved into a ROOT file. Finally, ROOT provides a graphical user interface to edit or build geometry. The editor can be opened with the Edit(…) method of TGeoManager.

The possibility to visualize 3D objects is very important: in ROOT, the rendering engine is provided by the OpenGL library that provides advanced visualization features and real-time animations. Event display applications are an important application of 3D visualization. EVE is a ROOT module based on experiment-independent part of the ALICE event displays, using the ROOT GUI and the OpenGL rendering engine.

Categories: Posts