Skip to content

GDML Export Option "f" is bugged. #9310

@kkauder

Description

@kkauder
  • [ x ] Checked for duplicates

Describe the bug

After I write out (part of) a geometry with

writer->WriteGDMLfile ( gGeoManager, n, outname.c_str(),"vgf");

the main volume is named, e.g., HcalBarrel0x0x55d87ec06500. However, at the end of the file it still says

<world ref="HcalBarrel"/>.

The result is that ROOT itself cannot read the file:

Info in <TGeoManager::Import>: Reading geometry from file: [...]
Info in <TGeoManager::TGeoManager>: Geometry GDMLImport, Geometry imported from GDML created
Error in <TGeoManager::Import>: Cannot open file

Expected behavior

The function should return usable gdml. I tested that if I change by hand to

<world ref="HcalBarrel0x0x55d87ec06500"/>

the file is woorking and valid.

To Reproduce

root -l $ROOTSYS/tutorials/geom/rootgeom.C
TGeoNodeMatrix* m = (TGeoNodeMatrix*) gGeoManager->GetListOfNodes()->At(0);
TGeoNode* n = (TGeoNode*) m->GetNodes()->At(1);
TGDMLWrite *writer = new TGDMLWrite;
writer->SetG4Compatibility(true);
writer->WriteGDMLfile ( gGeoManager, n, "test.gdml","vgf");
.q
root -l
gGeoManager->Import("test.gdml")
Info in <TGeoManager::Import>: Reading geometry from file: test.gdml
Info in <TGeoManager::TGeoManager>: Geometry GDMLImport, Geometry imported from GDML created
Error in <TGeoManager::Import>: Cannot open file

A side bug, I cannot reproduce this with the Export option, and that
is because it doesn't recognize the f flag:

root [1] gGeoManager->Export("test.gdml","vgf")
Info in <TGeoManager::Export>: Exporting simple1 Simple geometry as gdml code
Info in <TGDMLWrite::WriteGDMLfile>: Potentially slow with incremental suffix naming convention set

Setup

  1. 6.24.06
  2. singularity container running debian (on top of Scientific Linux 7)
  3. Container maintainer installed it

Additional context

I can test in a variety of other environments, but this seems pretty cut and dry and OS-independent

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions