Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The LCDD geometry needs to be dumped to plain GDML to be loaded by ROOT.

Create the script GDMLROOT.py and put it in $ROOTSYS/gdml. It should contain the following codeYou can use a script similar to the following to load a plain GDML file into ROOT.

No Format
import sys
import xml.sax
import ROOT
import ROOTBinding
import GDMLContentHandler

ROOT.gSystem.Loadvoid gdmlTest()
{
    char* testfile="./test.gdml";
    gSystem->Load("libGeom");

gdmlhandler = GDMLContentHandler.GDMLContentHandler(ROOTBinding.ROOTBinding())

filename = 'test.gdml'
if sys.argv.__len__() > 1: gSystem->Load("libGdml");
    filename = sys.argv[1]

xml.sax.parse(filename, gdmlhandler)
geomgr = ROOT.gGeoManager

geomgr.SetTopVolume(gdmlhandler.WorldVolume())
geomgr.CloseGeometry()

geomgr.DefaultColors()

geomgr.SetExplodedView(1)
geomgr.SetBombFactors(5.0,5.0,5.0,5.0)

gdmlhandler.WorldVolume().Draw("ogl")

This command takes a GDML file as its argument. Otherwise, it uses the default of test.gdml.

...

TGeoManager::Import(testfile);
    gGeoManager->GetTopVolume()->Draw("ogl");
}

This command should display the ROOT OpenGL viewer with the geometry from the test.gdml file.