Exporting Geometry error

Hello,

I am successfully creating a geometry formed by set of assemblies of large number of TGeoArab8 volumes.
After creation of the geometry, the call gGeoManager->GetByteCount() reports a big but reasonable total size of logical tree : 811883665 bytes.
While performing the export of geometry to a file by mean of gGeoManager->Export(name,"","") I am getting an error:
Error in TBufferFile::WriteByteCount: bytecount too large (more than 1073741822).

There are no problems with smaller geometries.

Could you suggest me a possible solution of the problem?

Thank you in advance,
A.

The log-output is below:

Info in TGeoManager::TGeoManager: Geometry Geometry, default geometry created
Info in TGeoManager::SetTopVolume: Top volume is World. Master volume is World
Info in TGeoNavigator::BuildCache: — Maximum geometry depth set to 100
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 TGeoManager::CountLevels: max level = 3, max placements = 23324
Info in TGeoManager::CloseGeometry: 1108764 nodes/ 1108778 volume UID’s in default geometry
Info in TGeoManager::CloseGeometry: ----------------modeler ready----------------
Info in TGeoManager::GetByteCount: Total size of logical tree : 811883665 bytes
Info in TGeoManager::Export: Exporting Geometry nmos3d_d0p1_g0p0 as root file. Optimizations not streamed.
Error in TBufferFile::WriteByteCount: bytecount too large (more than 1073741822)

Hi,

The size of the geometry goes as the square of the maximum number of placements, due to navigation optimisation structures which are being built. Having 23K placements in a single volume is not quite acceptable and hardly usable for navigation or visualization. There is a simple way of making a more hierarchic structure from a flat one by using TGeoVolumeAssembly, which will largely decrease the geometry size.

Assuming you have the volumes V0, V2, …, V23323 (!) now placed in a single mother M, you can do something like:

Int_t npergroup=100;
TGeoVolumeAssembly *vgroup = 0;
for (Int_t i=0; i<23323; ++i) {
   if (i%npergroup == 0) {
      if (vgroup) M->AddNode(vgroup);
      vgroup = new TGeoVolumeAssembly(Form("vgroup%d",i/npergroup));
   }
   vgroup->AddNode(Vi, matrix_i);
}
M->AddNode(vgroup);

This assumes that you have your own indexing to select Vi and matrix_i. This will generate an additional level inside volume M and you will get maximum 233 placements per volume, which is already much better.

Best,

Hi again,

Now I realize that you have as many placements as logical volumes. How did you produce this geometry? The idea is that normally many volumes are identical, so that you can place them several times. On the usage of assemblies: my algorithm is just a fast workaround to lower the size, normally you should make groups which are close together (neighbors)

Regards,

Thank you!

I have to note, that my elementary volumes a mostly non-identical tetrahedrons, which I used to pack in TGeoVolumeAssemblies, producing groups of neighbours.

I used your advise to produce more hierarchic structure, reduced the maximum number of placements down to 374 and successfully created a root file without optimisation.

But the request to stream the optimisation during the export leads to the similar error despite the fact that
the total size of logical tree now is even smaller, 651196796 bytes.

What kind of optimisation the root is doing during the export?

The log-output is below:
Info in TGeoManager::TGeoManager: Geometry Geometry, default geometry created
Info in TGeoManager::SetTopVolume: Top volume is World. Master volume is World
Info in TGeoNavigator::BuildCache: — Maximum geometry depth set to 100
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 TGeoManager::CountLevels: max level = 5, max placements = 374
Info in TGeoManager::CloseGeometry: 1412183 nodes/ 1410591 volume UID’s in default geometry
Info in TGeoManager::CloseGeometry: ----------------modeler ready----------------
Info in TGeoManager::GetByteCount: Total size of logical tree : 675520376 bytes
Info in TGeoManager::Export: Exporting Geometry nmos3d_d0p1_g0p0 as root file. Optimizations streamed.
Error in TBufferFile::WriteByteCount: bytecount too large (more than 1073741822)

Hi,

I’m not an I/O expert, but ROOT cannot handle single buffers of more than 1GB (something related to 32 bits address space in buffer). Note that the size reported by GetByteCount is not accurate, the geometry is likely to be much bigger. The logical volumes are costly, specially if they have complicated shapes, you should really try reusing some of the volumes. There is a way to save individual volumes in your geometry:
TGeoVolume::Export() and TGeoVolume::Import().
You can use that for your top level volumes, but then you have to re-assemble the geometry yourself:

  • load each individual volume from file
  • call top->AddNode(vol_i); then CloseGeometry();

Hope this helps,