Composite Shapes cause bus error in gdml export

Hello,

I am using Root v5.28.00b on Mac OSX 10.6.4 with gdml enabled. I have made a very simple geometry example consisting of a box and a tube. I can export this to a gdml file without problems. However if I try to make a composite shape out of the two objects (as shown in the code below) I receive a bus error upon exporting the geometry as a gdml file. I have given also the output from my terminal when I receive this bus error. If anyone can help explain why this is happening and a solution I would greatly appreciate it.

Cheers,
Nathan

    [code]
gSystem->Load("libGeom");
new TGeoManager("world","the simplest geometry");

TGeoMaterial *vac = new TGeoMaterial("Vacuum",0,0,0);
TGeoMedium *med = new TGeoMedium("Vacuum",1,vac);

TGeoVolume *top = gGeoManager->MakeBox("Top",med,10.,10.,10.);
gGeoManager->SetTopVolume(top);

TGeoVolume *box = gGeoManager->MakeBox("B",med,5.,5.,5.);
TGeoVolume *tube = gGeoManager->MakeTube("T",med,3.,5.,10.);

TGeoCompositeShape *cs = new TGeoCompositeShape("cs","T+B");
TGeoVolume *comp = new TGeoVolume("COMP",cs);
comp->SetLineColor(3);
top->AddNode(comp,1);

gGeoManager->CloseGeometry();

top->Draw("ogl");

[/code]


ROOT 5.28/00b (branches/v5-28-00-patches@38394, Mar 18 2011, 13:21:00 on macosx)

CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] 
Processing simpledraw.C...
Info in <TGeoManager::TGeoManager>: Geometry world, the simplest geometry created
Info in <TGeoManager::SetTopVolume>: Top volume is Top. Master volume is Top
Info in <TGeoManager::CheckGeometry>: Fixing runtime shapes...
Info in <TGeoManager::CheckGeometry>: ...Nothing to fix
Info in <TGeoManager::CloseGeometry>: Counting nodes...
Info in <TGeoManager::Voxelize>: Voxelizing...
Info in <TGeoManager::CloseGeometry>: Building cache...
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
Info in <TGeoManager::CloseGeometry>: 2 nodes/ 4 volume UID's in the simplest geometry
Info in <TGeoManager::CloseGeometry>: ----------------modeler ready----------------
Info in <TCanvas::MakeDefCanvas>:  created default TCanvas with name c1
root [1] gGeoManager->Export("example.gdml");
Info in <TGeoManager::Export>: Exporting world the simplest geometry as gdml code
(Bool_t)1
(Bool_t)1
(Bool_t)1
(Bool_t)1
(Bool_t)1
(Bool_t)1
(Bool_t)1
(Bool_t)1
Info in <TPython::Exec>: Found  1  materials
(Bool_t)1
(Bool_t)1
Info in <TPython::Exec>: Found  4  shapes
Info in <TPython::Exec>: Dumped  4  shapes
(Bool_t)1
Info in <TPython::Exec>: Traversing geometry tree
(Bool_t)1
(Bool_t)1

 *** Break *** bus error



===========================================================
There was a crash (#4 0x00115348 in SigHandler ()).
This is the entire stack trace of all threads:
===========================================================

Thread 3 (process 47489):
#0  0x943d6066 in __semwait_signal ()
#1  0x943d5d22 in _pthread_cond_wait ()
#2  0x943d79b8 in pthread_cond_wait$UNIX2003 ()
#3  0x19edc8c8 in PyThread_acquire_lock ()
#4  0x19eb30ac in PyEval_RestoreThread ()
#5  0x169cc378 in _PyTime_DoubleToTimet ()
#6  0x19eb7382 in PyEval_EvalFrameEx ()
#7  0x19eb8f74 in PyEval_EvalCodeEx ()
#8  0x19e5ad9f in PyClassMethod_New ()
#9  0x19e386e0 in PyObject_Call ()
#10 0x19eb8843 in PyEval_EvalFrameEx ()
#11 0x19eb74e5 in PyEval_EvalFrameEx ()
#12 0x19eb74e5 in PyEval_EvalFrameEx ()
#13 0x19eb8f74 in PyEval_EvalCodeEx ()
#14 0x19e5ae0c in PyClassMethod_New ()
#15 0x19e386e0 in PyObject_Call ()
#16 0x19e4810d in PyClass_New ()
#17 0x19e386e0 in PyObject_Call ()
#18 0x19eb278a in PyEval_CallObjectWithKeywords ()
#19 0x19ee0d13 in initthread ()
#20 0x943d581d in _pthread_start ()
#21 0x943d56a2 in thread_start ()

Thread 2 (process 47489):
#0  0x943ce942 in kevent ()
#1  0x943cf05c in _dispatch_mgr_invoke ()
#2  0x943ce519 in _dispatch_queue_invoke ()
#3  0x943ce2be in _dispatch_worker_thread2 ()
#4  0x943cdd41 in _pthread_wqthread ()
#5  0x943cdb86 in start_wqthread ()

Thread 1 (process 47489):
#0  0x943d4515 in wait4 ()
#1  0x94443493 in system$UNIX2003 ()
#2  0x001185f6 in TUnixSystem::StackTrace ()
#3  0x0011526a in TUnixSystem::DispatchSignals ()
#4  0x00115348 in SigHandler ()
#5  <signal handler called>
#6  0x02205b51 in TGeoMedium::GetMaterial ()
#7  0x02206146 in TGeoVolume::GetMaterial ()
#8  0x0215c4c1 in G__G__Geom1_173_0_63 ()
#9  0x00811366 in Cint::G__CallFunc::Execute ()
#10 0x19cd45c0 in PyROOT::TRootObjectExecutor::Execute ()
#11 0x19cdb36b in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::CallSafe ()
#12 0x19cdb503 in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::Execute ()
#13 0x19cd8552 in PyROOT::TMethodHolder<PyROOT::TScopeAdapter, PyROOT::TMemberAdapter>::operator() ()
#14 0x19ce0268 in PyROOT::(anonymous namespace)::mp_call ()
#15 0x19e386e0 in PyObject_Call ()
#16 0x19eb8812 in PyEval_EvalFrameEx ()
#17 0x19eb74e5 in PyEval_EvalFrameEx ()
#18 0x19eb74e5 in PyEval_EvalFrameEx ()
#19 0x19eb8f74 in PyEval_EvalCodeEx ()
#20 0x19eb9019 in PyEval_EvalCode ()
#21 0x19ed00af in Py_CompileString ()
#22 0x19ed0299 in PyRun_StringFlags ()
#23 0x19cfd519 in TPython::Exec ()
#24 0x19d0cd20 in G__G__PyROOT_212_0_4 ()
#25 0x0080e832 in Cint::G__ExceptionWrapper ()
#26 0x008e3c11 in G__execute_call ()
#27 0x008e6763 in G__call_cppfunc ()
#28 0x008b5eba in G__interpret_func ()
#29 0x008a2b5c in G__getfunction ()
#30 0x0086e749 in G__getitem ()
#31 0x00873796 in G__getexpr ()
#32 0x00918d74 in G__exec_statement ()
#33 0x008575ab in G__exec_tempfile_core ()
#34 0x008578f6 in G__exec_tempfile_fp ()
#35 0x0092607e in G__process_cmd ()
#36 0x00021111 in TCint::ProcessLine ()
#37 0x00061dd0 in TApplication::ProcessLine ()
#38 0x00095533 in TROOT::ProcessLine ()
#39 0x0204e5d8 in TGeoManager::Export ()
#40 0x02165382 in G__G__Geom1_180_0_225 ()
#41 0x0080e832 in Cint::G__ExceptionWrapper ()
#42 0x008e3c11 in G__execute_call ()
#43 0x008e6763 in G__call_cppfunc ()
#44 0x008b5eba in G__interpret_func ()
#45 0x008a2b5c in G__getfunction ()
#46 0x009b886d in G__getstructmem ()
#47 0x009ad11a in G__getvariable ()
#48 0x0086df7a in G__getitem ()
#49 0x00873796 in G__getexpr ()
#50 0x00918d74 in G__exec_statement ()
#51 0x008575ab in G__exec_tempfile_core ()
#52 0x008578f6 in G__exec_tempfile_fp ()
#53 0x0092607e in G__process_cmd ()
#54 0x00021111 in TCint::ProcessLine ()
#55 0x00061dd0 in TApplication::ProcessLine ()
#56 0x0106cdba in TRint::HandleTermInput ()
#57 0x0106af20 in TTermInputHandler::Notify ()
#58 0x0106d324 in TTermInputHandler::ReadNotify ()
#59 0x00114edd in TUnixSystem::CheckDescriptors ()
#60 0x00115ab7 in TUnixSystem::DispatchOneEvent ()
#61 0x000a5420 in TSystem::InnerLoop ()
#62 0x000a8b61 in TSystem::Run ()
#63 0x00060222 in TApplication::Run ()
#64 0x0106bd67 in TRint::Run ()
#65 0x00001abe in main ()
===========================================================


The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x02205b51 in TGeoMedium::GetMaterial ()
#7  0x02206146 in TGeoVolume::GetMaterial ()
===========================================================

Hi Nathan,
GDML exporter needs all volumes to have non-null media. Just replace the line as below:
TGeoVolume *comp = new TGeoVolume(“COMP”,cs, med);

Cheers,

Hello Andrei,

Thank you for the help it works correctly now.

Cheers,
Nathan

Just a quick additional note. It seems that not only the “.gdml” export:
gGeoManager->Export(“MyGeom.gdml”)
needs all volumes to have non-null media.
Also the “.C” export:
gGeoManager->Export(“MyGeom.C”);
exhibits the same problem.
Exporting to a “.root” and/or “.xml” file does not seem to be affected.
Is this described somewhere?

BTW. A GDML expert’s advice is still needed here: [url]Loading mixtures of mixtures from GDML in TGeoManager 8-[

Hi,
Not documented, let’s call it feature. I will have a look at the other post, not because I am a gdml expert, but because I have to maintain the gdml interface of TGeo.

Cheers,