Re: pyROOT - viewing geometry

From: <WLavrijsen_at_lbl.gov>
Date: Wed, 5 Mar 2008 08:39:02 -0800 (PST)


Michal,

> I was probably hit some TGeoMatrix creation error.

the two scripts don't really look alike, but I was eventually able to reproduce the problem: in PyROOT there are two threads active, one for the prompt, one for updating canvases. The second Draw("ogl") destroys the old OpenGL scene, and then sometimes an update is still underway, resulting in a double delete.

> Invoking Draw() on the top volume after aligning the contents yields:
> Info in <TGLSceneBase::RemoveViewer>: scene 'unnamed-1' not used -
> autodestructing.
 

The only solution that I could devise was to run the event processing off the main thread. Problem is, one then looses the prompt. Script is below; note that it isn't necessary to create a TGeoManager up front (the method Import is static).

Best regards,

           Wim

import ROOT
ROOT.PyConfig.StartGuiThread = 0 # no GUI thread, needs to be at the top g = ROOT.TGeoManager.Import("lcontainers.root") rotation=ROOT.TGeoRotation()
corr=[]
vol = g.GetTopVolume()
print type(vol)
vol.Draw("ogl")
for i in range(6):

    corr.append(ROOT.TGeoCombiTrans(0,500*i,0,rotation))     g.GetPhysicalNode(i).Align(corr[i])
vol.Draw("ogl")

# process events off the mean thread
import time
while 1:
  ROOT.gSystem.ProcessEvents()
  time.sleep( 0.01 )

-- 
Wim.Lavrijsen_at_cern.ch   --   WLavrijsen_at_lbl.gov   --   www.lavrijsen.net

"Your day will be somewhat dictated by authority."      --fortune cookie
Received on Wed Mar 05 2008 - 17:36:16 CET

This archive was generated by hypermail 2.2.0 : Fri Mar 07 2008 - 11:50:02 CET