Save replicated volumes as multiple single pacements in GDML file

I have a Geant4 geometry containing G4ReplicatedSlice replicated volumes. I save it to a GDML file using the G4GDMLParser as:

parser.Write(outputFile, physVolume, true, schemaLocation);

where schemaLocation = "http://service-spi.web.cern.ch/service-spi/app/releases/GDML/schema/gdml.xsd". This produces GDML files with replicated volumes which can be read back by Geant4 but not by Root’s TGeo, which according to this comment does not support parameterized volumes. So I was wondering if there is a way to configure the G4GDMLParser to “unroll” the parametrized volume into its single components when writing it in a GDML file. This would increase the file dimension but at least it would (hopefully) be usable with TGeo.
Thanks in advance for any help.

Parameterised volumes are “unrolled” by default when exported to GDML.
Export/import of G4ReplicatedSlice structures are not yet implemented in the GDML parser.

Hi Gabriele,

thanks for the answer, I’ll try something different.
Just FYI the export/import of G4ReplicatedSlice to/from GDML seems to work for me in Geant4 (I have two nested G4ReplicatedSlices in my geometry and they are present in the exported GDML file and correctly read back in my simulation). I’m using Geant4 10.06.p02.

That’s because they’re seen as normal physical volumes and you may be lucky for your specific configuration… but not all their possible configurations are supported and loaded properly, as their specific type is not known in the GDML parser… it is something we may consider implementing at some point.