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.
ksmith
February 20, 2018, 4:38pm
2
Have you mistakenly not defined materials as I had?
Hi,
When coming from GDML, which does not store visualisation attributes, ROOT invokes TGeoManager::SetDefaultColors(). This loops over volumes and assigns some colours to all volumes, but also makes transparent all volumes for which the density is less than 0.1. This is your case, since you have not defined materials in your file so ROOT assigned an automatic one with 0 density. What you can do before you draw:
gGeoManager->GetTopVolume()->SetTransparency(0);
also, to draw the original trans…
Since the links no longer render for context here is the original post:
Continuing the discussion from GDML import doesn't draw :
I just attempted to draw this geometry again with the current master (commit 6a12464be798b421d5) and I’m still getting a blank canvas.
PS what does root-config --git-revision provide?
$ root-config --git-revision
v6-11-02-1327-g6a12464be7
system
Closed
March 6, 2018, 4:38pm
3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.