Import a stp or GDML into root as a TGeoVolume

Hi all, so I have a project with root sims. I am creating a bunch of tubes, and boxes and simulating various things.

I want to add a very unique piece to the simulations. I have the piece as a step file, and I have also been able to convert it into a GDML but how do I then import as a TGeoVolume to be placed in root?

Cheers


Please read tips for efficient and successful posting and posting code

ROOT Version: Not Provided
Platform: Not Provided
Compiler: Not Provided


Hi, in the main gdml file you have to embed the child volume definition within the parent volume definition:

    <volume name="parent">
      <materialref ref="Air"/>
      <solidref ref="parent_box"/>
      <physvol name="child_1" copynumber="1">
        <file name="child_definition.gdml" volname="child"/>
        <positionref ref="child_pos"/>
      </physvol>
    </volume>

See the example in the attached tarball. Note however that if your “piece” is a tessellated volume, the navigation functionality for it (that you may need in your sims) is NOT implemented.
teddy.tgz (77.1 KB)

Hi, thanks for the response but which is the “main” gdml? I have 0 GDML files in my repo currently. I would like to add one.

Unfortunately could not get the tarball to run:

root [0] TGeoManager::Import("teddy.gdml");
Info in <TGeoManager::Import>: Reading geometry from file: teddy.gdml
Info in <TGeoManager::TGeoManager>: Geometry GDMLImport, Geometry imported from GDML created
Fatal in <TGDMLParse::Tessellated>: Vertex pos_2 not defined
aborting
#0  0x00007f7622909c3a in __GI___wait4 (pid=19486, stat_loc=stat_loc
entry=0x7fff0c9e4a68, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:27
#1  0x00007f7622909bfb in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7fff0c9e4a68, options=options
entry=0) at waitpid.c:38
#2  0x00007f7622878f67 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3  0x00007f7622f260be in TUnixSystem::StackTrace() () from /home/lgolino/packages/root/install/lib/libCore.so
#4  0x00007f7622def2da in DefaultErrorHandler(int, bool, char const*, char const*) () from /home/lgolino/packages/root/install/lib/libCore.so
#5  0x00007f7622eb0598 in ErrorHandler () from /home/lgolino/packages/root/install/lib/libCore.so
#6  0x00007f7622e0290d in TObject::Fatal(char const*, char const*, ...) const () from /home/lgolino/packages/root/install/lib/libCore.so
#7  0x00007f760e467ac9 in TGDMLParse::Tessellated(TXMLEngine*, void*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#8  0x00007f760e4821b6 in TGDMLParse::ParseGDML(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#9  0x00007f760e481d1a in TGDMLParse::ParseGDML(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#10 0x00007f760e481d1a in TGDMLParse::ParseGDML(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#11 0x00007f760e484462 in TGDMLParse::VolProcess(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#12 0x00007f760e481f81 in TGDMLParse::ParseGDML(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#13 0x00007f760e481d1a in TGDMLParse::ParseGDML(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#14 0x00007f760e481d1a in TGDMLParse::ParseGDML(TXMLEngine*, void*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#15 0x00007f760e4823a0 in TGDMLParse::GDMLReadFile(char const*) () from /home/lgolino/packages/root/install/lib/libGdml.so
#16 0x00007f761caf0034 in ?? ()
#17 0x0000000000000000 in ?? ()

Using ROOT 6.26/06, is this an issue with my build?

Cheers

Hi, 6.26/06 should do, the error you get is weird, why it only complains about pos_2 and not about pos_0 or pos_1? Anyway, I figured you want to integrate this special tesselated volume imported from step in your geometry, and this is a way to do it: say you have a previous geometry, where this volume is missing and you have a gdml file coming from a step conversion (looking more or less like the teddy_volume.gdml). In a first step add this volume as a box in your geometry, and export the geometry using:

gGeoManager->Export("geom.gdml");

Then either manually replace the box volume with the definition in the geom.gdml file, or use the trick above to add the volume from a file. Finally, read the new geometry and optionally export it as a root file using:

TGeoManager::Import("geom_with_volume.gdml");
gGeoManager->Export("geom_with_volume.root");

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.