Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non-trivial problems with the root persistence for tessellated solids while converting VecGeom shapes. #14283

Closed
1 task
Om4143 opened this issue Dec 20, 2023 · 3 comments · Fixed by #14327
Closed
1 task
Assignees
Labels

Comments

@Om4143
Copy link

Om4143 commented Dec 20, 2023

Check duplicate issues.

  • Checked for duplicates

Description

Hi,
I am using VecGeom converter. If I use this converter in same macro that converts gdml to root, works fine but When I export it into root file and convert it again while importing root file, It crashes. This issue is already discussed with @agheata in https://root-forum.cern.ch/t/tessellated-volume-behave-like-box-after-transporting-with-geant-3-and-4-after-converting-cad-to-root-geometry/57083

Attached File:
Macro and required GDML file

void ConvertGDMLtoRootMacro() {  
  TGeoManager* gGeoManager = new TGeoManager("cbmsim", "");
  
  const TString _volumename = "mainframe_02";
  const TString _file = _volumename + ".gdml";
  const TString _file_out = _volumename + ".root";

  TGeoVolume *_vol_assembly = new TGeoVolumeAssembly(_volumename);

  gGeoManager->SetTopVolume(_vol_assembly);
  TGDMLParse parser;
  TGeoVolume *_gdml_vol = parser.GDMLReadFile(_file);
  TObjArray *_node = _gdml_vol->GetNodes();

  Int_t copy_number = 0;
  for (int iNode = 0; iNode < _node->GetEntriesFast(); iNode++) {
    TGeoNode *_fNode = (TGeoNode *)_node->At(iNode);
    TGeoVolume *_fVol = (TGeoVolume *)_fNode->GetVolume();

    _vol_assembly->AddNode(_fVol, copy_number, 0);
    copy_number++;
  }
  _gdml_vol->Draw("ogl");
  gGeoManager->CloseGeometry();
  _vol_assembly->Export(_file_out);
  
       // Convert to VecGeom tessellated solid
   auto converter = TVirtualGeoConverter::Instance(gGeoManager);
   if (!converter) {
      printf("Raytracing a tessellated shape without VecGeom support will just draw a box\n");
   } else {
      converter->ConvertGeometry();
   }    
   _vol_assembly->Draw("ogl");
   _vol_assembly->Raytrace(kTRUE);
   _vol_assembly->RandomPoints(1000000,"");
 
}

Input GDML File:
https://drive.google.com/file/d/1FbQ6rK0fIDXamiAeHWVUxc4M7YcpjA0R/view?usp=sharing

Reproducer

mater branch of ROOT is configured with VecGeom.
run with root -l ConvertGDMLtoRootMacro.C

ROOT version

ROOT 6.31/01

Installation method

build from source

Operating system

Ubuntu 22.04.3 LTS

Additional context

No response

@Om4143 Om4143 added the bug label Dec 20, 2023
agheata added a commit to agheata/root that referenced this issue Jan 10, 2024
The previous implementation required TGeoTessellated shapes to be read attached to a TGeoManager. This removes the limitation, and allows also reading geometry files containing shapes converted to VecGeom corresponding solids. Fixes #root-project#14283
agheata added a commit that referenced this issue Jan 11, 2024
The previous implementation required TGeoTessellated shapes to be read attached to a TGeoManager. This removes the limitation, and allows also reading geometry files containing shapes converted to VecGeom corresponding solids. Fixes ##14283
@agheata
Copy link
Member

agheata commented Jan 11, 2024

A fix is available in the master branch, @Om4143 can you please confirm that this works for you?

maksgraczyk pushed a commit to maksgraczyk/root that referenced this issue Jan 12, 2024
…14327)

The previous implementation required TGeoTessellated shapes to be read attached to a TGeoManager. This removes the limitation, and allows also reading geometry files containing shapes converted to VecGeom corresponding solids. Fixes #root-project#14283
@Om4143
Copy link
Author

Om4143 commented Jan 15, 2024

As I have checked the root file using new development. and converter is working for root file and not seen any persistent problem so far. So In my case, its looks working fine. Thanks a lot 🙏

@Mehul0111
Copy link

Why for a small tessellated geometry the message appears

Tile degenerated 2: Length of sides of facet are too small.

Carbonfiber_ring

vgvassilev pushed a commit to vgvassilev/root that referenced this issue Feb 8, 2024
…14327)

The previous implementation required TGeoTessellated shapes to be read attached to a TGeoManager. This removes the limitation, and allows also reading geometry files containing shapes converted to VecGeom corresponding solids. Fixes #root-project#14283
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

3 participants