I want to be able to quickly use ROOT’s GDML visualisation from the command line.
Traditionally I have done it as so:
std::string testfile = "simple.gdml"
gSystem->Load("libGeom");
gSystem->Load("libGdml");
TGeoManager::Import(testfile.c_str());
gGeoManager->GetTopVolume()->Draw("ogl");
i.e., literally typing it into the root prompt by hand. This is not ideal.
I came up with the following pyROOT script to try and quickly view arbitrary GDML from the command line:
#!/usr/bin/env python
import ROOT
import sys
ROOT.gSystem.Load("libGeom")
ROOT.gSystem.Load("libGdml")
if __name__ == "__main__":
ROOT.TGeoManager.Import(sys.argv[1])
ROOT.gGeoManager.GetTopVolume().Draw("ogl")
Whilst this looks like it should work, it does in fact not work! Instead I see a blank, frozen canvas. I find ROOT so strange, why doesn’t this work? What am I missing from this recipe? Any alternatives which are known to work that I can try?
Thank you.