Versions Compared

Key

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

Create the script GDMLROOT.py containing the following and put it in $ROOTSYS/gdml. It should contain the following code.

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

ROOT.gSystem.Load("libGeom")

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

filename = 'test.gdml'
if sys.argv.__len__() > 1:
    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 will load a geometry from that directorytakes a GDML file as its argument. Otherwise, it uses the default of test.gdml.

No Format
python -i GDMLROOT.py testmygeom.gdml