OS: Linux Red Hat Enterprise 6.7
ROOT: 5.34/21
I am attempting a simple GDML Import/Export test with ROOT. I started by following a few tutorials (link) on how to create a world and add nodes to volumes, and how to export the world to a GDML file.
I wrote a macro “worldMake.c” to create a world with a box at the centre, and export it to “world.gdml”. Fig. 1 shows the result of Draw() with no options, or with “ogle”. Fig. 2 shows Draw() with options “ogl”. I think “ogl” means OpenGL, but I’m not sure what the “e” means.
[code]
void worldMake() {
gSystem->Load(“libGeom”);
gSystem->Load(“libGdml”);
new TGeoManager("world", "the simplest geometry");
TGeoMaterial *mat = new TGeoMaterial("Vacuum", 0, 0, 0 );
mat->SetTransparency( 50 );
TGeoMedium *med = new TGeoMedium("Vacuum", 1, mat );
TGeoVolume *top = gGeoManager->MakeBox("Top", med, 10., 10., 10. );
gGeoManager->SetTopVolume( top );
top->SetLineColor( kMagenta );
TGeoVolume *box = gGeoManager->MakeBox("Box", med, 2., [attachment=0]draw_ogl_worldDraw.png[/attachment]2., 2. );
box->SetLineColor( kRed );
TGeoTranslation *tr1 = new TGeoTranslation( .4, .4, .4 );
top->AddNode( box, 1, tr1 );
gGeoManager->CloseGeometry();
gGeoManager->SetTopVisible();
top->Draw(); // add "ogle" for OpenGL (not sure what the e means)
gGeoManager->Export("world.gdml");
}
[/code]File 1: “worldMake.c”
[code]
<?xml version="1.0"?> [/code][i]File 2: "world.gdml"[/i]I wrote another macro “worldDraw.c” to import the GDML file and recreate the world. However, Draw() with no options, or “ogle”, produces a blank canvas with no wireframe (Fig. 3). Draw() with options “ogl” (Fig. 4) produces a blank canvas and an OpenGL window in monochrome and opaque volumes, despite the transparency set in “worldMake.c”.
void worldDraw() {
gSystem->Load("libGeom");
gSystem->Load("libGdml");
TGeoManager *geom = TGeoManager::Import("world.gdml");
TGeoVolume *top = gGeoManager->GetTopVolume();
//geom->
//top->SetLineColor( kRed );
top->Draw();
}
File 3: “worldDraw.c”
I understand that GDML does not store colour and transparency data, as that’s up to the renderer to define, so I would like to know how to identify and reference the materials and volumes in order to define colours etc in “worldDraw.c”. I imagine I need to call something like GetTopVolume() to access the materials and volumes, but the documentation and reference manuals are hard to follow.
Some other things I’ve noticed about the documentation: I cannot find a list of accepted arguments for the Draw() options (link). I only heard about “ogle” from world of mouth/other forums!
This is my first time using ROOT (and this forum), and would appreciate any advice you can give! Please let me know if there’s too much information, and I’ll try to refine it.
Many thanks,
Peter