Tessellated volume behave like box after transporting with GEANT 3 and 4 after converting CAD to root geometry

Hi All,
I am converting CAD geometry to GDML using MRADSIM-convertor. Conversion is done successfully. The GDML file is converted into ROOT file by using TGDMLParse class. For each volume, material is also assigned in root macro using SetMaterial() function for each volume. Now the problem comes when I transport this geomtery via GEANT3 or GEANT4. All tessellated volume behave like a box. They are not tessellated anymore. For clear visualization I am including geometry and tessellated shape of the bars after conversion and material budget file for the same.

In geometry if you look base there are slanted bars but in material file it looks like a box. I suspect that all tessellated volume behave like a solid box.

I would be great to help and focus on this matter.


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

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


Since @agheata is fully involved in this area. I would expect comment from his side. Thanks in advance.

Hi,
Indeed, as stated in the class reference the current implementation does not provide navigation functionality, so you get the parent class (box) behavior if you attempt to navigate into.
Currently, the only option to do navigation is via the VecGeom package which should be installed separately (configured to use a vector backend) and then compile ROOT with VecGeom support. There is a ROOT tutorial tutorials/geom/tessellatedNav.C that demonstrates how it works, by
ray-tracing a .obj model imported from a file (but having a GDML import works as well). The relevant conversion to VecGeom part is this one
The quick start for installing VecGeom with vector support is here. This requires installing Vc to have vectorization support, like:

DIR=`pwd` && git clone https://github.com/root-project/veccore.git && mkdir veccore/build && cd veccore/build && cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_VC=ON -DCUDA=ON -DCMAKE_INSTALL_PREFIX=$DIR/veccore_install && make -j install && cd $DIR

then install VecGeom like:

DIR=`pwd` && git clone https://gitlab.cern.ch/VecGeom/VecGeom.git && mkdir VecGeom/build && cd VecGeom/build && cmake .. -DVECGEOM_BACKEND=vc -DVECGEOM_VECTOR=native -DCMAKE_INSTALL_PREFIX=$DIR/VecGeom_install && make -j install && cd $DIR

Then configure ROOT using:

cmake $ROOT_SOURCE -Dvecgeom=ON -DVecGeom_DIR=<use_above_install_directory>/VecGeom_install

At this point you can test if the above tutorial macro works, and you can adapt it for your geometry.

Thanks @agheata for the reply. When I am configuring root-6.28.06 with VecGeom, I am getting error at the time of make. Please find the error log file and CMakeCache file. Please let me know If i missed something ?
error.txt (3.7 KB)
CMakeCache.txt (154.5 KB)

Weird, I can’t reproduce. Can you try using ROOT master?

Can you also try to configure VecGeom via: -DVECGEOM_BACKEND=scalar and recompile? It might be that the interpreter has trouble parsing some Vc headers. This is a much slower option for navigation, but at least to pin down the compilation problem.

Thanks @agheata master branch build successfully. But the problem doesn’t solve after compiling with VecGeom (Geometry after using RandomPoints included here). Is there other way to navigate the node using VecGeom or I have to modify in my code to use VecGeom functionality. For clear picture I am including the macro which I use for the conversion from GDML to Root. Please have a look if I am doing something wrong.

Thanks again :slight_smile:
Import_GDML_Export_ROOT.c (841 Bytes)

Hi,
Your conversion to ROOT is fine but has nothing to do with using VecGeom. In the code that reads the root file and calls navigation functions, you have to do something like:

   // code reading the geometry file in memory, resulting in a valid closed geometry manager
   // ...
   auto converter = TVirtualGeoConverter::Instance(gGeoManager);
   if (!converter) {
      printf("It looks like your ROOT version is missing VecGeom support\n");
   } else {
      converter->ConvertGeometry();
   }
   // Now you can have code calling geometry navigation, such as shooting random points and locating them

P.S. don’t make an assembly volume your top volume, but rather put the assembly in a containing top box

Thanks a lot @agheata . It works fine now.

@agheata Do you have any idea how does it works in geant4_vmc ? Sorry for disturb you again :pray:

Hi, you will just have to insert the conversion code above just before calling: application->RunMC(), so after the geometry is read from the file and the geometry manager is closed.

Thanks @agheata When I am trying to convert full geometry It crashes. I couldn’t find the reason. I am including the macro (gitlab link) that created geometry file. Could you please have a look if you get some time?

(https://git.cbm.gsi.de/trd/cbmsoft/cbmroot_geometry/-/blob/trd_support/macro/trd/fair/trd.v23/Create_TRD_Geometry_v23c.C)

The link asks for authentication. However, the most interesting part is the crash printout and stack trace, can you post those?

@agheata I am including the error log and macro here. The converter is applied line !625

Create_TRD_Geometry_v23c.C (163.0 KB)
error.txt (62.9 KB)

That’s weird, it looks like the tessellated solid in memory on the ROOT side is corrupted. So if I’m not wrong if you read the GDML file having the tessellated inside you can convert and OK, but if you read the geometry from the ROOT file (created based on the GDML also) you get a crash. Can you try to:

  1. load the GDML that worked for conversion to VecGeom and export to ROOT file (no conversion)
  2. load the saved root file and try to convert to VecGeom
    If 2 fails it means there is a problem when exporting to root.

@agheata May be it could be the reason because I am not using TGeoManager when I convert gdml to root. The macro that I used for conversion is attached here.
ConvertGDMLtoRoot (1).C (1.7 KB)

@agheata I have modified conversion macro and conversion works in the same macro and exported in root file. When I try to load the saved root file and try to convert to VecGeom, It crashes. Sending you modified conversion macro.
ConvertGDMLtoRoot.C (2.2 KB)

Can you send me also the mainframe_02.gdml file? I’ll have a look but unlikely very soon.

I am sending you the google drive link from where you can download it.

@agheata Did you manage to look into the issue? Sorry for bothering you :pray: