You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

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 takes a GDML file as its argument. Otherwise, it uses the default of test.gdml.

python -i GDMLROOT.py mygeom.gdml
  • No labels